public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Vijaya Mohan Guvva <vmohan@brocade.com>
To: linux-scsi@vger.kernel.org
Cc: JBottomley@parallels.com,
	adapter_linux_open_src_team@Brocade.COM,
	Vijaya Mohan Guvva <vmohan@Brocade.COM>
Subject: [PATCH V1 16/17] bfa: dis-associate bfa path_tov with dev_loss_tmo
Date: Mon, 13 May 2013 02:33:34 -0700	[thread overview]
Message-ID: <1368437615-9867-17-git-send-email-vmohan@brocade.com> (raw)
In-Reply-To: <1368437615-9867-1-git-send-email-vmohan@brocade.com>

Disassoicate path_tov in the driver with the dev_loss_tmo set by the
application.

Signed-off-by: Vijaya Mohan Guvva <vmohan@brocade.com>
---
 drivers/scsi/bfa/bfad_attr.c | 33 +++++++--------------------------
 1 file changed, 7 insertions(+), 26 deletions(-)

diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c
index 72f5dc3..e9a681d 100644
--- a/drivers/scsi/bfa/bfad_attr.c
+++ b/drivers/scsi/bfa/bfad_attr.c
@@ -335,23 +335,10 @@ bfad_im_reset_stats(struct Scsi_Host *shost)
 }
 
 /*
- * FC transport template entry, get rport loss timeout.
- */
-static void
-bfad_im_get_rport_loss_tmo(struct fc_rport *rport)
-{
-	struct bfad_itnim_data_s *itnim_data = rport->dd_data;
-	struct bfad_itnim_s   *itnim = itnim_data->itnim;
-	struct bfad_s         *bfad = itnim->im->bfad;
-	unsigned long   flags;
-
-	spin_lock_irqsave(&bfad->bfad_lock, flags);
-	rport->dev_loss_tmo = bfa_fcpim_path_tov_get(&bfad->bfa);
-	spin_unlock_irqrestore(&bfad->bfad_lock, flags);
-}
-
-/*
  * FC transport template entry, set rport loss timeout.
+ * Update dev_loss_tmo based on the value pushed down by the stack
+ * In case it is lesser than path_tov of driver, set it to path_tov + 1
+ * to ensure that the driver times out before the application
  */
 static void
 bfad_im_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout)
@@ -359,15 +346,11 @@ bfad_im_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout)
 	struct bfad_itnim_data_s *itnim_data = rport->dd_data;
 	struct bfad_itnim_s   *itnim = itnim_data->itnim;
 	struct bfad_s         *bfad = itnim->im->bfad;
-	unsigned long   flags;
-
-	if (timeout > 0) {
-		spin_lock_irqsave(&bfad->bfad_lock, flags);
-		bfa_fcpim_path_tov_set(&bfad->bfa, timeout);
-		rport->dev_loss_tmo = bfa_fcpim_path_tov_get(&bfad->bfa);
-		spin_unlock_irqrestore(&bfad->bfad_lock, flags);
-	}
+	uint16_t path_tov = bfa_fcpim_path_tov_get(&bfad->bfa);
 
+	rport->dev_loss_tmo = timeout;
+	if (timeout < path_tov)
+		rport->dev_loss_tmo = path_tov + 1;
 }
 
 static int
@@ -665,7 +648,6 @@ struct fc_function_template bfad_im_fc_function_template = {
 	.show_rport_maxframe_size = 1,
 	.show_rport_supported_classes = 1,
 	.show_rport_dev_loss_tmo = 1,
-	.get_rport_dev_loss_tmo = bfad_im_get_rport_loss_tmo,
 	.set_rport_dev_loss_tmo = bfad_im_set_rport_loss_tmo,
 	.issue_fc_host_lip = bfad_im_issue_fc_host_lip,
 	.vport_create = bfad_im_vport_create,
@@ -723,7 +705,6 @@ struct fc_function_template bfad_im_vport_fc_function_template = {
 	.show_rport_maxframe_size = 1,
 	.show_rport_supported_classes = 1,
 	.show_rport_dev_loss_tmo = 1,
-	.get_rport_dev_loss_tmo = bfad_im_get_rport_loss_tmo,
 	.set_rport_dev_loss_tmo = bfad_im_set_rport_loss_tmo,
 };
 
-- 
1.7.12


  parent reply	other threads:[~2013-05-13  9:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13  9:33 [PATCH V1 00/17] Update the driver version to 3.2.21.1 Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 01/17] bfa: Support for FC BB credit recovery Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 02/17] bfa: Forward Error Correction status query Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 03/17] bfa: Add dynamic diagnostic port support Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 04/17] bfa: Fix WARN_ON condition check Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 05/17] bfa: FDMI enhancements Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 06/17] bfa: Fix 1860 port initialize when ATC is enabled Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 07/17] bfa: Fix FDISC timeout handling Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 08/17] bfa: kdump fix on 815 and 825 adapters Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 09/17] bfa: driver compatibility with 32bit libs Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 10/17] bfa: fru vpd date update changes Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 11/17] bfa: firmware statistics update Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 12/17] bfa: Allow rsp queue process during ioc disable Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 13/17] bfa: Fix bug_on condition in RPSC rsp handling Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 14/17] bfa: fix endianess issue for firmware stats Vijaya Mohan Guvva
2013-05-13  9:33 ` [PATCH V1 15/17] bfa: Support for chinook-quad port card Vijaya Mohan Guvva
2013-05-13  9:33 ` Vijaya Mohan Guvva [this message]
2013-05-13  9:33 ` [PATCH V1 17/17] bfa: Update the driver version to 3.2.21.1 Vijaya Mohan Guvva
2013-05-23 10:55 ` [PATCH V1 00/17] " Vijay Mohan Guvva
2013-06-04 15:26 ` Vijaya Mohan Guvva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368437615-9867-17-git-send-email-vmohan@brocade.com \
    --to=vmohan@brocade.com \
    --cc=JBottomley@parallels.com \
    --cc=adapter_linux_open_src_team@Brocade.COM \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox