Fixed srp and mlxfw backports
authorVladimir Sokolovsky <vlad@mellanox.com>
Wed, 4 Sep 2019 21:50:01 +0000 (16:50 -0500)
committerVladimir Sokolovsky <vlad@mellanox.com>
Wed, 4 Sep 2019 21:50:01 +0000 (16:50 -0500)
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
patches/0007-BACKPORT-srp.patch
patches/0008-BACKPORT-mlxfw.patch

index aeaed0d..1083461 100644 (file)
@@ -5,8 +5,8 @@ Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
 ---
  drivers/infiniband/ulp/srp/ib_srp.c | 246 ++++++++++++++++++++++++++++
  drivers/infiniband/ulp/srp/ib_srp.h |  36 ++++
- drivers/scsi/scsi_transport_srp.c   |   9 +
- 3 files changed, 291 insertions(+)
+ drivers/scsi/scsi_transport_srp.c   |  39 +++++
+ 3 files changed, 321 insertions(+)
 
 diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
 index xxxxxxx..xxxxxxx 100644
@@ -682,7 +682,61 @@ diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp
 index xxxxxxx..xxxxxxx 100644
 --- a/drivers/scsi/scsi_transport_srp.c
 +++ b/drivers/scsi/scsi_transport_srp.c
-@@ -557,12 +557,21 @@ int srp_reconnect_rport(struct srp_rport *rport)
+@@ -5,6 +5,7 @@
+  * Copyright (C) 2007 FUJITA Tomonori <tomof@acm.org>
+  */
+ #include <linux/init.h>
++#include <linux/version.h>
+ #include <linux/module.h>
+ #include <linux/jiffies.h>
+ #include <linux/err.h>
+@@ -97,6 +98,11 @@ int srp_tmo_valid(int reconnect_delay, int fast_io_fail_tmo, long dev_loss_tmo)
+       if (fast_io_fail_tmo >= 0 && dev_loss_tmo >= 0 &&
+           fast_io_fail_tmo >= dev_loss_tmo)
+               return -EINVAL;
++      if (fast_io_fail_tmo > 0 && reconnect_delay > 0 &&
++          fast_io_fail_tmo >= reconnect_delay)
++              return -EINVAL;
++      if (fast_io_fail_tmo < 0 && reconnect_delay > 0)
++              return -EINVAL;
+       return 0;
+ }
+ EXPORT_SYMBOL_GPL(srp_tmo_valid);
+@@ -409,7 +415,11 @@ static void __rport_fail_io_fast(struct srp_rport *rport)
+        * calls before invoking i->f->terminate_rport_io().
+        */
+       scsi_target_block(rport->dev.parent);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) || defined(CONFIG_COMPAT_SCSI_TARGET_UNBLOCK)
+       scsi_target_unblock(rport->dev.parent, SDEV_TRANSPORT_OFFLINE);
++#else
++      scsi_target_unblock(rport->dev.parent);
++#endif
+       /* Involve the LLD if possible to terminate all I/O on the rport. */
+       i = to_srp_internal(shost->transportt);
+@@ -452,7 +462,11 @@ static void rport_dev_loss_timedout(struct work_struct *work)
+       mutex_lock(&rport->mutex);
+       WARN_ON(srp_rport_set_state(rport, SRP_RPORT_LOST) != 0);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) || defined(CONFIG_COMPAT_SCSI_TARGET_UNBLOCK)
+       scsi_target_unblock(rport->dev.parent, SDEV_TRANSPORT_OFFLINE);
++#else
++      scsi_target_unblock(rport->dev.parent);
++#endif
+       mutex_unlock(&rport->mutex);
+       i->f->rport_delete(rport);
+@@ -551,18 +565,31 @@ int srp_reconnect_rport(struct srp_rport *rport)
+               rport->failed_reconnects = 0;
+               srp_rport_set_state(rport, SRP_RPORT_RUNNING);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) || defined(CONFIG_COMPAT_SCSI_TARGET_UNBLOCK)
+               scsi_target_unblock(&shost->shost_gendev, SDEV_RUNNING);
++#else
++              scsi_target_unblock(&shost->shost_gendev);
++#endif
+               /*
+                * If the SCSI error handler has offlined one or more devices,
                 * invoking scsi_target_unblock() won't change the state of
                 * these devices into running so do that explicitly.
                 */
@@ -704,3 +758,36 @@ index xxxxxxx..xxxxxxx 100644
        } else if (rport->state == SRP_RPORT_RUNNING) {
                /*
                 * srp_reconnect_rport() has been invoked with fast_io_fail
+@@ -570,12 +597,20 @@ int srp_reconnect_rport(struct srp_rport *rport)
+                * failure timers if these had not yet been started.
+                */
+               __rport_fail_io_fast(rport);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) || defined(CONFIG_COMPAT_SCSI_TARGET_UNBLOCK)
+               scsi_target_unblock(&shost->shost_gendev,
+                                   SDEV_TRANSPORT_OFFLINE);
++#else
++              scsi_target_unblock(&shost->shost_gendev);
++#endif
+               __srp_start_tl_fail_timers(rport);
+       } else if (rport->state != SRP_RPORT_BLOCKED) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) || defined(CONFIG_COMPAT_SCSI_TARGET_UNBLOCK)
+               scsi_target_unblock(&shost->shost_gendev,
+                                   SDEV_TRANSPORT_OFFLINE);
++#else
++              scsi_target_unblock(&shost->shost_gendev);
++#endif
+       }
+       mutex_unlock(&rport->mutex);
+@@ -606,7 +641,11 @@ enum blk_eh_timer_return srp_timed_out(struct scsi_cmnd *scmd)
+       return rport && rport->fast_io_fail_tmo < 0 &&
+               rport->dev_loss_tmo < 0 &&
+               i->f->reset_timer_if_blocked && scsi_device_blocked(sdev) ?
++#ifdef HAVE_BLK_EH_DONE
+               BLK_EH_RESET_TIMER : BLK_EH_DONE;
++#else
++              BLK_EH_RESET_TIMER : BLK_EH_NOT_HANDLED;
++#endif
+ }
+ EXPORT_SYMBOL(srp_timed_out);
index f72fcb3..29b4861 100644 (file)
@@ -6,7 +6,8 @@ Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
  drivers/net/ethernet/mellanox/mlxfw/mlxfw.h   |  5 ++
  .../net/ethernet/mellanox/mlxfw/mlxfw_fsm.c   | 62 +++++++++++++++++++
  .../net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c  |  3 +
- 3 files changed, 70 insertions(+)
+ .../mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c     |  3 +
+ 4 files changed, 73 insertions(+)
 
 diff --git a/drivers/net/ethernet/mellanox/mlxfw/mlxfw.h b/drivers/net/ethernet/mellanox/mlxfw/mlxfw.h
 index xxxxxxx..xxxxxxx 100644
@@ -248,3 +249,17 @@ index xxxxxxx..xxxxxxx 100644
  #define pr_fmt(fmt) "mlxfw_mfa2: " fmt
  
  #include <linux/kernel.h>
+diff --git a/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c b/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c
+index xxxxxxx..xxxxxxx 100644
+--- a/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c
++++ b/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c
+@@ -1,6 +1,9 @@
+ // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
+ /* Copyright (c) 2017-2019 Mellanox Technologies. All rights reserved */
++#ifdef pr_fmt
++#undef pr_fmt
++#endif
+ #define pr_fmt(fmt) "MFA2: " fmt
+ #include "mlxfw_mfa2_tlv_multi.h"