bcmdhd wifi:update driver 1.201.59.5
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rkwifi / bcmdhd / wl_cfg80211.c
index cb4fc5eefa84409b7506cba2be4cf839ea94dce9..f453cf87689adfa604fdefa229b3e0193a57d706 100755 (executable)
@@ -366,7 +366,7 @@ static s32 wl_cfg80211_del_station(struct wiphy *wiphy,
 static s32 wl_cfg80211_change_station(struct wiphy *wiphy,
        struct net_device *dev, u8 *mac, struct station_parameters *params);
 #endif /* WL_SUPPORT_BACKPORTED_KPATCHES || KERNEL_VER >= KERNEL_VERSION(3, 2, 0)) */
-static s32 
+static s32
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) || defined(WL_COMPAT_WIRELESS)
 wl_cfg80211_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
 #else
@@ -1827,7 +1827,7 @@ wl_cfg80211_change_virtual_iface(struct wiphy *wiphy, struct net_device *ndev,
                        chspec = wl_cfg80211_get_shared_freq(wiphy);
 
                        wlif_type = WL_P2P_IF_GO;
-                       printk("%s : ap (%d), infra (%d), iftype: (%d)\n",
+                       printf("%s : ap (%d), infra (%d), iftype: (%d)\n",
                                ndev->name, ap, infra, type);
                        wl_set_p2p_status(cfg, IF_CHANGING);
                        wl_clr_p2p_status(cfg, IF_CHANGED);
@@ -4507,7 +4507,7 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
        err = wldev_iovar_setbuf_bsscfg(dev, "join", ext_join_params, join_params_size,
                cfg->ioctl_buf, WLC_IOCTL_MAXLEN, bssidx, &cfg->ioctl_buf_sync);
 
-       printk("Connectting with " MACDBG " channel (%d) ssid \"%s\", len (%d)\n\n",
+       printf("Connectting with " MACDBG " channel (%d) ssid \"%s\", len (%d)\n\n",
                MAC2STRDBG((u8*)(&ext_join_params->assoc.bssid)), cfg->channel,
                ext_join_params->ssid.SSID, ext_join_params->ssid.SSID_len);
 
@@ -6615,7 +6615,7 @@ wl_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev,
        dev = ndev_to_wlc_ndev(dev, cfg);
 #endif
        _chan = ieee80211_frequency_to_channel(chan->center_freq);
-       printk("netdev_ifidx(%d), chan_type(%d) target channel(%d) \n",
+       printf("netdev_ifidx(%d), chan_type(%d) target channel(%d) \n",
                dev->ifindex, channel_type, _chan);
 
 #ifdef CUSTOM_PLATFORM_NV_TEGRA
@@ -7887,7 +7887,7 @@ wl_cfg80211_del_station(
                sizeof(scb_val_t), true);
        if (err < 0)
                WL_ERR(("WLC_SCB_DEAUTHENTICATE_FOR_REASON err %d\n", err));
-       printk("Disconnect STA : %s scb_val.val %d\n",
+       printf("Disconnect STA : %s scb_val.val %d\n",
                bcm_ether_ntoa((const struct ether_addr *)mac_addr, eabuf),
                scb_val.val);
 
@@ -9135,16 +9135,16 @@ static s32 wl_inform_single_bss(struct bcm_cfg80211 *cfg, struct wl_bss_info *bi
                return -EINVAL;
        }
        channel = ieee80211_get_channel(wiphy, freq);
+       WL_SCAN(("BSSID %pM, channel %d, rssi %d, capa 0x04%x, mgmt_type %d, "
+               "frame_len %d, SSID \"%s\"\n", &bi->BSSID, notif_bss_info->channel,
+               notif_bss_info->rssi, mgmt->u.beacon.capab_info, mgmt_type,
+               notif_bss_info->frame_len, bi->SSID));
        if (unlikely(!channel)) {
                WL_ERR(("ieee80211_get_channel error, freq=%d, channel=%d\n",
                        freq, notif_bss_info->channel));
                kfree(notif_bss_info);
                return -EINVAL;
        }
-       WL_SCAN(("BSSID %pM, channel %d, rssi %d, capa 0x04%x, mgmt_type %d, "
-               "frame_len %d, SSID \"%s\"\n", &bi->BSSID, notif_bss_info->channel,
-               notif_bss_info->rssi, mgmt->u.beacon.capab_info, mgmt_type,
-               notif_bss_info->frame_len, bi->SSID));
 
        signal = notif_bss_info->rssi * 100;
        if (!mgmt->u.probe_resp.timestamp) {
@@ -9364,7 +9364,9 @@ wl_notify_connect_status_ap(struct bcm_cfg80211 *cfg, struct net_device *ndev,
        isfree = true;
 
        if (event == WLC_E_ASSOC_IND && reason == DOT11_SC_SUCCESS) {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
+               cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, 0);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
                cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, 0, GFP_ATOMIC);
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || \
        defined(WL_COMPAT_WIRELESS)
@@ -9373,7 +9375,9 @@ wl_notify_connect_status_ap(struct bcm_cfg80211 *cfg, struct net_device *ndev,
                cfg80211_rx_mgmt(ndev, freq, mgmt_frame, len, GFP_ATOMIC);
 #endif /* LINUX_VERSION >= VERSION(3, 12, 0) */
        } else if (event == WLC_E_DISASSOC_IND) {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
+               cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, 0);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
                cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, 0, GFP_ATOMIC);
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || \
        defined(WL_COMPAT_WIRELESS)
@@ -9382,7 +9386,9 @@ wl_notify_connect_status_ap(struct bcm_cfg80211 *cfg, struct net_device *ndev,
                cfg80211_rx_mgmt(ndev, freq, mgmt_frame, len, GFP_ATOMIC);
 #endif /* LINUX_VERSION >= VERSION(3, 12, 0) */
        } else if ((event == WLC_E_DEAUTH_IND) || (event == WLC_E_DEAUTH)) {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
+               cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, 0);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
                cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, 0, GFP_ATOMIC);
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || \
        defined(WL_COMPAT_WIRELESS)
@@ -9408,13 +9414,13 @@ exit:
                }
                sinfo.assoc_req_ies = data;
                sinfo.assoc_req_ies_len = len;
-               printk("%s: connected device "MACDBG"\n", __FUNCTION__, MAC2STRDBG(e->addr.octet));
+               printf("%s: connected device "MACDBG"\n", __FUNCTION__, MAC2STRDBG(e->addr.octet));
                cfg80211_new_sta(ndev, e->addr.octet, &sinfo, GFP_ATOMIC);
        } else if (event == WLC_E_DISASSOC_IND) {
-               printk("%s: disassociated device "MACDBG"\n", __FUNCTION__, MAC2STRDBG(e->addr.octet));
+               printf("%s: disassociated device "MACDBG"\n", __FUNCTION__, MAC2STRDBG(e->addr.octet));
                cfg80211_del_sta(ndev, e->addr.octet, GFP_ATOMIC);
        } else if ((event == WLC_E_DEAUTH_IND) || (event == WLC_E_DEAUTH)) {
-               printk("%s: deauthenticated device "MACDBG"\n", __FUNCTION__, MAC2STRDBG(e->addr.octet));
+               printf("%s: deauthenticated device "MACDBG"\n", __FUNCTION__, MAC2STRDBG(e->addr.octet));
                cfg80211_del_sta(ndev, e->addr.octet, GFP_ATOMIC);
        }
 #endif /* LINUX_VERSION < VERSION(3,2,0) && !WL_CFG80211_STA_EVENT && !WL_COMPAT_WIRELESS */
@@ -9553,7 +9559,7 @@ wl_notify_connect_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
                        wl_link_up(cfg);
                        act = true;
                        if (!wl_get_drv_status(cfg, DISCONNECTING, ndev)) {
-                                       printk("wl_bss_connect_done succeeded with " MACDBG "\n",
+                                       printf("wl_bss_connect_done succeeded with " MACDBG "\n",
                                                MAC2STRDBG((u8*)(&e->addr)));
                                        wl_bss_connect_done(cfg, ndev, e, data, true);
                                        dhd_conf_set_phyoclscdenable((dhd_pub_t *)cfg->pub);
@@ -9585,7 +9591,7 @@ wl_notify_connect_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
                                /* WLAN_REASON_UNSPECIFIED is used for hang up event in Android */
                                reason = (reason == WLAN_REASON_UNSPECIFIED)? 0 : reason;
 
-                               printk("link down if %s may call cfg80211_disconnected. "
+                               printf("link down if %s may call cfg80211_disconnected. "
                                        "event : %d, reason=%d from " MACDBG "\n",
                                        ndev->name, event, ntoh32(e->reason),
                                        MAC2STRDBG((u8*)(&e->addr)));
@@ -9622,7 +9628,7 @@ wl_notify_connect_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
                                }
                        }
                        else if (wl_get_drv_status(cfg, CONNECTING, ndev)) {
-                               printk("link down, during connecting\n");
+                               printf("link down, during connecting\n");
 #ifdef ESCAN_RESULT_PATCH
                                if ((memcmp(connect_req_bssid, broad_bssid, ETHER_ADDR_LEN) == 0) ||
                                        (memcmp(&e->addr, broad_bssid, ETHER_ADDR_LEN) == 0) ||
@@ -9638,7 +9644,7 @@ wl_notify_connect_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
                                complete(&cfg->iface_disable);
 
                } else if (wl_is_nonetwork(cfg, e)) {
-                       printk("connect failed event=%d e->status %d e->reason %d \n",
+                       printf("connect failed event=%d e->status %d e->reason %d \n",
                                event, (int)ntoh32(e->status), (int)ntoh32(e->reason));
                        /* Clean up any pending scan request */
                        if (cfg->scan_request)
@@ -10001,7 +10007,7 @@ wl_bss_roaming_done(struct bcm_cfg80211 *cfg, struct net_device *ndev,
                memcpy(cfg->fbt_key, data, FBT_KEYLEN);
        }
 #endif /* WLFBT */
-       printk("wl_bss_roaming_done succeeded to " MACDBG "\n",
+       printf("wl_bss_roaming_done succeeded to " MACDBG "\n",
                MAC2STRDBG((u8*)(&e->addr)));
        dhd_conf_set_wme((dhd_pub_t *)cfg->pub);
 
@@ -10545,7 +10551,9 @@ wl_notify_rx_mgmt_frame(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
        WL_DBG((" device name is ndev %s \n", ndev->name));
 #endif
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
+       retval = cfg80211_rx_mgmt(cfgdev, freq, 0,  mgmt_frame, mgmt_frame_len, 0);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
        retval = cfg80211_rx_mgmt(cfgdev, freq, 0,  mgmt_frame, mgmt_frame_len, 0, GFP_ATOMIC);
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || \
        defined(WL_COMPAT_WIRELESS)
@@ -10943,9 +10951,14 @@ static void wl_scan_timeout(unsigned long data)
 static s32
 wl_cfg80211_netdev_notifier_call(struct notifier_block * nb,
        unsigned long state,
-       void *ndev)
+       void *ptr)
 {
-       struct net_device *dev = ndev;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0))
+       struct net_device *dev = ptr;
+#else
+       // terence 20150701: fix for p2p connection issue
+       struct net_device *dev = netdev_notifier_info_to_dev(ptr);
+#endif
        struct wireless_dev *wdev = dev->ieee80211_ptr;
        struct bcm_cfg80211 *cfg = g_bcm_cfg;
 
@@ -10993,7 +11006,7 @@ wl_cfg80211_netdev_notifier_call(struct notifier_block * nb,
 
                case NETDEV_UNREGISTER:
                        /* after calling list_del_rcu(&wdev->list) */
-                       wl_dealloc_netinfo(cfg, ndev);
+                       wl_dealloc_netinfo(cfg, dev);
                        break;
                case NETDEV_GOING_DOWN:
                        /* At NETDEV_DOWN state, wdev_cleanup_work work will be called.
@@ -11616,7 +11629,7 @@ static void wl_cfg80211_determine_vsdb_mode(struct bcm_cfg80211 *cfg)
                        }
                }
        }
-       printk("%s concurrency is enabled\n", cfg->vsdb_mode ? "Multi Channel" : "Same Channel");
+       printf("%s concurrency is enabled\n", cfg->vsdb_mode ? "Multi Channel" : "Same Channel");
        return;
 }
 
@@ -11951,7 +11964,7 @@ s32 wl_cfg80211_attach_post(struct net_device *ndev)
                                        /* Update MAC addr for p2p0 interface here. */
                                        memcpy(cfg->p2p_net->dev_addr, ndev->dev_addr, ETH_ALEN);
                                        cfg->p2p_net->dev_addr[0] |= 0x02;
-                                       printk("%s: p2p_dev_addr="MACDBG "\n",
+                                       printf("%s: p2p_dev_addr="MACDBG "\n",
                                                cfg->p2p_net->name,
                                                MAC2STRDBG(cfg->p2p_net->dev_addr));
                                } else {
@@ -12188,7 +12201,7 @@ static s32 wl_event_handler(void *data)
 
        cfg = (struct bcm_cfg80211 *)tsk->parent;
 
-       printk("tsk Enter, tsk = 0x%p\n", tsk);
+       printf("tsk Enter, tsk = 0x%p\n", tsk);
 
        while (down_interruptible (&tsk->sema) == 0) {
                SMP_RD_BARRIER_DEPENDS();
@@ -12258,7 +12271,7 @@ static s32 wl_event_handler(void *data)
                }
                DHD_OS_WAKE_UNLOCK(cfg->pub);
        }
-       printk("%s: was terminated\n", __FUNCTION__);
+       printf("%s: was terminated\n", __FUNCTION__);
        complete_and_exit(&tsk->completed, 0);
        return 0;
 }
@@ -14251,7 +14264,10 @@ wl_tdls_event_handler(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
                dhd_tdls_update_peer_info(ndev, TRUE, (uint8 *)&e->addr.octet[0]);
 #endif /* PCIE_FULL_DONGLE */
                if (cfg->tdls_mgmt_frame) {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
+                       cfg80211_rx_mgmt(cfgdev, cfg->tdls_mgmt_freq, 0,
+                               cfg->tdls_mgmt_frame, cfg->tdls_mgmt_frame_len, 0);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
                        cfg80211_rx_mgmt(cfgdev, cfg->tdls_mgmt_freq, 0,
                                cfg->tdls_mgmt_frame, cfg->tdls_mgmt_frame_len,
                                0, GFP_ATOMIC);
@@ -15045,7 +15061,7 @@ int wl_cfg80211_do_driver_init(struct net_device *net)
 void wl_cfg80211_enable_trace(u32 level)
 {
        wl_dbg_level = level;
-       printk("%s: wl_dbg_level = 0x%x\n", __FUNCTION__, wl_dbg_level);
+       printf("%s: wl_dbg_level = 0x%x\n", __FUNCTION__, wl_dbg_level);
 }
 
 #if defined(WL_SUPPORT_BACKPORTED_KPATCHES) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, \