Add new field in show-details to report Sync Write Cache support for a
given IOA.  This will only be displayed when passing an IOA to command
'show-details'.

This field tells if the adapter has support to sync cache
enabled/implemented.  It does not mean that sync cache is enabled
for a specific device.  It has three states: Unsupported - in
case adapter doesn't support it; Enabled - if Sync Cache is
supported and is globally enabled for this adapter; Disabled - in case
it is supported but was disabled for the whole adapter.

The information is recovered from the device using the Query Cache
Parameters command.  It can return a new value now, indicating if Volume
Set Caching Mode Page is enabled.

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

diff --git a/iprconfig.c b/iprconfig.c
index 2ee1e5a..2addf16 100644
--- a/iprconfig.c
+++ b/iprconfig.c
@@ -2046,8 +2046,10 @@ static char *ioa_details(char *body, struct ipr_dev *dev)
        struct ipr_inquiry_page0 page0_inq;
        struct scsi_dev_data *scsi_dev_data = dev->scsi_dev_data;
        struct ipr_dual_ioa_entry *ioa_entry;
+       struct ipr_reclaim_query_data reclaim_data;
        int rc, i;
        char buffer[200];
+       char *dynbuf;
        int cache_size, dram_size;
        u32 fw_level;
 
@@ -2055,6 +2057,7 @@ static char *ioa_details(char *body, struct ipr_dev *dev)
        memset(&cfc_vpd, 0, sizeof(cfc_vpd));
        memset(&cc_vpd, 0, sizeof(cc_vpd));
        memset(&dram_vpd, 0, sizeof(dram_vpd));
+       memset(&reclaim_data, 0, sizeof(reclaim_data));
 
        ipr_inquiry(dev, IPR_STD_INQUIRY, &ioa_vpd, sizeof(ioa_vpd));
 
@@ -2166,6 +2169,22 @@ static char *ioa_details(char *body, struct ipr_dev *dev)
                        body = add_line_to_body(body,_("Current Requested 
Caching Mode"), _("Default"));
        }
 
+       if (dev->ioa->has_cache) {
+               if (dev->ioa->vset_write_cache) {
+                       dynbuf = "Synchronize Cache";
+               } else {
+                       if (ipr_reclaim_cache_store(dev->ioa,
+                                                   IPR_RECLAIM_QUERY,
+                                                   &reclaim_data))
+                               goto out;
+
+                       dynbuf = (reclaim_data.rechargeable_battery_type ?
+                                 "Battery Backed" : "Supercap Protected");
+               }
+               body = add_line_to_body(body, _("Cache Protection"), dynbuf);
+       }
+
+       out:
        return body;
 }
 
diff --git a/iprlib.c b/iprlib.c
index a31a60d..b03c995 100644
--- a/iprlib.c
+++ b/iprlib.c
@@ -6384,6 +6384,10 @@ void check_current_config(bool allow_rebuild_refresh)
                get_dual_ioa_state(ioa);
                get_subsys_config(ioa);
 
+               if (ioa->has_vset_write_cache == 1 &&
+                   get_ioa_caching(ioa) == IPR_IOA_VSET_CACHE_ENABLED)
+                       ioa->vset_write_cache = 1;
+
                /* Get Query Array Config Data */
                rc = ipr_query_array_config(ioa, allow_rebuild_refresh, 0, 0, 
0, qac_data);
 
@@ -7316,7 +7320,9 @@ int get_ioa_caching(struct ipr_ioa *ioa)
                                return IPR_IOA_CACHING_DISABLED_DUAL_ENABLED;
                        else
                                return IPR_IOA_CACHING_DEFAULT_DUAL_ENABLED;
-               else 
+               else if (term->vset_write_cache_enabled)
+                       return IPR_IOA_VSET_CACHE_ENABLED;
+               else
                        if (term->disable_caching_requested == 
IPR_IOA_REQUESTED_CACHING_DISABLED)
                                return IPR_IOA_REQUESTED_CACHING_DISABLED;
                        else
diff --git a/iprlib.h b/iprlib.h
index 279c1df..736d9d6 100644
--- a/iprlib.h
+++ b/iprlib.h
@@ -216,6 +216,8 @@ typedef uint64_t u64;
 #define IPR_IOA_CACHING_DEFAULT_DUAL_ENABLED   0x2
 #define IPR_IOA_CACHING_DISABLED_DUAL_ENABLED  0x3
 
+#define IPR_IOA_VSET_CACHE_ENABLED             0x4
+
 #define IPR_IOA_SET_CACHING_DEFAULT          0x0
 #define IPR_IOA_SET_CACHING_DISABLED         0x10
 #define IPR_IOA_SET_CACHING_DUAL_DISABLED    0x20
@@ -1481,6 +1483,7 @@ struct ipr_ioa {
        u8 disable_rebuild_verify:1;
        u8 configure_rebuild_verify:1;
        u8 has_vset_write_cache:1;
+       u8 vset_write_cache:1;
 
 #define IPR_SIS32              0x00
 #define IPR_SIS64              0x01
@@ -2193,13 +2196,17 @@ struct ipr_global_cache_params_term {
 #if defined (__BIG_ENDIAN_BITFIELD)
        u8 enable_caching_dual_ioa_failure:1;
        u8 disable_caching_requested:1;
-       u8 reserved1:6;
+       u8 reserved1:2;
+       u8 vset_write_cache_enabled:1;
+       u8 reserved2:3;
 #elif defined (__LITTLE_ENDIAN_BITFIELD)
-       u8 reserved1:6;
+       u8 reserved2:3;
+       u8 vset_write_cache_enabled:1;
+       u8 reserved1:2;
        u8 disable_caching_requested:1;
        u8 enable_caching_dual_ioa_failure:1;
 #endif
-       u8 reserved2;
+       u8 reserved3;
 };
 
 struct ipr_query_ioa_caching_info {
-- 
2.1.0


------------------------------------------------------------------------------
_______________________________________________
Iprdd-devel mailing list
Iprdd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iprdd-devel

Reply via email to