History log of /drivers/scsi/libfc/fc_elsct.c
Revision Date Author Comments
1ea2c1daf4476ac798b1de8196f11dd36425b5ae 23-Jan-2012 Neerav Parikh <neerav.parikh@intel.com> [SCSI] libfc: Make the libfc Common Transport(CT) code generic

Currently the libfc Common Transport(CT) calls assume that
the CT requests are Name Server specific only. This patch
makes it more flexible to allow more FC-GS services to make
use of these routines.

Signed-off-by: Neerav Parikh <neerav.parikh@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Acked-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
c6b21c93c1794113c68f3d43f321968191d87b1b 14-Jan-2012 Bart Van Assche <bvanassche@acm.org> [SCSI] libfc: Declare local functions static

Avoid that sparse complains about missing declarations for local
functions by declaring these static or by adding an #include directive.
Add the __percpu annotation where it is missing.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
09703660edf83b8b6d175440bf745f30580d85ab 27-May-2011 Paul Gortmaker <paul.gortmaker@windriver.com> scsi: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required

For the basic SCSI infrastructure files that are exporting symbols
but not modules themselves, add in the basic export.h header file
to allow the exports.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
24f089e2f2c800f88039e9d536d558ec6e349fad 21-Jul-2010 Joe Eykholt <jeykholt@cisco.com> [SCSI] libfc: add fc_fill_reply_hdr() and fc_fill_hdr()

Add functions to fill in an FC header given a request header.
These reduces code lines in fc_lport and fc_rport and works
without an exchange/sequence assigned.

fc_fill_reply_hdr() fills a header for a final reply frame.

fc_fill_hdr() which is similar but allows specifying the
f_ctl parameter.

Add defines for F_CTL values FC_FCTL_REQ and FC_FCTL_RESP.
These can be used for most request and response sequences.

v2 of patch adds a line to copy the frame encapsulation
info from the received frame.

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>
7b2787ec15b9d1c2f716da61b0eec21a3f5e6520 08-May-2010 Robert Love <robert.w.love@intel.com> [SCSI] libfc: Move the port_id into lport

This patch creates a port_id member in struct fc_lport.
This allows libfc to just deal with fc_lport instances
instead of calling into the fc_host to get the port_id.

This change helps in only using symbols necessary for
operation from the libfc structures. libfc still needs
to change the fc_host_port_id() if the port_id changes
so the presentation layer (scsi_transport_fc) can provide
the user with the correct value, but libfc shouldn't
rely on the presentation layer for operational values.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
52a6690d3f0cb7414c34b1e26c569b32d4987662 03-Nov-2009 Joe Eykholt <jeykholt@cisco.com> [SCSI] libfc: fix fc_els_resp_type to correct display of CT responses

Local port debug messages were using fc_els_resp_type() which showed
all CT responses as rejects.

Handle CT responses correctly based by inspecting fh_type.

I decided not to rename the function to keep the patch smaller.
We could call it just fc_resp_type() or fc_elsct_resp_type().

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>
3a3b42bf89a9b90ae9ed2c57fdc378e5473a0ef9 03-Nov-2009 Robert Love <robert.w.love@intel.com> [SCSI] libfc: Formatting cleanups across libfc

This patch makes a variety of cleanup changes to all libfc files.

This patch adds kernel-doc headers to all functions lacking them
and attempts to better format existing headers. It also add kernel-doc
headers to structures.

This patch ensures that the current naming conventions for local ports,
remote ports and remote port private data is upheld in the following
manner.

struct instance (i.e. variable name)
--------------------------------------------------
fc_lport lport
fc_rport rport
fc_rport_libfc_priv rpriv
fc_rport_priv rdata

I also renamed dns_rp and ptp_rp to dns_rdata and ptp_rdata
respectively.

I used emacs 'indent-region' and 'tabify' on all libfc files
to correct spacing alignments.

I feel sorry for anyone attempting to review this patch.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
11b561886643d4e23d0fd58c205d830a448dd0a2 03-Nov-2009 Chris Leech <christopher.leech@intel.com> [SCSI] libfcoe, fcoe: libfcoe NPIV support

The FIP code in libfcoe needed several changes to support NPIV

1) dst_src_addr needs to be managed per-n_port-ID for FPMA fabrics with NPIV
enabled. Managing the MAC address is now handled in fcoe, with some slight
changes to update_mac() and a new get_src_addr() function pointer.

