Qiwei Cai | e689a26 | 2018-07-26 15:50:22 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
| 19 | #ifndef __WLAN_HDD_RSSI_MONITOR_H |
| 20 | #define __WLAN_HDD_RSSI_MONITOR_H |
| 21 | |
| 22 | /** |
| 23 | * DOC: wlan_hdd_rssi_monitor_h |
| 24 | * |
| 25 | * WLAN Host Device Driver RSSI monitoring API specification |
| 26 | */ |
| 27 | |
| 28 | #ifdef FEATURE_RSSI_MONITOR |
| 29 | /** |
| 30 | * wlan_hdd_cfg80211_monitor_rssi() - SSR wrapper to rssi monitoring |
| 31 | * @wiphy: wiphy structure pointer |
| 32 | * @wdev: Wireless device structure pointer |
| 33 | * @data: Pointer to the data received |
| 34 | * @data_len: Length of @data |
| 35 | * |
| 36 | * Return: 0 on success; errno on failure |
| 37 | */ |
| 38 | int |
| 39 | wlan_hdd_cfg80211_monitor_rssi(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 40 | const void *data, int data_len); |
| 41 | |
| 42 | /** |
| 43 | * hdd_rssi_threshold_breached() - rssi breached NL event |
| 44 | * @hdd_handle: HDD handle |
| 45 | * @data: rssi breached event data |
| 46 | * |
| 47 | * This function reads the rssi breached event %data and fill in the skb with |
| 48 | * NL attributes and send up the NL event. |
| 49 | * |
| 50 | * Return: none |
| 51 | */ |
| 52 | void hdd_rssi_threshold_breached(hdd_handle_t hdd_handle, |
| 53 | struct rssi_breach_event *data); |
| 54 | |
| 55 | #define FEATURE_RSSI_MONITOR_VENDOR_EVENTS \ |
| 56 | [QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI_INDEX] = { \ |
| 57 | .vendor_id = QCA_NL80211_VENDOR_ID, \ |
| 58 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI \ |
| 59 | }, |
| 60 | |
| 61 | #define FEATURE_RSSI_MONITOR_VENDOR_COMMANDS \ |
| 62 | { \ |
| 63 | .info.vendor_id = QCA_NL80211_VENDOR_ID, \ |
| 64 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI, \ |
| 65 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | \ |
| 66 | WIPHY_VENDOR_CMD_NEED_NETDEV | \ |
| 67 | WIPHY_VENDOR_CMD_NEED_RUNNING, \ |
| 68 | .doit = wlan_hdd_cfg80211_monitor_rssi \ |
| 69 | }, |
| 70 | |
| 71 | #else /* FEATURE_RSSI_MONITOR */ |
| 72 | static inline |
| 73 | void hdd_rssi_threshold_breached(hdd_handle_t hdd_handle, |
| 74 | struct rssi_breach_event *data) |
| 75 | { |
| 76 | } |
| 77 | |
| 78 | #define FEATURE_RSSI_MONITOR_VENDOR_EVENTS |
| 79 | #define FEATURE_RSSI_MONITOR_VENDOR_COMMANDS |
| 80 | #endif /* FEATURE_RSSI_MONITOR */ |
| 81 | |
| 82 | #endif /* __WLAN_HDD_RSSI_MONITOR_H */ |
| 83 | |