aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/libfc
AgeCommit message (Collapse)AuthorFilesLines
2016-11-08scsi: libfc: Replace ->seq_assign callback with function callHannes Reinecke1-4/+2
The ->seq_assign callback only ever had one implementation, so call the function directly and drop the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->seq_set_resp callback with direct function callHannes Reinecke1-7/+4
The ->seq_set_resp callback only ever had one implementation, so call it directly and drop the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->seq_start_next callback with function callHannes Reinecke3-7/+5
The ->seq_start_next callback only ever had one implementation, so call the function directly and drop the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->exch_done callback with function callHannes Reinecke3-16/+12
The ->exch_done callback only ever had one implementation, so we can as well call it directly and drop the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->seq_exch_abort callback with function callHannes Reinecke2-7/+10
The ->seq_exch_abort callback only ever had one implementation, so we can as well call it directly and drop the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->seq_send callback with function callHannes Reinecke2-7/+4
The ->seq_send callback only ever had one implementation, so we can as well call it directly and drop the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Remove fc_rport_init()Hannes Reinecke1-10/+0
Function is empty now and can be removed. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Reviewed-by: Chad Dupuis <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->rport_flush_queue callback with function callHannes Reinecke3-6/+4
The ->rport_flush_queue callback only ever had a single implementation, so we can as well call it directly and drop the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->rport_recv_req callback with function callHannes Reinecke2-5/+3
The ->rport_recv_req callback only ever had one implementation, so we can as well call it directly and drop the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->rport_logoff callback with function callHannes Reinecke3-14/+12
The ->rport_logoff callback only ever had one implementation, so we can as well call it directly and drop the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Reviewed-by: Chad Dupuis <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->rport_login callback with function callHannes Reinecke3-10/+16
The ->rport_login callback only ever had one implementation, so we can as well call it directly and drop the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->rport_create callback with function callHannes Reinecke3-13/+9
The ->rport_create callback only ever had a single implementation, so we can as well call it directly and drop the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->rport_lookup callback with function callHannes Reinecke2-10/+8
The ->rport_lookup callback only ever had a single implementation, so we can as well call it directly and drop the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->rport_destroy callback with function callHannes Reinecke3-44/+36
The ->rport_destroy callback only ever had one implementation, so we can as well call it directly and drop the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->exch_seq_send callback with function callHannes Reinecke5-24/+38
The ->exch_seq_send callback only ever had one implementation, so we can call the function directly and drop the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->lport_recv with function callHannes Reinecke2-8/+5
The ->lport_recv callback only ever had one implementation, so call the function directly and remove the callback. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->lport_reset callback with function callHannes Reinecke2-4/+1
The ->lport_reset callback only ever had one implementation, which already is exported. So remove it and use the function directly. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Replace ->seq_els_rsp_send callback with function callHannes Reinecke4-23/+21
The 'seq_els_rsp_send' callback only ever had one implementation, so we might as well drop it and use the function directly. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Check xid when looking up REC exchangesHannes Reinecke1-4/+12
We currently can only lookup the local xid, so we need to reject REC with empty rxid. Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: wait for E_D_TOV when out-of-order sequence is receivedHannes Reinecke1-18/+20
When detecting an out-of-order sequence we should be waiting for E_D_TOV before trying to abort the sequence. The response might still be stuck in the queue somewhere. Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: reset timeout on queue fullHannes Reinecke1-3/+17
When we're receiving a timeout we should be checking for queue full status; if there are still some packets pending we should be resetting the counter to ensure we're not missing out any packets which are still queued. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Do not drop out-of-order framesHannes Reinecke1-3/+0
When receiving packets from the network we cannot guarantee any frame ordering, so we should be receiving all valid frames and let the upper layers deal with it. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: don't fail sequence abort for completed exchangesHannes Reinecke1-10/+30
If a sequence should be aborted the exchange might already be completed (eg if the response is still queued in the rx queue), so this shouldn't considered as an error. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: quarantine timed out xidsHannes Reinecke2-17/+29
When a sequence times out we have no idea what happened to the frame. And we do not know if we will ever receive the frame. Hence we cannot re-use the xid as we would risk data corruption if the xid had been re-used and the timed out frame would be received after that. So we need to quarantine the xid until the lport is reset. Yes, I know this will (eventually) deplete the xid pool. But for now it's the safest method. Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: safeguard against invalid exchange indexHannes Reinecke1-7/+14
The cached exchange index might be invalid, in which case we should drop down to allocate a new one. And we should not try to access an invalid exchange when responding to a BA_ABTS. Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Clarify ramp-down messagesHannes Reinecke1-3/+9
When the queue depth is reduced we should print out the reason for this; it might be due to a queue full condition. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Return LS_RJT_BUSY for PRLI in status PLOGIHannes Reinecke1-0/+17
Occasionally it might happen that we receive a PRLI while we're still waiting for our PLOGI response. In that case we should return 'busy' LS status instead of 'plogi required' LS status. Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Rework PRLI handlingHannes Reinecke1-18/+38
PRLI is only required if the port is acting as an initiator; ports which support target functionality only do not need to send PRLI. At the same time the PRLI state is only used if the port initiated a PRLI transfer; if we received a PRLI request we should _not_ change the state as this would cause our PRLI response to be dropped. And when we receive a PRLI response we need to check if an image pair has been established; if not the remote port cannot act as a target for us and we need to disable target functionality. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Implement RTV responderHannes Reinecke1-1/+40
The libfc stack generates an RTV request, so we should be implementing an RTV responder, too. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: use error code for fc_rport_error()Hannes Reinecke1-40/+61
We only ever use the 'fp' argument for fc_rport_error() to encapsulate the error code, so we can as well do away with that and pass the error directly. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: do not overwrite DID_TIME_OUT statusHannes Reinecke1-3/+9
When a command is aborted it might already have the DID_TIME_OUT status set, so we shouldn't be overwriting that. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: sanitize E_D_TOV and R_A_TOV settingHannes Reinecke3-9/+14
When setting the FCP timeout we need to ensure a lower boundary for E_D_TOV and R_A_TOV, otherwise we'd be getting spurious I/O issues due to the fcp timer firing too early. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: use configured rport E_D_TOVHannes Reinecke1-1/+1
If fc_rport_error_retry() is attempting to retry the remote port state we should be waiting for the configured e_d_tov value rather than the default. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: use configured lport R_A_TOVHannes Reinecke1-1/+1
We should be using the configured R_A_TOV value when sending the exchange. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: spurious I/O error under high loadHannes Reinecke1-8/+15
If a command times out libfc is sending an REC, which also might fail (due to frames being lost or something). If no data has been transferred we can simply retry the command, but the current code sets a state of FC_ERROR, which then is being translated into DID_ERROR, resulting in an I/O error. So to handle this properly we need to set a separate state FC_TRANS_RESET and mapping it onto DID_SOFT_RETRY. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: additional debugging messagesHannes Reinecke3-24/+101
Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Revert "[SCSI] libfc: use offload EM instance again instead ↵Martin K. Petersen1-5/+10
jumping to next EM" This reverts commit 3e22760d4db6fd89e0be46c3d132390a251da9c6. This revert came about because of efforts by Ewan Milne, Curtis Taylor and I. In researching this issue, significant performance issues were seen on large CPU count systems using the software FCOE stack. Hannes also weighed in. The same was not apparent on much smaller low count CPU systems. The behavior introduced by commit 3e22760d4db6fd89e0be46c3d132390a251da9c6 lands sup with large count CPU systems seeing continual blk_requeue_request() calls due to ML_QUEUE_HOST_BUSY. fc_exch_alloc() used to try all the available exchange managers in the list for an available exchange id, but this was changed in 2010 so that if the first matched exchange manager couldn't allocate one, it fails and we end up returning host busy. This was due to commit: Setting the ddp_min module parameter to fcoe to 128MB prevents the ->match function from permitting the use of the offload exchange manager for the frame, and we no longer see the problem with host busy status, since it uses the larger non-offloaded pool. Reverting commit 3e22760d4db6fd89e0be46c3d132390a251da9c6 was tested to also prevent the host busy issue due to failing allocations. Suggested-by: Ewan Milne <[email protected]> Suggested-by: Curtis Taylor <[email protected]> Tested-by: Laurence Oberman <[email protected]> Signed-off-by: Laurence Oberman <[email protected]>
2016-11-08scsi: libfc: don't advance state machine for incoming FLOGIHannes Reinecke1-6/+14
When we receive an FLOGI but have already sent our own we should not advance the state machine but rather wait for our FLOGI to return before continuing with PLOGI. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Do not login if the port is already startedHannes Reinecke1-0/+6
When the port is already started we don't need to login; that will only confuse the state machine. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Do not drop down to FLOGI for fc_rport_login()Hannes Reinecke1-1/+5
When fc_rport_login() is called while the rport is not in RPORT_ST_INIT, RPORT_ST_READY, or RPORT_ST_DELETE login is already in progress and there's no need to drop down to FLOGI; doing so will only confuse the other side. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Do not take rdata->rp_mutex when processing a -FC_EX_CLOSED ELS ↵Chad Dupuis1-8/+24
response. When an ELS response handler receives a -FC_EX_CLOSED, the rdata->rp_mutex is already held which can lead to a deadlock condition like the following stack trace: [<ffffffffa04d8f18>] fc_rport_plogi_resp+0x28/0x200 [libfc] [<ffffffffa04cfa1a>] fc_invoke_resp+0x6a/0xe0 [libfc] [<ffffffffa04d0c08>] fc_exch_mgr_reset+0x1b8/0x280 [libfc] [<ffffffffa04d87b3>] fc_rport_logoff+0x43/0xd0 [libfc] [<ffffffffa04ce73d>] fc_disc_stop+0x6d/0xf0 [libfc] [<ffffffffa04ce7ce>] fc_disc_stop_final+0xe/0x20 [libfc] [<ffffffffa04d55f7>] fc_fabric_logoff+0x17/0x70 [libfc] The other ELS handlers need to follow the FLOGI response handler and simply do a kref_put against the fc_rport_priv struct and exit when receving a -FC_EX_CLOSED response. Signed-off-by: Chad Dupuis <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Fixup disc_mutex handlingHannes Reinecke3-15/+34
The list of attached 'rdata' remote port structures is RCU protected, so there is no need to take the 'disc_mutex' when traversing it. Rather we should be using rcu_read_lock() and kref_get_unless_zero() to validate the entries. We need, however, take the disc_mutex when deleting an entry; otherwise we risk clashes with list_add. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-11-08scsi: libfc: Revisit kref handlingHannes Reinecke1-30/+101
The kref handling in fc_rport is a mess. This patch updates the kref handling according to the following rules: - Take a reference whenever scheduling a workqueue - Take a reference whenever an ELS command is send - Drop the reference at the end of the workqueue function - Drop the reference at the end of handling ELS replies - Take a reference when allocating an rport - Drop the reference when removing an rport Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-08-18scsi: libfc: do not send ABTS when resetting exchangesHannes Reinecke1-1/+0
When all exchanges are reset the upper layers have already logged out of the remote port, so the exchanges can be reset without sending any ABTS. Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Chad Dupuis <[email protected]> Tested-by: Chad Dupuis <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-08-18scsi: libfc: reset exchange manager during LOGO handlingHannes Reinecke1-1/+13
FC-LS mandates that we should invalidate all sequences before sending a LOGO. And we should set the event to RPORT_EV_STOP when a LOGO request has been received to signal that all exchanges are terminated. Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Chad Dupuis <[email protected]> Tested-by: Chad Dupuis <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-08-18scsi: libfc: send LOGO for PLOGI failureHannes Reinecke1-1/+9
When running in point-to-multipoint mode PLOGI is done after FLOGI completed. So when the PLOGI fails we should be sending a LOGO to the remote port. [mkp: Applied by hand] Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Chad Dupuis <[email protected]> Tested-by: Chad Dupuis <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-08-18scsi: libfc: Issue PRLI after a PRLO has been receivedHannes Reinecke1-1/+1
When receiving a PRLO it just means that the operating parameters have changed, it does _not_ mean that the port doesn't want to communicate with us. So instead of implicitly logging out we should be issueing a PRLI to figure out the new operating parameters. We can always recover once PRLI fails. Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Chad Dupuis <[email protected]> Tested-by: Chad Dupuis <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-07-13libfc: sanity check cpu number extracted from xidChris Leech1-1/+9
In the receive path libfc extracts a cpu number from the ox_id in the fiber channel header and uses that to do a per_cpu_ptr conversion. If, for some reason, a frame is received with an invalid ox_id, per_cpu_ptr will return an invalid pointer and the libfc receive path will panic the system trying to use it. I'm currently looking at such a case, and I don't yet know why a cpu number > nr_cpu_ids is appearing in an exchange id. But adding a sanity check in libfc prevents a system panic, and seems like good idea when dealing with frames coming in from the network. Signed-off-by: Chris Leech <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-07-12scsi: libfc: fix seconds_since_last_reset calculationArnd Bergmann1-4/+1
The fc_get_host_stats() function contains a complex conversion from jiffies to timespec to seconds. As we try to get rid of uses of struct timespec, we can clean this up and replace it with a simpler computation. Simply dividing the difference in jiffies by HZ is not only much more efficient, it also avoids a problem that causes the seconds_since_last_reset value to be incorrect if jiffies has overrun since the 'boot_time' value was recorded. Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-07-12libfc: Update rport reference countingHannes Reinecke2-31/+37
Originally libfc would just be initializing the refcount to '1', and using the disc_mutex to synchronize if and when the final put should be happening. This has a race condition as the mutex might be delayed, causing other threads to access an invalid structure. This patch updates the rport reference counting to increase the reference every time 'rport_lookup' is called, and decreases the reference correspondingly. This removes the need to hold 'disc_mutex' when removing the structure, and avoids the above race condition. Signed-off-by: Hannes Reinecke <[email protected]> Acked-by: Vasu Dev <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>