Skip to content

Commit a3fd4bf

Browse files
Benjamin-Blockmartinkpetersen
authored andcommitted
scsi: zfcp: fix wrong data and display format of SFP+ temperature
When implementing support for retrieval of local diagnostic data from the FCP channel, the wrong data format was assumed for the temperature of the local SFP+ connector. The Fibre Channel Link Services (FC-LS-3) specification is not clear on the format of the stored integer, and only after consulting the SNIA specification SFF-8472 did we realize it is stored as two's complement. Thus, the used data and display format is wrong, and highly misleading for users when the temperature should drop below 0°C (however unlikely that may be). To fix this, change the data format in `struct fsf_qtcb_bottom_port` from unsigned to signed, and change the printf format string used to generate `zfcp_sysfs_adapter_diag_sfp_temperature_show()` from `%hu` to `%hd`. Link: https://lore.kernel.org/r/d6e3be5428da5c9490cfff4df7cae868bc9f1a7e.1582039501.git.bblock@linux.ibm.com Fixes: a10a61e ("scsi: zfcp: support retrieval of SFP Data via Exchange Port Data") Fixes: 6028f7c ("scsi: zfcp: introduce sysfs interface for diagnostics of local SFP transceiver") Cc: <[email protected]> # 5.5+ Reviewed-by: Jens Remus <[email protected]> Reviewed-by: Fedor Loshakov <[email protected]> Reviewed-by: Steffen Maier <[email protected]> Signed-off-by: Benjamin Block <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 51fdaa0 commit a3fd4bf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/s390/scsi/zfcp_fsf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ struct fsf_qtcb_bottom_port {
410410
u8 cb_util;
411411
u8 a_util;
412412
u8 res2;
413-
u16 temperature;
413+
s16 temperature;
414414
u16 vcc;
415415
u16 tx_bias;
416416
u16 tx_power;

drivers/s390/scsi/zfcp_sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ static ZFCP_DEV_ATTR(adapter_diag, b2b_credit, 0400,
800800
static ZFCP_DEV_ATTR(adapter_diag_sfp, _name, 0400, \
801801
zfcp_sysfs_adapter_diag_sfp_##_name##_show, NULL)
802802

803-
ZFCP_DEFINE_DIAG_SFP_ATTR(temperature, temperature, 5, "%hu");
803+
ZFCP_DEFINE_DIAG_SFP_ATTR(temperature, temperature, 6, "%hd");
804804
ZFCP_DEFINE_DIAG_SFP_ATTR(vcc, vcc, 5, "%hu");
805805
ZFCP_DEFINE_DIAG_SFP_ATTR(tx_bias, tx_bias, 5, "%hu");
806806
ZFCP_DEFINE_DIAG_SFP_ATTR(tx_power, tx_power, 5, "%hu");

0 commit comments

Comments
 (0)