summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc
Commit message (Collapse)AuthorAgeFilesLines
...
| * scsi: libfc: Replace ->seq_start_next callback with function callHannes Reinecke2016-11-083-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Replace ->exch_done callback with function callHannes Reinecke2016-11-083-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Replace ->seq_exch_abort callback with function callHannes Reinecke2016-11-082-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Replace ->seq_send callback with function callHannes Reinecke2016-11-082-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Remove fc_rport_init()Hannes Reinecke2016-11-081-10/+0
| | | | | | | | | | | | | | | | | | Function is empty now and can be removed. Signed-off-by: Hannes Reinecke <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Reviewed-by: Chad Dupuis <chad.dupuis@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Replace ->rport_flush_queue callback with function callHannes Reinecke2016-11-083-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Replace ->rport_recv_req callback with function callHannes Reinecke2016-11-082-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Replace ->rport_logoff callback with function callHannes Reinecke2016-11-083-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Reviewed-by: Chad Dupuis <chad.dupuis@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Replace ->rport_login callback with function callHannes Reinecke2016-11-083-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Replace ->rport_create callback with function callHannes Reinecke2016-11-083-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Replace ->rport_lookup callback with function callHannes Reinecke2016-11-082-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Replace ->rport_destroy callback with function callHannes Reinecke2016-11-083-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Replace ->exch_seq_send callback with function callHannes Reinecke2016-11-085-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Replace ->lport_recv with function callHannes Reinecke2016-11-082-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Replace ->lport_reset callback with function callHannes Reinecke2016-11-082-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Replace ->seq_els_rsp_send callback with function callHannes Reinecke2016-11-084-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Check xid when looking up REC exchangesHannes Reinecke2016-11-081-4/+12
| | | | | | | | | | | | | | | | | | We currently can only lookup the local xid, so we need to reject REC with empty rxid. Signed-off-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: wait for E_D_TOV when out-of-order sequence is receivedHannes Reinecke2016-11-081-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 <hare@suse.com> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: reset timeout on queue fullHannes Reinecke2016-11-081-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Do not drop out-of-order framesHannes Reinecke2016-11-081-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: don't fail sequence abort for completed exchangesHannes Reinecke2016-11-081-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: quarantine timed out xidsHannes Reinecke2016-11-082-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 <hare@suse.com> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: safeguard against invalid exchange indexHannes Reinecke2016-11-081-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 <hare@suse.com> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Clarify ramp-down messagesHannes Reinecke2016-11-081-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Return LS_RJT_BUSY for PRLI in status PLOGIHannes Reinecke2016-11-081-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 <hare@suse.com> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Rework PRLI handlingHannes Reinecke2016-11-081-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Implement RTV responderHannes Reinecke2016-11-081-1/+40
| | | | | | | | | | | | | | | | | | The libfc stack generates an RTV request, so we should be implementing an RTV responder, too. Signed-off-by: Hannes Reinecke <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: use error code for fc_rport_error()Hannes Reinecke2016-11-081-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: do not overwrite DID_TIME_OUT statusHannes Reinecke2016-11-081-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: sanitize E_D_TOV and R_A_TOV settingHannes Reinecke2016-11-083-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: use configured rport E_D_TOVHannes Reinecke2016-11-081-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: use configured lport R_A_TOVHannes Reinecke2016-11-081-1/+1
| | | | | | | | | | | | | | | | | | We should be using the configured R_A_TOV value when sending the exchange. Signed-off-by: Hannes Reinecke <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: spurious I/O error under high loadHannes Reinecke2016-11-081-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 <hare@suse.de> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: additional debugging messagesHannes Reinecke2016-11-083-24/+101
| | | | | | | | | | | | Signed-off-by: Hannes Reinecke <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Revert "[SCSI] libfc: use offload EM instance again instead ↵Martin K. Petersen2016-11-081-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 <emilne@redhat.com> Suggested-by: Curtis Taylor <cjt@us.ibm.com> Tested-by: Laurence Oberman <loberman@redhat.com> Signed-off-by: Laurence Oberman <loberman@redhat.com>
| * scsi: libfc: don't advance state machine for incoming FLOGIHannes Reinecke2016-11-081-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Do not login if the port is already startedHannes Reinecke2016-11-081-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Do not drop down to FLOGI for fc_rport_login()Hannes Reinecke2016-11-081-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Do not take rdata->rp_mutex when processing a -FC_EX_CLOSED ELS ↵Chad Dupuis2016-11-081-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 <chad.dupuis@cavium.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Fixup disc_mutex handlingHannes Reinecke2016-11-083-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| * scsi: libfc: Revisit kref handlingHannes Reinecke2016-11-081-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 <hare@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | scsi: libfc: fix seconds_since_last_reset miscalculationJohannes Thumshirn2016-11-171-1/+1
|/ | | | | | | | | | | | | Commit 540eb1eef0ab ("scsi: libfc: fix seconds_since_last_reset calculation") removed the use of 'struct timespec' from fc_get_host_stats(). This broke the output of 'fcoeadm -s' after kernel 4.8-rc1. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Cc: <stable@vger.kernel.org> # v4.8+ Fixes: 540eb1eef0ab ("scsi: libfc: fix seconds_since_last_reset calculation") Acked-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: libfc: do not send ABTS when resetting exchangesHannes Reinecke2016-08-181-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 <hare@suse.com> Reviewed-by: Chad Dupuis <chad.dupuis@qlogic.com> Tested-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: libfc: reset exchange manager during LOGO handlingHannes Reinecke2016-08-181-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 <hare@suse.com> Reviewed-by: Chad Dupuis <chad.dupuis@qlogic.com> Tested-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: libfc: send LOGO for PLOGI failureHannes Reinecke2016-08-181-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 <hare@suse.com> Reviewed-by: Chad Dupuis <chad.dupuis@qlogic.com> Tested-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: libfc: Issue PRLI after a PRLO has been receivedHannes Reinecke2016-08-181-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 <hare@suse.com> Reviewed-by: Chad Dupuis <chad.dupuis@qlogic.com> Tested-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* libfc: sanity check cpu number extracted from xidChris Leech2016-07-131-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 <cleech@redhat.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: libfc: fix seconds_since_last_reset calculationArnd Bergmann2016-07-121-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 <arnd@arndb.de> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* libfc: Update rport reference countingHannes Reinecke2016-07-122-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 <hare@suse.com> Acked-by: Vasu Dev <vasu.dev@intel.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* libfc: Use the correct function name in kernel-doc comment.Sebastian Herbszt2015-11-091-1/+1
| | | | | | | Signed-off-by: Sebastian Herbszt <herbszt@gmx.de> Acked-by: Vasu Dev <vasu.dev@intel.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>