2) The libfc elsct_send() hook is used to setup FCoE specific response
handlers for FIP encapsulated ELS exchanges. This lets the FCoE specific
handling know which VN_Port the exchange is for, and doesn't require
tracking OX_IDs. It might be possible to roll back to the full FIP frame
in these, but for now I've just stashed the contents of the MAC address
descriptor in the skb context block for later use. Also, because
fcoe_elsct_send() just passes control on to fc_elsct_send(), all transmits
still come through the normal frame_send() path.

3) The NPIV changes added a mutex hold in the keep alive sending, the lport
mutex is protecting the vport list. We can't take a mutex from a timer,
so move the FIP keep alive logic to the link work struct.

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>
8f550f937e9fdafa5c37e348e214aecec851ef3f 22-Oct-2009 Chris Leech <christopher.leech@intel.com> [SCSI] libfc: fix memory corruption caused by double frees and bad error handling

I was running into several different panics under stress, which I traced down
to a few different possible slab corruption issues in error handling paths.
I have not yet looked into why these exchange sends fail, but with these
fixes my test system is much more stable under stress than before.

fc_elsct_send() could fail and either leave the passed in frame intact
(failure in fc_ct/els_fill) or the frame could have been freed if the
failure was is fc_exch_seq_send(). The caller had no way of knowing, and
there was a potential double free in the error handling in fc_fcp_rec().

Make fc_elsct_send() always free the frame before returning, and remove the
fc_frame_free() call in fc_fcp_rec().

While fc_exch_seq_send() did always consume the frame, there were double free
bugs in the error handling of fc_fcp_cmd_send() and fc_fcp_srr() as well.

Numerous calls to error handling routines (fc_disc_error(),
fc_lport_error(), fc_rport_error_retry() ) were passing in a frame pointer that
had already been freed in the case of an error. I have changed the call
sites to pass in a NULL pointer, but there may be more appropriate error
codes to use.

Question: Why do these error routines take a frame pointer anyway? I
understand passing in a pointer encoded error to the response handlers, but
the error routines take no action on a valid pointer and should never be
called that way.

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>
2ab7e1ecb81ce35ed8e8df512e3fc6338a4c55bb 25-Aug-2009 Joe Eykholt <jeykholt@cisco.com> [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>
f657d299cf05883e23e12a69e86842da1df378ad 25-Aug-2009 Joe Eykholt <jeykholt@cisco.com> [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>
a46f327aa5caf2cce138e98ddd863b6cca0e71e2 25-Aug-2009 Joe Eykholt <jeykholt@cisco.com> [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>
9fb9d32831fd687e427ec5b147bb690f468b99a0 25-Aug-2009 Joe Eykholt <jeykholt@cisco.com> [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>
a29e7646f42a325a7f6cce34adbeb52e8db15566 22-Apr-2009 Robert Love <robert.w.love@intel.com> [SCSI] libfc: Fix compilation warnings with allmodconfig

When building with a .config generated from 'make allmodconfig'
some build warnings are generated. This patch corrects the warnings,
adds a FC_FID_NONE (= 0) enumeration for FC-IDs and cleans up one
variable naming to meet our variable naming conventions. For example,
fc_lport's should be named "lport," not "lp."

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
42e9a92fe6a9095bd68a379aaec7ad2be0337f7a 10-Dec-2008 Robert Love <robert.w.love@intel.com> [SCSI] libfc: A modular Fibre Channel library

libFC is composed of 4 blocks supported by an exchange manager
and a framing library. The upper 4 layers are fc_lport, fc_disc,
fc_rport and fc_fcp. A LLD that uses libfc could choose to
either use libfc's block, or using the transport template
defined in libfc.h, override one or more blocks with its own
implementation.

The EM (Exchange Manager) manages exhcanges/sequences for all
commands- ELS, CT and FCP.

The framing library frames ELS and CT commands.

The fc_lport block manages the library's representation of the
host's FC enabled ports.

The fc_disc block manages discovery of targets as well as
handling changes that occur in the FC fabric (via. RSCN events).

The fc_rport block manages the library's representation of other
entities in the FC fabric. Currently the library uses this block
for targets, its peer when in point-to-point mode and the
directory server, but can be extended for other entities if
needed.

The fc_fcp block interacts with the scsi-ml and handles all
I/O.

Signed-off-by: Robert Love <robert.w.love@intel.com>
[jejb: added include of delay.h to fix ppc64 compile prob spotted by sfr]
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>