UPSTREAM: mwifiex: update cfg80211 with correct reason code when association fails
authorBing Zhao <bzhao@marvell.com>
Sat, 6 Oct 2012 01:50:33 +0000 (18:50 -0700)
committerGerrit <chrome-bot@google.com>
Sat, 6 Oct 2012 21:29:03 +0000 (14:29 -0700)
This patch adds support to send correct reason code got from
firmware when association attempt fails. Also, the error message
displayed for association failure due to network incompatibility
is modified. Current message "cannot find ssid.." misleads user.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
BUG=chrome-os-partner:14966
TEST=check driver/wpa_supplicant logs and confirm that application
is informed with correct reason codes in various scenarios.

Change-Id: If89a1e85af82d8054fc65a8d6b95a3961ccd987b
Reviewed-on: https://gerrit.chromium.org/gerrit/34847
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Bing Zhao <bzhao@marvell.com>
Tested-by: Bing Zhao <bzhao@marvell.com>
drivers/net/wireless/mwifiex/cfg80211.c
drivers/net/wireless/mwifiex/scan.c

index 8f7f5a2..f7be67a 100644 (file)
@@ -1045,8 +1045,9 @@ done:
                }
        }
 
-       if (mwifiex_bss_start(priv, bss, &req_ssid))
-               return -EFAULT;
+       ret = mwifiex_bss_start(priv, bss, &req_ssid);
+       if (ret)
+               return ret;
 
        if (mode == NL80211_IFTYPE_ADHOC) {
                /* Inform the BSS information to kernel, otherwise
@@ -1096,9 +1097,19 @@ done:
                        "info: association to bssid %pM failed\n",
                        priv->cfg_bssid);
                memset(priv->cfg_bssid, 0, ETH_ALEN);
+
+               if (ret > 0)
+                       cfg80211_connect_result(priv->netdev, priv->cfg_bssid,
+                                               NULL, 0, NULL, 0, ret,
+                                               GFP_KERNEL);
+               else
+                       cfg80211_connect_result(priv->netdev, priv->cfg_bssid,
+                                               NULL, 0, NULL, 0,
+                                               WLAN_STATUS_UNSPECIFIED_FAILURE,
+                                               GFP_KERNEL);
        }
 
-       return ret;
+       return 0;
 }
 
 /*
index 984f7ec..88fdf50 100644 (file)
@@ -1439,8 +1439,8 @@ int mwifiex_check_network_compatibility(struct mwifiex_private *priv,
                        ret = mwifiex_is_network_compatible(priv, bss_desc,
                                                            priv->bss_mode);
                        if (ret)
-                               dev_err(priv->adapter->dev, "cannot find ssid "
-                                       "%s\n", bss_desc->ssid.ssid);
+                               dev_err(priv->adapter->dev,
+                                       "Incompatible network settings\n");
                                break;
                default:
                                ret = 0;