All of lore.kernel.org
 help / color / mirror / Atom feed
* [ndctl PATCH 1/2] ndctl, list: Add controller temperature
@ 2018-06-15  0:27 Dan Williams
  2018-06-15  0:27 ` [ndctl PATCH 2/2] ndctl, test: Update libndctl test for controller temperature valid Dan Williams
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Williams @ 2018-06-15  0:27 UTC (permalink / raw)
  To: linux-nvdimm

Emit the controller temperature if the smart payload includes this
field.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 ndctl/util/json-smart.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ndctl/util/json-smart.c b/ndctl/util/json-smart.c
index 4020423bb8c8..9482b35a43d6 100644
--- a/ndctl/util/json-smart.c
+++ b/ndctl/util/json-smart.c
@@ -109,6 +109,16 @@ struct json_object *util_dimm_health_to_json(struct ndctl_dimm *dimm)
 			json_object_object_add(jhealth, "temperature_celsius", jobj);
 	}
 
+	if (flags & ND_SMART_CTEMP_VALID) {
+		unsigned int temp = ndctl_cmd_smart_get_ctrl_temperature(cmd);
+		double t = ndctl_decode_smart_temperature(temp);
+
+		jobj = json_object_new_double(t);
+		if (jobj)
+			json_object_object_add(jhealth,
+					"controller_temperature_celsius", jobj);
+	}
+
 	if (flags & ND_SMART_SPARES_VALID) {
 		unsigned int spares = ndctl_cmd_smart_get_spares(cmd);
 

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [ndctl PATCH 2/2] ndctl, test: Update libndctl test for controller temperature valid
  2018-06-15  0:27 [ndctl PATCH 1/2] ndctl, list: Add controller temperature Dan Williams
@ 2018-06-15  0:27 ` Dan Williams
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2018-06-15  0:27 UTC (permalink / raw)
  To: linux-nvdimm

nfit_test is growing support for emitting the controller temperature.
Permit use of the flag, i.e. do not fail upon seeing 'CTEMP_VALID'.

Rather than add a kernel version gate, just be tolerant of any value of
the flag.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/libndctl.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/test/libndctl.c b/test/libndctl.c
index 8098c1c45051..edff0af33c7d 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -2177,8 +2177,8 @@ static int check_set_config_data(struct ndctl_bus *bus, struct ndctl_dimm *dimm,
 	return 0;
 }
 
-#define __check_smart(dimm, cmd, field) ({ \
-	if (ndctl_cmd_smart_get_##field(cmd) != smart_data.field) { \
+#define __check_smart(dimm, cmd, field, mask) ({ \
+	if ((ndctl_cmd_smart_get_##field(cmd) & mask) != smart_data.field) { \
 		fprintf(stderr, "%s dimm: %#x expected \'" #field \
 				"\' %#x got: %#x\n", __func__, \
 				ndctl_dimm_get_handle(dimm), \
@@ -2230,14 +2230,14 @@ static int check_smart(struct ndctl_bus *bus, struct ndctl_dimm *dimm,
 		return rc;
 	}
 
-	__check_smart(dimm, cmd, flags);
-	__check_smart(dimm, cmd, health);
-	__check_smart(dimm, cmd, temperature);
-	__check_smart(dimm, cmd, spares);
-	__check_smart(dimm, cmd, alarm_flags);
-	__check_smart(dimm, cmd, life_used);
-	__check_smart(dimm, cmd, shutdown_state);
-	__check_smart(dimm, cmd, vendor_size);
+	__check_smart(dimm, cmd, flags, ~ND_SMART_CTEMP_VALID);
+	__check_smart(dimm, cmd, health, -1);
+	__check_smart(dimm, cmd, temperature, -1);
+	__check_smart(dimm, cmd, spares, -1);
+	__check_smart(dimm, cmd, alarm_flags, -1);
+	__check_smart(dimm, cmd, life_used, -1);
+	__check_smart(dimm, cmd, shutdown_state, -1);
+	__check_smart(dimm, cmd, vendor_size, -1);
 
 	check->cmd = cmd;
 	return 0;

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-15  0:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-15  0:27 [ndctl PATCH 1/2] ndctl, list: Add controller temperature Dan Williams
2018-06-15  0:27 ` [ndctl PATCH 2/2] ndctl, test: Update libndctl test for controller temperature valid Dan Williams

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.