ipmi: Fix how the lower layers are told to watch for messages

The IPMI driver has a mechanism to tell the lower layers it needs
to watch for messages, commands, and watchdogs (so it doesn't
needlessly poll).  However, it needed some extensions, it needed
a way to tell what is being waited for so it could set the timeout
appropriately.

The update to the lower layer was also being done once a second
at best because it was done in the main timeout handler.  However,
if a command is sent and a response message is coming back,
it needed to be started immediately.  So modify the code to
update immediately if it needs to be enabled.  Disable is still
lazy.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Tested-by: Kamlakant Patel <kamlakant.patel@cavium.com>
This commit is contained in:
Corey Minyard
2018-10-23 11:29:02 -05:00
parent a1466ec5b6
commit c65ea99659
4 changed files with 134 additions and 52 deletions

View File

@@ -30,6 +30,17 @@ struct device;
/* Structure for the low-level drivers. */
struct ipmi_smi;
/*
* Flags for set_check_watch() below. Tells if the SMI should be
* waiting for watchdog timeouts, commands and/or messages. There is
* also an internal flag for the message handler, SMIs should ignore
* it.
*/
#define IPMI_WATCH_MASK_INTERNAL (1 << 0)
#define IPMI_WATCH_MASK_CHECK_MESSAGES (1 << 1)
#define IPMI_WATCH_MASK_CHECK_WATCHDOG (1 << 2)
#define IPMI_WATCH_MASK_CHECK_COMMANDS (1 << 3)
/*
* Messages to/from the lower layer. The smi interface will take one
* of these to send. After the send has occurred and a response has
@@ -55,8 +66,16 @@ struct ipmi_smi_msg {
int rsp_size;
unsigned char rsp[IPMI_MAX_MSG_LENGTH];
/* Will be called when the system is done with the message
(presumably to free it). */
/*
* There should be a response message coming back in the BMC
* message queue.
*/
bool needs_response;
/*
* Will be called when the system is done with the message
* (presumably to free it).
*/
void (*done)(struct ipmi_smi_msg *msg);
};
@@ -105,12 +124,15 @@ struct ipmi_smi_handlers {
/*
* Called by the upper layer when some user requires that the
* interface watch for events, received messages, watchdog
* pretimeouts, or not. Used by the SMI to know if it should
* watch for these. This may be NULL if the SMI does not
* implement it.
* interface watch for received messages and watchdog
* pretimeouts (basically do a "Get Flags", or not. Used by
* the SMI to know if it should watch for these. This may be
* NULL if the SMI does not implement it. watch_mask is from
* IPMI_WATCH_MASK_xxx above. The interface should run slower
* timeouts for just watchdog checking or faster timeouts when
* waiting for the message queue.
*/
void (*set_need_watch)(void *send_info, bool enable);
void (*set_need_watch)(void *send_info, unsigned int watch_mask);
/*
* Called when flushing all pending messages.