aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Pedersen <c_tpeder@qca.qualcomm.com>2012-06-21 15:50:08 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2012-10-24 04:49:31 -0400
commit85b20fc2420c4d20729f3bbdbfe5962dcc58c3b0 (patch)
tree0bdc0b3837b710af6d895c6a06007e9a06a47bb5
parent9b34f40c20111ba658f88e1669598db494be1fbc (diff)
ath6kl: support rssi threshold for sched scan
The ath6kl firmware can filter scan results based on rssi. This is useful to limit hosts wakeups on scheduled scans. Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c19
-rw-r--r--drivers/net/wireless/ath/ath6kl/core.h3
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.c18
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.h10
4 files changed, 49 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 277089963eb4..a5f3d6e54708 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -3211,7 +3211,7 @@ static int ath6kl_cfg80211_sscan_start(struct wiphy *wiphy,
3211 struct ath6kl *ar = ath6kl_priv(dev); 3211 struct ath6kl *ar = ath6kl_priv(dev);
3212 struct ath6kl_vif *vif = netdev_priv(dev); 3212 struct ath6kl_vif *vif = netdev_priv(dev);
3213 u16 interval; 3213 u16 interval;
3214 int ret; 3214 int ret, rssi_thold;
3215 3215
3216 if (ar->state != ATH6KL_STATE_ON) 3216 if (ar->state != ATH6KL_STATE_ON)
3217 return -EIO; 3217 return -EIO;
@@ -3244,6 +3244,23 @@ static int ath6kl_cfg80211_sscan_start(struct wiphy *wiphy,
3244 return ret; 3244 return ret;
3245 } 3245 }
3246 3246
3247 if (test_bit(ATH6KL_FW_CAPABILITY_RSSI_SCAN_THOLD,
3248 ar->fw_capabilities)) {
3249 if (request->rssi_thold <= NL80211_SCAN_RSSI_THOLD_OFF)
3250 rssi_thold = 0;
3251 else if (request->rssi_thold < -127)
3252 rssi_thold = -127;
3253 else
3254 rssi_thold = request->rssi_thold;
3255
3256 ret = ath6kl_wmi_set_rssi_filter_cmd(ar->wmi, vif->fw_vif_idx,
3257 rssi_thold);
3258 if (ret) {
3259 ath6kl_err("failed to set RSSI threshold for scan\n");
3260 return ret;
3261 }
3262 }
3263
3247 /* fw uses seconds, also make sure that it's >0 */ 3264 /* fw uses seconds, also make sure that it's >0 */
3248 interval = max_t(u16, 1, request->interval / 1000); 3265 interval = max_t(u16, 1, request->interval / 1000);
3249 3266
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h
index cec49a31029a..a6f0d2c40d2e 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -115,6 +115,9 @@ enum ath6kl_fw_capability {
115 */ 115 */
116 ATH6KL_FW_CAPABILITY_SCHED_SCAN_MATCH_LIST, 116 ATH6KL_FW_CAPABILITY_SCHED_SCAN_MATCH_LIST,
117 117
118 /* Firmware supports filtering BSS results by RSSI */
119 ATH6KL_FW_CAPABILITY_RSSI_SCAN_THOLD,
120
118 /* this needs to be last */ 121 /* this needs to be last */
119 ATH6KL_FW_CAPABILITY_MAX, 122 ATH6KL_FW_CAPABILITY_MAX,
120}; 123};
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index c30ab4b11d61..9673f2778176 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -1531,6 +1531,24 @@ static int ath6kl_wmi_cac_event_rx(struct wmi *wmi, u8 *datap, int len,
1531 return 0; 1531 return 0;
1532} 1532}
1533 1533
1534int ath6kl_wmi_set_rssi_filter_cmd(struct wmi *wmi, u8 if_idx, s8 rssi)
1535{
1536 struct sk_buff *skb;
1537 struct wmi_set_rssi_filter_cmd *cmd;
1538 int ret;
1539
1540 skb = ath6kl_wmi_get_new_buf(sizeof(*cmd));
1541 if (!skb)
1542 return -ENOMEM;
1543
1544 cmd = (struct wmi_set_rssi_filter_cmd *) skb->data;
1545 cmd->rssi = rssi;
1546
1547 ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_RSSI_FILTER_CMDID,
1548 NO_SYNC_WMIFLAG);
1549 return ret;
1550}
1551
1534static int ath6kl_wmi_send_snr_threshold_params(struct wmi *wmi, 1552static int ath6kl_wmi_send_snr_threshold_params(struct wmi *wmi,
1535 struct wmi_snr_threshold_params_cmd *snr_cmd) 1553 struct wmi_snr_threshold_params_cmd *snr_cmd)
1536{ 1554{
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.h b/drivers/net/wireless/ath/ath6kl/wmi.h
index 43339aca585d..b5deaffb79e4 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.h
+++ b/drivers/net/wireless/ath/ath6kl/wmi.h
@@ -628,6 +628,10 @@ enum wmi_cmd_id {
628 WMI_SET_MCASTRATE, 628 WMI_SET_MCASTRATE,
629 629
630 WMI_STA_BMISS_ENHANCE_CMDID, 630 WMI_STA_BMISS_ENHANCE_CMDID,
631
632 WMI_SET_REGDOMAIN_CMDID,
633
634 WMI_SET_RSSI_FILTER_CMDID,
631}; 635};
632 636
633enum wmi_mgmt_frame_type { 637enum wmi_mgmt_frame_type {
@@ -1276,6 +1280,11 @@ struct wmi_snr_threshold_params_cmd {
1276 u8 reserved[3]; 1280 u8 reserved[3];
1277} __packed; 1281} __packed;
1278 1282
1283/* Don't report BSSs with signal (RSSI) below this threshold */
1284struct wmi_set_rssi_filter_cmd {
1285 s8 rssi;
1286} __packed;
1287
1279enum wmi_preamble_policy { 1288enum wmi_preamble_policy {
1280 WMI_IGNORE_BARKER_IN_ERP = 0, 1289 WMI_IGNORE_BARKER_IN_ERP = 0,
1281 WMI_FOLLOW_BARKER_IN_ERP, 1290 WMI_FOLLOW_BARKER_IN_ERP,
@@ -2592,6 +2601,7 @@ int ath6kl_wmi_add_wow_pattern_cmd(struct wmi *wmi, u8 if_idx,
2592 const u8 *mask); 2601 const u8 *mask);
2593int ath6kl_wmi_del_wow_pattern_cmd(struct wmi *wmi, u8 if_idx, 2602int ath6kl_wmi_del_wow_pattern_cmd(struct wmi *wmi, u8 if_idx,
2594 u16 list_id, u16 filter_id); 2603 u16 list_id, u16 filter_id);
2604int ath6kl_wmi_set_rssi_filter_cmd(struct wmi *wmi, u8 if_idx, s8 rssi);
2595int ath6kl_wmi_set_roam_lrssi_cmd(struct wmi *wmi, u8 lrssi); 2605int ath6kl_wmi_set_roam_lrssi_cmd(struct wmi *wmi, u8 lrssi);
2596int ath6kl_wmi_ap_set_dtim_cmd(struct wmi *wmi, u8 if_idx, u32 dtim_period); 2606int ath6kl_wmi_ap_set_dtim_cmd(struct wmi *wmi, u8 if_idx, u32 dtim_period);
2597int ath6kl_wmi_force_roam_cmd(struct wmi *wmi, const u8 *bssid); 2607int ath6kl_wmi_force_roam_cmd(struct wmi *wmi, const u8 *bssid);