aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2009-09-10[SCSI] libfc: improve debug messages for ELS response handlersJoe Eykholt4-14/+57
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>
2009-09-10[SCSI] libfc: fix: rport_recv_req needs disc_mutex when calling rport_lookupJoe Eykholt1-0/+3
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>
2009-09-10[SCSI] libfc: move remote port lookup for ELS requests into fc_rport.c.Joe Eykholt3-66/+44
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>
2009-09-10[SCSI] libfc: Always reset remote port roles when receiving PRLIRobert Love1-0/+6
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>
2009-09-10[SCSI] libfc: Initialize fc_rport_identifiers inside fc_rport_createRobert Love4-42/+32
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>
2009-09-10[SCSI] libfc: don't do discovery before callback is setJoe Eykholt1-0/+3
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>
2009-09-10[SCSI] libfc: clean up point-to-point discovery code.Joe Eykholt2-93/+4
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>
2009-09-10[SCSI] libfc: discovery gpn_ft parse bugJoe Eykholt1-3/+4
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>
2009-09-10[SCSI] libfc: discovery retry should clear pending first.Joe Eykholt1-2/+2
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>
2009-09-10[SCSI] libfc: fix: empty zone causes endless discovery retries.Joe Eykholt2-0/+4
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>
2009-09-10[SCSI] libfc: handle discovery failure more correctly.Joe Eykholt1-0/+3
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>
2009-09-10[SCSI] libfc: rearrange code in fc_disc_gpn_ft_resp()Joe Eykholt1-16/+12
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>
2009-09-10[SCSI] libfc: discovery restart sequence error fixJoe Eykholt1-2/+1
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>
2009-09-10[SCSI] libfc: do not log off rports before or after discoveryJoe Eykholt2-13/+37
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>
2009-09-10[SCSI] libfc: move rport_lookup into fc_rport.cJoe Eykholt2-22/+20
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>
2009-09-10[SCSI] libfc: change to make remote port callback optionalJoe Eykholt2-44/+5
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>
2009-09-10[SCSI] libfc: have rport_create do a lookup for pre-existing rports firstJoe Eykholt2-6/+7
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>
2009-09-10[SCSI] libfc: make rport module maintain the rport listJoe Eykholt3-18/+15
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>
2009-09-10[SCSI] libfc: simplify fc_lport_rport_callbackJoe Eykholt1-28/+15
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>
2009-09-10[SCSI] libfc: rport debug messages were printing pointer valuesJoe Eykholt1-1/+2
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>
2009-09-10[SCSI] libfc: remove unused disc->delay elementJoe Eykholt2-4/+0
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>
2009-09-10[SCSI] libfc: eliminate disc->eventJoe Eykholt2-20/+12
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>
2009-09-10[SCSI] libfc: fix rport event race between READY and LOGOJoe Eykholt1-3/+1
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>
2009-09-10[SCSI] libfc: don't create dummy (rogue) remote portsJoe Eykholt3-142/+92
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>
2009-09-10[SCSI] libfc: rename rport event CREATED to READYJoe Eykholt4-6/+6
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>
2009-09-10[SCSI] libfc: rearrange code in fc_rport_workJoe Eykholt1-9/+15
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>
2009-09-10[SCSI] libfc: make rport structure optionalJoe Eykholt4-101/+98
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>
2009-09-10[SCSI] libfc: change elsct to use FC_ID instead of rdataJoe Eykholt7-39/+24
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>
2009-09-10[SCSI] libfc: make fc_rport_priv the primary rport interface.Joe Eykholt7-279/+245
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>
2009-09-10[SCSI] libfc: fix RPORT_TO_PRIV and PRIV_TO_RPORT() macros.Joe Eykholt1-2/+2
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>
2009-09-10[SCSI] libfc: change interface for rport_createJoe Eykholt4-44/+35
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>
2009-09-10[SCSI] libfc: prepare to split off struct fc_rport_priv from fc_rport_libfc_privJoe Eykholt4-41/+49
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>
2009-09-10[SCSI] fcoe: use rtnl mutex in place of hostlist lockChris Leech1-26/+11
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>
2009-09-10[SCSI] fcoe: Fix module ref count bug by adding NETDEV UNREGISTER handlingChris Leech2-121/+67
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>
2009-09-10[SCSI] fcoe: move the host-list add/remove to keep out VN_PortsChris Leech1-12/+19
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>
2009-09-10[SCSI] fcoe: add mutex to protect create and destroyChris Leech1-1/+39
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>
2009-09-10[SCSI] fcoe: split out per interface setupChris Leech1-119/+148
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>
2009-09-10[SCSI] fcoe: fcoe_interface create, destroy and refcountingChris Leech2-19/+79
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>
2009-09-10[SCSI] fcoe: remove fcoe_interface->priv pointerChris Leech2-5/+0
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>
2009-09-10[SCSI] fcoe: move offload exchange manager pointer from fcoe_port to fcoe_interfaceChris Leech2-9/+7
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>
2009-09-10[SCSI] fcoe: move FIP controller from fcoe_port to fcoe_interfaceChris Leech2-48/+39
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>
2009-09-10[SCSI] fcoe: move packet handlers from fcoe_port to fcoe_interfaceChris Leech2-14/+18
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>
2009-09-10[SCSI] fcoe: move netdev to fcoe_interfaceChris Leech2-32/+38
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>
2009-09-10[SCSI] fcoe: Introduce and allocate fcoe_interface structure, 1:1 with net_deviceChris Leech2-157/+188
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>
2009-09-10[SCSI] fcoe: interface changes to fcoe_if_create and fcoe_if_destroyChris Leech1-65/+48
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>
2009-09-10[SCSI] fcoe: remove unnecessary list and lock initializations.Joe Eykholt1-3/+0
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>
2009-09-10[SCSI] fcoe: fix missing error check in call to fcoe_if_initChris Leech1-1/+3
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>
2009-09-10[SCSI] libfcoe: fcoe_ctlr_destroy use cancel_work_sync instead of flush_workChris Leech1-2/+6
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>
2009-09-10[SCSI] fcoe: Add sysfs parameter to fcoe for minimum DDP read I/O sizeYi Zou1-1/+8
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>
2009-09-05[SCSI] fcoe, libfc: fully makes use of per cpu exch pool and then removes em_lockVasu Dev3-102/+115
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>