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.
Showing the changes to include/linux (1 of 4 files). Show all
Unified · Split
| @@ -30,6 +30,17 @@ struct device; · 29 unmodified lines | |||
| 30 | /* Structure for the low-level drivers. */ | 30 | /* Structure for the low-level drivers. */ |
| 31 | struct ipmi_smi; | 31 | struct ipmi_smi; |
| 32 | 32 | ||
| 33 | /* | ||
| 34 | * Flags for set_check_watch() below. Tells if the SMI should be | ||
| 35 | * waiting for watchdog timeouts, commands and/or messages. There is | ||
| 36 | * also an internal flag for the message handler, SMIs should ignore | ||
| 37 | * it. | ||
| 38 | */ | ||
| 39 | #define IPMI_WATCH_MASK_INTERNAL (1 << 0) | ||
| 40 | #define IPMI_WATCH_MASK_CHECK_MESSAGES (1 << 1) | ||
| 41 | #define IPMI_WATCH_MASK_CHECK_WATCHDOG (1 << 2) | ||
| 42 | #define IPMI_WATCH_MASK_CHECK_COMMANDS (1 << 3) | ||
| 43 | |||
| 33 | /* | 44 | /* |
| 34 | * Messages to/from the lower layer. The smi interface will take one | 45 | * Messages to/from the lower layer. The smi interface will take one |
| 35 | * of these to send. After the send has occurred and a response has | 46 | * of these to send. After the send has occurred and a response has |
| @@ -55,8 +66,16 @@ struct ipmi_smi_msg { · 19 unmodified lines | |||
| 55 | int rsp_size; | 66 | int rsp_size; |
| 56 | unsigned char rsp[IPMI_MAX_MSG_LENGTH]; | 67 | unsigned char rsp[IPMI_MAX_MSG_LENGTH]; |
| 57 | 68 | ||
| 58 | /* Will be called when the system is done with the message | 69 | /* |
| 59 | (presumably to free it). */ | 70 | * There should be a response message coming back in the BMC |
| 71 | * message queue. | ||
| 72 | */ | ||
| 73 | bool needs_response; | ||
| 74 | |||
| 75 | /* | ||
| 76 | * Will be called when the system is done with the message | ||
| 77 | * (presumably to free it). | ||
| 78 | */ | ||
| 60 | void (*done)(struct ipmi_smi_msg *msg); | 79 | void (*done)(struct ipmi_smi_msg *msg); |
| 61 | }; | 80 | }; |
| 62 | 81 | ||
| @@ -105,12 +124,15 @@ struct ipmi_smi_handlers { · 42 unmodified lines | |||
| 105 | 124 | ||
| 106 | /* | 125 | /* |
| 107 | * Called by the upper layer when some user requires that the | 126 | * Called by the upper layer when some user requires that the |
| 108 | * interface watch for events, received messages, watchdog | 127 | * interface watch for received messages and watchdog |
| 109 | * pretimeouts, or not. Used by the SMI to know if it should | 128 | * pretimeouts (basically do a "Get Flags", or not. Used by |
| 110 | * watch for these. This may be NULL if the SMI does not | 129 | * the SMI to know if it should watch for these. This may be |
| 111 | * implement it. | 130 | * NULL if the SMI does not implement it. watch_mask is from |
| 131 | * IPMI_WATCH_MASK_xxx above. The interface should run slower | ||
| 132 | * timeouts for just watchdog checking or faster timeouts when | ||
| 133 | * waiting for the message queue. | ||
| 112 | */ | 134 | */ |
| 113 | void (*set_need_watch)(void *send_info, bool enable); | 135 | void (*set_need_watch)(void *send_info, unsigned int watch_mask); |
| 114 | 136 | ||
| 115 | /* | 137 | /* |
| 116 | * Called when flushing all pending messages. | 138 | * Called when flushing all pending messages. |