aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex
diff options
context:
space:
mode:
authorAvinash Patil <patila@marvell.com>2015-01-28 05:24:22 -0500
committerKalle Valo <kvalo@codeaurora.org>2015-01-29 03:22:05 -0500
commit0a694d68651b16b307d5ad64acac90d604146bcc (patch)
tree26f261a187d6b767af55eb1c0fe4a6abfd9b5302 /drivers/net/wireless/mwifiex
parent85afb18621be393f925ed85f96a80d52e3706578 (diff)
mwifiex: support for channel report for radar detection
This patch adds support for channel report enabling. Channel report event happens if radar is detected on specified channel after driver has issued radar detect command within CAC time. Driver in turn sends RADAR_DETECTED event to cfg80211 to tell radar was detected within CAC time. Signed-off-by: Avinash Patil <patila@marvell.com> Signed-off-by: Qingshui Gao <gaoqs@marvell.com> Signed-off-by: Cathy Luo <cluo@marvell.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r--drivers/net/wireless/mwifiex/11h.c51
-rw-r--r--drivers/net/wireless/mwifiex/fw.h23
-rw-r--r--drivers/net/wireless/mwifiex/main.h2
-rw-r--r--drivers/net/wireless/mwifiex/sta_event.c5
-rw-r--r--drivers/net/wireless/mwifiex/uap_event.c4
5 files changed, 85 insertions, 0 deletions
diff --git a/drivers/net/wireless/mwifiex/11h.c b/drivers/net/wireless/mwifiex/11h.c
index 8832c83816ee..e44cac72712e 100644
--- a/drivers/net/wireless/mwifiex/11h.c
+++ b/drivers/net/wireless/mwifiex/11h.c
@@ -165,3 +165,54 @@ void mwifiex_abort_cac(struct mwifiex_private *priv)
165 NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); 165 NL80211_RADAR_CAC_ABORTED, GFP_KERNEL);
166 } 166 }
167} 167}
168
169/* This function handles channel report event from FW during CAC period.
170 * If radar is detected during CAC, driver indicates the same to cfg80211
171 * and also cancels ongoing delayed work.
172 */
173int mwifiex_11h_handle_chanrpt_ready(struct mwifiex_private *priv,
174 struct sk_buff *skb)
175{
176 struct host_cmd_ds_chan_rpt_event *rpt_event;
177 struct mwifiex_ie_types_chan_rpt_data *rpt;
178 u8 *evt_buf;
179 u16 event_len, tlv_len;
180
181 rpt_event = (void *)(skb->data + sizeof(u32));
182 event_len = skb->len - (sizeof(struct host_cmd_ds_chan_rpt_event)+
183 sizeof(u32));
184
185 if (le32_to_cpu(rpt_event->result) != HostCmd_RESULT_OK) {
186 dev_err(priv->adapter->dev, "Error in channel report event\n");
187 return -1;
188 }
189
190 evt_buf = (void *)&rpt_event->tlvbuf;
191
192 while (event_len >= sizeof(struct mwifiex_ie_types_header)) {
193 rpt = (void *)&rpt_event->tlvbuf;
194 tlv_len = le16_to_cpu(rpt->header.len);
195
196 switch (le16_to_cpu(rpt->header.type)) {
197 case TLV_TYPE_CHANRPT_11H_BASIC:
198 if (rpt->map.radar) {
199 dev_notice(priv->adapter->dev,
200 "RADAR Detected on channel %d!\n",
201 priv->dfs_chandef.chan->hw_value);
202 cancel_delayed_work_sync(&priv->dfs_cac_work);
203 cfg80211_cac_event(priv->netdev,
204 &priv->dfs_chandef,
205 NL80211_RADAR_DETECTED,
206 GFP_KERNEL);
207 }
208 break;
209 default:
210 break;
211 }
212
213 evt_buf += (tlv_len + sizeof(rpt->header));
214 event_len -= (tlv_len + sizeof(rpt->header));
215 }
216
217 return 0;
218}
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h
index 739151c13f15..324ef298bea6 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -158,6 +158,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
158#define TLV_TYPE_POWER_GROUP (PROPRIETARY_TLV_BASE_ID + 84) 158#define TLV_TYPE_POWER_GROUP (PROPRIETARY_TLV_BASE_ID + 84)
159#define TLV_TYPE_BSS_SCAN_RSP (PROPRIETARY_TLV_BASE_ID + 86) 159#define TLV_TYPE_BSS_SCAN_RSP (PROPRIETARY_TLV_BASE_ID + 86)
160#define TLV_TYPE_BSS_SCAN_INFO (PROPRIETARY_TLV_BASE_ID + 87) 160#define TLV_TYPE_BSS_SCAN_INFO (PROPRIETARY_TLV_BASE_ID + 87)
161#define TLV_TYPE_CHANRPT_11H_BASIC (PROPRIETARY_TLV_BASE_ID + 91)
161#define TLV_TYPE_UAP_RETRY_LIMIT (PROPRIETARY_TLV_BASE_ID + 93) 162#define TLV_TYPE_UAP_RETRY_LIMIT (PROPRIETARY_TLV_BASE_ID + 93)
162#define TLV_TYPE_WAPI_IE (PROPRIETARY_TLV_BASE_ID + 94) 163#define TLV_TYPE_WAPI_IE (PROPRIETARY_TLV_BASE_ID + 94)
163#define TLV_TYPE_UAP_MGMT_FRAME (PROPRIETARY_TLV_BASE_ID + 104) 164#define TLV_TYPE_UAP_MGMT_FRAME (PROPRIETARY_TLV_BASE_ID + 104)
@@ -494,6 +495,7 @@ enum P2P_MODES {
494#define EVENT_HOSTWAKE_STAIE 0x0000004d 495#define EVENT_HOSTWAKE_STAIE 0x0000004d
495#define EVENT_CHANNEL_SWITCH_ANN 0x00000050 496#define EVENT_CHANNEL_SWITCH_ANN 0x00000050
496#define EVENT_TDLS_GENERIC_EVENT 0x00000052 497#define EVENT_TDLS_GENERIC_EVENT 0x00000052
498#define EVENT_CHANNEL_REPORT_RDY 0x00000054
497#define EVENT_EXT_SCAN_REPORT 0x00000058 499#define EVENT_EXT_SCAN_REPORT 0x00000058
498#define EVENT_REMAIN_ON_CHAN_EXPIRED 0x0000005f 500#define EVENT_REMAIN_ON_CHAN_EXPIRED 0x0000005f
499#define EVENT_TX_STATUS_REPORT 0x00000074 501#define EVENT_TX_STATUS_REPORT 0x00000074
@@ -1228,6 +1230,13 @@ struct host_cmd_ds_chan_rpt_req {
1228 __le32 msec_dwell_time; 1230 __le32 msec_dwell_time;
1229} __packed; 1231} __packed;
1230 1232
1233struct host_cmd_ds_chan_rpt_event {
1234 __le32 result;
1235 __le64 start_tsf;
1236 __le32 duration;
1237 u8 tlvbuf[0];
1238} __packed;
1239
1231struct mwifiex_fixed_bcn_param { 1240struct mwifiex_fixed_bcn_param {
1232 __le64 timestamp; 1241 __le64 timestamp;
1233 __le16 beacon_period; 1242 __le16 beacon_period;
@@ -1804,6 +1813,20 @@ struct mwifiex_ie_types_rssi_threshold {
1804 u8 evt_freq; 1813 u8 evt_freq;
1805} __packed; 1814} __packed;
1806 1815
1816struct meas_rpt_map {
1817 u8 rssi:3;
1818 u8 unmeasured:1;
1819 u8 radar:1;
1820 u8 unidentified_sig:1;
1821 u8 ofdm_preamble:1;
1822 u8 bss:1;
1823} __packed;
1824
1825struct mwifiex_ie_types_chan_rpt_data {
1826 struct mwifiex_ie_types_header header;
1827 struct meas_rpt_map map;
1828} __packed;
1829
1807struct host_cmd_ds_802_11_subsc_evt { 1830struct host_cmd_ds_802_11_subsc_evt {
1808 __le16 action; 1831 __le16 action;
1809 __le16 events; 1832 __le16 events;
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index e266d99ac2b2..281a30a8d857 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -1384,6 +1384,8 @@ void mwifiex_clean_auto_tdls(struct mwifiex_private *priv);
1384int mwifiex_cmd_issue_chan_report_request(struct mwifiex_private *priv, 1384int mwifiex_cmd_issue_chan_report_request(struct mwifiex_private *priv,
1385 struct host_cmd_ds_command *cmd, 1385 struct host_cmd_ds_command *cmd,
1386 void *data_buf); 1386 void *data_buf);
1387int mwifiex_11h_handle_chanrpt_ready(struct mwifiex_private *priv,
1388 struct sk_buff *skb);
1387 1389
1388void mwifiex_parse_tx_status_event(struct mwifiex_private *priv, 1390void mwifiex_parse_tx_status_event(struct mwifiex_private *priv,
1389 void *event_body); 1391 void *event_body);
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c
index c37e8cb2dd32..ad5c5e0deac0 100644
--- a/drivers/net/wireless/mwifiex/sta_event.c
+++ b/drivers/net/wireless/mwifiex/sta_event.c
@@ -516,6 +516,11 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
516 mwifiex_parse_tx_status_event(priv, adapter->event_body); 516 mwifiex_parse_tx_status_event(priv, adapter->event_body);
517 break; 517 break;
518 518
519 case EVENT_CHANNEL_REPORT_RDY:
520 dev_dbg(adapter->dev, "event: Channel Report\n");
521 ret = mwifiex_11h_handle_chanrpt_ready(priv,
522 adapter->event_skb);
523 break;
519 default: 524 default:
520 dev_dbg(adapter->dev, "event: unknown event id: %#x\n", 525 dev_dbg(adapter->dev, "event: unknown event id: %#x\n",
521 eventcause); 526 eventcause);
diff --git a/drivers/net/wireless/mwifiex/uap_event.c b/drivers/net/wireless/mwifiex/uap_event.c
index 9b4ca6ff7931..e0bdf6a79916 100644
--- a/drivers/net/wireless/mwifiex/uap_event.c
+++ b/drivers/net/wireless/mwifiex/uap_event.c
@@ -215,7 +215,11 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
215 adapter->ps_state = PS_STATE_AWAKE; 215 adapter->ps_state = PS_STATE_AWAKE;
216 adapter->pm_wakeup_card_req = false; 216 adapter->pm_wakeup_card_req = false;
217 adapter->pm_wakeup_fw_try = false; 217 adapter->pm_wakeup_fw_try = false;
218 break;
218 219
220 case EVENT_CHANNEL_REPORT_RDY:
221 dev_dbg(adapter->dev, "event: Channel Report\n");
222 mwifiex_11h_handle_chanrpt_ready(priv, adapter->event_skb);
219 break; 223 break;
220 default: 224 default:
221 dev_dbg(adapter->dev, "event: unknown event id: %#x\n", 225 dev_dbg(adapter->dev, "event: unknown event id: %#x\n",