ipmi(4): Limit maximum watchdog pre-timeout interval.

Previous code by default setting pre-timeout interval to 120 seconds
made impossible to set timeout interval below that, resulting in error
0xcc (Invalid data field in Request) at least on Supermicro boards.

To fix that limit maximum pre-timeout interval to ~1/4 of the timeout
interval, that sounds like a reasonable default: not too short to fire
too late, but also not too long to give many false reports.

MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2021-09-14 21:06:39 -04:00
parent 02d8194012
commit 6c2d440416

View File

@ -668,7 +668,8 @@ ipmi_set_watchdog(struct ipmi_softc *sc, unsigned int sec)
req->ir_request[0] = IPMI_SET_WD_TIMER_DONT_STOP
| IPMI_SET_WD_TIMER_SMS_OS;
req->ir_request[1] = (wd_timer_actions & 0xff);
req->ir_request[2] = (wd_pretimeout_countdown & 0xff);
req->ir_request[2] = min(0xff,
min(wd_pretimeout_countdown, (sec + 2) / 4));
req->ir_request[3] = 0; /* Timer use */
req->ir_request[4] = (sec * 10) & 0xff;
req->ir_request[5] = (sec * 10) >> 8;