Add QCA vendor interface to fetch thermal statistics from the driver

Enhance QCA_NL80211_VENDOR_SUBCMD_THERMAL_CMD to fetch thermal
statistics for different temperature levels from the driver to
userspace. The statistics will be stored in the driver/firmware for
predefined temperature levels and will be reported to userspace when
QCA_NL80211_VENDOR_SUBCMD_THERMAL_CMD is sent with the command type
QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_GET_THERMAL_STATS.

The thermal statistics can be cleared from userspace by sending a
QCA_NL80211_VENDOR_SUBCMD_THERMAL_CMD command with the type
QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_CLEAR_THERMAL_STATS.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Aleti Nageshwar Reddy 2021-07-28 13:28:53 +05:30 committed by Jouni Malinen
parent 24774dcc2e
commit 51f89565fc

View file

@ -7308,6 +7308,15 @@ enum qca_wlan_vendor_attr_thermal_cmd {
* there is any critical ongoing operation. * there is any critical ongoing operation.
*/ */
QCA_WLAN_VENDOR_ATTR_THERMAL_COMPLETION_WINDOW = 3, QCA_WLAN_VENDOR_ATTR_THERMAL_COMPLETION_WINDOW = 3,
/* Nested attribute, the driver/firmware uses this attribute to report
* thermal statistics of different thermal levels to userspace when
* requested using the
* QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_GET_THERMAL_STATS command
* type. This attribute contains a nested array of records of thermal
* statistics of multiple levels. The attributes used inside this nested
* attribute are defined in enum qca_wlan_vendor_attr_thermal_stats.
*/
QCA_WLAN_VENDOR_ATTR_THERMAL_STATS = 4,
/* keep last */ /* keep last */
QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_AFTER_LAST, QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_AFTER_LAST,
@ -7336,6 +7345,13 @@ enum qca_wlan_vendor_attr_thermal_cmd {
* @QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_GET_LEVEL: Request to get the current * @QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_GET_LEVEL: Request to get the current
* thermal level from the driver/firmware. The driver should respond with a * thermal level from the driver/firmware. The driver should respond with a
* thermal level defined in enum qca_wlan_vendor_thermal_level. * thermal level defined in enum qca_wlan_vendor_thermal_level.
* @QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_GET_THERMAL_STATS: Request to get the
* current thermal statistics from the driver/firmware. The driver should
* respond with statistics of all thermal levels encapsulated in the attribute
* QCA_WLAN_VENDOR_ATTR_THERMAL_STATS.
* @QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_CLEAR_THERMAL_STATS: Request to clear
* the current thermal statistics for all thermal levels maintained in the
* driver/firmware and start counting from zero again.
*/ */
enum qca_wlan_vendor_attr_thermal_cmd_type { enum qca_wlan_vendor_attr_thermal_cmd_type {
QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_GET_PARAMS, QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_GET_PARAMS,
@ -7344,6 +7360,8 @@ enum qca_wlan_vendor_attr_thermal_cmd_type {
QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_RESUME, QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_RESUME,
QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_SET_LEVEL, QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_SET_LEVEL,
QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_GET_LEVEL, QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_GET_LEVEL,
QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_GET_THERMAL_STATS,
QCA_WLAN_VENDOR_ATTR_THERMAL_CMD_TYPE_CLEAR_THERMAL_STATS,
}; };
/** /**
@ -7438,6 +7456,35 @@ enum qca_wlan_vendor_attr_thermal_event {
QCA_WLAN_VENDOR_ATTR_THERMAL_EVENT_AFTER_LAST - 1, QCA_WLAN_VENDOR_ATTR_THERMAL_EVENT_AFTER_LAST - 1,
}; };
/**
* enum qca_wlan_vendor_attr_thermal_stats - vendor subcmd attributes
* to get thermal status from the driver/firmware.
* enum values are used for NL attributes encapsulated inside the
* QCA_WLAN_VENDOR_ATTR_THERMAL_STATS nested attribute.
*
* QCA_WLAN_VENDOR_ATTR_THERMAL_STATS_MIN_TEMPERATURE: Minimum temperature
* of a thermal level in Celsius. u32 size.
* QCA_WLAN_VENDOR_ATTR_THERMAL_STATS_MAX_TEMPERATURE: Maximum temperature
* of a thermal level in Celsius. u32 size.
* QCA_WLAN_VENDOR_ATTR_THERMAL_STATS_DWELL_TIME: The total time spent on each
* thermal level in milliseconds. u32 size.
* QCA_WLAN_VENDOR_ATTR_THERMAL_STATS_TEMP_LEVEL_COUNTER: Indicates the number
* of times the temperature crossed into the temperature range defined by the
* thermal level from both higher and lower directions. u32 size.
*/
enum qca_wlan_vendor_attr_thermal_stats {
QCA_WLAN_VENDOR_ATTR_THERMAL_STATS_INVALID = 0,
QCA_WLAN_VENDOR_ATTR_THERMAL_STATS_MIN_TEMPERATURE,
QCA_WLAN_VENDOR_ATTR_THERMAL_STATS_MAX_TEMPERATURE,
QCA_WLAN_VENDOR_ATTR_THERMAL_STATS_DWELL_TIME,
QCA_WLAN_VENDOR_ATTR_THERMAL_STATS_TEMP_LEVEL_COUNTER,
/* keep last */
QCA_WLAN_VENDOR_ATTR_THERMAL_STATS_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_THERMAL_STATS_MAX =
QCA_WLAN_VENDOR_ATTR_THERMAL_STATS_AFTER_LAST - 1,
};
/** /**
* enum he_fragmentation_val - HE fragmentation support values * enum he_fragmentation_val - HE fragmentation support values
* Indicates level of dynamic fragmentation that is supported by * Indicates level of dynamic fragmentation that is supported by