aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Minyard <cminyard@mvista.com>2018-04-05 13:59:17 -0400
committerCorey Minyard <cminyard@mvista.com>2018-04-18 11:22:43 -0400
commit252e30c1e7d847c09d9480e4b17ba0485059f576 (patch)
treed154f7ffa97ac8668c3dab129600a23147b2e143
parentce7fa1c38d07102d4dc4627f757a3f2467069d86 (diff)
ipmi: Add a maintenance mode for IPMB messages
If you send a command to another BMC that might take some extra time, increase the timeouts temporarily. Signed-off-by: Corey Minyard <cminyard@mvista.com>
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index add8130be517..dcfbf2e3c8c5 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -143,6 +143,12 @@ module_param(default_retry_ms, ulong, 0644);
143MODULE_PARM_DESC(default_retry_ms, 143MODULE_PARM_DESC(default_retry_ms,
144 "The time (milliseconds) between retry sends"); 144 "The time (milliseconds) between retry sends");
145 145
146/* The default timeout for maintenance mode message retries. */
147static unsigned long default_maintenance_retry_ms = 3000;
148module_param(default_maintenance_retry_ms, ulong, 0644);
149MODULE_PARM_DESC(default_maintenance_retry_ms,
150 "The time (milliseconds) between retry sends in maintenance mode");
151
146/* The default maximum number of retries */ 152/* The default maximum number of retries */
147static unsigned int default_max_retries = 4; 153static unsigned int default_max_retries = 4;
148module_param(default_max_retries, uint, 0644); 154module_param(default_max_retries, uint, 0644);
@@ -525,6 +531,13 @@ struct ipmi_smi {
525 spinlock_t maintenance_mode_lock; /* Used in a timer... */ 531 spinlock_t maintenance_mode_lock; /* Used in a timer... */
526 532
527 /* 533 /*
534 * If we are doing maintenance on something on IPMB, extend
535 * the timeout time to avoid timeouts writing firmware and
536 * such.
537 */
538 int ipmb_maintenance_mode_timeout;
539
540 /*
528 * A cheap hack, if this is non-null and a message to an 541 * A cheap hack, if this is non-null and a message to an
529 * interface comes in with a NULL user, call this routine with 542 * interface comes in with a NULL user, call this routine with
530 * it. Note that the message will still be freed by the 543 * it. Note that the message will still be freed by the
@@ -1861,6 +1874,15 @@ static int i_ipmi_request(ipmi_user_t user,
1861 1874
1862 spin_lock_irqsave(&(intf->seq_lock), flags); 1875 spin_lock_irqsave(&(intf->seq_lock), flags);
1863 1876
1877 if (is_maintenance_mode_cmd(msg))
1878 intf->ipmb_maintenance_mode_timeout =
1879 maintenance_mode_timeout_ms;
1880
1881 if (intf->ipmb_maintenance_mode_timeout &&
1882 retry_time_ms == 0)
1883 /* Different default in maintenance mode */
1884 retry_time_ms = default_maintenance_retry_ms;
1885
1864 /* 1886 /*
1865 * Create a sequence number with a 1 second 1887 * Create a sequence number with a 1 second
1866 * timeout and 4 retries. 1888 * timeout and 4 retries.
@@ -4710,6 +4732,12 @@ static unsigned int ipmi_timeout_handler(ipmi_smi_t intf,
4710 */ 4732 */
4711 INIT_LIST_HEAD(&timeouts); 4733 INIT_LIST_HEAD(&timeouts);
4712 spin_lock_irqsave(&intf->seq_lock, flags); 4734 spin_lock_irqsave(&intf->seq_lock, flags);
4735 if (intf->ipmb_maintenance_mode_timeout) {
4736 if (intf->ipmb_maintenance_mode_timeout <= timeout_period)
4737 intf->ipmb_maintenance_mode_timeout = 0;
4738 else
4739 intf->ipmb_maintenance_mode_timeout -= timeout_period;
4740 }
4713 for (i = 0; i < IPMI_IPMB_NUM_SEQ; i++) 4741 for (i = 0; i < IPMI_IPMB_NUM_SEQ; i++)
4714 check_msg_timeout(intf, &(intf->seq_table[i]), 4742 check_msg_timeout(intf, &(intf->seq_table[i]),
4715 &timeouts, timeout_period, i, 4743 &timeouts, timeout_period, i,