summaryrefslogtreecommitdiff
path: root/sbin/ifconfig/sff.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2019-08-27 23:24:36 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2019-08-27 23:24:36 +0000
commitbd7e1f090a77154f91efa6fda34b1ede0f7713bd (patch)
tree696edbfee4ee48f923eedc191e540a9982ebc726 /sbin/ifconfig/sff.c
parent8412df1fc011769a1f834367137ec64c93ee0e5a (diff)
print more qsfp temperature information
this shows the maximum case temperature reported by the chip, and the low and high alarm ranges for temp and vcc when page 3 is available and working. this will hopefully give deraadt@ a better idea about how much headroom one of his 100g optics has.
Diffstat (limited to 'sbin/ifconfig/sff.c')
-rw-r--r--sbin/ifconfig/sff.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/sbin/ifconfig/sff.c b/sbin/ifconfig/sff.c
index b536e0653d7..896d634bc02 100644
--- a/sbin/ifconfig/sff.c
+++ b/sbin/ifconfig/sff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sff.c,v 1.14 2019/08/27 11:54:42 dlg Exp $ */
+/* $OpenBSD: sff.c,v 1.15 2019/08/27 23:24:35 dlg Exp $ */
/*
* Copyright (c) 2019 David Gwynne <dlg@openbsd.org>
@@ -257,6 +257,13 @@ static const char *sff8024_con_names[] = {
#define SFF8436_TX_POWER_BASE 50
#define SFF8436_TX_POWER(_i) (SFF8436_TX_POWER_BASE + ((_i) * 2))
+/* Upper Page 00h */
+
+#define SFF8436_MAXCASETEMP 190 /* C */
+#define SFF8436_MAXCASETEMP_DEFAULT 70 /* if SFF8436_MAXCASETEMP is 0 */
+
+/* Upper page 03h */
+
#define SFF8436_AW_TEMP 128
#define SFF8436_AW_VCC 144
#define SFF8436_AW_RX_POWER 176
@@ -693,7 +700,7 @@ if_sff8636_thresh(int s, const char *ifname, int dump,
}
printf("\ttemp: ");
- if_sff_printalarm(" C", 0,
+ if_sff_printalarm(" C", 1,
if_sff_int(&pg3, SFF8436_TEMP) / SFF_TEMP_FACTOR,
temp.thresholds[SFF_THRESH_HI_ALARM],
temp.thresholds[SFF_THRESH_LO_ALARM],
@@ -702,7 +709,7 @@ if_sff8636_thresh(int s, const char *ifname, int dump,
printf("\n");
printf("\tvoltage: ");
- if_sff_printalarm(" V", 0,
+ if_sff_printalarm(" V", 1,
if_sff_uint(&pg3, SFF8436_VCC) / SFF_VCC_FACTOR,
vcc.thresholds[SFF_THRESH_HI_ALARM],
vcc.thresholds[SFF_THRESH_LO_ALARM],
@@ -748,6 +755,7 @@ static int
if_sff8636(int s, const char *ifname, int dump, const struct if_sffpage *pg0)
{
int16_t temp;
+ uint8_t maxcasetemp;
uint8_t flat;
unsigned int i;
@@ -758,6 +766,11 @@ if_sff8636(int s, const char *ifname, int dump, const struct if_sffpage *pg0)
return (0);
}
+ maxcasetemp = pg0->sff_data[SFF8436_MAXCASETEMP];
+ if (maxcasetemp == 0x00)
+ maxcasetemp = SFF8436_MAXCASETEMP_DEFAULT;
+ printf("\tmax case temp: %u C\n", maxcasetemp);
+
temp = if_sff_int(pg0, SFF8436_TEMP);
/* the temp reading look unset, assume the rest will be unset too */
if ((uint16_t)temp == 0 || (uint16_t)temp == 0xffffU) {