Re: [PATCH v2 6/8] scsi_transport_fc: Added a new rport state FC_PORTSTATE_MARGINAL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/28/20 6:50 AM, Muneendra wrote:
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@xxxxxxxxxxxx>

---
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

This should be moved to the next patch.

@@ -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);

??? Where is this function used ?
I thought this was done with the iterators in the previous patch.

Cheers,

Hannes
--
Dr. Hannes Reinecke		           Kernel Storage Architect
hare@xxxxxxx			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux