When user passed 0x0 to old firmwares, rebuild rate would be set to the
implementation default value, defined by SIS, and any further read to
Mode Page 0x24 would display 0x0 in the Rebuild Rate field.  Newer
firmwares, on the other hand, will correctly set the rebuild rate to the
implementation defined value, but the Mode Page field will display the
configured value, instead of 0x0.  This causes iprutils to believe the
new configuration has failed, and error out.

The Implementation defined value used by every IPR adapter out there is
the minimum rebuild rate possible, 2/16, which translates to 0x2 in the
Mode page field.  This patch gives iprutils the notion of the minimum
rebuild rate, and supports this scenario, so we don't fail when the user
requests a rebuild rate of 0.

To avoid confusing the user, we also make the values go from 10 to 100
instead of 0-100.  If the user wants to enable the default setting,
instead of typing 0, he needs to use 'default'.

Signed-off-by: Gabriel Krisman Bertazi <kris...@linux.vnet.ibm.com>
---
 iprconfig.8 | 2 +-
 iprconfig.c | 5 +++--
 iprlib.c    | 3 ++-
 iprlib.h    | 2 ++
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/iprconfig.8 b/iprconfig.8
index 7ec3b92..82b6467 100644
--- a/iprconfig.8
+++ b/iprconfig.8
@@ -774,7 +774,7 @@ Example:
 .TP
 .B set-array-rebuild-rate [IOA] [Rebuild Rate | default]
 Used to set the rebuilt rate ratio of the IOA. [Rebuild Rate] must be in
-range 0..100. If 'default' is used, the IOA will reset to the
+range 10..100. If 'default' is used, the IOA will reset to the
 implementation default rate.  The value actually configured may not be
 the exact rate configured by the user, but an approximation to the
 closest rate supported by the IOA.
diff --git a/iprconfig.c b/iprconfig.c
index a6b1372..d071b6a 100644
--- a/iprconfig.c
+++ b/iprconfig.c
@@ -18194,10 +18194,11 @@ static int set_array_rebuild_rate(char**args, int 
num_args)
                char *endptr = NULL;
                rebuild_rate = strtol(args[1], &endptr, 10);
                if (endptr == args[1]
-                   || rebuild_rate < 0 || rebuild_rate > 100) {
+                   || rebuild_rate < 10 || rebuild_rate > 100) {
                        scsi_err(dev,
                                 "'%s' is not a valid rebuild rate value.\n"
-                                "Supported values are in the range 0-100.\n"
+                                "Supported values are in the range 10-100.\n"
+                                "Use 'default' to reset the configuration.\n"
                                 "Higher values may affect performance but "
                                 "decrease the total rebuild time.\n", args[1]);
                        return -EINVAL;
diff --git a/iprlib.c b/iprlib.c
index 70e2924..1698a71 100644
--- a/iprlib.c
+++ b/iprlib.c
@@ -5596,7 +5596,8 @@ int ipr_set_array_rebuild_rate(struct ipr_ioa *ioa, u8 
rebuild_rate)
        if (rc)
                return rc;
 
-       if (rebuild_rate != page24->rebuild_rate)
+       if (rebuild_rate != page24->rebuild_rate &&
+           (rebuild_rate || page24->rebuild_rate != MIN_ARRAY_REBUILD_RATE))
                return -EINVAL;
 
        return 0;
diff --git a/iprlib.h b/iprlib.h
index b2a46c9..81d8eef 100644
--- a/iprlib.h
+++ b/iprlib.h
@@ -1748,6 +1748,8 @@ struct ipr_mode_page24 {
        u8 rebuild_without_verify:1;
 #endif
 
+#define MIN_ARRAY_REBUILD_RATE         0x02
+
 #define DISABLE_DUAL_IOA_AF            0x00
 #define ENABLE_DUAL_IOA_AF             0x02
 #define ENABLE_DUAL_IOA_ACTIVE_ACTIVE  0x03
-- 
2.1.0


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
Iprdd-devel mailing list
Iprdd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iprdd-devel

Reply via email to