summaryrefslogtreecommitdiff
path: root/drivers/scsi/libfc
AgeCommit message (Collapse)Author
2011-08-28[SCSI] libfc: fix referencing to fc_fcp_pkt from the frame pointer via fr_fsp()Yi Zou
In commit 6a716a8, while releasing the DDP context in case frame_send() failed, the frame may already be freed, so we should store the pointer to fc_fcp_pkt and release the DDP context using the locally stored fsp instead of getting fsp from the fr_fsp(fp) on a frame. Signed-off-by: Yi Zou <yi.zou@intel.com> Reported-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-08-28[SCSI] libfc: block SCSI eh thread for blocked rportsVasu Dev
Call fc_block_scsi_eh() in all fcoe eh to blocks the scsi_eh thread for blocked rports. Signed-off-by: Vasu Dev <vasu.dev@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> 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>
2011-08-28[SCSI] libfc: fix fc_eh_host_resetVasu Dev
Current fc_eh_host_reset leaves lport offline permanently due to FLOGI response getting handled by LOGO response from last reset as both had same exchange id. So fix this by having end to end exches clean-up using exchange abort along exches reset done from fc_eh_host_reset. This would avoid exchanges collision between the sessions across the reset. In this case implicit login should have done that but no aborting support for FIP frames, so just wait till lport->r_a_tov before restarting next flogi to ensure all exchanges are good to use again for next session. Below is the trace of LOGO from older session coming ahead of FLOGI response with same exche id 0x203:- 617 86.435165 4e.00.0b -> ff.ff.fc FC ELS LOGO 0x203 618 86.435195 4e.00.0b -> b6.02.00 FC ELS LOGO 0x213 619 86.435220 4e.00.0b -> 18.03.00 FC ELS LOGO 0x223 620 86.435244 4e.00.0b -> 18.02.00 FC ELS LOGO 0x233 621 86.435267 4e.00.0b -> 18.01.00 FC ELS LOGO 0x243 622 86.435349 00.00.00 -> ff.ff.fe FC ELS FLOGI 0x203 623 86.435549 ff.ff.fc -> 4e.00.0b FC ELS ACC (LOGO) 0x203 624 86.438721 ff.ff.fe -> 4e.00.0b FC ELS ACC (FLOGI) 0x203 625 86.442059 18.03.00 -> 4e.00.0b FC ELS ACC (LOGO) 0x223 626 86.443683 b6.02.00 -> 4e.00.0b FC ELS ACC (LOGO) 0x213 627 86.447693 18.01.00 -> 4e.00.0b FC ELS ACC (LOGO) 0x243 628 86.453499 18.02.00 -> 4e.00.0b FC ELS ACC (LOGO) 0x233 Signed-off-by: Vasu Dev <vasu.dev@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> 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>
2011-07-28[SCSI] libfc: fix warn on in lport retryVasu Dev
The lport retry timer hits warn on in case it has become ready in response from fip login from fcoe_ctlr_flogi_send(), this is possible but safe code path, therefore removing this warn on. Jun 22 03:16:30 10.0.16.6 [488198.316517] host3: Assigned Port ID 180f02 Jun 22 03:16:32 10.0.16.6 [488200.091561] ------------[ cut here ]------------ Jun 22 03:16:32 10.0.16.6 [488200.091586] WARNING: at drivers/scsi/libfc/fc_lport.c:1355 fc_lport_timeout+0xd9/0xe0 [libfc]() Signed-off-by: Vasu Dev <vasu.dev@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-07-28[SCSI] libfc: Remove the reference to FCP packet from scsi_cmnd in case of errorNeerav Parikh
fc_queuecommand() allocates an FCP packet for each SCSI command and sends it out on the wire. In the process it stores the reference to the FCP packet in the scsi_cmnd structure. Now, in case under stress testing the libfc exchange layer runs out of exchanges the fc_queuecommand() may not be able to send out commands out on the wire. In such a scenario if there is an error in sending the FCP packet out the wire; fc_queuecommand() deletes the FCP packet from internal queue, releases the FCP packet and returns a SCSI_MLQUEUE_HOST_BUSY status to the scsi-ml. But, the reference to the FCP packet set in the scsi_cmnd is not removed from the scsi_cmnd in this code path. This might lead to a crash under stress testing where the scsi_cmnd failed by fc_queuecommand() comes up to fc_eh_abort() via scsi eh thread. fc_eh_abort() will get reference to the FCP packet to be aborted from the scsi_cmnd for further FCP abort related processing and then try to release the FCP packet that has already been released. This patch removes the FCP packet reference from the scsi_cmnd before returning back from fc_queuecommand() in case of an error in sending out the FCP packet. Signed-off-by: Neerav Parikh <Neerav.Parikh@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-07-28[SCSI] libfc: cleanup sending SRR requestHillf Danton
The variable on stack, namely cdb_op, is not used but removed. [ Patch reworked by Robert Love due to invalid patch format ] Signed-off-by: Hillf Danton <dhillf@gmail.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-07-28[SCSI] libfc: two minor changes in commentsHillf Danton
One change is to cleanup typo in comment for fc_fcp_recv(), another corrects the misleading comment for fc_fcp_abts_resp(). [ Patch reworked by Robert Love due to invalid patch format ] Signed-off-by: Hillf Danton <dhillf@gmail.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-07-28[SCSI] libfc, fcoe: ignore rx frame with wrong xid infoVasu Dev
Drop the rx frame having xid with wrong cpu info or received with xid not matching to our xid. Not dropping such frame is causing panic as that causes accessing data struct beyond their bounds. Signed-off-by: Vasu Dev <vasu.dev@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-07-28[SCSI] libfc: release exchg cacheHillf Danton
If fail to create workqueue, the newly created cache for exchg has to be released. Signed-off-by: Hillf Danton <dhillf@gmail.com> Reviewed-by: Vasu Dev <vasu.dev@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-07-28[SCSI] libfc: use FC_MAX_ERROR_CNTHillf Danton
Though defined, FC_MAX_ERROR_CNT is not used. It is used now for CRC error in the path of receiving FCP frame. Signed-off-by: Hillf Danton <dhillf@gmail.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-07-23Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6Linus Torvalds
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (77 commits) [SCSI] fix crash in scsi_dispatch_cmd() [SCSI] sr: check_events() ignore GET_EVENT when TUR says otherwise [SCSI] bnx2i: Fixed kernel panic due to illegal usage of sc->request->cpu [SCSI] bfa: Update the driver version to 3.0.2.1 [SCSI] bfa: Driver and BSG enhancements. [SCSI] bfa: Added support to query PHY. [SCSI] bfa: Added HBA diagnostics support. [SCSI] bfa: Added support for flash configuration [SCSI] bfa: Added support to obtain SFP info. [SCSI] bfa: Added support for CEE info and stats query. [SCSI] bfa: Extend BSG interface. [SCSI] bfa: FCS bug fixes. [SCSI] bfa: DMA memory allocation enhancement. [SCSI] bfa: Brocade-1860 Fabric Adapter vHBA support. [SCSI] bfa: Brocade-1860 Fabric Adapter PLL init fixes. [SCSI] bfa: Added Fabric Assigned Address(FAA) support [SCSI] bfa: IOC bug fixes. [SCSI] bfa: Enable ASIC block configuration and query. [SCSI] bnx2i: Updated copyright and bump version [SCSI] bnx2i: Modified to skip CNIC registration if iSCSI is not supported ... Fix up some trivial conflicts in: - drivers/scsi/bnx2fc/{bnx2fc.h,bnx2fc_fcoe.c}: Crazy broadcom version number conflicts - drivers/target/tcm_fc/tfc_cmd.c Just trivial cleanups done on adjacent lines
2011-07-20scsi,rcu: Convert call_rcu(fc_rport_free_rcu) to kfree_rcu()Lai Jiangshan
The rcu callback fc_rport_free_rcu() just calls a kfree(), so we use kfree_rcu() instead of the call_rcu(fc_rport_free_rcu). Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Robert Love <robert.w.love@intel.com> Cc: "James E.J. Bottomley" <James.Bottomley@suse.de> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
2011-06-29[SCSI] libfc: post reset event on lport resetVasu Dev
Post an FCH_EVT_LIPRESET event on lport reset as as lport reset occurs on FIP cleat virtual link, this could be due to change in fcoe vlan and this event will allow user app fcoemon to switch to new fcoe vlan. Signed-off-by: Vasu Dev <vasu.dev@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29[SCSI] libfc:Fix for exchange/seq loopup failure when FCoE stack is used as ↵Kiran Patil
target and connected to windows initaitor Problem: Linux based SW target (TCM) connected to windows initiator was unable to satisfy write request of size > 2K. Fix: Existing linux implememtation of FCoE stack is expecting sequence number to match w.r.t incoming framme. When DDP is used on target in response to write request from initiator, SW stack is notified only when last data frame arrives and only the pakcket header of last data frame is posted to NetRx queue of storage. When that last packet was processed in libfc:Exchange layer, implementation was expecting sequence number to match, but in this case sequence number which is embedded in FC Header is assigned by windows initaitor, hence due to sequence number mismatch post-processing which shall result into sending RSP is not done. Enhanced the code to utilize the sequence number of incoming last frame and process the packet so that, it will eventually complete the write request by sending write response (RSP) GOOD. Notes/Dependencies: This patch is validated using windows and linux initiator to make sure, it doesn't break anything. Signed-off-by: Kiran Patil <kiran.patil@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29[SCSI] libfc: Enhancement to RPORT state machine applicable only for VN2VN modeKiran Patil
Problem: Existing RPORT state machine continues witg FLOGI/PLOGI process only after it receices beacon from other end. Once claiming stage is over (either clain notify or clain repose), beacon is sent and state machine enters into operational mode where it initiates the rlogin process (FLOGI/PLOGI) to the peer but before this rlogin is initiated, exitsing implementation checks if it received beacon from other end, it beacon is not received yet, rlogin process is not initiated. Other end initiates FLOGI but peer end keeps on rejecting FLOGI, hence after 3 retries other end deletes associated rport, then sends a beacon. Once the beacon is received, peer end now initiates rlogin to the peer end but since associated rport is deleted FLOGI is neither accepted nor the reject response send out because rport is deleted. Hence unable to proceed withg FLOGI/PLOGI process and fails to establish VN2VN connection. Fix: VN2VN spec is not standard yet but based on exitsing collateral on T11, it appears that, both end shall send beacon and enter into 'operational mode' without explictly waiting for beacon from other end. Fix is to allow the RPORT login process as long as respective RPORT is created (as part of claim notification / claim response) even though state of RPORT is INIT. Means don't wait for beacon from peer end, if peer end initiates FLOGI (means peer end exist and responding). Notes: This patch is preparing the FCoE stack for target wrt offload. This is generic patch and harmless even if applied on storage initiator because 'else if' condition of function 'fcoe_oem_found' shall evaluate to TRUE only for targets. Dependencies: None Signed-off-by: Kiran Patil <kiran.patil@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-05-24[SCSI] libfc: do not immediately retry the cmd when seq_send fails in ↵Yi Zou
fc_fcp_send_data Currently, when seq_send() fails in fc_fcp_send_data(), fc_fcp_retry_cmd() would complete this failed I/O directly and let scsi-ml retry. However, target side is not notified which may hang the target. Instead, we should just bail out from from fc_fcp_send_data and let scsi-ml times it out and aborts this I/O instead. Signed-off-by: Yi Zou <yi.zou@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <jbottomley@parallels.com>
2011-05-24[SCSI] libfc: fix race in SRR responseVasu Dev
In this case fsp was freed before error handler was invoked, this is fixed by having SRR fsp reference freed by exch destructor so that fsp will be always held until it exch is freed. Also don't reset fsp->recov_seq since this is needed by SRR error handler to do exch done. Signed-off-by: Vasu Dev <vasu.dev@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <jbottomley@parallels.com>
2011-05-24[SCSI] libfc: don't call resp handler after FC_EX_TIMEOUTVasu Dev
In cases exch is already timed out then exch layer could end up calling resp handler again for its response frame received after timeout, though in this case fc_exch_timeout handler would have already called resp with FC_EX_TIMEOUT. This would cause REC response handler to release its fsp pkt hold twice instead once and possibly similar issues with other ELS exchanges in this race. To avoid this race have resp updated under exch lock in rx path, the resp would get set to NULL in case of FC_EX_TIMEOUT under the same lock to prevent resp callback after FC_EX_TIMEOUT. Signed-off-by: Vasu Dev <vasu.dev@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <jbottomley@parallels.com>
2011-05-24[SCSI] libfc: release DDP context if frame_send() failsYi Zou
In case frame_send() fails, make sure to let the underlying HW release the DDP context that has already been set up before calling frame_send(). Signed-off-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>
2011-05-24[SCSI] libfc: fix mm leak in handling incoming request for target discoveryHillf Danton
When handling incoming request, if the operation code carried by the received frame is not RSCN, the frame should be freed as in the RSCN case, or there is memory leakage. Signed-off-by: Hillf Danton <dhillf@gmail.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <jbottomley@parallels.com>
2011-05-01[SCSI] libfc: rec tov value and REC_TOV_CONST units usages is incorrectVasu Dev
Added REC_TOV_CONST intent was to have rec tov as e_d_tov + 1s but currently it is e_d_tov + 1ms since e_d_tov is stored in ms unit. Also returned rec tov by get_fsp_rec_tov is in ms and this ms tov is used as-is with fc_fcp_timer_set expecting jiffies tov. Fixed this by having get_fsp_rec_tov return rec tov in jiffies as e_d_tov + 1s and then use jiffies tov w/ fc_fcp_timer_set. Also some cleanup, no need to cache get_fsp_rec_tov return value in local rec_tov at various places. Signed-off-by: Vasu Dev <vasu.dev@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-05-01[SCSI] libfc: remove duplicate ema_list initVasu Dev
As ema_list is already initialized by libfc_host_alloc. 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>
2011-05-01[SCSI] libfc: Move host_lock usage into ramp_up/down routinesRobert Love
The host_lock is still used to protect the can_queue value in the Scsi_Host, but it doesn't need to be held and released by each caller. This patch moves the lock usage into the fc_fcp_can_queue_ramp_up and fc_fcp_can_queue_ramp_down routines. Signed-off-by: Robert Love <robert.w.love@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-03-31Fix common misspellingsLucas De Marchi
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-02-28[SCSI] fcoe, libfc: initialize EM anchors list and then update npiv EMsVasu Dev
EM anchors list initialization for only master port was not enough to keep npiv working as described here:- https://lists.open-fcoe.org/pipermail/devel/2011-January/011063.html So this patch moves fc_exch_mgr_list_clone to update npiv ports EMs once EM anchors list initialized. Also some cleanup, no need to set lport = NULL as that always get initialized later. 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>
2011-02-28[SCSI] Revert "[SCSI] libfc: fix exchange being deleted when the abort ↵Parikh, Neerav
itself is timed out" When abort for an exchange timed out it didn't release the reference to the exchange resulting in a memory leak. After discussion with the author of the patch (CC) that introduced this bug it was suggested to revert that patch. This reverts commit ea3e2e72eeb3e8a9440a5da965914f9b12088626. Signed-off by: Neerav Parikh <Neerav.Parikh@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-28[SCSI] libfc: Fixing a memory leak when destroying an interfaceParikh, Neerav
When an fcoe interface is being destroyed; in the process the fcoe driver will try to release all the resources it had allocated for that interface including rports. But, it seems that it does not release the reference held for the name server rport in that process resulting into a memory leak. This patch fixes that memory leak. Signed-off-by: Neerav Parikh <neerav.parikh@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] libfc: introduce LLD event callbackBhanu Prakash Gollapudi
This patch enables LLD to listen to rport events and perform LLD specific operations based on the rport event. This patch also stores sp_features and spp_type in rdata for further reference by LLD. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] libfc: Extending lport's roles for target if there is a registered ↵Kiran Patil
target. Problem: From initaitor machine, when queried role of target (other end of connection), it is "initiator", hence SCSI-ml doesn't send any LUN Inquiry commands. Fix: If there is a registered target for FC_TYPE_FCP, extend lport's params (capability) to be target as well, By default lport params are INITIATOR only. Having this fix, caused initiator to send SCSI LUN inquiry command to target. Signed-off-by: Kiran Patil <kiran.patil@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] libfc: Enhanced exchange ID selection mechanism and fix related EMA ↵Kiran Patil
selection logic. Problem: In case of exchange responder case, EMA selection was defaulted to the last EMA from EMA list (lport.ema_list). If exchange ID is selected from offload pool and not setup DDP, resulting into incorrect selection of EMA, and eventually dropping the packet because unable to find exchange. Fix: Enhanced the exchange ID selection (depending upon request type and exchange responder) Made necessary enhancement in EMA selection algorithm. Signed-off-by: Kiran Patil <kiran.patil@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] libfc: export seq_release() for users of seq_assign()Joe Eykholt
Target modules using lport->tt.seq_assign() get a hold on the exchange but have no way of releasing it. Add that. Signed-off-by: Joe Eykholt <jeykholt@cisco.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] libfc: Remove usage of the Scsi_Host's host_lockRobert Love
This patch removes the use of the Scsi_Host's host_lock within fc_queuecommand. It also removes the DEF_SCSI_QCMD usage so that libfc has fully moved on to the new queuecommand interface. Signed-off-by: Robert Love <robert.w.love@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Reviewed-by: Nicholas A. Bellinger <nab@linux-iscsi.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] libfc: use PRLI hook to get parameters when sending outgoing PRLIJoe Eykholt
When sending an outgoing PRLI as an initiator, get the parameters from registered providers so that they all get a chance to decide on roles. The passive provider is called last, and could override the initiator role. 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>
2011-02-12[SCSI] libfc: add hook to notify providers of local port changesJoe Eykholt
When an SCST provider is registered, it needs to know what local ports are available for configuration as targets. Add a notifier chain that is invoked when any local port that is added or deleted. Maintain a global list of local ports and add an interator function that calls a given function for every existing local port. This is used when first loading a provider. 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>
2011-02-12[SCSI] libfc: add method for setting handler for incoming exchangeJoe Eykholt
Add a method for setting handler for incoming exchange. For multi-sequence exchanges, this allows the target driver to add a response handler for handling subsequent sequences, and exchange manager resets. The new function is called fc_seq_set_resp(). 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>
2011-02-12[SCSI] libfc: add hook for FC-4 provider registrationJoe Eykholt
Allow FC-4 provider modules to hook into libfc, mostly for targets. This should allow any FC-4 module to handle PRLI requests and maintain process-association states. Each provider registers its ops with libfc and then will be called for any incoming PRLI for that FC-4 type on any instance. The provider can decide whether to handle that particular instance using any method it likes, such as ACLs or other configuration information. A count is kept of the number of successful PRLIs from the remote port. Providers are called back with an implicit PRLO when the remote port is about to be deleted or has been reset. fc_lport_recv_req() now sends incoming FC-4 requests to FC-4 providers, and there is a built-in provider always registered for handling incoming ELS requests. The call to provider recv() routines uses rcu_read_lock() so that providers aren't removed during the call. That lock is very cheap and shouldn't affect any performance on ELS requests. Providers can rely on the RCU lock to protect a session lookup as well. 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>
2011-02-12[SCSI] libfc: fix sparse static and non-ANSI warningsRandy Dunlap
Fix sparse warning for non-ANSI function declaration. Declare workqueue structs as static. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Cc: Robert Love <robert.w.love@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] libfc:prevent dereferencing ERR_PTR in fc_tm_done()Dan Carpenter
If we goto out, then it tries to call kfree_skb() on an ERR_PTR which will oops. Just return directly. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] libfc: Cleanup return paths in fc_rport_error_retryHillf Danton
This patch makes it so that we only have one call to fc_rport_error. This patch does not completely consolidate return statements, there is still one return used when not calling fc_rport_error, but alternative solutions made the code more confusing. [ Patch modified by Robert Love ] [ Patch title and commit message edited by Robert Love to make it more relevant ] Signed-off-by: Hillf Danton <dhillf@gmail.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] libfc: Return a valid return code in fc_fcp_pkt_abort()Hillf Danton
Here ticks_left is added to record the result of wait_for_completion_timeout(). [ Patch title and description edited by Robert Love to make it more descriptive ] Signed-off-by: Hillf Danton <dhillf@gmail.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] libfc: always initialize the FCoE DDP exchange id for fsp as ↵Yi Zou
FC_XID_UNKNOWN The fsp's xfer_ddp is used as indication of the exchange id for the DDPed I/O. We should always initialize it as FC_XID_UNKNOWN for a newly allocated fsp, otherwise the fsp allocated in fc_fcp, i.e., not from queuecommand like LUN RESET that is not doing DDP may still think DDP is setup for it since xid 0 is valid and goes on to call fc_fcp_ddp_done() in fc_fcp_resp() from fc_tm_done(). So, set xfer_ddp as FC_XID_UNKNOWN in fc_fcp_pkt_alloc() now. Also removes the setting of fsp->lp as it's already done when fsp is allocated. 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>
2011-01-13Merge branch 'for-next' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits) Documentation/trace/events.txt: Remove obsolete sched_signal_send. writeback: fix global_dirty_limits comment runtime -> real-time ppc: fix comment typo singal -> signal drivers: fix comment typo diable -> disable. m68k: fix comment typo diable -> disable. wireless: comment typo fix diable -> disable. media: comment typo fix diable -> disable. remove doc for obsolete dynamic-printk kernel-parameter remove extraneous 'is' from Documentation/iostats.txt Fix spelling milisec -> ms in snd_ps3 module parameter description Fix spelling mistakes in comments Revert conflicting V4L changes i7core_edac: fix typos in comments mm/rmap.c: fix comment sound, ca0106: Fix assignment to 'channel'. hrtimer: fix a typo in comment init/Kconfig: fix typo anon_inodes: fix wrong function name in comment fix comment typos concerning "consistent" poll: fix a typo in comment ... Fix up trivial conflicts in: - drivers/net/wireless/iwlwifi/iwl-core.c (moved to iwl-legacy.c) - fs/ext4/ext4.h Also fix missed 'diabled' typo in drivers/net/bnx2x/bnx2x.h while at it.
2010-12-22Merge branch 'master' into for-nextJiri Kosina
Conflicts: MAINTAINERS arch/arm/mach-omap2/pm24xx.c drivers/scsi/bfa/bfa_fcpim.c Needed to update to apply fixes for which the old branch was too outdated.
2010-12-21[SCSI] libfc: fix statistics for FCP input/output megabytesJoe Eykholt
The statistics for InputMegabytes and OutputMegabytes are misnamed. They're accumulating bytes, not megabytes. The statistic returned via /sys must be in megabytes, however, which is what the HBA-API wants. The FCP code needs to accumulate it in bytes and then divide by 1,000,000 (not 2^20) before it presented via sysfs. This affects fcoe.ko only, not fnic. The fnic driver correctly by accumulating bytes and then converts to megabytes. I checked that libhbalinux is using the /sys file directly without conversion. BTW, qla2xxx does divide by 2^20, which I'm not fixing here. 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>
2010-12-21[SCSI] libfc: fix fc_tm_done not freeing the allocated fsp pktYi Zou
Frame should be freed in fc_tm_done, this is an updated patch on the one initially submitted by Hillf Danton. Signed-off-by: Hillf Danton <dhillf@gmail.com> 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>
2010-12-21[SCSI] libfc: the timeout for the REC itself is 2 * R_A_TOV_elsYi Zou
The timeout for the exchange carrying REC itself is 2 * R_A_TOV_els. 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>
2010-12-21[SCSI] libfc: fix exchange being deleted when the abort itself is timed outYi Zou
Should not continue when the abort itself is being timeout since in that case the exchange will be deleted and relesased. We still want to call the associated response handler to let the layer, e.g., fcp, know the exchange itself is being timed out. 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>
2010-12-21[SCSI] libfc: do not fc_io_compl on fsp w/o any scsi_cmnd associatedYi Zou
Do not call fc_io_compl() on fsp w/o any scsi_cmnd, e.g., lun reset is built inside fc_fcp, not from a scsi command from queuecommnd from scsi-ml, so in in case target is buggy that is invalid flags in the FCP_RSP, as we have seen in some SAN Blaze target where all bits in flags are 0, we do not want to call io_compl on this fsp. [ Comment block added by Robert Love ] 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>
2010-12-21[SCSI] libfc: add print of exchange id for debugging fc_fcpYi Zou
This is very helpful to match up the corresponding exchange to the actual I/O described by the fsp, particularly when you do a side-by-side comparison of the syslog with your trace. 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>
2010-12-21[SCSI] libfc: fix memory leakage in remote portHillf Danton
There seems rdata should get put before return. Signed-off-by: Hillf Danton <dhillf@gmail.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>