mwifiex: handle radar detect event from FW
authorAvinash Patil <patila@marvell.com>
Wed, 28 Jan 2015 10:24:23 +0000 (15:54 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 29 Jan 2015 08:22:06 +0000 (10:22 +0200)
This patch adds support for radar_detected event from FW.
Driver in turn would stop netdev queues to stop TX traffic and
issue RADAR_DETECT event to cfg80211.

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>
drivers/net/wireless/mwifiex/11h.c
drivers/net/wireless/mwifiex/fw.h
drivers/net/wireless/mwifiex/main.h
drivers/net/wireless/mwifiex/sta_event.c
drivers/net/wireless/mwifiex/uap_event.c

index e44cac72712e0632aecaed4a43c82671b12220f1..08c12aece9aed5d8a1619fa38dabed7d9ba1fe95 100644 (file)
@@ -216,3 +216,27 @@ int mwifiex_11h_handle_chanrpt_ready(struct mwifiex_private *priv,
 
        return 0;
 }
+
+/* Handler for radar detected event from FW.*/
+int mwifiex_11h_handle_radar_detected(struct mwifiex_private *priv,
+                                     struct sk_buff *skb)
+{
+       struct mwifiex_radar_det_event *rdr_event;
+
+       rdr_event = (void *)(skb->data + sizeof(u32));
+
+       if (le32_to_cpu(rdr_event->passed)) {
+               dev_notice(priv->adapter->dev,
+                          "radar detected; indicating kernel\n");
+               cfg80211_radar_event(priv->adapter->wiphy, &priv->dfs_chandef,
+                                    GFP_KERNEL);
+               dev_dbg(priv->adapter->dev, "regdomain: %d\n",
+                       rdr_event->reg_domain);
+               dev_dbg(priv->adapter->dev, "radar detection type: %d\n",
+                       rdr_event->det_type);
+       } else {
+               dev_dbg(priv->adapter->dev, "false radar detection event!\n");
+       }
+
+       return 0;
+}
index 324ef298bea6c3b99f257e7fb347af30fad9c7a6..6d433227e273c61ac150712899b68f641521db55 100644 (file)
@@ -495,6 +495,7 @@ enum P2P_MODES {
 #define EVENT_HOSTWAKE_STAIE           0x0000004d
 #define EVENT_CHANNEL_SWITCH_ANN        0x00000050
 #define EVENT_TDLS_GENERIC_EVENT        0x00000052
+#define EVENT_RADAR_DETECTED           0x00000053
 #define EVENT_CHANNEL_REPORT_RDY        0x00000054
 #define EVENT_EXT_SCAN_REPORT           0x00000058
 #define EVENT_REMAIN_ON_CHAN_EXPIRED    0x0000005f
@@ -1813,6 +1814,25 @@ struct mwifiex_ie_types_rssi_threshold {
        u8 evt_freq;
 } __packed;
 
+#define MWIFIEX_DFS_REC_HDR_LEN                8
+#define MWIFIEX_DFS_REC_HDR_NUM                10
+#define MWIFIEX_BIN_COUNTER_LEN                7
+
+struct mwifiex_radar_det_event {
+       __le32 detect_count;
+       u8 reg_domain;  /*1=fcc, 2=etsi, 3=mic*/
+       u8 det_type;  /*0=none, 1=pw(chirp), 2=pri(radar)*/
+       __le16 pw_chirp_type;
+       u8 pw_chirp_idx;
+       u8 pw_value;
+       u8 pri_radar_type;
+       u8 pri_bincnt;
+       u8 bin_counter[MWIFIEX_BIN_COUNTER_LEN];
+       u8 num_dfs_records;
+       u8 dfs_record_hdr[MWIFIEX_DFS_REC_HDR_NUM][MWIFIEX_DFS_REC_HDR_LEN];
+       __le32 passed;
+} __packed;
+
 struct meas_rpt_map {
        u8 rssi:3;
        u8 unmeasured:1;
index 281a30a8d857137ec78ed06914434721539b875e..ad9d679c3eed1cc3472f04cd4c6491035037b4ad 100644 (file)
@@ -1395,6 +1395,8 @@ mwifiex_clone_skb_for_tx_status(struct mwifiex_private *priv,
                                struct sk_buff *skb, u8 flag, u64 *cookie);
 void mwifiex_dfs_cac_work_queue(struct work_struct *work);
 void mwifiex_abort_cac(struct mwifiex_private *priv);
+int mwifiex_11h_handle_radar_detected(struct mwifiex_private *priv,
+                                     struct sk_buff *skb);
 
 void mwifiex_hist_data_set(struct mwifiex_private *priv, u8 rx_rate, s8 snr,
                           s8 nflr);
index ad5c5e0deac06bd680eb189f30905340628172aa..c03b82c2fe1c73015d4806a395b04c3a3a2f686d 100644 (file)
@@ -521,6 +521,11 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
                ret = mwifiex_11h_handle_chanrpt_ready(priv,
                                                       adapter->event_skb);
                break;
+       case EVENT_RADAR_DETECTED:
+               dev_dbg(adapter->dev, "event: Radar detected\n");
+               ret = mwifiex_11h_handle_radar_detected(priv,
+                                                       adapter->event_skb);
+               break;
        default:
                dev_dbg(adapter->dev, "event: unknown event id: %#x\n",
                        eventcause);
index e0bdf6a79916dc962613178a4599141be154ce4a..f4794cdc36d229612931a22c85e6524171afcb3b 100644 (file)
@@ -221,6 +221,10 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
                dev_dbg(adapter->dev, "event: Channel Report\n");
                mwifiex_11h_handle_chanrpt_ready(priv, adapter->event_skb);
                break;
+       case EVENT_RADAR_DETECTED:
+               dev_dbg(adapter->dev, "event: Radar detected\n");
+               mwifiex_11h_handle_radar_detected(priv, adapter->event_skb);
+               break;
        default:
                dev_dbg(adapter->dev, "event: unknown event id: %#x\n",
                        eventcause);