mwifiex: fix radar detection issue
authorGanapathi Bhat <gbhat@marvell.com>
Mon, 25 Jul 2016 15:51:11 +0000 (21:21 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Sat, 3 Sep 2016 09:57:18 +0000 (12:57 +0300)
It's been observed that firmware sends RADAR detected event without
specifying bss_num/bss_type. Also, the event body is empty.
Currently the event is being ignored by driver.

This patch checks on which interface 11H is active, accordingly fills
bss_num/bss_type and handles the event. Condition
"if (le32_to_cpu(rdr_event->passed))" which always fails is also removed.

Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/11h.c
drivers/net/wireless/marvell/mwifiex/cmdevt.c

index 81c60d0a1bda348728fb539e4d487285d3367aa3..43dccd5b0291f98fcf184822d8a50374c142fc9c 100644 (file)
@@ -260,22 +260,17 @@ int mwifiex_11h_handle_radar_detected(struct mwifiex_private *priv,
 
        rdr_event = (void *)(skb->data + sizeof(u32));
 
-       if (le32_to_cpu(rdr_event->passed)) {
-               mwifiex_dbg(priv->adapter, MSG,
-                           "radar detected; indicating kernel\n");
-               if (mwifiex_stop_radar_detection(priv, &priv->dfs_chandef))
-                       mwifiex_dbg(priv->adapter, ERROR,
-                                   "Failed to stop CAC in FW\n");
-               cfg80211_radar_event(priv->adapter->wiphy, &priv->dfs_chandef,
-                                    GFP_KERNEL);
-               mwifiex_dbg(priv->adapter, MSG, "regdomain: %d\n",
-                           rdr_event->reg_domain);
-               mwifiex_dbg(priv->adapter, MSG, "radar detection type: %d\n",
-                           rdr_event->det_type);
-       } else {
-               mwifiex_dbg(priv->adapter, MSG,
-                           "false radar detection event!\n");
-       }
+       mwifiex_dbg(priv->adapter, MSG,
+                   "radar detected; indicating kernel\n");
+       if (mwifiex_stop_radar_detection(priv, &priv->dfs_chandef))
+               mwifiex_dbg(priv->adapter, ERROR,
+                           "Failed to stop CAC in FW\n");
+       cfg80211_radar_event(priv->adapter->wiphy, &priv->dfs_chandef,
+                            GFP_KERNEL);
+       mwifiex_dbg(priv->adapter, MSG, "regdomain: %d\n",
+                   rdr_event->reg_domain);
+       mwifiex_dbg(priv->adapter, MSG, "radar detection type: %d\n",
+                   rdr_event->det_type);
 
        return 0;
 }
index c29f26d8baf2a7d057a7a95f962bc653f9409d20..d433aa01fdbb9b86c7dfb422c3acb795a0269adf 100644 (file)
@@ -480,13 +480,27 @@ int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter)
  */
 int mwifiex_process_event(struct mwifiex_adapter *adapter)
 {
-       int ret;
+       int ret, i;
        struct mwifiex_private *priv =
                mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
        struct sk_buff *skb = adapter->event_skb;
-       u32 eventcause = adapter->event_cause;
+       u32 eventcause;
        struct mwifiex_rxinfo *rx_info;
 
+       if ((adapter->event_cause & EVENT_ID_MASK) == EVENT_RADAR_DETECTED) {
+               for (i = 0; i < adapter->priv_num; i++) {
+                       priv = adapter->priv[i];
+                       if (priv && mwifiex_is_11h_active(priv)) {
+                               adapter->event_cause |=
+                                       ((priv->bss_num & 0xff) << 16) |
+                                       ((priv->bss_type & 0xff) << 24);
+                               break;
+                       }
+               }
+       }
+
+       eventcause = adapter->event_cause;
+
        /* Save the last event to debug log */
        adapter->dbg.last_event_index =
                        (adapter->dbg.last_event_index + 1) % DBG_CMD_NUM;