From d635711daa98be86d4c7fd01499c34f566b54ccb Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Fri, 10 Jun 2016 05:30:17 -0300 Subject: Linux-libre 4.6.2-gnu --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 1156 ++++++--------------- 1 file changed, 306 insertions(+), 850 deletions(-) (limited to 'drivers/staging/wilc1000/wilc_wfi_cfgoperations.c') diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 53fb2d4bb..448a5c8c4 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -74,6 +74,10 @@ static const struct ieee80211_txrx_stypes } }; +static const struct wiphy_wowlan_support wowlan_support = { + .flags = WIPHY_WOWLAN_ANY +}; + #define WILC_WFI_DWELL_PASSIVE 100 #define WILC_WFI_DWELL_ACTIVE 40 @@ -89,7 +93,7 @@ static const struct ieee80211_txrx_stypes extern int wilc_mac_open(struct net_device *ndev); extern int wilc_mac_close(struct net_device *ndev); -static tstrNetworkInfo last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; +static struct network_info last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; static u32 last_scanned_cnt; struct timer_list wilc_during_ip_timer; static struct timer_list hAgingTimer; @@ -153,7 +157,7 @@ static u8 wlan_channel = INVALID_CHANNEL; static u8 curr_channel; static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09}; static u8 p2p_local_random = 0x01; -static u8 p2p_recv_random = 0x00; +static u8 p2p_recv_random; static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; static bool wilc_ie; @@ -188,29 +192,29 @@ static void clear_shadow_scan(void) if (op_ifcs == 0) { del_timer_sync(&hAgingTimer); - PRINT_INFO(CORECONFIG_DBG, "destroy aging timer\n"); for (i = 0; i < last_scanned_cnt; i++) { - if (last_scanned_shadow[last_scanned_cnt].pu8IEs) { - kfree(last_scanned_shadow[i].pu8IEs); - last_scanned_shadow[last_scanned_cnt].pu8IEs = NULL; + if (last_scanned_shadow[last_scanned_cnt].ies) { + kfree(last_scanned_shadow[i].ies); + last_scanned_shadow[last_scanned_cnt].ies = NULL; } - wilc_free_join_params(last_scanned_shadow[i].pJoinParams); - last_scanned_shadow[i].pJoinParams = NULL; + kfree(last_scanned_shadow[i].join_params); + last_scanned_shadow[i].join_params = NULL; } last_scanned_cnt = 0; } } -static u32 get_rssi_avg(tstrNetworkInfo *network_info) +static u32 get_rssi_avg(struct network_info *network_info) { u8 i; int rssi_v = 0; - u8 num_rssi = (network_info->strRssi.u8Full) ? NUM_RSSI : (network_info->strRssi.u8Index); + u8 num_rssi = (network_info->str_rssi.u8Full) ? + NUM_RSSI : (network_info->str_rssi.u8Index); for (i = 0; i < num_rssi; i++) - rssi_v += network_info->strRssi.as8RSSI[i]; + rssi_v += network_info->str_rssi.as8RSSI[i]; rssi_v /= num_rssi; return rssi_v; @@ -224,28 +228,36 @@ static void refresh_scan(void *user_void, u8 all, bool direct_scan) int i; int rssi = 0; - priv = (struct wilc_priv *)user_void; + priv = user_void; wiphy = priv->dev->ieee80211_ptr->wiphy; for (i = 0; i < last_scanned_cnt; i++) { - tstrNetworkInfo *network_info; + struct network_info *network_info; network_info = &last_scanned_shadow[i]; - if (!network_info->u8Found || all) { + if (!network_info->found || all) { s32 freq; struct ieee80211_channel *channel; if (network_info) { - freq = ieee80211_channel_to_frequency((s32)network_info->u8channel, IEEE80211_BAND_2GHZ); + freq = ieee80211_channel_to_frequency((s32)network_info->ch, IEEE80211_BAND_2GHZ); channel = ieee80211_get_channel(wiphy, freq); rssi = get_rssi_avg(network_info); - if (memcmp("DIRECT-", network_info->au8ssid, 7) || + if (memcmp("DIRECT-", network_info->ssid, 7) || direct_scan) { - bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, network_info->au8bssid, network_info->u64Tsf, network_info->u16CapInfo, - network_info->u16BeaconPeriod, (const u8 *)network_info->pu8IEs, - (size_t)network_info->u16IEsLen, (((s32)rssi) * 100), GFP_KERNEL); + bss = cfg80211_inform_bss(wiphy, + channel, + CFG80211_BSS_FTYPE_UNKNOWN, + network_info->bssid, + network_info->tsf_hi, + network_info->cap_info, + network_info->beacon_period, + (const u8 *)network_info->ies, + (size_t)network_info->ies_len, + (s32)rssi * 100, + GFP_KERNEL); cfg80211_put_bss(wiphy, bss); } } @@ -258,7 +270,7 @@ static void reset_shadow_found(void) int i; for (i = 0; i < last_scanned_cnt; i++) - last_scanned_shadow[i].u8Found = 0; + last_scanned_shadow[i].found = 0; } static void update_scan_time(void) @@ -266,7 +278,7 @@ static void update_scan_time(void) int i; for (i = 0; i < last_scanned_cnt; i++) - last_scanned_shadow[i].u32TimeRcvdInScan = jiffies; + last_scanned_shadow[i].time_scan = jiffies; } static void remove_network_from_shadow(unsigned long arg) @@ -276,13 +288,12 @@ static void remove_network_from_shadow(unsigned long arg) for (i = 0; i < last_scanned_cnt; i++) { - if (time_after(now, last_scanned_shadow[i].u32TimeRcvdInScan + (unsigned long)(SCAN_RESULT_EXPIRE))) { - PRINT_D(CFG80211_DBG, "Network expired in ScanShadow: %s\n", last_scanned_shadow[i].au8ssid); - - kfree(last_scanned_shadow[i].pu8IEs); - last_scanned_shadow[i].pu8IEs = NULL; + if (time_after(now, last_scanned_shadow[i].time_scan + + (unsigned long)(SCAN_RESULT_EXPIRE))) { + kfree(last_scanned_shadow[i].ies); + last_scanned_shadow[i].ies = NULL; - wilc_free_join_params(last_scanned_shadow[i].pJoinParams); + kfree(last_scanned_shadow[i].join_params); for (j = i; (j < last_scanned_cnt - 1); j++) last_scanned_shadow[j] = last_scanned_shadow[j + 1]; @@ -291,37 +302,31 @@ static void remove_network_from_shadow(unsigned long arg) } } - PRINT_D(CFG80211_DBG, "Number of cached networks: %d\n", - last_scanned_cnt); if (last_scanned_cnt != 0) { hAgingTimer.data = arg; mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME)); - } else { - PRINT_D(CFG80211_DBG, "No need to restart Aging timer\n"); } } static void clear_duringIP(unsigned long arg) { - PRINT_D(GENERIC_DBG, "GO:IP Obtained , enable scan\n"); wilc_optaining_ip = false; } -static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, +static int is_network_in_shadow(struct network_info *pstrNetworkInfo, void *user_void) { int state = -1; int i; if (last_scanned_cnt == 0) { - PRINT_D(CFG80211_DBG, "Starting Aging timer\n"); hAgingTimer.data = (unsigned long)user_void; mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME)); state = -1; } else { for (i = 0; i < last_scanned_cnt; i++) { - if (memcmp(last_scanned_shadow[i].au8bssid, - pstrNetworkInfo->au8bssid, 6) == 0) { + if (memcmp(last_scanned_shadow[i].bssid, + pstrNetworkInfo->bssid, 6) == 0) { state = i; break; } @@ -330,58 +335,57 @@ static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, return state; } -static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, +static void add_network_to_shadow(struct network_info *pstrNetworkInfo, void *user_void, void *pJoinParams) { int ap_found = is_network_in_shadow(pstrNetworkInfo, user_void); u32 ap_index = 0; u8 rssi_index = 0; - if (last_scanned_cnt >= MAX_NUM_SCANNED_NETWORKS_SHADOW) { - PRINT_D(CFG80211_DBG, "Shadow network reached its maximum limit\n"); + if (last_scanned_cnt >= MAX_NUM_SCANNED_NETWORKS_SHADOW) return; - } + if (ap_found == -1) { ap_index = last_scanned_cnt; last_scanned_cnt++; } else { ap_index = ap_found; } - rssi_index = last_scanned_shadow[ap_index].strRssi.u8Index; - last_scanned_shadow[ap_index].strRssi.as8RSSI[rssi_index++] = pstrNetworkInfo->s8rssi; + rssi_index = last_scanned_shadow[ap_index].str_rssi.u8Index; + last_scanned_shadow[ap_index].str_rssi.as8RSSI[rssi_index++] = pstrNetworkInfo->rssi; if (rssi_index == NUM_RSSI) { rssi_index = 0; - last_scanned_shadow[ap_index].strRssi.u8Full = 1; - } - last_scanned_shadow[ap_index].strRssi.u8Index = rssi_index; - last_scanned_shadow[ap_index].s8rssi = pstrNetworkInfo->s8rssi; - last_scanned_shadow[ap_index].u16CapInfo = pstrNetworkInfo->u16CapInfo; - last_scanned_shadow[ap_index].u8SsidLen = pstrNetworkInfo->u8SsidLen; - memcpy(last_scanned_shadow[ap_index].au8ssid, - pstrNetworkInfo->au8ssid, pstrNetworkInfo->u8SsidLen); - memcpy(last_scanned_shadow[ap_index].au8bssid, - pstrNetworkInfo->au8bssid, ETH_ALEN); - last_scanned_shadow[ap_index].u16BeaconPeriod = pstrNetworkInfo->u16BeaconPeriod; - last_scanned_shadow[ap_index].u8DtimPeriod = pstrNetworkInfo->u8DtimPeriod; - last_scanned_shadow[ap_index].u8channel = pstrNetworkInfo->u8channel; - last_scanned_shadow[ap_index].u16IEsLen = pstrNetworkInfo->u16IEsLen; - last_scanned_shadow[ap_index].u64Tsf = pstrNetworkInfo->u64Tsf; + last_scanned_shadow[ap_index].str_rssi.u8Full = 1; + } + last_scanned_shadow[ap_index].str_rssi.u8Index = rssi_index; + last_scanned_shadow[ap_index].rssi = pstrNetworkInfo->rssi; + last_scanned_shadow[ap_index].cap_info = pstrNetworkInfo->cap_info; + last_scanned_shadow[ap_index].ssid_len = pstrNetworkInfo->ssid_len; + memcpy(last_scanned_shadow[ap_index].ssid, + pstrNetworkInfo->ssid, pstrNetworkInfo->ssid_len); + memcpy(last_scanned_shadow[ap_index].bssid, + pstrNetworkInfo->bssid, ETH_ALEN); + last_scanned_shadow[ap_index].beacon_period = pstrNetworkInfo->beacon_period; + last_scanned_shadow[ap_index].dtim_period = pstrNetworkInfo->dtim_period; + last_scanned_shadow[ap_index].ch = pstrNetworkInfo->ch; + last_scanned_shadow[ap_index].ies_len = pstrNetworkInfo->ies_len; + last_scanned_shadow[ap_index].tsf_hi = pstrNetworkInfo->tsf_hi; if (ap_found != -1) - kfree(last_scanned_shadow[ap_index].pu8IEs); - last_scanned_shadow[ap_index].pu8IEs = - kmalloc(pstrNetworkInfo->u16IEsLen, GFP_KERNEL); - memcpy(last_scanned_shadow[ap_index].pu8IEs, - pstrNetworkInfo->pu8IEs, pstrNetworkInfo->u16IEsLen); - last_scanned_shadow[ap_index].u32TimeRcvdInScan = jiffies; - last_scanned_shadow[ap_index].u32TimeRcvdInScanCached = jiffies; - last_scanned_shadow[ap_index].u8Found = 1; + kfree(last_scanned_shadow[ap_index].ies); + last_scanned_shadow[ap_index].ies = kmalloc(pstrNetworkInfo->ies_len, + GFP_KERNEL); + memcpy(last_scanned_shadow[ap_index].ies, + pstrNetworkInfo->ies, pstrNetworkInfo->ies_len); + last_scanned_shadow[ap_index].time_scan = jiffies; + last_scanned_shadow[ap_index].time_scan_cached = jiffies; + last_scanned_shadow[ap_index].found = 1; if (ap_found != -1) - wilc_free_join_params(last_scanned_shadow[ap_index].pJoinParams); - last_scanned_shadow[ap_index].pJoinParams = pJoinParams; + kfree(last_scanned_shadow[ap_index].join_params); + last_scanned_shadow[ap_index].join_params = pJoinParams; } static void CfgScanResult(enum scan_event scan_event, - tstrNetworkInfo *network_info, + struct network_info *network_info, void *user_void, void *join_params) { @@ -391,7 +395,7 @@ static void CfgScanResult(enum scan_event scan_event, struct ieee80211_channel *channel; struct cfg80211_bss *bss = NULL; - priv = (struct wilc_priv *)user_void; + priv = user_void; if (priv->bCfgScanning) { if (scan_event == SCAN_EVENT_NETWORK_FOUND) { wiphy = priv->dev->ieee80211_ptr->wiphy; @@ -400,67 +404,53 @@ static void CfgScanResult(enum scan_event scan_event, return; if (wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC && - (((s32)network_info->s8rssi * 100) < 0 || - ((s32)network_info->s8rssi * 100) > 100)) { - PRINT_ER("wiphy signal type fial\n"); + (((s32)network_info->rssi * 100) < 0 || + ((s32)network_info->rssi * 100) > 100)) return; - } if (network_info) { - s32Freq = ieee80211_channel_to_frequency((s32)network_info->u8channel, IEEE80211_BAND_2GHZ); + s32Freq = ieee80211_channel_to_frequency((s32)network_info->ch, IEEE80211_BAND_2GHZ); channel = ieee80211_get_channel(wiphy, s32Freq); if (!channel) return; - PRINT_INFO(CFG80211_DBG, "Network Info:: CHANNEL Frequency: %d, RSSI: %d, CapabilityInfo: %d," - "BeaconPeriod: %d\n", channel->center_freq, (((s32)network_info->s8rssi) * 100), - network_info->u16CapInfo, network_info->u16BeaconPeriod); - - if (network_info->bNewNetwork) { + if (network_info->new_network) { if (priv->u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { - PRINT_D(CFG80211_DBG, "Network %s found\n", network_info->au8ssid); priv->u32RcvdChCount++; - if (!join_params) - PRINT_INFO(CORECONFIG_DBG, ">> Something really bad happened\n"); add_network_to_shadow(network_info, priv, join_params); - if (!(memcmp("DIRECT-", network_info->au8ssid, 7))) { - bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, network_info->au8bssid, network_info->u64Tsf, network_info->u16CapInfo, - network_info->u16BeaconPeriod, (const u8 *)network_info->pu8IEs, - (size_t)network_info->u16IEsLen, (((s32)network_info->s8rssi) * 100), GFP_KERNEL); + if (!(memcmp("DIRECT-", network_info->ssid, 7))) { + bss = cfg80211_inform_bss(wiphy, + channel, + CFG80211_BSS_FTYPE_UNKNOWN, + network_info->bssid, + network_info->tsf_hi, + network_info->cap_info, + network_info->beacon_period, + (const u8 *)network_info->ies, + (size_t)network_info->ies_len, + (s32)network_info->rssi * 100, + GFP_KERNEL); cfg80211_put_bss(wiphy, bss); } - - - } else { - PRINT_ER("Discovered networks exceeded the max limit\n"); } } else { u32 i; for (i = 0; i < priv->u32RcvdChCount; i++) { - if (memcmp(last_scanned_shadow[i].au8bssid, network_info->au8bssid, 6) == 0) { - PRINT_D(CFG80211_DBG, "Update RSSI of %s\n", last_scanned_shadow[i].au8ssid); - - last_scanned_shadow[i].s8rssi = network_info->s8rssi; - last_scanned_shadow[i].u32TimeRcvdInScan = jiffies; + if (memcmp(last_scanned_shadow[i].bssid, network_info->bssid, 6) == 0) { + last_scanned_shadow[i].rssi = network_info->rssi; + last_scanned_shadow[i].time_scan = jiffies; break; } } } } } else if (scan_event == SCAN_EVENT_DONE) { - PRINT_D(CFG80211_DBG, "Scan Done[%p]\n", priv->dev); - PRINT_D(CFG80211_DBG, "Refreshing Scan ...\n"); refresh_scan(priv, 1, false); - if (priv->u32RcvdChCount > 0) - PRINT_D(CFG80211_DBG, "%d Network(s) found\n", priv->u32RcvdChCount); - else - PRINT_D(CFG80211_DBG, "No networks found\n"); - down(&(priv->hSemScanReq)); if (priv->pstrScanReq) { @@ -473,7 +463,6 @@ static void CfgScanResult(enum scan_event scan_event, } else if (scan_event == SCAN_EVENT_ABORTED) { down(&(priv->hSemScanReq)); - PRINT_D(CFG80211_DBG, "Scan Aborted\n"); if (priv->pstrScanReq) { update_scan_time(); refresh_scan(priv, 1, false); @@ -490,9 +479,9 @@ static void CfgScanResult(enum scan_event scan_event, int wilc_connecting; static void CfgConnectResult(enum conn_event enuConnDisconnEvent, - tstrConnectInfo *pstrConnectInfo, + struct connect_info *pstrConnectInfo, u8 u8MacStatus, - tstrDisconnectNotifInfo *pstrDisconnectNotifInfo, + struct disconnect_info *pstrDisconnectNotifInfo, void *pUserVoid) { struct wilc_priv *priv; @@ -504,49 +493,47 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, wilc_connecting = 0; - priv = (struct wilc_priv *)pUserVoid; + priv = pUserVoid; dev = priv->dev; vif = netdev_priv(dev); wl = vif->wilc; - pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; + pstrWFIDrv = (struct host_if_drv *)priv->hif_drv; if (enuConnDisconnEvent == CONN_DISCONN_EVENT_CONN_RESP) { u16 u16ConnectStatus; - u16ConnectStatus = pstrConnectInfo->u16ConnectStatus; - - PRINT_D(CFG80211_DBG, " Connection response received = %d\n", u8MacStatus); + u16ConnectStatus = pstrConnectInfo->status; if ((u8MacStatus == MAC_DISCONNECTED) && - (pstrConnectInfo->u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { + (pstrConnectInfo->status == SUCCESSFUL_STATUSCODE)) { u16ConnectStatus = WLAN_STATUS_UNSPECIFIED_FAILURE; - wilc_wlan_set_bssid(priv->dev, NullBssid); + wilc_wlan_set_bssid(priv->dev, NullBssid, + STATION_MODE); eth_zero_addr(wilc_connected_ssid); if (!pstrWFIDrv->p2p_connect) wlan_channel = INVALID_CHANNEL; - PRINT_ER("Unspecified failure: Connection status %d : MAC status = %d\n", u16ConnectStatus, u8MacStatus); + netdev_err(dev, "Unspecified failure\n"); } if (u16ConnectStatus == WLAN_STATUS_SUCCESS) { bool bNeedScanRefresh = false; u32 i; - PRINT_INFO(CFG80211_DBG, "Connection Successful:: BSSID: %x%x%x%x%x%x\n", pstrConnectInfo->au8bssid[0], - pstrConnectInfo->au8bssid[1], pstrConnectInfo->au8bssid[2], pstrConnectInfo->au8bssid[3], pstrConnectInfo->au8bssid[4], pstrConnectInfo->au8bssid[5]); - memcpy(priv->au8AssociatedBss, pstrConnectInfo->au8bssid, ETH_ALEN); + memcpy(priv->au8AssociatedBss, pstrConnectInfo->bssid, ETH_ALEN); for (i = 0; i < last_scanned_cnt; i++) { - if (memcmp(last_scanned_shadow[i].au8bssid, - pstrConnectInfo->au8bssid, ETH_ALEN) == 0) { + if (memcmp(last_scanned_shadow[i].bssid, + pstrConnectInfo->bssid, + ETH_ALEN) == 0) { unsigned long now = jiffies; if (time_after(now, - last_scanned_shadow[i].u32TimeRcvdInScanCached + (unsigned long)(nl80211_SCAN_RESULT_EXPIRE - (1 * HZ)))) { + last_scanned_shadow[i].time_scan_cached + + (unsigned long)(nl80211_SCAN_RESULT_EXPIRE - (1 * HZ)))) bNeedScanRefresh = true; - } break; } @@ -556,34 +543,27 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, refresh_scan(priv, 1, true); } - - PRINT_D(CFG80211_DBG, "Association request info elements length = %zu\n", pstrConnectInfo->ReqIEsLen); - - PRINT_D(CFG80211_DBG, "Association response info elements length = %d\n", pstrConnectInfo->u16RespIEsLen); - - cfg80211_connect_result(dev, pstrConnectInfo->au8bssid, - pstrConnectInfo->pu8ReqIEs, pstrConnectInfo->ReqIEsLen, - pstrConnectInfo->pu8RespIEs, pstrConnectInfo->u16RespIEsLen, + cfg80211_connect_result(dev, pstrConnectInfo->bssid, + pstrConnectInfo->req_ies, pstrConnectInfo->req_ies_len, + pstrConnectInfo->resp_ies, pstrConnectInfo->resp_ies_len, u16ConnectStatus, GFP_KERNEL); } else if (enuConnDisconnEvent == CONN_DISCONN_EVENT_DISCONN_NOTIF) { wilc_optaining_ip = false; - PRINT_ER("Received MAC_DISCONNECTED from firmware with reason %d on dev [%p]\n", - pstrDisconnectNotifInfo->u16reason, priv->dev); p2p_local_random = 0x01; p2p_recv_random = 0x00; wilc_ie = false; eth_zero_addr(priv->au8AssociatedBss); - wilc_wlan_set_bssid(priv->dev, NullBssid); + wilc_wlan_set_bssid(priv->dev, NullBssid, STATION_MODE); eth_zero_addr(wilc_connected_ssid); if (!pstrWFIDrv->p2p_connect) wlan_channel = INVALID_CHANNEL; if ((pstrWFIDrv->IFC_UP) && (dev == wl->vif[1]->ndev)) { - pstrDisconnectNotifInfo->u16reason = 3; + pstrDisconnectNotifInfo->reason = 3; } else if ((!pstrWFIDrv->IFC_UP) && (dev == wl->vif[1]->ndev)) { - pstrDisconnectNotifInfo->u16reason = 1; + pstrDisconnectNotifInfo->reason = 1; } - cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, pstrDisconnectNotifInfo->ie, + cfg80211_disconnected(dev, pstrDisconnectNotifInfo->reason, pstrDisconnectNotifInfo->ie, pstrDisconnectNotifInfo->ie_len, false, GFP_KERNEL); } @@ -601,13 +581,12 @@ static int set_channel(struct wiphy *wiphy, vif = netdev_priv(priv->dev); channelnum = ieee80211_frequency_to_channel(chandef->chan->center_freq); - PRINT_D(CFG80211_DBG, "Setting channel %d with frequency %d\n", channelnum, chandef->chan->center_freq); curr_channel = channelnum; result = wilc_set_mac_chnl_num(vif, channelnum); if (result != 0) - PRINT_ER("Error in setting channel %d\n", channelnum); + netdev_err(priv->dev, "Error in setting channel\n"); return result; } @@ -628,38 +607,33 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) priv->u32RcvdChCount = 0; - wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif)); reset_shadow_found(); priv->bCfgScanning = true; if (request->n_channels <= MAX_NUM_SCANNED_NETWORKS) { - for (i = 0; i < request->n_channels; i++) { + for (i = 0; i < request->n_channels; i++) au8ScanChanList[i] = (u8)ieee80211_frequency_to_channel(request->channels[i]->center_freq); - PRINT_INFO(CFG80211_DBG, "ScanChannel List[%d] = %d,", i, au8ScanChanList[i]); - } - - PRINT_D(CFG80211_DBG, "Requested num of scan channel %d\n", request->n_channels); - PRINT_D(CFG80211_DBG, "Scan Request IE len = %zu\n", request->ie_len); - - PRINT_D(CFG80211_DBG, "Number of SSIDs %d\n", request->n_ssids); if (request->n_ssids >= 1) { - strHiddenNetwork.pstrHiddenNetworkInfo = kmalloc(request->n_ssids * sizeof(struct hidden_network), GFP_KERNEL); - strHiddenNetwork.u8ssidnum = request->n_ssids; + strHiddenNetwork.net_info = + kmalloc_array(request->n_ssids, + sizeof(struct hidden_network), + GFP_KERNEL); + if (!strHiddenNetwork.net_info) + return -ENOMEM; + strHiddenNetwork.n_ssids = request->n_ssids; for (i = 0; i < request->n_ssids; i++) { if (request->ssids[i].ssid && request->ssids[i].ssid_len != 0) { - strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid = kmalloc(request->ssids[i].ssid_len, GFP_KERNEL); - memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, request->ssids[i].ssid, request->ssids[i].ssid_len); - strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen = request->ssids[i].ssid_len; + strHiddenNetwork.net_info[i].ssid = kmalloc(request->ssids[i].ssid_len, GFP_KERNEL); + memcpy(strHiddenNetwork.net_info[i].ssid, request->ssids[i].ssid, request->ssids[i].ssid_len); + strHiddenNetwork.net_info[i].ssid_len = request->ssids[i].ssid_len; } else { - PRINT_D(CFG80211_DBG, "Received one NULL SSID\n"); - strHiddenNetwork.u8ssidnum -= 1; + strHiddenNetwork.n_ssids -= 1; } } - PRINT_D(CFG80211_DBG, "Trigger Scan Request\n"); s32Error = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN, au8ScanChanList, request->n_channels, @@ -667,7 +641,6 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) request->ie_len, CfgScanResult, (void *)priv, &strHiddenNetwork); } else { - PRINT_D(CFG80211_DBG, "Trigger Scan Request\n"); s32Error = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN, au8ScanChanList, request->n_channels, @@ -676,14 +649,11 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) (void *)priv, NULL); } } else { - PRINT_ER("Requested num of scanned channels is greater than the max, supported" - " channels\n"); + netdev_err(priv->dev, "Requested scanned channels over\n"); } - if (s32Error != 0) { + if (s32Error != 0) s32Error = -EBUSY; - PRINT_WRN(CFG80211_DBG, "Device is busy: Error(%d)\n", s32Error); - } return s32Error; } @@ -695,98 +665,52 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, u32 i; u8 u8security = NO_ENCRYPT; enum AUTHTYPE tenuAuth_type = ANY; - char *pcgroup_encrypt_val = NULL; - char *pccipher_group = NULL; - char *pcwpa_version = NULL; struct wilc_priv *priv; struct host_if_drv *pstrWFIDrv; - tstrNetworkInfo *pstrNetworkInfo = NULL; + struct network_info *pstrNetworkInfo = NULL; struct wilc_vif *vif; wilc_connecting = 1; priv = wiphy_priv(wiphy); vif = netdev_priv(priv->dev); - pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv); - - wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif)); + pstrWFIDrv = (struct host_if_drv *)priv->hif_drv; - PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv); - if (!(strncmp(sme->ssid, "DIRECT-", 7))) { - PRINT_D(CFG80211_DBG, "Connected to Direct network,OBSS disabled\n"); + if (!(strncmp(sme->ssid, "DIRECT-", 7))) pstrWFIDrv->p2p_connect = 1; - } else { + else pstrWFIDrv->p2p_connect = 0; - } - PRINT_INFO(CFG80211_DBG, "Required SSID = %s\n , AuthType = %d\n", sme->ssid, sme->auth_type); for (i = 0; i < last_scanned_cnt; i++) { - if ((sme->ssid_len == last_scanned_shadow[i].u8SsidLen) && - memcmp(last_scanned_shadow[i].au8ssid, + if ((sme->ssid_len == last_scanned_shadow[i].ssid_len) && + memcmp(last_scanned_shadow[i].ssid, sme->ssid, sme->ssid_len) == 0) { - PRINT_INFO(CFG80211_DBG, "Network with required SSID is found %s\n", sme->ssid); - if (!sme->bssid) { - PRINT_INFO(CFG80211_DBG, "BSSID is not passed from the user\n"); + if (!sme->bssid) break; - } else { - if (memcmp(last_scanned_shadow[i].au8bssid, + else + if (memcmp(last_scanned_shadow[i].bssid, sme->bssid, - ETH_ALEN) == 0) { - PRINT_INFO(CFG80211_DBG, "BSSID is passed from the user and matched\n"); + ETH_ALEN) == 0) break; - } - } } } if (i < last_scanned_cnt) { - PRINT_D(CFG80211_DBG, "Required bss is in scan results\n"); - pstrNetworkInfo = &last_scanned_shadow[i]; - - PRINT_INFO(CFG80211_DBG, "network BSSID to be associated: %x%x%x%x%x%x\n", - pstrNetworkInfo->au8bssid[0], pstrNetworkInfo->au8bssid[1], - pstrNetworkInfo->au8bssid[2], pstrNetworkInfo->au8bssid[3], - pstrNetworkInfo->au8bssid[4], pstrNetworkInfo->au8bssid[5]); } else { s32Error = -ENOENT; - if (last_scanned_cnt == 0) - PRINT_D(CFG80211_DBG, "No Scan results yet\n"); - else - PRINT_D(CFG80211_DBG, "Required bss not in scan results: Error(%d)\n", s32Error); - - goto done; + wilc_connecting = 0; + return s32Error; } - priv->WILC_WFI_wep_default = 0; memset(priv->WILC_WFI_wep_key, 0, sizeof(priv->WILC_WFI_wep_key)); memset(priv->WILC_WFI_wep_key_len, 0, sizeof(priv->WILC_WFI_wep_key_len)); - PRINT_INFO(CFG80211_DBG, "sme->crypto.wpa_versions=%x\n", sme->crypto.wpa_versions); - PRINT_INFO(CFG80211_DBG, "sme->crypto.cipher_group=%x\n", sme->crypto.cipher_group); - - PRINT_INFO(CFG80211_DBG, "sme->crypto.n_ciphers_pairwise=%d\n", sme->crypto.n_ciphers_pairwise); - - if (INFO) { - for (i = 0; i < sme->crypto.n_ciphers_pairwise; i++) - PRINT_D(CORECONFIG_DBG, "sme->crypto.ciphers_pairwise[%d]=%x\n", i, sme->crypto.ciphers_pairwise[i]); - } - if (sme->crypto.cipher_group != NO_ENCRYPT) { - pcwpa_version = "Default"; - PRINT_D(CORECONFIG_DBG, ">> sme->crypto.wpa_versions: %x\n", sme->crypto.wpa_versions); if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP40) { u8security = ENCRYPT_ENABLED | WEP; - pcgroup_encrypt_val = "WEP40"; - pccipher_group = "WLAN_CIPHER_SUITE_WEP40"; - PRINT_INFO(CFG80211_DBG, "WEP Default Key Idx = %d\n", sme->key_idx); - if (INFO) { - for (i = 0; i < sme->key_len; i++) - PRINT_D(CORECONFIG_DBG, "WEP Key Value[%d] = %d\n", i, sme->key[i]); - } - priv->WILC_WFI_wep_default = sme->key_idx; priv->WILC_WFI_wep_key_len[sme->key_idx] = sme->key_len; memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len); @@ -801,10 +725,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, sme->key_idx); } else if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104) { u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED; - pcgroup_encrypt_val = "WEP104"; - pccipher_group = "WLAN_CIPHER_SUITE_WEP104"; - priv->WILC_WFI_wep_default = sme->key_idx; priv->WILC_WFI_wep_key_len[sme->key_idx] = sme->key_len; memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len); @@ -820,31 +741,21 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) { if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP) { u8security = ENCRYPT_ENABLED | WPA2 | TKIP; - pcgroup_encrypt_val = "WPA2_TKIP"; - pccipher_group = "TKIP"; } else { u8security = ENCRYPT_ENABLED | WPA2 | AES; - pcgroup_encrypt_val = "WPA2_AES"; - pccipher_group = "AES"; } - pcwpa_version = "WPA_VERSION_2"; } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) { if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP) { u8security = ENCRYPT_ENABLED | WPA | TKIP; - pcgroup_encrypt_val = "WPA_TKIP"; - pccipher_group = "TKIP"; } else { u8security = ENCRYPT_ENABLED | WPA | AES; - pcgroup_encrypt_val = "WPA_AES"; - pccipher_group = "AES"; } - pcwpa_version = "WPA_VERSION_1"; } else { s32Error = -ENOTSUPP; - PRINT_ER("Not supported cipher: Error(%d)\n", s32Error); - - goto done; + netdev_err(dev, "Not supported cipher\n"); + wilc_connecting = 0; + return s32Error; } } @@ -859,22 +770,17 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, } } - PRINT_D(CFG80211_DBG, "Adding key with cipher group = %x\n", sme->crypto.cipher_group); - - PRINT_D(CFG80211_DBG, "Authentication Type = %d\n", sme->auth_type); switch (sme->auth_type) { case NL80211_AUTHTYPE_OPEN_SYSTEM: - PRINT_D(CFG80211_DBG, "In OPEN SYSTEM\n"); tenuAuth_type = OPEN_SYSTEM; break; case NL80211_AUTHTYPE_SHARED_KEY: tenuAuth_type = SHARED_KEY; - PRINT_D(CFG80211_DBG, "In SHARED KEY\n"); break; default: - PRINT_D(CFG80211_DBG, "Automatic Authentation type = %d\n", sme->auth_type); + break; } if (sme->crypto.n_akm_suites) { @@ -888,33 +794,26 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, } } - - PRINT_INFO(CFG80211_DBG, "Required Channel = %d\n", pstrNetworkInfo->u8channel); - - PRINT_INFO(CFG80211_DBG, "Group encryption value = %s\n Cipher Group = %s\n WPA version = %s\n", - pcgroup_encrypt_val, pccipher_group, pcwpa_version); - - curr_channel = pstrNetworkInfo->u8channel; + curr_channel = pstrNetworkInfo->ch; if (!pstrWFIDrv->p2p_connect) - wlan_channel = pstrNetworkInfo->u8channel; + wlan_channel = pstrNetworkInfo->ch; - wilc_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid); + wilc_wlan_set_bssid(dev, pstrNetworkInfo->bssid, STATION_MODE); - s32Error = wilc_set_join_req(vif, pstrNetworkInfo->au8bssid, sme->ssid, + s32Error = wilc_set_join_req(vif, pstrNetworkInfo->bssid, sme->ssid, sme->ssid_len, sme->ie, sme->ie_len, CfgConnectResult, (void *)priv, u8security, tenuAuth_type, - pstrNetworkInfo->u8channel, - pstrNetworkInfo->pJoinParams); + pstrNetworkInfo->ch, + pstrNetworkInfo->join_params); if (s32Error != 0) { - PRINT_ER("wilc_set_join_req(): Error(%d)\n", s32Error); + netdev_err(dev, "wilc_set_join_req(): Error\n"); s32Error = -ENOENT; - goto done; + wilc_connecting = 0; + return s32Error; } -done: - return s32Error; } @@ -930,12 +829,10 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co priv = wiphy_priv(wiphy); vif = netdev_priv(priv->dev); - pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; + pstrWFIDrv = (struct host_if_drv *)priv->hif_drv; if (!pstrWFIDrv->p2p_connect) wlan_channel = INVALID_CHANNEL; - wilc_wlan_set_bssid(priv->dev, NullBssid); - - PRINT_D(CFG80211_DBG, "Disconnecting with reason code(%d)\n", reason_code); + wilc_wlan_set_bssid(priv->dev, NullBssid, STATION_MODE); p2p_local_random = 0x01; p2p_recv_random = 0x00; @@ -944,7 +841,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co s32Error = wilc_disconnect(vif, reason_code); if (s32Error != 0) { - PRINT_ER("Error in disconnecting: Error(%d)\n", s32Error); + netdev_err(priv->dev, "Error in disconnecting\n"); s32Error = -EINVAL; } @@ -957,7 +854,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, { s32 s32Error = 0, KeyLen = params->key_len; - u32 i; struct wilc_priv *priv; const u8 *pu8RxMic = NULL; const u8 *pu8TxMic = NULL; @@ -972,29 +868,13 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, vif = netdev_priv(netdev); wl = vif->wilc; - PRINT_D(CFG80211_DBG, "Adding key with cipher suite = %x\n", params->cipher); - - PRINT_D(CFG80211_DBG, "%p %p %d\n", wiphy, netdev, key_index); - - PRINT_D(CFG80211_DBG, "key %x %x %x\n", params->key[0], - params->key[1], - params->key[2]); - - switch (params->cipher) { case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: if (priv->wdev->iftype == NL80211_IFTYPE_AP) { - priv->WILC_WFI_wep_default = key_index; priv->WILC_WFI_wep_key_len[key_index] = params->key_len; memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len); - PRINT_D(CFG80211_DBG, "Adding AP WEP Default key Idx = %d\n", key_index); - PRINT_D(CFG80211_DBG, "Adding AP WEP Key len= %d\n", params->key_len); - - for (i = 0; i < params->key_len; i++) - PRINT_D(CFG80211_DBG, "WEP AP key val[%d] = %x\n", i, params->key[i]); - tenuAuth_type = OPEN_SYSTEM; if (params->cipher == WLAN_CIPHER_SUITE_WEP40) @@ -1008,16 +888,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, break; } if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) { - priv->WILC_WFI_wep_default = key_index; priv->WILC_WFI_wep_key_len[key_index] = params->key_len; memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len); - PRINT_D(CFG80211_DBG, "Adding WEP Default key Idx = %d\n", key_index); - PRINT_D(CFG80211_DBG, "Adding WEP Key length = %d\n", params->key_len); - if (INFO) { - for (i = 0; i < params->key_len; i++) - PRINT_INFO(CFG80211_DBG, "WEP key value[%d] = %d\n", i, params->key[i]); - } wilc_add_wep_key_bss_sta(vif, params->key, params->key_len, key_index); } @@ -1068,22 +941,12 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, priv->wilc_gtk[key_index]->key_len = params->key_len; priv->wilc_gtk[key_index]->seq_len = params->seq_len; - if (INFO) { - for (i = 0; i < params->key_len; i++) - PRINT_INFO(CFG80211_DBG, "Adding group key value[%d] = %x\n", i, params->key[i]); - for (i = 0; i < params->seq_len; i++) - PRINT_INFO(CFG80211_DBG, "Adding group seq value[%d] = %x\n", i, params->seq[i]); - } - - wilc_add_rx_gtk(vif, params->key, KeyLen, key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, AP_MODE, u8gmode); } else { - PRINT_INFO(CFG80211_DBG, "STA Address: %x%x%x%x%x\n", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4]); - if (params->cipher == WLAN_CIPHER_SUITE_TKIP) u8pmode = ENCRYPT_ENABLED | WPA | TKIP; else @@ -1105,14 +968,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, if ((params->seq_len) > 0) priv->wilc_ptk[key_index]->seq = kmalloc(params->seq_len, GFP_KERNEL); - if (INFO) { - for (i = 0; i < params->key_len; i++) - PRINT_INFO(CFG80211_DBG, "Adding pairwise key value[%d] = %x\n", i, params->key[i]); - - for (i = 0; i < params->seq_len; i++) - PRINT_INFO(CFG80211_DBG, "Adding group seq value[%d] = %x\n", i, params->seq[i]); - } - memcpy(priv->wilc_ptk[key_index]->key, params->key, params->key_len); if ((params->seq_len) > 0) @@ -1156,10 +1011,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, memcpy(g_key_gtk_params.seq, params->seq, params->seq_len); } g_key_gtk_params.cipher = params->cipher; - - PRINT_D(CFG80211_DBG, "key %x %x %x\n", g_key_gtk_params.key[0], - g_key_gtk_params.key[1], - g_key_gtk_params.key[2]); g_gtk_keys_saved = true; } @@ -1193,27 +1044,18 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, memcpy(g_key_ptk_params.seq, params->seq, params->seq_len); } g_key_ptk_params.cipher = params->cipher; - - PRINT_D(CFG80211_DBG, "key %x %x %x\n", g_key_ptk_params.key[0], - g_key_ptk_params.key[1], - g_key_ptk_params.key[2]); g_ptk_keys_saved = true; } wilc_add_ptk(vif, params->key, KeyLen, mac_addr, pu8RxMic, pu8TxMic, STATION_MODE, u8mode, key_index); - PRINT_D(CFG80211_DBG, "Adding pairwise key\n"); - if (INFO) { - for (i = 0; i < params->key_len; i++) - PRINT_INFO(CFG80211_DBG, "Adding pairwise key value[%d] = %d\n", i, params->key[i]); - } } } break; default: - PRINT_ER("Not supported cipher: Error(%d)\n", s32Error); + netdev_err(netdev, "Not supported cipher\n"); s32Error = -ENOTSUPP; } @@ -1270,18 +1112,14 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, kfree(g_key_gtk_params.seq); g_key_gtk_params.seq = NULL; - wilc_set_machw_change_vir_if(netdev, false); } if (key_index >= 0 && key_index <= 3) { memset(priv->WILC_WFI_wep_key[key_index], 0, priv->WILC_WFI_wep_key_len[key_index]); priv->WILC_WFI_wep_key_len[key_index] = 0; - - PRINT_D(CFG80211_DBG, "Removing WEP key with index = %d\n", key_index); wilc_remove_wep_key(vif, key_index); } else { - PRINT_D(CFG80211_DBG, "Removing all installed keys\n"); - wilc_remove_key(priv->hWILCWFIDrv, mac_addr); + wilc_remove_key(priv->hif_drv, mac_addr); } return 0; @@ -1293,26 +1131,17 @@ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, { struct wilc_priv *priv; struct key_params key_params; - u32 i; priv = wiphy_priv(wiphy); if (!pairwise) { - PRINT_D(CFG80211_DBG, "Getting group key idx: %x\n", key_index); - key_params.key = priv->wilc_gtk[key_index]->key; key_params.cipher = priv->wilc_gtk[key_index]->cipher; key_params.key_len = priv->wilc_gtk[key_index]->key_len; key_params.seq = priv->wilc_gtk[key_index]->seq; key_params.seq_len = priv->wilc_gtk[key_index]->seq_len; - if (INFO) { - for (i = 0; i < key_params.key_len; i++) - PRINT_INFO(CFG80211_DBG, "Retrieved key value %x\n", key_params.key[i]); - } } else { - PRINT_D(CFG80211_DBG, "Getting pairwise key\n"); - key_params.key = priv->wilc_ptk[key_index]->key; key_params.cipher = priv->wilc_ptk[key_index]->cipher; key_params.key_len = priv->wilc_ptk[key_index]->key_len; @@ -1334,11 +1163,7 @@ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 ke priv = wiphy_priv(wiphy); vif = netdev_priv(priv->dev); - PRINT_D(CFG80211_DBG, "Setting default key with idx = %d\n", key_index); - - if (key_index != priv->WILC_WFI_wep_default) { - wilc_set_wep_default_keyid(vif, key_index); - } + wilc_set_wep_default_keyid(vif, key_index); return 0; } @@ -1355,10 +1180,6 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, vif = netdev_priv(dev); if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) { - PRINT_D(HOSTAPD_DBG, "Getting station parameters\n"); - - PRINT_INFO(HOSTAPD_DBG, ": %x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4]); - for (i = 0; i < NUM_STA_ASSOCIATED; i++) { if (!(memcmp(mac, priv->assoc_stainfo.au8Sta_AssociatedBss[i], ETH_ALEN))) { associatedsta = i; @@ -1367,7 +1188,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, } if (associatedsta == -1) { - PRINT_ER("Station required is not associated\n"); + netdev_err(dev, "sta required is not associated\n"); return -ENOENT; } @@ -1375,7 +1196,6 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, wilc_get_inactive_time(vif, mac, &inactive_time); sinfo->inactive_time = 1000 * inactive_time; - PRINT_D(CFG80211_DBG, "Inactive time %d\n", sinfo->inactive_time); } if (vif->iftype == STATION_MODE) { @@ -1400,9 +1220,6 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, wilc_enable_tcp_ack_filter(true); else if (strStatistics.link_speed != DEFAULT_LINK_SPEED) wilc_enable_tcp_ack_filter(false); - - PRINT_D(CORECONFIG_DBG, "*** stats[%d][%d][%d][%d][%d]\n", sinfo->signal, sinfo->rx_packets, sinfo->tx_packets, - sinfo->tx_failed, sinfo->txrate.legacy); } return 0; } @@ -1410,14 +1227,13 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, static int change_bss(struct wiphy *wiphy, struct net_device *dev, struct bss_parameters *params) { - PRINT_D(CFG80211_DBG, "Changing Bss parametrs\n"); return 0; } static int set_wiphy_params(struct wiphy *wiphy, u32 changed) { s32 s32Error = 0; - struct cfg_param_val pstrCfgParamVal; + struct cfg_param_attr pstrCfgParamVal; struct wilc_priv *priv; struct wilc_vif *vif; @@ -1425,37 +1241,28 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed) vif = netdev_priv(priv->dev); pstrCfgParamVal.flag = 0; - PRINT_D(CFG80211_DBG, "Setting Wiphy params\n"); if (changed & WIPHY_PARAM_RETRY_SHORT) { - PRINT_D(CFG80211_DBG, "Setting WIPHY_PARAM_RETRY_SHORT %d\n", - priv->dev->ieee80211_ptr->wiphy->retry_short); pstrCfgParamVal.flag |= RETRY_SHORT; pstrCfgParamVal.short_retry_limit = priv->dev->ieee80211_ptr->wiphy->retry_short; } if (changed & WIPHY_PARAM_RETRY_LONG) { - PRINT_D(CFG80211_DBG, "Setting WIPHY_PARAM_RETRY_LONG %d\n", priv->dev->ieee80211_ptr->wiphy->retry_long); pstrCfgParamVal.flag |= RETRY_LONG; pstrCfgParamVal.long_retry_limit = priv->dev->ieee80211_ptr->wiphy->retry_long; } if (changed & WIPHY_PARAM_FRAG_THRESHOLD) { - PRINT_D(CFG80211_DBG, "Setting WIPHY_PARAM_FRAG_THRESHOLD %d\n", priv->dev->ieee80211_ptr->wiphy->frag_threshold); pstrCfgParamVal.flag |= FRAG_THRESHOLD; pstrCfgParamVal.frag_threshold = priv->dev->ieee80211_ptr->wiphy->frag_threshold; } if (changed & WIPHY_PARAM_RTS_THRESHOLD) { - PRINT_D(CFG80211_DBG, "Setting WIPHY_PARAM_RTS_THRESHOLD %d\n", priv->dev->ieee80211_ptr->wiphy->rts_threshold); - pstrCfgParamVal.flag |= RTS_THRESHOLD; pstrCfgParamVal.rts_threshold = priv->dev->ieee80211_ptr->wiphy->rts_threshold; } - PRINT_D(CFG80211_DBG, "Setting CFG params in the host interface\n"); s32Error = wilc_hif_set_cfg(vif, &pstrCfgParamVal); if (s32Error) - PRINT_ER("Error in setting WIPHY PARAMS\n"); - + netdev_err(priv->dev, "Error in setting WIPHY PARAMS\n"); return s32Error; } @@ -1470,19 +1277,16 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, struct wilc_priv *priv = wiphy_priv(wiphy); vif = netdev_priv(priv->dev); - PRINT_D(CFG80211_DBG, "Setting PMKSA\n"); for (i = 0; i < priv->pmkid_list.numpmkid; i++) { if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, ETH_ALEN)) { flag = PMKID_FOUND; - PRINT_D(CFG80211_DBG, "PMKID already exists\n"); break; } } if (i < WILC_MAX_NUM_PMKIDS) { - PRINT_D(CFG80211_DBG, "Setting PMKID in private structure\n"); memcpy(priv->pmkid_list.pmkidlist[i].bssid, pmksa->bssid, ETH_ALEN); memcpy(priv->pmkid_list.pmkidlist[i].pmkid, pmksa->pmkid, @@ -1490,14 +1294,13 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, if (!(flag == PMKID_FOUND)) priv->pmkid_list.numpmkid++; } else { - PRINT_ER("Invalid PMKID index\n"); + netdev_err(netdev, "Invalid PMKID index\n"); s32Error = -EINVAL; } - if (!s32Error) { - PRINT_D(CFG80211_DBG, "Setting pmkid in the host interface\n"); + if (!s32Error) s32Error = wilc_set_pmkid_info(vif, &priv->pmkid_list); - } + return s32Error; } @@ -1509,12 +1312,9 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, struct wilc_priv *priv = wiphy_priv(wiphy); - PRINT_D(CFG80211_DBG, "Deleting PMKSA keys\n"); - for (i = 0; i < priv->pmkid_list.numpmkid; i++) { if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, ETH_ALEN)) { - PRINT_D(CFG80211_DBG, "Reseting PMKID values\n"); memset(&priv->pmkid_list.pmkidlist[i], 0, sizeof(struct host_if_pmkid)); break; } @@ -1541,8 +1341,6 @@ static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) { struct wilc_priv *priv = wiphy_priv(wiphy); - PRINT_D(CFG80211_DBG, "Flushing PMKID key values\n"); - memset(&priv->pmkid_list, 0, sizeof(struct host_if_pmkid_attr)); return 0; @@ -1569,7 +1367,6 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) } if (wlan_channel != INVALID_CHANNEL) { if (channel_list_attr_index) { - PRINT_D(GENERIC_DBG, "Modify channel list attribute\n"); for (i = channel_list_attr_index + 3; i < ((channel_list_attr_index + 3) + buf[channel_list_attr_index + 1]); i++) { if (buf[i] == 0x51) { for (j = i + 2; j < ((i + 2) + buf[i + 1]); j++) { @@ -1581,7 +1378,6 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) } if (op_channel_attr_index) { - PRINT_D(GENERIC_DBG, "Modify operating channel attribute\n"); buf[op_channel_attr_index + 6] = 0x51; buf[op_channel_attr_index + 7] = wlan_channel; } @@ -1611,7 +1407,6 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftyp } if (wlan_channel != INVALID_CHANNEL && bOperChan) { if (channel_list_attr_index) { - PRINT_D(GENERIC_DBG, "Modify channel list attribute\n"); for (i = channel_list_attr_index + 3; i < ((channel_list_attr_index + 3) + buf[channel_list_attr_index + 1]); i++) { if (buf[i] == 0x51) { for (j = i + 2; j < ((i + 2) + buf[i + 1]); j++) { @@ -1623,14 +1418,13 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftyp } if (op_channel_attr_index) { - PRINT_D(GENERIC_DBG, "Modify operating channel attribute\n"); buf[op_channel_attr_index + 6] = 0x51; buf[op_channel_attr_index + 7] = wlan_channel; } } } -void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) +void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size) { struct wilc_priv *priv; u32 header, pkt_offset; @@ -1639,7 +1433,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) s32 s32Freq; priv = wiphy_priv(dev->ieee80211_ptr->wiphy); - pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; + pstrWFIDrv = (struct host_if_drv *)priv->hif_drv; memcpy(&header, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET); @@ -1647,41 +1441,29 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) if (pkt_offset & IS_MANAGMEMENT_CALLBACK) { if (buff[FRAME_TYPE_ID] == IEEE80211_STYPE_PROBE_RESP) { - PRINT_D(GENERIC_DBG, "Probe response ACK\n"); cfg80211_mgmt_tx_status(priv->wdev, priv->u64tx_cookie, buff, size, true, GFP_KERNEL); return; } else { - if (pkt_offset & IS_MGMT_STATUS_SUCCES) { - PRINT_D(GENERIC_DBG, "Success Ack - Action frame category: %x Action Subtype: %d Dialog T: %x OR %x\n", buff[ACTION_CAT_ID], buff[ACTION_SUBTYPE_ID], - buff[ACTION_SUBTYPE_ID + 1], buff[P2P_PUB_ACTION_SUBTYPE + 1]); + if (pkt_offset & IS_MGMT_STATUS_SUCCES) cfg80211_mgmt_tx_status(priv->wdev, priv->u64tx_cookie, buff, size, true, GFP_KERNEL); - } else { - PRINT_D(GENERIC_DBG, "Fail Ack - Action frame category: %x Action Subtype: %d Dialog T: %x OR %x\n", buff[ACTION_CAT_ID], buff[ACTION_SUBTYPE_ID], - buff[ACTION_SUBTYPE_ID + 1], buff[P2P_PUB_ACTION_SUBTYPE + 1]); + else cfg80211_mgmt_tx_status(priv->wdev, priv->u64tx_cookie, buff, size, false, GFP_KERNEL); - } return; } } else { - PRINT_D(GENERIC_DBG, "Rx Frame Type:%x\n", buff[FRAME_TYPE_ID]); - s32Freq = ieee80211_channel_to_frequency(curr_channel, IEEE80211_BAND_2GHZ); if (ieee80211_is_action(buff[FRAME_TYPE_ID])) { - PRINT_D(GENERIC_DBG, "Rx Action Frame Type: %x %x\n", buff[ACTION_SUBTYPE_ID], buff[P2P_PUB_ACTION_SUBTYPE]); - if (priv->bCfgScanning && time_after_eq(jiffies, (unsigned long)pstrWFIDrv->p2p_timeout)) { - PRINT_D(GENERIC_DBG, "Receiving action frames from wrong channels\n"); + netdev_dbg(dev, "Receiving action wrong ch\n"); return; } if (buff[ACTION_CAT_ID] == PUB_ACTION_ATTR_ID) { switch (buff[ACTION_SUBTYPE_ID]) { case GAS_INTIAL_REQ: - PRINT_D(GENERIC_DBG, "GAS INITIAL REQ %x\n", buff[ACTION_SUBTYPE_ID]); break; case GAS_INTIAL_RSP: - PRINT_D(GENERIC_DBG, "GAS INITIAL RSP %x\n", buff[ACTION_SUBTYPE_ID]); break; case PUBLIC_ACT_VENDORSPEC: @@ -1692,7 +1474,6 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) if (!memcmp(p2p_vendor_spec, &buff[i], 6)) { p2p_recv_random = buff[i + 6]; wilc_ie = true; - PRINT_D(GENERIC_DBG, "WILC Vendor specific IE:%02x\n", p2p_recv_random); break; } } @@ -1709,32 +1490,31 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) } } } else { - PRINT_D(GENERIC_DBG, "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, p2p_recv_random); + netdev_dbg(dev, "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, p2p_recv_random); } } if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP) && (wilc_ie)) { - PRINT_D(GENERIC_DBG, "Sending P2P to host without extra elemnt\n"); cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, 0); return; } break; default: - PRINT_D(GENERIC_DBG, "NOT HANDLED PUBLIC ACTION FRAME TYPE:%x\n", buff[ACTION_SUBTYPE_ID]); + netdev_dbg(dev, "NOT HANDLED PUBLIC ACTION FRAME TYPE:%x\n", buff[ACTION_SUBTYPE_ID]); break; } } } - cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, 0); + cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size, 0); } } static void WILC_WFI_mgmt_tx_complete(void *priv, int status) { - struct p2p_mgmt_data *pv_data = (struct p2p_mgmt_data *)priv; + struct p2p_mgmt_data *pv_data = priv; kfree(pv_data->buff); @@ -1745,9 +1525,7 @@ static void WILC_WFI_RemainOnChannelReady(void *pUserVoid) { struct wilc_priv *priv; - priv = (struct wilc_priv *)pUserVoid; - - PRINT_D(HOSTINF_DBG, "Remain on channel ready\n"); + priv = pUserVoid; priv->bInP2PlistenState = true; @@ -1762,20 +1540,15 @@ static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, u32 u32SessionID) { struct wilc_priv *priv; - priv = (struct wilc_priv *)pUserVoid; + priv = pUserVoid; if (u32SessionID == priv->strRemainOnChanParams.u32ListenSessionID) { - PRINT_D(GENERIC_DBG, "Remain on channel expired\n"); - priv->bInP2PlistenState = false; cfg80211_remain_on_channel_expired(priv->wdev, priv->strRemainOnChanParams.u64ListenCookie, priv->strRemainOnChanParams.pstrListenChan, GFP_KERNEL); - } else { - PRINT_D(GENERIC_DBG, "Received ID 0x%x Expected ID 0x%x (No match)\n", u32SessionID - , priv->strRemainOnChanParams.u32ListenSessionID); } } @@ -1791,11 +1564,8 @@ static int remain_on_channel(struct wiphy *wiphy, priv = wiphy_priv(wiphy); vif = netdev_priv(priv->dev); - PRINT_D(GENERIC_DBG, "Remaining on channel %d\n", chan->hw_value); - - if (wdev->iftype == NL80211_IFTYPE_AP) { - PRINT_D(GENERIC_DBG, "Required remain-on-channel while in AP mode"); + netdev_dbg(vif->ndev, "Required while in AP mode\n"); return s32Error; } @@ -1826,8 +1596,6 @@ static int cancel_remain_on_channel(struct wiphy *wiphy, priv = wiphy_priv(wiphy); vif = netdev_priv(priv->dev); - PRINT_D(CFG80211_DBG, "Cancel remain on channel\n"); - s32Error = wilc_listen_state_expired(vif, priv->strRemainOnChanParams.u32ListenSessionID); return s32Error; } @@ -1851,7 +1619,7 @@ static int mgmt_tx(struct wiphy *wiphy, vif = netdev_priv(wdev->netdev); priv = wiphy_priv(wiphy); - pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; + pstrWFIDrv = (struct host_if_drv *)priv->hif_drv; *cookie = (unsigned long)buf; priv->u64tx_cookie = *cookie; @@ -1859,49 +1627,36 @@ static int mgmt_tx(struct wiphy *wiphy, if (ieee80211_is_mgmt(mgmt->frame_control)) { mgmt_tx = kmalloc(sizeof(struct p2p_mgmt_data), GFP_KERNEL); - if (!mgmt_tx) { - PRINT_ER("Failed to allocate memory for mgmt_tx structure\n"); + if (!mgmt_tx) return -EFAULT; - } + mgmt_tx->buff = kmalloc(buf_len, GFP_KERNEL); if (!mgmt_tx->buff) { - PRINT_ER("Failed to allocate memory for mgmt_tx buff\n"); kfree(mgmt_tx); - return -EFAULT; + return -ENOMEM; } + memcpy(mgmt_tx->buff, buf, len); mgmt_tx->size = len; if (ieee80211_is_probe_resp(mgmt->frame_control)) { - PRINT_D(GENERIC_DBG, "TX: Probe Response\n"); - PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value); wilc_set_mac_chnl_num(vif, chan->hw_value); curr_channel = chan->hw_value; } else if (ieee80211_is_action(mgmt->frame_control)) { - PRINT_D(GENERIC_DBG, "ACTION FRAME:%x\n", (u16)mgmt->frame_control); - - if (buf[ACTION_CAT_ID] == PUB_ACTION_ATTR_ID) { if (buf[ACTION_SUBTYPE_ID] != PUBLIC_ACT_VENDORSPEC || buf[P2P_PUB_ACTION_SUBTYPE] != GO_NEG_CONF) { - PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value); wilc_set_mac_chnl_num(vif, chan->hw_value); curr_channel = chan->hw_value; } switch (buf[ACTION_SUBTYPE_ID]) { case GAS_INTIAL_REQ: - { - PRINT_D(GENERIC_DBG, "GAS INITIAL REQ %x\n", buf[ACTION_SUBTYPE_ID]); break; - } case GAS_INTIAL_RSP: - { - PRINT_D(GENERIC_DBG, "GAS INITIAL RSP %x\n", buf[ACTION_SUBTYPE_ID]); break; - } case PUBLIC_ACT_VENDORSPEC: { @@ -1916,8 +1671,6 @@ static int mgmt_tx(struct wiphy *wiphy, if ((buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP || buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP)) { if (p2p_local_random > p2p_recv_random) { - PRINT_D(GENERIC_DBG, "LOCAL WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, p2p_recv_random); - for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) { if (buf[i] == P2PELEM_ATTR_ID && !(memcmp(p2p_oui, &buf[i + 2], 4))) { if (buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP) @@ -1933,13 +1686,11 @@ static int mgmt_tx(struct wiphy *wiphy, mgmt_tx->buff[len + sizeof(p2p_vendor_spec)] = p2p_local_random; mgmt_tx->size = buf_len; } - } else { - PRINT_D(GENERIC_DBG, "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, p2p_recv_random); } } } else { - PRINT_D(GENERIC_DBG, "Not a P2P public action frame\n"); + netdev_dbg(vif->ndev, "Not a P2P public action frame\n"); } break; @@ -1947,24 +1698,18 @@ static int mgmt_tx(struct wiphy *wiphy, default: { - PRINT_D(GENERIC_DBG, "NOT HANDLED PUBLIC ACTION FRAME TYPE:%x\n", buf[ACTION_SUBTYPE_ID]); + netdev_dbg(vif->ndev, "NOT HANDLED PUBLIC ACTION FRAME TYPE:%x\n", buf[ACTION_SUBTYPE_ID]); break; } } } - PRINT_D(GENERIC_DBG, "TX: ACTION FRAME Type:%x : Chan:%d\n", buf[ACTION_SUBTYPE_ID], chan->hw_value); pstrWFIDrv->p2p_timeout = (jiffies + msecs_to_jiffies(wait)); - - PRINT_D(GENERIC_DBG, "Current Jiffies: %lu Timeout:%llu\n", - jiffies, pstrWFIDrv->p2p_timeout); } wilc_wlan_txq_add_mgmt_pkt(wdev->netdev, mgmt_tx, mgmt_tx->buff, mgmt_tx->size, WILC_WFI_mgmt_tx_complete); - } else { - PRINT_D(GENERIC_DBG, "This function transmits only management frames\n"); } return 0; } @@ -1977,10 +1722,7 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy, struct host_if_drv *pstrWFIDrv; priv = wiphy_priv(wiphy); - pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; - - - PRINT_D(GENERIC_DBG, "Tx Cancel wait :%lu\n", jiffies); + pstrWFIDrv = (struct host_if_drv *)priv->hif_drv; pstrWFIDrv->p2p_timeout = jiffies; if (!priv->bInP2PlistenState) { @@ -2007,7 +1749,6 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, if (!frame_type) return; - PRINT_D(GENERIC_DBG, "Frame registering Frame Type: %x: Boolean: %d\n", frame_type, reg); switch (frame_type) { case PROBE_REQ: { @@ -2029,17 +1770,14 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, } } - if (!wl->initialized) { - PRINT_D(GENERIC_DBG, "Return since mac is closed\n"); + if (!wl->initialized) return; - } wilc_frame_register(vif, frame_type, reg); } static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev, s32 rssi_thold, u32 rssi_hyst) { - PRINT_D(CFG80211_DBG, "Setting CQM RSSi Function\n"); return 0; } @@ -2049,8 +1787,6 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev, struct wilc_priv *priv; struct wilc_vif *vif; - PRINT_D(CFG80211_DBG, "Dumping station information\n"); - if (idx != 0) return -ENOENT; @@ -2070,17 +1806,13 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, struct wilc_priv *priv; struct wilc_vif *vif; - PRINT_D(CFG80211_DBG, " Power save Enabled= %d , TimeOut = %d\n", enabled, timeout); - if (!wiphy) return -ENOENT; priv = wiphy_priv(wiphy); vif = netdev_priv(priv->dev); - if (!priv->hWILCWFIDrv) { - PRINT_ER("Driver is NULL\n"); + if (!priv->hif_drv) return -EIO; - } if (wilc_enable_ps) wilc_set_power_mgmt(vif, enabled, timeout); @@ -2094,286 +1826,73 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, { struct wilc_priv *priv; struct wilc_vif *vif; - u8 interface_type; - u16 TID = 0; - u8 i; struct wilc *wl; vif = netdev_priv(dev); priv = wiphy_priv(wiphy); wl = vif->wilc; - - PRINT_D(HOSTAPD_DBG, "In Change virtual interface function\n"); - PRINT_D(HOSTAPD_DBG, "Wireless interface name =%s\n", dev->name); p2p_local_random = 0x01; p2p_recv_random = 0x00; wilc_ie = false; wilc_optaining_ip = false; del_timer(&wilc_during_ip_timer); - PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n"); - - if (g_ptk_keys_saved && g_gtk_keys_saved) { - wilc_set_machw_change_vir_if(dev, true); - } switch (type) { case NL80211_IFTYPE_STATION: wilc_connecting = 0; - PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_STATION\n"); - dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; vif->monitor_flag = 0; vif->iftype = STATION_MODE; + wilc_set_operation_mode(vif, STATION_MODE); memset(priv->assoc_stainfo.au8Sta_AssociatedBss, 0, MAX_NUM_STA * ETH_ALEN); - interface_type = vif->iftype; - vif->iftype = STATION_MODE; - - if (wl->initialized) { - wilc_del_all_rx_ba_session(vif, wl->vif[0]->bssid, - TID); - wilc_wait_msg_queue_idle(); - - up(&wl->cfg_event); - - wilc1000_wlan_deinit(dev); - wilc1000_wlan_init(dev, vif); - wilc_initialized = 1; - vif->iftype = interface_type; - - wilc_set_wfi_drv_handler(vif, - wilc_get_vif_idx(wl->vif[0])); - wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr); - wilc_set_operation_mode(vif, STATION_MODE); - - if (g_wep_keys_saved) { - wilc_set_wep_default_keyid(wl->vif[0], - g_key_wep_params.key_idx); - wilc_add_wep_key_bss_sta(wl->vif[0], - g_key_wep_params.key, - g_key_wep_params.key_len, - g_key_wep_params.key_idx); - } - wilc_flush_join_req(vif); - - if (g_ptk_keys_saved && g_gtk_keys_saved) { - PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0], - g_key_ptk_params.key[1], - g_key_ptk_params.key[2]); - PRINT_D(CFG80211_DBG, "gtk %x %x %x\n", g_key_gtk_params.key[0], - g_key_gtk_params.key[1], - g_key_gtk_params.key[2]); - add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy, - wl->vif[0]->ndev, - g_add_ptk_key_params.key_idx, - g_add_ptk_key_params.pairwise, - g_add_ptk_key_params.mac_addr, - (struct key_params *)(&g_key_ptk_params)); - - add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy, - wl->vif[0]->ndev, - g_add_gtk_key_params.key_idx, - g_add_gtk_key_params.pairwise, - g_add_gtk_key_params.mac_addr, - (struct key_params *)(&g_key_gtk_params)); - } - - if (wl->initialized) { - for (i = 0; i < num_reg_frame; i++) { - PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, - vif->g_struct_frame_reg[i].reg); - wilc_frame_register(vif, - vif->g_struct_frame_reg[i].frame_type, - vif->g_struct_frame_reg[i].reg); - } - } - - wilc_enable_ps = true; - wilc_set_power_mgmt(vif, 1, 0); - } + wilc_enable_ps = true; + wilc_set_power_mgmt(vif, 1, 0); break; case NL80211_IFTYPE_P2P_CLIENT: - wilc_enable_ps = false; - wilc_set_power_mgmt(vif, 0, 0); wilc_connecting = 0; - PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_P2P_CLIENT\n"); - - wilc_del_all_rx_ba_session(vif, wl->vif[0]->bssid, TID); - dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; vif->monitor_flag = 0; - - PRINT_D(HOSTAPD_DBG, "Downloading P2P_CONCURRENCY_FIRMWARE\n"); vif->iftype = CLIENT_MODE; + wilc_set_operation_mode(vif, STATION_MODE); - - if (wl->initialized) { - wilc_wait_msg_queue_idle(); - - wilc1000_wlan_deinit(dev); - wilc1000_wlan_init(dev, vif); - wilc_initialized = 1; - - wilc_set_wfi_drv_handler(vif, - wilc_get_vif_idx(wl->vif[0])); - wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr); - wilc_set_operation_mode(vif, STATION_MODE); - - if (g_wep_keys_saved) { - wilc_set_wep_default_keyid(wl->vif[0], - g_key_wep_params.key_idx); - wilc_add_wep_key_bss_sta(wl->vif[0], - g_key_wep_params.key, - g_key_wep_params.key_len, - g_key_wep_params.key_idx); - } - - wilc_flush_join_req(vif); - - if (g_ptk_keys_saved && g_gtk_keys_saved) { - PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0], - g_key_ptk_params.key[1], - g_key_ptk_params.key[2]); - PRINT_D(CFG80211_DBG, "gtk %x %x %x\n", g_key_gtk_params.key[0], - g_key_gtk_params.key[1], - g_key_gtk_params.key[2]); - add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy, - wl->vif[0]->ndev, - g_add_ptk_key_params.key_idx, - g_add_ptk_key_params.pairwise, - g_add_ptk_key_params.mac_addr, - (struct key_params *)(&g_key_ptk_params)); - - add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy, - wl->vif[0]->ndev, - g_add_gtk_key_params.key_idx, - g_add_gtk_key_params.pairwise, - g_add_gtk_key_params.mac_addr, - (struct key_params *)(&g_key_gtk_params)); - } - - refresh_scan(priv, 1, true); - wilc_set_machw_change_vir_if(dev, false); - - if (wl->initialized) { - for (i = 0; i < num_reg_frame; i++) { - PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, - vif->g_struct_frame_reg[i].reg); - wilc_frame_register(vif, - vif->g_struct_frame_reg[i].frame_type, - vif->g_struct_frame_reg[i].reg); - } - } - } + wilc_enable_ps = false; + wilc_set_power_mgmt(vif, 0, 0); break; case NL80211_IFTYPE_AP: wilc_enable_ps = false; - PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_AP %d\n", type); dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; vif->iftype = AP_MODE; - PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv); - - PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n"); - wilc_wlan_get_firmware(dev); - - if (wl->initialized) { - vif->iftype = AP_MODE; - wilc_mac_close(dev); - wilc_mac_open(dev); - - for (i = 0; i < num_reg_frame; i++) { - PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, - vif->g_struct_frame_reg[i].reg); - wilc_frame_register(vif, - vif->g_struct_frame_reg[i].frame_type, - vif->g_struct_frame_reg[i].reg); - } + + if (wl->initialized) { + wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif), + 0); + wilc_set_operation_mode(vif, AP_MODE); + wilc_set_power_mgmt(vif, 0, 0); } break; case NL80211_IFTYPE_P2P_GO: - PRINT_D(GENERIC_DBG, "start duringIP timer\n"); - wilc_optaining_ip = true; mod_timer(&wilc_during_ip_timer, jiffies + msecs_to_jiffies(during_ip_time)); - wilc_set_power_mgmt(vif, 0, 0); - wilc_del_all_rx_ba_session(vif, wl->vif[0]->bssid, TID); - wilc_enable_ps = false; - PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n"); + wilc_set_operation_mode(vif, AP_MODE); dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; - - PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv); - - PRINT_D(HOSTAPD_DBG, "Downloading P2P_CONCURRENCY_FIRMWARE\n"); - - vif->iftype = GO_MODE; - wilc_wait_msg_queue_idle(); - wilc1000_wlan_deinit(dev); - wilc1000_wlan_init(dev, vif); - wilc_initialized = 1; - - wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(wl->vif[0])); - wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr); - wilc_set_operation_mode(vif, AP_MODE); - - if (g_wep_keys_saved) { - wilc_set_wep_default_keyid(wl->vif[0], - g_key_wep_params.key_idx); - wilc_add_wep_key_bss_sta(wl->vif[0], - g_key_wep_params.key, - g_key_wep_params.key_len, - g_key_wep_params.key_idx); - } - - wilc_flush_join_req(vif); - - if (g_ptk_keys_saved && g_gtk_keys_saved) { - PRINT_D(CFG80211_DBG, "ptk %x %x %x cipher %x\n", g_key_ptk_params.key[0], - g_key_ptk_params.key[1], - g_key_ptk_params.key[2], - g_key_ptk_params.cipher); - PRINT_D(CFG80211_DBG, "gtk %x %x %x cipher %x\n", g_key_gtk_params.key[0], - g_key_gtk_params.key[1], - g_key_gtk_params.key[2], - g_key_gtk_params.cipher); - add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy, - wl->vif[0]->ndev, - g_add_ptk_key_params.key_idx, - g_add_ptk_key_params.pairwise, - g_add_ptk_key_params.mac_addr, - (struct key_params *)(&g_key_ptk_params)); - - add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy, - wl->vif[0]->ndev, - g_add_gtk_key_params.key_idx, - g_add_gtk_key_params.pairwise, - g_add_gtk_key_params.mac_addr, - (struct key_params *)(&g_key_gtk_params)); - } - - if (wl->initialized) { - for (i = 0; i < num_reg_frame; i++) { - PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, - vif->g_struct_frame_reg[i].reg); - wilc_frame_register(vif, - vif->g_struct_frame_reg[i].frame_type, - vif->g_struct_frame_reg[i].reg); - } - } + wilc_enable_ps = false; + wilc_set_power_mgmt(vif, 0, 0); break; default: - PRINT_ER("Unknown interface type= %d\n", type); + netdev_err(dev, "Unknown interface type= %d\n", type); return -EINVAL; } @@ -2391,18 +1910,15 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev, priv = wiphy_priv(wiphy); vif = netdev_priv(dev); - wl = vif ->wilc; - PRINT_D(HOSTAPD_DBG, "Starting ap\n"); - - PRINT_D(HOSTAPD_DBG, "Interval = %d\n DTIM period = %d\n Head length = %zu Tail length = %zu\n", - settings->beacon_interval, settings->dtim_period, beacon->head_len, beacon->tail_len); + wl = vif->wilc; s32Error = set_channel(wiphy, &settings->chandef); if (s32Error != 0) - PRINT_ER("Error in setting channel\n"); + netdev_err(dev, "Error in setting channel\n"); - wilc_wlan_set_bssid(dev, wl->vif[0]->src_addr); + wilc_wlan_set_bssid(dev, wl->vif[vif->idx]->src_addr, AP_MODE); + wilc_set_power_mgmt(vif, 0, 0); s32Error = wilc_add_beacon(vif, settings->beacon_interval, settings->dtim_period, beacon->head_len, @@ -2421,8 +1937,6 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev, priv = wiphy_priv(wiphy); vif = netdev_priv(priv->dev); - PRINT_D(HOSTAPD_DBG, "Setting beacon\n"); - s32Error = wilc_add_beacon(vif, 0, 0, beacon->head_len, (u8 *)beacon->head, beacon->tail_len, @@ -2444,14 +1958,12 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev) priv = wiphy_priv(wiphy); vif = netdev_priv(priv->dev); - PRINT_D(HOSTAPD_DBG, "Deleting beacon\n"); - - wilc_wlan_set_bssid(dev, NullBssid); + wilc_wlan_set_bssid(dev, NullBssid, AP_MODE); s32Error = wilc_del_beacon(vif); if (s32Error) - PRINT_ER("Host delete beacon fail\n"); + netdev_err(dev, "Host delete beacon fail\n"); return s32Error; } @@ -2477,14 +1989,6 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.rates_len = params->supported_rates_len; strStaParams.rates = params->supported_rates; - PRINT_D(CFG80211_DBG, "Adding station parameters %d\n", params->aid); - - PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][0], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][1], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][2], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][3], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][4], - priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][5]); - PRINT_D(HOSTAPD_DBG, "ASSOC ID = %d\n", strStaParams.aid); - PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n", - strStaParams.rates_len); - if (!params->ht_capa) { strStaParams.ht_supported = false; } else { @@ -2502,26 +2006,9 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.flags_mask = params->sta_flags_mask; strStaParams.flags_set = params->sta_flags_set; - PRINT_D(HOSTAPD_DBG, "IS HT supported = %d\n", - strStaParams.ht_supported); - PRINT_D(HOSTAPD_DBG, "Capability Info = %d\n", - strStaParams.ht_capa_info); - PRINT_D(HOSTAPD_DBG, "AMPDU Params = %d\n", - strStaParams.ht_ampdu_params); - PRINT_D(HOSTAPD_DBG, "HT Extended params = %d\n", - strStaParams.ht_ext_params); - PRINT_D(HOSTAPD_DBG, "Tx Beamforming Cap = %d\n", - strStaParams.ht_tx_bf_cap); - PRINT_D(HOSTAPD_DBG, "Antenna selection info = %d\n", - strStaParams.ht_ante_sel); - PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", - strStaParams.flags_mask); - PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", - strStaParams.flags_set); - s32Error = wilc_add_station(vif, &strStaParams); if (s32Error) - PRINT_ER("Host add station fail\n"); + netdev_err(dev, "Host add station fail\n"); } return s32Error; @@ -2542,21 +2029,14 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev, vif = netdev_priv(dev); if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) { - PRINT_D(HOSTAPD_DBG, "Deleting station\n"); - - - if (!mac) { - PRINT_D(HOSTAPD_DBG, "All associated stations\n"); + if (!mac) s32Error = wilc_del_allstation(vif, priv->assoc_stainfo.au8Sta_AssociatedBss); - } else { - PRINT_D(HOSTAPD_DBG, "With mac address: %x%x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); - } s32Error = wilc_del_station(vif, mac); if (s32Error) - PRINT_ER("Host delete station fail\n"); + netdev_err(dev, "Host delete station fail\n"); } return s32Error; } @@ -2569,9 +2049,6 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, struct add_sta_param strStaParams = { {0} }; struct wilc_vif *vif; - - PRINT_D(HOSTAPD_DBG, "Change station paramters\n"); - if (!wiphy) return -EFAULT; @@ -2584,14 +2061,6 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.rates_len = params->supported_rates_len; strStaParams.rates = params->supported_rates; - PRINT_D(HOSTAPD_DBG, "BSSID = %x%x%x%x%x%x\n", - strStaParams.bssid[0], strStaParams.bssid[1], - strStaParams.bssid[2], strStaParams.bssid[3], - strStaParams.bssid[4], strStaParams.bssid[5]); - PRINT_D(HOSTAPD_DBG, "ASSOC ID = %d\n", strStaParams.aid); - PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n", - strStaParams.rates_len); - if (!params->ht_capa) { strStaParams.ht_supported = false; } else { @@ -2609,26 +2078,9 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.flags_mask = params->sta_flags_mask; strStaParams.flags_set = params->sta_flags_set; - PRINT_D(HOSTAPD_DBG, "IS HT supported = %d\n", - strStaParams.ht_supported); - PRINT_D(HOSTAPD_DBG, "Capability Info = %d\n", - strStaParams.ht_capa_info); - PRINT_D(HOSTAPD_DBG, "AMPDU Params = %d\n", - strStaParams.ht_ampdu_params); - PRINT_D(HOSTAPD_DBG, "HT Extended params = %d\n", - strStaParams.ht_ext_params); - PRINT_D(HOSTAPD_DBG, "Tx Beamforming Cap = %d\n", - strStaParams.ht_tx_bf_cap); - PRINT_D(HOSTAPD_DBG, "Antenna selection info = %d\n", - strStaParams.ht_ante_sel); - PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", - strStaParams.flags_mask); - PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", - strStaParams.flags_set); - s32Error = wilc_edit_station(vif, &strStaParams); if (s32Error) - PRINT_ER("Host edit station fail\n"); + netdev_err(dev, "Host edit station fail\n"); } return s32Error; } @@ -2645,34 +2097,94 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy, struct net_device *new_ifc = NULL; priv = wiphy_priv(wiphy); - - - - PRINT_D(HOSTAPD_DBG, "Adding monitor interface[%p]\n", priv->wdev->netdev); - vif = netdev_priv(priv->wdev->netdev); if (type == NL80211_IFTYPE_MONITOR) { - PRINT_D(HOSTAPD_DBG, "Monitor interface mode: Initializing mon interface virtual device driver\n"); - PRINT_D(HOSTAPD_DBG, "Adding monitor interface[%p]\n", vif->ndev); new_ifc = WILC_WFI_init_mon_interface(name, vif->ndev); if (new_ifc) { - PRINT_D(HOSTAPD_DBG, "Setting monitor flag in private structure\n"); vif = netdev_priv(priv->wdev->netdev); vif->monitor_flag = 1; - } else - PRINT_ER("Error in initializing monitor interface\n "); + } } return priv->wdev; } static int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) { - PRINT_D(HOSTAPD_DBG, "Deleting virtual interface\n"); return 0; } +static int wilc_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wow) +{ + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); + + if (!wow && wilc_wlan_get_num_conn_ifcs(vif->wilc)) + vif->wilc->suspend_event = true; + else + vif->wilc->suspend_event = false; + + return 0; +} + +static int wilc_resume(struct wiphy *wiphy) +{ + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); + + netdev_info(vif->ndev, "cfg resume\n"); + return 0; +} + +static void wilc_set_wakeup(struct wiphy *wiphy, bool enabled) +{ + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); + + netdev_info(vif->ndev, "cfg set wake up = %d\n", enabled); +} + +static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, + enum nl80211_tx_power_setting type, int mbm) +{ + int ret; + s32 tx_power = MBM_TO_DBM(mbm); + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); + + if (tx_power < 0) + tx_power = 0; + else if (tx_power > 18) + tx_power = 18; + ret = wilc_set_tx_power(vif, tx_power); + if (ret) + netdev_err(vif->ndev, "Failed to set tx power\n"); + + return ret; +} + +static int get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, + int *dbm) +{ + int ret; + struct wilc_priv *priv = wiphy_priv(wiphy); + struct wilc_vif *vif = netdev_priv(priv->dev); + struct wilc *wl; + + wl = vif->wilc; + + /* If firmware is not started, return. */ + if (!wl->initialized) + return -EIO; + + ret = wilc_get_tx_power(vif, (u8 *)dbm); + if (ret) + netdev_err(vif->ndev, "Failed to get tx power\n"); + + return ret; +} + static struct cfg80211_ops wilc_cfg80211_ops = { .set_monitor_channel = set_channel, .scan = scan, @@ -2708,55 +2220,25 @@ static struct cfg80211_ops wilc_cfg80211_ops = { .set_power_mgmt = set_power_mgmt, .set_cqm_rssi_config = set_cqm_rssi_config, -}; - -int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed) -{ - struct wilc_priv *priv; + .suspend = wilc_suspend, + .resume = wilc_resume, + .set_wakeup = wilc_set_wakeup, + .set_tx_power = set_tx_power, + .get_tx_power = get_tx_power, - priv = wiphy_priv(wiphy); - switch (changed) { - case WILC_WFI_RX_PKT: - { - priv->netstats.rx_packets++; - priv->netstats.rx_bytes += pktlen; - priv->netstats.rx_time = get_jiffies_64(); - } - break; - - case WILC_WFI_TX_PKT: - { - priv->netstats.tx_packets++; - priv->netstats.tx_bytes += pktlen; - priv->netstats.tx_time = get_jiffies_64(); - - } - break; - - default: - break; - } - return 0; -} +}; static struct wireless_dev *WILC_WFI_CfgAlloc(void) { struct wireless_dev *wdev; - - PRINT_D(CFG80211_DBG, "Allocating wireless device\n"); - wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); - if (!wdev) { - PRINT_ER("Cannot allocate wireless device\n"); + if (!wdev) goto _fail_; - } wdev->wiphy = wiphy_new(&wilc_cfg80211_ops, sizeof(struct wilc_priv)); - if (!wdev->wiphy) { - PRINT_ER("Cannot allocate wiphy\n"); + if (!wdev->wiphy) goto _fail_mem_; - } WILC_WFI_band_2ghz.ht_cap.ht_supported = 1; WILC_WFI_band_2ghz.ht_cap.cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT); @@ -2780,11 +2262,9 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de struct wireless_dev *wdev; s32 s32Error = 0; - PRINT_D(CFG80211_DBG, "Registering wifi device\n"); - wdev = WILC_WFI_CfgAlloc(); if (!wdev) { - PRINT_ER("CfgAlloc Failed\n"); + netdev_err(net, "wiphy new allocate failed\n"); return NULL; } @@ -2792,9 +2272,10 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de sema_init(&(priv->SemHandleUpdateStats), 1); priv->wdev = wdev; wdev->wiphy->max_scan_ssids = MAX_NUM_PROBED_SSID; +#ifdef CONFIG_PM + wdev->wiphy->wowlan = &wowlan_support; +#endif wdev->wiphy->max_num_pmkids = WILC_MAX_NUM_PMKIDS; - PRINT_INFO(CFG80211_DBG, "Max number of PMKIDs = %d\n", wdev->wiphy->max_num_pmkids); - wdev->wiphy->max_scan_ie_len = 1000; wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; wdev->wiphy->cipher_suites = cipher_suites; @@ -2807,20 +2288,11 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de wdev->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; wdev->iftype = NL80211_IFTYPE_STATION; - - - PRINT_INFO(CFG80211_DBG, "Max scan ids = %d,Max scan IE len = %d,Signal Type = %d,Interface Modes = %d,Interface Type = %d\n", - wdev->wiphy->max_scan_ssids, wdev->wiphy->max_scan_ie_len, wdev->wiphy->signal_type, - wdev->wiphy->interface_modes, wdev->iftype); - set_wiphy_dev(wdev->wiphy, dev); s32Error = wiphy_register(wdev->wiphy); - if (s32Error) { - PRINT_ER("Cannot register wiphy device\n"); - } else { - PRINT_D(CFG80211_DBG, "Successful Registering\n"); - } + if (s32Error) + netdev_err(net, "Cannot register wiphy device\n"); priv->dev = net; return wdev; @@ -2832,26 +2304,21 @@ int wilc_init_host_int(struct net_device *net) struct wilc_priv *priv; - PRINT_D(INIT_DBG, "Host[%p][%p]\n", net, net->ieee80211_ptr); priv = wdev_priv(net->ieee80211_ptr); if (op_ifcs == 0) { setup_timer(&hAgingTimer, remove_network_from_shadow, 0); setup_timer(&wilc_during_ip_timer, clear_duringIP, 0); } op_ifcs++; - if (s32Error < 0) { - PRINT_ER("Failed to creat refresh Timer\n"); - return s32Error; - } priv->gbAutoRateAdjusted = false; priv->bInP2PlistenState = false; sema_init(&(priv->hSemScanReq), 1); - s32Error = wilc_init(net, &priv->hWILCWFIDrv); + s32Error = wilc_init(net, &priv->hif_drv); if (s32Error) - PRINT_ER("Error while initializing hostinterface\n"); + netdev_err(net, "Error while initializing hostinterface\n"); return s32Error; } @@ -2874,39 +2341,28 @@ int wilc_deinit_host_int(struct net_device *net) s32Error = wilc_deinit(vif); clear_shadow_scan(); - if (op_ifcs == 0) { - PRINT_D(CORECONFIG_DBG, "destroy during ip\n"); + if (op_ifcs == 0) del_timer_sync(&wilc_during_ip_timer); - } if (s32Error) - PRINT_ER("Error while deintializing host interface\n"); + netdev_err(net, "Error while deintializing host interface\n"); return s32Error; } void wilc_free_wiphy(struct net_device *net) { - PRINT_D(CFG80211_DBG, "Unregistering wiphy\n"); - - if (!net) { - PRINT_D(INIT_DBG, "net_device is NULL\n"); + if (!net) return; - } - if (!net->ieee80211_ptr) { - PRINT_D(INIT_DBG, "ieee80211_ptr is NULL\n"); + if (!net->ieee80211_ptr) return; - } - if (!net->ieee80211_ptr->wiphy) { - PRINT_D(INIT_DBG, "wiphy is NULL\n"); + if (!net->ieee80211_ptr->wiphy) return; - } wiphy_unregister(net->ieee80211_ptr->wiphy); - PRINT_D(INIT_DBG, "Freeing wiphy\n"); wiphy_free(net->ieee80211_ptr->wiphy); kfree(net->ieee80211_ptr); } -- cgit v1.2.3-54-g00ecf