Moger, Babu [Fri, 4 Sep 2009 03:42:28 +0000 (21:42 -0600)]
[SCSI] scsi_dh_rdac: changes for rdac debug logging
Patch to add debugging stuff for rdac device handler.
- Added a bit mask "module parameter" rdac_logging with 2 bits for each type
of logging.
- currently defined only two types of logging(failover and sense logging). Can
be enhanced later if required.
- By default only failover logging is enabled which is equivalent of current
logging.
Signed-off-by: Babu Moger <babu.moger@lsi.com>
Reviewed-by: Vijay Chauhan <vijay.chauhan@lsi.com>
Reviewed-by: Bob Stankey <Robert.stankey@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Moger, Babu [Fri, 4 Sep 2009 03:42:21 +0000 (21:42 -0600)]
[SCSI] scsi_dh_rdac: changes to collect the rdac debug information during the initialization
Adding the code to read the debug information during initialization. This
patch collects the information about storage and controllers during
rdac_activate.
Signed-off-by: Babu Moger <babu.moger@lsi.com>
Reviewed-by: Vijay Chauhan <vijay.chauhan@lsi.com>
Reviewed-by: Bob Stankey <Robert.stankey@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Moger, Babu [Fri, 4 Sep 2009 03:42:15 +0000 (21:42 -0600)]
[SCSI] scsi_dh_rdac: move the init code from rdac_activate to rdac_bus_attach
Moving the initialization code from rdac_activate to rdac_bus_attach which is
more efficient. We don't have to collect all the information during every
activate.
Signed-off-by: Babu Moger <babu.moger@lsi.com>
Reviewed-by: Vijay Chauhan <vijay.chauhan@lsi.com>
Reviewed-by: Bob Stankey <Robert.stankey@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Michal Schmidt [Thu, 3 Sep 2009 12:27:08 +0000 (14:27 +0200)]
[SCSI] sg: fix oops in the error path in sg_build_indirect()
When the allocation fails in sg_build_indirect(), an oops happens in
the error path. It's caused by an obvious typo.
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Reported-by: Bob Tracy <rct@gherkin.frus.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Kashyap, Desai [Wed, 2 Sep 2009 07:14:10 +0000 (12:44 +0530)]
[SCSI] mptsas : Bump version to 3.04.12
Bump version to 3.04.12
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Kashyap, Desai [Wed, 2 Sep 2009 06:16:33 +0000 (11:46 +0530)]
[SCSI] mptsas : FW event thread and scsi mid layer deadlock in SYNCHRONIZE CACHE command
Normally In HBA reset path MPT driver will flush existing work in current work
queue (mpt/0) . This is just a dummy activity for MPT driver point of
view, since HBA reset will turn off Work queue events.
It means we will simply returns from work queue without doing anything.
But for the case where Work is already done (half the way), we have to have
that work to be done.
Considering above condition we stuck forever since Deadlock in scsi midlayer
and MPT driver. sd_sync_cache() will wait forever since HBA is not in
Running state, and it will never come into Running state since
sd_sync_cache() is called from HBA reset context.
Now new code will not wait for half cooked work to be finished
before returning from HBA reset.
Once we are out of HBA reset, EH thread will change host state to running from
recovery and work waiting for running state of HBA will be finished.
New code is turning ON firmware event from another special work called
Rescan toplogy.
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Kashyap, Desai [Wed, 2 Sep 2009 06:15:53 +0000 (11:45 +0530)]
[SCSI] mptsas : Send DID_NO_CONNECT for pending IOs of removed device
Driver is modified to return DID_NO_CONNECT for all pending I/O
requests for bus type SAS, if it founds the target is removed at
the firmware level.
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Kashyap, Desai [Wed, 2 Sep 2009 06:14:57 +0000 (11:44 +0530)]
[SCSI] mptsas : PAE Kernel more than 4 GB kernel panic
This patch is solving problem for PAE kernel DMA operation.
On PAE system dma_addr and unsigned long will have different
values.
Now dma_addr is not type casted using unsigned long.
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Kashyap, Desai [Wed, 2 Sep 2009 06:14:19 +0000 (11:44 +0530)]
[SCSI] mptsas : NULL pointer on big endian systems causing Expander not to tear off
On Big endian system kernel will crash due to address translation
is not handle properly.
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Kashyap, Desai [Wed, 2 Sep 2009 06:13:36 +0000 (11:43 +0530)]
[SCSI] mptsas : Sanity check for phyinfo is added
Check for phyinfo->phy before calling sas_port_delete_phy.
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Charlie Brady [Wed, 26 Aug 2009 18:16:57 +0000 (14:16 -0400)]
[SCSI] scsi_dh_rdac: Add support for Sun StorageTek ST2500, ST2510 and ST2530
These storage arrays can use RDAC when configured with 'linux' as the
initiator.
http://www.sun.com/storage/disk_systems/workgroup/2500/
http://www.sun.com/storage/disk_systems/workgroup/2510/
http://www.sun.com/storage/disk_systems/workgroup/2530/
Signed-off-by: Charlie Brady <charlieb@budge.apana.org.au>
Reviewed-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Anil Ravindranath [Wed, 26 Aug 2009 00:35:18 +0000 (17:35 -0700)]
[SCSI] pmcraid: PMC-Sierra MaxRAID driver to support 6Gb/s SAS RAID controller
Signed-off-by: Anil Ravindranath <anil_ravindranath@pmc-sierra.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Giridhar Malavali [Tue, 25 Aug 2009 18:36:21 +0000 (11:36 -0700)]
[SCSI] qla2xxx: Update version number to 8.03.01-k6.
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Andrew Vasquez [Tue, 25 Aug 2009 18:36:20 +0000 (11:36 -0700)]
[SCSI] qla2xxx: Properly delete rports attached to a vport.
Original code would inadvertently skip the deferred
fc_remote_port_delete() call for rports hanging off any vport.
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>
Andrew Vasquez [Tue, 25 Aug 2009 18:36:19 +0000 (11:36 -0700)]
[SCSI] qla2xxx: Correct various NPIV issues.
* Consolidate vport-count processing.
* Correct vp_idx restrictions during RSCN processing.
* Push topology verification check to qla2x00_do_dpc_all_vps().
* Don't skip vport full-login-lip/lip-reset mailbox handling.
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>
Lalit Chandivade [Tue, 25 Aug 2009 18:36:18 +0000 (11:36 -0700)]
[SCSI] qla2xxx: Correct qla2x00_eh_wait_on_command() to wait correctly.
Original code would break-out of loop after only one iteration.
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
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>
Andrew Vasquez [Tue, 25 Aug 2009 18:36:17 +0000 (11:36 -0700)]
[SCSI] qla2xxx: Further limit device-table (qla_devtbl) lookup to non-24xx.
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>
Santosh Vernekar [Tue, 25 Aug 2009 18:36:16 +0000 (11:36 -0700)]
[SCSI] qla2xxx: Correctly set FCF_TAPE_PRESENT flag based on scsi-device.
In fabric-login based on iop BIT_8 firmware notifies presence of
a FCP2 device and not necessarily a TAPE device. So instead of
setting FCF_TAPE_PRESENT flag there we set it using
scsi_device->type after mid-layer scan recognises "type" of the
device.
It also adds a new flag FCF_FCP2_DEVICE for any future use.
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>
Joe Eykholt [Tue, 25 Aug 2009 21:04:08 +0000 (14:04 -0700)]
[SCSI] fcoe: flush per-cpu thread work when destroying interface
This fixes one cause of an occational problem when unloading
libfc where the exchange manager pool doesn't have all items freed.
The existing WARN_ON(mp->total_exches <= 0) isn't hit.
However, note that total_exches is decremented when the
exchange is completed, and it can be held with a refcnt
for a while after that.
I'm not sure what the offending exchange is, but I suspect
it is an incoming request, because outgoing state machines
should be all stopped at this point.
Note that although receive is stopped before the exchange
manager is freed, there could still be active threads
handling received frames.
This patch flushes the queues by allocating a new skb
and sending it through, and have the thread handle
this new skb specially. This is similar to the way the work
queues are flushed now by putting work items in them and waiting
until they make it through the queue.
An skb->destructor function is used to inform us of
the completion of the flush, and the fr_dev() is left
NULL to indicate to fcoe_percpu_receive_thread() that
the skb should be just freed. There's already a check
for the lp being NULL which prints a message.
We skip printing the message if the destructor is for flushing.
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>
Joe Eykholt [Tue, 25 Aug 2009 21:04:03 +0000 (14:04 -0700)]
[SCSI] libfc: don't swap OX_ID and RX_ID when sending BA_RJT
I saw an lport debug message from the exchange manager saying:
"lport 70500: Received response for out of range oxid:ffff"
A trace showed this was a BA_RJT sent due to an incoming ABTS
which arrived on an unknown exchange. So, the sender of the
BA_RJT was in error, but in this case, both the initiator and
responder were the same machine.
The OX_ID and RX_ID should not have been reversed in this 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>
Joe Eykholt [Tue, 25 Aug 2009 21:03:58 +0000 (14:03 -0700)]
[SCSI] libfc: send GPN_ID in reaction to single-port RSCNs.
When an RSCN indicates changes to individual remote ports,
don't blindly log them out and then back in. Instead, determine
whether they're still in the directory, by doing GPN_ID.
If that is successful, call login, which will send ADISC and reverify,
otherwise, call logoff. Perhaps we should just delete the rport,
not send LOGO, but it seems safer.
Also, fix a possible issue where if a mix of records in the RSCN
cause us to queue disc_ports for disc_single and then we decide
to do full rediscovery, we leak memory for those disc_ports queued.
So, go through the list of disc_ports even if doing full discovery.
Free the disc_ports in any case. If any of the disc_single() calls
return error, do a full discovery.
The ability to fill in GPN_ID requests was added to fc_ct_fill().
For this, it needs the FC_ID to be passed in as an arg.
The did parameter for fc_elsct_send() is used for that, since the
actual D_DID will always be 0xfffffc for all CT requests so far.
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>
Joe Eykholt [Tue, 25 Aug 2009 21:03:52 +0000 (14:03 -0700)]
[SCSI] libfc: fix handling of incoming Discover Address (ADISC) requests
The local port facility has been replying to ADISC requests without
looking to see if the remote port is logged in. This is incorrect.
An ADISC request requires PLOGI first. It should be rejected if
the sending remote port is not logged in.
This is like other incoming requests that require login, all of
which should be handled in the remote port module.
Move the ADISC request handling from fc_lport.c to fc_rport.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>
Joe Eykholt [Tue, 25 Aug 2009 21:03:47 +0000 (14:03 -0700)]
[SCSI] libfc: use ADISC to verify rport login state
When rport_login is called on an rport that is already thought
to be logged in, use ADISC. If that fails, redo PLOGI.
This is less disruptive after fabric changes that don't affect
the state of the target.
Implement the sending of ADISC via fc_els_fill.
Add ADISC state to the rport state machine. This is entered from READY
and returns to READY after successful completion. If it fails, the rport
is either logged off and deleted or re-does PLOGI.
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>
Joe Eykholt [Tue, 25 Aug 2009 21:03:42 +0000 (14:03 -0700)]
[SCSI] libfc: LOGO response code had extraeous enter_rtv
fc_rport_logo_resp() had a call to fc_rport_enter_rtv() if the
LOGO was accepted. This must've been a copy/paste mistake, but
it didn't matter since we don't stay in the LOGO state long enough
to hit this code.
Change fc_rport_logo_resp() to just enter the delete state
no matter what.
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>
Joe Eykholt [Tue, 25 Aug 2009 21:03:36 +0000 (14:03 -0700)]
[SCSI] libfc: re-login to remote ports that send us LOGO
After a quick link flap, a target was seen to send us a LOGO.
Apparently, it saw an RSCN reporting that we had dropped out of the
fabric after we had logged back into it.
This is likely in larger fabrics (more than 2 FC switches) after
a quick link flap at the initiator. Each link transition causes
an port-specific RSCN to the target. After the link comes back up,
the initiator successfully discovers and does a PLOGI to the target
before the target sees the first RSCN reporting the initiator is gone,
and it sends a LOGO. The target may see a subsequent RSCN saying the
port is back, but probably wouldn't send a PLOGI and leaves it
up to the initiator to re-login.
An RSCN can be delayed by the switches due to software layers but a
PLOGI is forwarded in hardware causing the PLOGI to beat the RSCN.
If a remote port is in the discovered set and sends a LOGO, re-login to 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>
Joe Eykholt [Tue, 25 Aug 2009 21:03:31 +0000 (14:03 -0700)]
[SCSI] libfc: fix rport error handling for login-required and invalid ops
When receiving an ELS request, if the request isn't recognized,
the unsupported operation error should be given even if the port
is not found or not logged in.
Also, the LOGO request shouldn't give the login-required explanation.
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>
Joe Eykholt [Tue, 25 Aug 2009 21:03:26 +0000 (14:03 -0700)]
[SCSI] libfc: correctly handle incoming PLOGI request.
libfc receives PLOGIs from switches which are trying to discover what
kind of devices are present, and from other initiators to find out
if we're a target.
As an initiator, some argue we don't need to handle incoming PLOGI
requests, and we currently reject them from unknown remote ports,
but accept them is we're in the middle of a PLOGI to the remote port.
For eventual target implementations, we want to handle them always.
For incoming PLOGI, don't fail if the rport_priv doesn't exist.
Just create it and go become READY without going through PRLI. If
PRLI occurs, then our roles will be set and we'll become READY again.
Also, allow incoming PRLI in RTV 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>
Joe Eykholt [Tue, 25 Aug 2009 21:03:21 +0000 (14:03 -0700)]
[SCSI] libfc: improve debug messages for ELS response handlers
Improve lport and rport debug messages to indicate whether
the response is LS_ACC, LS_RJT, closed, or timeout.
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>
Joe Eykholt [Tue, 25 Aug 2009 21:03:15 +0000 (14:03 -0700)]
[SCSI] libfc: fix: rport_recv_req needs disc_mutex when calling rport_lookup
The rport_lookup function must be called while holding the disc_mutex.
Otherwise, the rdata could be deleted just after that by another thread.
All callers now check the state after grabbing the rdata rp_mutex.
Even though rport_lookup skips ports in DELETE state, it does that
without holding the rdata rp_mutex, so that the state may change.
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>
Joe Eykholt [Tue, 25 Aug 2009 21:03:10 +0000 (14:03 -0700)]
[SCSI] libfc: move remote port lookup for ELS requests into fc_rport.c.
This moves the remote port lookup for incoming ELS requests into
fc_rport.c, in preparation for handing PLOGI and LOGO from
unknown rports.
This changes the arg to rport_recv_req from an rdata to an lport.
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>
Robert Love [Tue, 25 Aug 2009 21:03:04 +0000 (14:03 -0700)]
[SCSI] libfc: Always reset remote port roles when receiving PRLI
Don't trust previous roles, reset them when we receive a PRLI.
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Robert Love [Tue, 25 Aug 2009 21:02:59 +0000 (14:02 -0700)]
[SCSI] libfc: Initialize fc_rport_identifiers inside fc_rport_create
Currently these values are initialized by the callers. This was exposed
by a later patch that adds PLOGI request support. The patch failed to
initialize the new remote port's roles and it caused problems. This patch
has the rport_create routine initialize the identifiers and then the
callers can override them with real values.
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Joe Eykholt [Tue, 25 Aug 2009 21:02:54 +0000 (14:02 -0700)]
[SCSI] libfc: don't do discovery before callback is set
It's possible to "restart" discovery before it was started if
an RSCN is received early enough. We were jumping to 0
due to the disc_callback function pointer not getting set.
Don't restart discovery if disc_callback is NULL.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>