From: Muneendra <muneendra.kumar@broadcom.com>
To: linux-scsi@vger.kernel.org, hare@suse.de
Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com,
Muneendra <muneendra.kumar@broadcom.com>
Subject: [PATCH v2 6/8] scsi_transport_fc: Added a new rport state FC_PORTSTATE_MARGINAL
Date: Mon, 28 Sep 2020 10:20:55 +0530 [thread overview]
Message-ID: <1601268657-940-7-git-send-email-muneendra.kumar@broadcom.com> (raw)
In-Reply-To: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 2638 bytes --]
Added a new rport state FC_PORTSTATE_MARGINAL.
Made changes in fc_remote_port_chkready function to treat marginal and
online as same
Added a new inline function fc_rport_chkmarginal_set_noretries
which will set the SCMD_NORETRIES_ABORT bit in cmd->state if rport state
is marginal.
Signed-off-by: Muneendra <muneendra.kumar@broadcom.com>
---
v2:
New patch
---
include/scsi/scsi_transport_fc.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 1c7dd35cb7a0..ee99c6ca7e45 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -14,6 +14,7 @@
#include <linux/bsg-lib.h>
#include <asm/unaligned.h>
#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_netlink.h>
#include <scsi/scsi_host.h>
@@ -67,6 +68,7 @@ enum fc_port_state {
FC_PORTSTATE_ERROR,
FC_PORTSTATE_LOOPBACK,
FC_PORTSTATE_DELETED,
+ FC_PORTSTATE_MARGINAL,
};
@@ -383,6 +385,7 @@ struct fc_starget_attrs { /* aka fc_target_attrs */
u64 node_name;
u64 port_name;
u32 port_id;
+ enum fc_port_state port_state;
};
#define fc_starget_node_name(x) \
@@ -391,6 +394,8 @@ struct fc_starget_attrs { /* aka fc_target_attrs */
(((struct fc_starget_attrs *)&(x)->starget_data)->port_name)
#define fc_starget_port_id(x) \
(((struct fc_starget_attrs *)&(x)->starget_data)->port_id)
+#define fc_starget_port_state(x) \
+ (((struct fc_starget_attrs *)&(x)->starget_data)->port_state)
#define starget_to_rport(s) \
scsi_is_fc_rport(s->dev.parent) ? dev_to_rport(s->dev.parent) : NULL
@@ -723,6 +728,7 @@ fc_remote_port_chkready(struct fc_rport *rport)
switch (rport->port_state) {
case FC_PORTSTATE_ONLINE:
+ case FC_PORTSTATE_MARGINAL:
if (rport->roles & FC_PORT_ROLE_FCP_TARGET)
result = 0;
else if (rport->flags & FC_RPORT_DEVLOSS_PENDING)
@@ -743,6 +749,24 @@ fc_remote_port_chkready(struct fc_rport *rport)
return result;
}
+/**
+ * fc_rport_chkmarginal_set_noretries - Set the SCMD_NORETRIES_ABORT bit
+ * in cmd->state if port state is marginal prior to initiating
+ * io to the port.
+ * @rport: remote port to be checked
+ * @scmd: scsi_cmd
+ **/
+static inline void
+fc_rport_chkmarginal_set_noretries(struct fc_rport *rport, struct scsi_cmnd *cmd)
+{
+ if ((rport->port_state == FC_PORTSTATE_MARGINAL) &&
+ (cmd->request->cmd_flags & REQ_FAILFAST_TRANSPORT))
+ set_bit(SCMD_NORETRIES_ABORT, &cmd->state);
+ else
+ clear_bit(SCMD_NORETRIES_ABORT, &cmd->state);
+
+}
+
static inline u64 wwn_to_u64(const u8 *wwn)
{
return get_unaligned_be64(wwn);
--
2.26.2
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4177 bytes --]
next prev parent reply other threads:[~2020-09-28 11:44 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-28 4:50 [PATCH v2 0/8] scsi: Support to handle Intermittent errors Muneendra
2020-09-28 4:50 ` [PATCH v2 1/8] scsi: Added a new definition in scsi_cmnd.h Muneendra
2020-09-30 9:17 ` Hannes Reinecke
2020-09-28 4:50 ` [PATCH v2 2/8] scsi: Added a new error code in scsi.h Muneendra
2020-09-30 9:17 ` Hannes Reinecke
2020-09-28 4:50 ` [PATCH v2 3/8] scsi: Clear state bit SCMD_NORETRIES_ABORT of scsi_cmd before start request Muneendra
2020-09-30 9:19 ` Hannes Reinecke
2020-09-28 4:50 ` [PATCH v2 4/8] scsi: No retries on abort success Muneendra
2020-09-30 9:27 ` Hannes Reinecke
2020-09-28 4:50 ` [PATCH v2 5/8] scsi: Added routine to set/clear SCMD_NORETRIES_ABORT bit for outstanding io on scsi_dev Muneendra
2020-09-30 9:26 ` Hannes Reinecke
2020-09-28 4:50 ` Muneendra [this message]
2020-09-30 9:30 ` [PATCH v2 6/8] scsi_transport_fc: Added a new rport state FC_PORTSTATE_MARGINAL Hannes Reinecke
2020-09-28 4:50 ` [PATCH v2 7/8] scsi_transport_fc: Added a new sysfs attribute port_state Muneendra
2020-09-30 9:33 ` Hannes Reinecke
2020-10-01 13:13 ` Muneendra Kumar M
2020-10-05 9:18 ` Muneendra Kumar M
2020-10-05 9:29 ` Hannes Reinecke
2020-10-07 7:14 ` Muneendra Kumar M
2020-10-02 16:26 ` Benjamin Block
2020-10-05 6:49 ` Hannes Reinecke
2020-10-05 8:41 ` Benjamin Block
2020-09-28 4:50 ` [PATCH v2 8/8] lpfc: Added support to handle marginal state Muneendra
2020-09-30 9:36 ` Hannes Reinecke
2020-09-30 11:33 ` Muneendra Kumar M
2020-09-30 11:50 ` Hannes Reinecke
2020-10-01 8:59 ` Muneendra Kumar M
2020-10-02 17:01 ` [PATCH v2 0/8] scsi: Support to handle Intermittent errors Mike Christie
2020-10-02 17:27 ` James Smart
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=1601268657-940-7-git-send-email-muneendra.kumar@broadcom.com \
--to=muneendra.kumar@broadcom.com \
--cc=emilne@redhat.com \
--cc=hare@suse.de \
--cc=jsmart2021@gmail.com \
--cc=linux-scsi@vger.kernel.org \
--cc=mkumar@redhat.com \
/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