diff options
Diffstat (limited to 'drivers/staging/wilc1000')
-rw-r--r-- | drivers/staging/wilc1000/coreconfigurator.h | 19 | ||||
-rw-r--r-- | drivers/staging/wilc1000/host_interface.c | 57 | ||||
-rw-r--r-- | drivers/staging/wilc1000/linux_mon.c | 2 | ||||
-rw-r--r-- | drivers/staging/wilc1000/linux_wlan.c | 7 | ||||
-rw-r--r-- | drivers/staging/wilc1000/wilc_sdio.c | 21 | ||||
-rw-r--r-- | drivers/staging/wilc1000/wilc_spi.c | 78 | ||||
-rw-r--r-- | drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 54 | ||||
-rw-r--r-- | drivers/staging/wilc1000/wilc_wlan.c | 10 | ||||
-rw-r--r-- | drivers/staging/wilc1000/wilc_wlan.h | 6 | ||||
-rw-r--r-- | drivers/staging/wilc1000/wilc_wlan_cfg.c | 59 |
10 files changed, 146 insertions, 167 deletions
diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h index cff1698..5256f40 100644 --- a/drivers/staging/wilc1000/coreconfigurator.h +++ b/drivers/staging/wilc1000/coreconfigurator.h @@ -70,10 +70,10 @@ enum connect_status { CONNECT_STS_FORCE_16_BIT = 0xFFFF }; -struct tstrRSSI { - u8 u8Full; - u8 u8Index; - s8 as8RSSI[NUM_RSSI]; +struct rssi_history_buffer { + bool full; + u8 index; + s8 samples[NUM_RSSI]; }; struct network_info { @@ -93,7 +93,7 @@ struct network_info { u8 *ies; u16 ies_len; void *join_params; - struct tstrRSSI str_rssi; + struct rssi_history_buffer rssi_history; u64 tsf_hi; }; @@ -124,10 +124,7 @@ s32 wilc_parse_network_info(u8 *msg_buffer, struct network_info **ret_network_info); s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len, struct connect_resp_info **ret_connect_resp_info); -void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer, - u32 u32Length); -void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer, - u32 u32Length); -void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer, - u32 u32Length); +void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length); +void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length); +void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length); #endif diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c307cce..c3a8af0 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -287,7 +287,6 @@ static int wilc_enqueue_cmd(struct host_if_msg *msg) return 0; } - /* The u8IfIdx starts from 0 to NUM_CONCURRENT_IFC -1, but 0 index used as * special purpose in wilc device, so we add 1 to the index to starts from 1. * As a result, the returned index will be 1 to NUM_CONCURRENT_IFC. @@ -385,7 +384,7 @@ static void handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx) wid.id = (u16)WID_IP_ADDRESS; wid.type = WID_STR; - wid.val = (u8 *)ip_addr; + wid.val = ip_addr; wid.size = IP_ALEN; ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1, @@ -1350,19 +1349,17 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif, if (u32RcvdAssocRespInfoLen != 0) { s32Err = wilc_parse_assoc_resp_info(rcv_assoc_resp, u32RcvdAssocRespInfoLen, - &pstrConnectRespInfo); + &pstrConnectRespInfo); if (s32Err) { netdev_err(vif->ndev, "wilc_parse_assoc_resp_info() returned error %d\n", s32Err); } else { strConnectInfo.status = pstrConnectRespInfo->status; - if (strConnectInfo.status == SUCCESSFUL_STATUSCODE) { - if (pstrConnectRespInfo->ies) { - strConnectInfo.resp_ies_len = pstrConnectRespInfo->ies_len; - strConnectInfo.resp_ies = kmalloc(pstrConnectRespInfo->ies_len, GFP_KERNEL); - memcpy(strConnectInfo.resp_ies, pstrConnectRespInfo->ies, - pstrConnectRespInfo->ies_len); - } + if (strConnectInfo.status == SUCCESSFUL_STATUSCODE && pstrConnectRespInfo->ies) { + strConnectInfo.resp_ies_len = pstrConnectRespInfo->ies_len; + strConnectInfo.resp_ies = kmalloc(pstrConnectRespInfo->ies_len, GFP_KERNEL); + memcpy(strConnectInfo.resp_ies, pstrConnectRespInfo->ies, + pstrConnectRespInfo->ies_len); } if (pstrConnectRespInfo) { @@ -1928,6 +1925,8 @@ static s32 Handle_Get_InActiveTime(struct wilc_vif *vif, wid.type = WID_STR; wid.size = ETH_ALEN; wid.val = kmalloc(wid.size, GFP_KERNEL); + if (!wid.val) + return -ENOMEM; stamac = wid.val; ether_addr_copy(stamac, strHostIfStaInactiveT->mac); @@ -3348,10 +3347,6 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) init_completion(&hif_drv->comp_inactive_time); if (clients_count == 0) { - if (result < 0) { - netdev_err(vif->ndev, "Failed to creat MQ\n"); - goto _fail_; - } hif_workqueue = create_singlethread_workqueue("WILC_wq"); if (!hif_workqueue) { netdev_err(vif->ndev, "Failed to create workqueue\n"); @@ -3444,8 +3439,7 @@ int wilc_deinit(struct wilc_vif *vif) return result; } -void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer, - u32 u32Length) +void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length) { s32 result = 0; struct host_if_msg msg; @@ -3453,7 +3447,7 @@ void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer, struct host_if_drv *hif_drv = NULL; struct wilc_vif *vif; - id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); + id = ((buffer[length - 4]) | (buffer[length - 3] << 8) | (buffer[length - 2] << 16) | (buffer[length - 1] << 24)); vif = wilc_get_vif_from_idx(wilc, id); if (!vif) return; @@ -3469,17 +3463,16 @@ void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer, msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO; msg.vif = vif; - msg.body.net_info.len = u32Length; - msg.body.net_info.buffer = kmalloc(u32Length, GFP_KERNEL); - memcpy(msg.body.net_info.buffer, pu8Buffer, u32Length); + msg.body.net_info.len = length; + msg.body.net_info.buffer = kmalloc(length, GFP_KERNEL); + memcpy(msg.body.net_info.buffer, buffer, length); result = wilc_enqueue_cmd(&msg); if (result) netdev_err(vif->ndev, "message parameters (%d)\n", result); } -void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer, - u32 u32Length) +void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length) { s32 result = 0; struct host_if_msg msg; @@ -3489,7 +3482,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer, mutex_lock(&hif_deinit_lock); - id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); + id = ((buffer[length - 4]) | (buffer[length - 3] << 8) | (buffer[length - 2] << 16) | (buffer[length - 1] << 24)); vif = wilc_get_vif_from_idx(wilc, id); if (!vif) { mutex_unlock(&hif_deinit_lock); @@ -3514,9 +3507,9 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer, msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; msg.vif = vif; - msg.body.async_info.len = u32Length; - msg.body.async_info.buffer = kmalloc(u32Length, GFP_KERNEL); - memcpy(msg.body.async_info.buffer, pu8Buffer, u32Length); + msg.body.async_info.len = length; + msg.body.async_info.buffer = kmalloc(length, GFP_KERNEL); + memcpy(msg.body.async_info.buffer, buffer, length); result = wilc_enqueue_cmd(&msg); if (result) @@ -3525,8 +3518,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer, mutex_unlock(&hif_deinit_lock); } -void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer, - u32 u32Length) +void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length) { s32 result = 0; struct host_if_msg msg; @@ -3534,7 +3526,7 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer, struct host_if_drv *hif_drv = NULL; struct wilc_vif *vif; - id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); + id = ((buffer[length - 4]) | (buffer[length - 3] << 8) | (buffer[length - 2] << 16) | (buffer[length - 1] << 24)); vif = wilc_get_vif_from_idx(wilc, id); if (!vif) return; @@ -3892,7 +3884,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo) pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i]; index += suppRatesNo; - continue; } else if (pu8IEs[index] == EXT_SUPP_RATES_IE) { extSuppRatesNo = pu8IEs[index + 1]; if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo)) @@ -3904,11 +3895,9 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo) pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i]; index += extSuppRatesNo; - continue; } else if (pu8IEs[index] == HT_CAPABILITY_IE) { pNewJoinBssParam->ht_capable = true; index += pu8IEs[index + 1] + 2; - continue; } else if ((pu8IEs[index] == WMM_IE) && (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) && @@ -3920,7 +3909,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo) if (pu8IEs[index + 8] & BIT(7)) pNewJoinBssParam->uapsd_cap = true; index += pu8IEs[index + 1] + 2; - continue; } else if ((pu8IEs[index] == P2P_IE) && (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) && (pu8IEs[index + 4] == 0x9a) && @@ -3950,8 +3938,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo) memcpy(pNewJoinBssParam->start_time, pu8IEs + u16P2P_count, 4); index += pu8IEs[index + 1] + 2; - continue; - } else if ((pu8IEs[index] == RSN_IE) || ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) && @@ -3997,7 +3983,6 @@ static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo) } pNewJoinBssParam->rsn_found = true; index += pu8IEs[index + 1] + 2; - continue; } else { index += pu8IEs[index + 1] + 2; } diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index f328d75..c9782d4 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -197,6 +197,8 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, if (skb->data[0] == 0xc0 && (!(memcmp(broadcast, &skb->data[4], 6)))) { skb2 = dev_alloc_skb(skb->len + sizeof(struct wilc_wfi_radiotap_cb_hdr)); + if (!skb2) + return -ENOMEM; memcpy(skb_put(skb2, skb->len), skb->data, skb->len); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 2eebc62..d6d8034 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1074,7 +1074,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) { u8 *buff = NULL; s8 rssi; - u32 size = 0, length = 0; + u32 size = 0; struct wilc_vif *vif; s32 ret = 0; struct wilc *wilc; @@ -1098,7 +1098,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) if (IS_ERR(buff)) return PTR_ERR(buff); - if (strncasecmp(buff, "RSSI", length) == 0) { + if (strncasecmp(buff, "RSSI", size) == 0) { ret = wilc_get_rssi(vif, &rssi); netdev_info(ndev, "RSSI :%d\n", rssi); @@ -1251,11 +1251,12 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, else strcpy(ndev->name, "p2p%d"); - vif->idx = wl->vif_num; vif->wilc = *wilc; vif->ndev = ndev; wl->vif[i] = vif; wl->vif_num = i; + vif->idx = wl->vif_num; + ndev->netdev_ops = &wilc_netdev_ops; { diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index cd6b8ba..0189e3e 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -1,11 +1,8 @@ -/* ////////////////////////////////////////////////////////////////////////// */ -/* */ -/* Copyright (c) Atmel Corporation. All rights reserved. */ -/* */ -/* Module Name: wilc_sdio.c */ -/* */ -/* */ -/* //////////////////////////////////////////////////////////////////////////// */ +/* + * Copyright (c) Atmel Corporation. All rights reserved. + * + * Module Name: wilc_sdio.c + */ #include <linux/string.h> #include "wilc_wlan_if.h" @@ -77,7 +74,7 @@ static int wilc_sdio_cmd52(struct wilc *wilc, struct sdio_cmd52 *cmd) sdio_release_host(func); if (ret) - dev_err(&func->dev, "wilc_sdio_cmd52..failed, err(%d)\n", ret); + dev_err(&func->dev, "%s..failed, err(%d)\n", __func__, ret); return ret; } @@ -106,7 +103,7 @@ static int wilc_sdio_cmd53(struct wilc *wilc, struct sdio_cmd53 *cmd) sdio_release_host(func); if (ret) - dev_err(&func->dev, "wilc_sdio_cmd53..failed, err(%d)\n", ret); + dev_err(&func->dev, "%s..failed, err(%d)\n", __func__, ret); return ret; } @@ -246,15 +243,11 @@ static void wilc_sdio_disable_interrupt(struct wilc *dev) struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev); int ret; - dev_dbg(&func->dev, "wilc_sdio_disable_interrupt IN\n"); - sdio_claim_host(func); ret = sdio_release_irq(func); if (ret < 0) dev_err(&func->dev, "can't release sdio_irq, err(%d)\n", ret); sdio_release_host(func); - - dev_info(&func->dev, "wilc_sdio_disable_interrupt OUT\n"); } /******************************************** diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 55d53c3..5ef8441 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -1,11 +1,9 @@ -/* ////////////////////////////////////////////////////////////////////////// */ -/* */ -/* Copyright (c) Atmel Corporation. All rights reserved. */ -/* */ -/* Module Name: wilc_spi.c */ -/* */ -/* */ -/* //////////////////////////////////////////////////////////////////////////// */ +/* + * Copyright (c) Atmel Corporation. All rights reserved. + * + * Module Name: wilc_spi.c + */ + #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> @@ -410,7 +408,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, if (len2 > ARRAY_SIZE(wb)) { dev_err(&spi->dev, "spi buffer size too small (%d) (%zu)\n", - len2, ARRAY_SIZE(wb)); + len2, ARRAY_SIZE(wb)); return N_FAIL; } /* zero spi write buffers. */ @@ -454,8 +452,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, return N_FAIL; } - if ((cmd == CMD_INTERNAL_READ) || (cmd == CMD_SINGLE_READ) - || (cmd == CMD_DMA_READ) || (cmd == CMD_DMA_EXT_READ)) { + if ((cmd == CMD_INTERNAL_READ) || (cmd == CMD_SINGLE_READ) || + (cmd == CMD_DMA_READ) || (cmd == CMD_DMA_EXT_READ)) { int retry; /* u16 crc1, crc2; */ u8 crc[2]; @@ -929,14 +927,16 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status) { struct spi_device *spi = to_spi_device(wilc->dev); int ret; + u32 tmp; + u32 byte_cnt; + int happened, j; + u32 unknown_mask; + u32 irq_flags; if (g_spi.has_thrpt_enh) { ret = spi_internal_read(wilc, 0xe840 - WILC_SPI_REG_BASE, int_status); } else { - u32 tmp; - u32 byte_cnt; - ret = wilc_spi_read_reg(wilc, WILC_VMM_TO_HOST_SIZE, &byte_cnt); if (!ret) { @@ -946,37 +946,28 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status) } tmp = (byte_cnt >> 2) & IRQ_DMA_WD_CNT_MASK; - { - int happended, j; - - j = 0; - do { - u32 irq_flags; - - happended = 0; + j = 0; + do { + happened = 0; - wilc_spi_read_reg(wilc, 0x1a90, &irq_flags); - tmp |= ((irq_flags >> 27) << IRG_FLAGS_OFFSET); + wilc_spi_read_reg(wilc, 0x1a90, &irq_flags); + tmp |= ((irq_flags >> 27) << IRG_FLAGS_OFFSET); - if (g_spi.nint > 5) { - wilc_spi_read_reg(wilc, 0x1a94, - &irq_flags); - tmp |= (((irq_flags >> 0) & 0x7) << (IRG_FLAGS_OFFSET + 5)); - } + if (g_spi.nint > 5) { + wilc_spi_read_reg(wilc, 0x1a94, + &irq_flags); + tmp |= (((irq_flags >> 0) & 0x7) << (IRG_FLAGS_OFFSET + 5)); + } - { - u32 unkmown_mask; + unknown_mask = ~((1ul << g_spi.nint) - 1); - unkmown_mask = ~((1ul << g_spi.nint) - 1); + if ((tmp >> IRG_FLAGS_OFFSET) & unknown_mask) { + dev_err(&spi->dev, "Unexpected interrupt (2): j=%d, tmp=%x, mask=%x\n", j, tmp, unknown_mask); + happened = 1; + } - if ((tmp >> IRG_FLAGS_OFFSET) & unkmown_mask) { - dev_err(&spi->dev, "Unexpected interrupt (2): j=%d, tmp=%x, mask=%x\n", j, tmp, unkmown_mask); - happended = 1; - } - } - j++; - } while (happended); - } + j++; + } while (happened); *int_status = tmp; } @@ -1130,11 +1121,8 @@ static int wilc_spi_sync_ext(struct wilc *wilc, int nint) return 1; } -/******************************************** - * - * Global spi HIF function table - * - ********************************************/ + +/* Global spi HIF function table */ static const struct wilc_hif_func wilc_hif_spi = { .hif_init = wilc_spi_init, .hif_deinit = _wilc_spi_deinit, diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 2b45363..44a12bd 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -29,8 +29,8 @@ #define P2P_INV_REQ 0x03 #define P2P_INV_RSP 0x04 #define PUBLIC_ACT_VENDORSPEC 0x09 -#define GAS_INTIAL_REQ 0x0a -#define GAS_INTIAL_RSP 0x0b +#define GAS_INITIAL_REQ 0x0a +#define GAS_INITIAL_RSP 0x0b #define INVALID_CHANNEL 0 @@ -205,11 +205,11 @@ static u32 get_rssi_avg(struct network_info *network_info) { u8 i; int rssi_v = 0; - u8 num_rssi = (network_info->str_rssi.u8Full) ? - NUM_RSSI : (network_info->str_rssi.u8Index); + u8 num_rssi = (network_info->rssi_history.full) ? + NUM_RSSI : (network_info->rssi_history.index); for (i = 0; i < num_rssi; i++) - rssi_v += network_info->str_rssi.as8RSSI[i]; + rssi_v += network_info->rssi_history.samples[i]; rssi_v /= num_rssi; return rssi_v; @@ -346,13 +346,13 @@ static void add_network_to_shadow(struct network_info *pstrNetworkInfo, } else { ap_index = ap_found; } - rssi_index = last_scanned_shadow[ap_index].str_rssi.u8Index; - last_scanned_shadow[ap_index].str_rssi.as8RSSI[rssi_index++] = pstrNetworkInfo->rssi; + rssi_index = last_scanned_shadow[ap_index].rssi_history.index; + last_scanned_shadow[ap_index].rssi_history.samples[rssi_index++] = pstrNetworkInfo->rssi; if (rssi_index == NUM_RSSI) { rssi_index = 0; - last_scanned_shadow[ap_index].str_rssi.u8Full = 1; + last_scanned_shadow[ap_index].rssi_history.full = true; } - last_scanned_shadow[ap_index].str_rssi.u8Index = rssi_index; + last_scanned_shadow[ap_index].rssi_history.index = 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; @@ -765,8 +765,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, } } - if ((sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) - || (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2)) { + if ((sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) || + (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2)) { for (i = 0; i < sme->crypto.n_ciphers_pairwise; i++) { if (sme->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP) u8security = u8security | TKIP; @@ -1301,16 +1301,16 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, for (i = 0; i < priv->pmkid_list.numpmkid; i++) { if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, - ETH_ALEN)) { + ETH_ALEN)) { flag = PMKID_FOUND; break; } } if (i < WILC_MAX_NUM_PMKIDS) { memcpy(priv->pmkid_list.pmkidlist[i].bssid, pmksa->bssid, - ETH_ALEN); + ETH_ALEN); memcpy(priv->pmkid_list.pmkidlist[i].pmkid, pmksa->pmkid, - PMKID_LEN); + PMKID_LEN); if (!(flag == PMKID_FOUND)) priv->pmkid_list.numpmkid++; } else { @@ -1334,7 +1334,7 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, for (i = 0; i < priv->pmkid_list.numpmkid; i++) { if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, - ETH_ALEN)) { + ETH_ALEN)) { memset(&priv->pmkid_list.pmkidlist[i], 0, sizeof(struct host_if_pmkid)); break; } @@ -1343,11 +1343,11 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, if (i < priv->pmkid_list.numpmkid && priv->pmkid_list.numpmkid > 0) { for (; i < (priv->pmkid_list.numpmkid - 1); i++) { memcpy(priv->pmkid_list.pmkidlist[i].bssid, - priv->pmkid_list.pmkidlist[i + 1].bssid, - ETH_ALEN); + priv->pmkid_list.pmkidlist[i + 1].bssid, + ETH_ALEN); memcpy(priv->pmkid_list.pmkidlist[i].pmkid, - priv->pmkid_list.pmkidlist[i].pmkid, - PMKID_LEN); + priv->pmkid_list.pmkidlist[i + 1].pmkid, + PMKID_LEN); } priv->pmkid_list.numpmkid--; } else { @@ -1477,10 +1477,10 @@ void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size) } if (buff[ACTION_CAT_ID] == PUB_ACTION_ATTR_ID) { switch (buff[ACTION_SUBTYPE_ID]) { - case GAS_INTIAL_REQ: + case GAS_INITIAL_REQ: break; - case GAS_INTIAL_RSP: + case GAS_INITIAL_RSP: break; case PUBLIC_ACT_VENDORSPEC: @@ -1497,8 +1497,8 @@ void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size) } } if (p2p_local_random > p2p_recv_random) { - if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP - || buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP)) { + if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP || + buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP)) { for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < size; i++) { if (buff[i] == P2PELEM_ATTR_ID && !(memcmp(p2p_oui, &buff[i + 2], 4))) { WILC_WFI_CfgParseRxAction(&buff[i + 6], size - (i + 6)); @@ -1666,10 +1666,10 @@ static int mgmt_tx(struct wiphy *wiphy, curr_channel = chan->hw_value; } switch (buf[ACTION_SUBTYPE_ID]) { - case GAS_INTIAL_REQ: + case GAS_INITIAL_REQ: break; - case GAS_INTIAL_RSP: + case GAS_INITIAL_RSP: break; case PUBLIC_ACT_VENDORSPEC: @@ -1682,8 +1682,8 @@ 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 ((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) { for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) { if (buf[i] == P2PELEM_ATTR_ID && !(memcmp(p2p_oui, &buf[i + 2], 4))) { diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index bc5ad20..9addef1 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -287,7 +287,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) while (dropped > 0) { wait_for_completion_timeout(&wilc->txq_event, - msecs_to_jiffies(1)); + msecs_to_jiffies(1)); dropped--; } @@ -810,9 +810,9 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) if (!is_cfg_packet) { if (pkt_len > 0) { wilc_frmw_to_linux(wilc, - &buffer[offset], - pkt_len, - pkt_offset); + &buffer[offset], + pkt_len, + pkt_offset); } } else { struct wilc_cfg_rsp rsp; @@ -1226,7 +1226,7 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer, ret_size = 0; if (!wait_for_completion_timeout(&wilc->cfg_event, - msecs_to_jiffies(CFG_PKTS_TIMEOUT))) { + msecs_to_jiffies(CFG_PKTS_TIMEOUT))) { netdev_dbg(vif->ndev, "Set Timed Out\n"); ret_size = 0; } diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 11365ef..7a5eba9 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -274,8 +274,8 @@ struct wilc_vif; int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_size); -int wilc_wlan_start(struct wilc *); -int wilc_wlan_stop(struct wilc *); +int wilc_wlan_start(struct wilc *wilc); +int wilc_wlan_stop(struct wilc *wilc); int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func); int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count); @@ -291,7 +291,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, void wilc_chip_sleep_manually(struct wilc *wilc); void wilc_enable_tcp_ack_filter(bool value); -int wilc_wlan_get_num_conn_ifcs(struct wilc *); +int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc); int wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev); void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size); diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index 926fc16..d3e5b1b 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -175,8 +175,9 @@ static int wilc_wlan_cfg_set_byte(u8 *frame, u32 offset, u16 id, u8 val8) buf[0] = (u8)id; buf[1] = (u8)(id >> 8); buf[2] = 1; - buf[3] = val8; - return 4; + buf[3] = 0; + buf[4] = val8; + return 5; } static int wilc_wlan_cfg_set_hword(u8 *frame, u32 offset, u16 id, u16 val16) @@ -191,10 +192,11 @@ static int wilc_wlan_cfg_set_hword(u8 *frame, u32 offset, u16 id, u16 val16) buf[0] = (u8)id; buf[1] = (u8)(id >> 8); buf[2] = 2; - buf[3] = (u8)val16; - buf[4] = (u8)(val16 >> 8); + buf[3] = 0; + buf[4] = (u8)val16; + buf[5] = (u8)(val16 >> 8); - return 5; + return 6; } static int wilc_wlan_cfg_set_word(u8 *frame, u32 offset, u16 id, u32 val32) @@ -209,19 +211,20 @@ static int wilc_wlan_cfg_set_word(u8 *frame, u32 offset, u16 id, u32 val32) buf[0] = (u8)id; buf[1] = (u8)(id >> 8); buf[2] = 4; - buf[3] = (u8)val32; - buf[4] = (u8)(val32 >> 8); - buf[5] = (u8)(val32 >> 16); - buf[6] = (u8)(val32 >> 24); + buf[3] = 0; + buf[4] = (u8)val32; + buf[5] = (u8)(val32 >> 8); + buf[6] = (u8)(val32 >> 16); + buf[7] = (u8)(val32 >> 24); - return 7; + return 8; } static int wilc_wlan_cfg_set_str(u8 *frame, u32 offset, u16 id, u8 *str, u32 size) { u8 *buf; - if ((offset + size + 3) >= MAX_CFG_FRAME_SIZE) + if ((offset + size + 4) >= MAX_CFG_FRAME_SIZE) return 0; buf = &frame[offset]; @@ -229,11 +232,12 @@ static int wilc_wlan_cfg_set_str(u8 *frame, u32 offset, u16 id, u8 *str, u32 siz buf[0] = (u8)id; buf[1] = (u8)(id >> 8); buf[2] = (u8)size; + buf[3] = (u8)(size >> 8); if ((str) && (size != 0)) - memcpy(&buf[3], str, size); + memcpy(&buf[4], str, size); - return (size + 3); + return (size + 4); } static int wilc_wlan_cfg_set_bin(u8 *frame, u32 offset, u16 id, u8 *b, u32 size) @@ -284,12 +288,12 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size) break; if (g_cfg_byte[i].id == wid) { - g_cfg_byte[i].val = info[3]; + g_cfg_byte[i].val = info[4]; break; } i++; } while (1); - len = 2; + len = 3; break; case WID_SHORT: @@ -298,12 +302,14 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size) break; if (g_cfg_hword[i].id == wid) { - g_cfg_hword[i].val = cpu_to_le16(info[3] | (info[4] << 8)); + g_cfg_hword[i].val = + cpu_to_le16(info[4] | + (info[5] << 8)); break; } i++; } while (1); - len = 3; + len = 4; break; case WID_INT: @@ -312,12 +318,16 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size) break; if (g_cfg_word[i].id == wid) { - g_cfg_word[i].val = cpu_to_le32(info[3] | (info[4] << 8) | (info[5] << 16) | (info[6] << 24)); + g_cfg_word[i].val = + cpu_to_le32(info[4] | + (info[5] << 8) | + (info[6] << 16) | + (info[7] << 24)); break; } i++; } while (1); - len = 5; + len = 6; break; case WID_STR: @@ -332,12 +342,13 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size) i += toggle; toggle ^= 1; } - memcpy(g_cfg_str[i].str, &info[2], (info[2] + 1)); + memcpy(g_cfg_str[i].str, &info[2], + (info[2] + 2)); break; } i++; } while (1); - len = 1 + info[2]; + len = 2 + info[2]; break; default: @@ -475,7 +486,8 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size) break; if (g_cfg_str[i].id == wid) { - u32 size = g_cfg_str[i].str[0]; + u32 size = g_cfg_str[i].str[0] | + (g_cfg_str[i].str[1] << 8); if (buffer_size >= size) { if (g_cfg_str[i].id == WID_SITE_SURVEY_RESULTS) { @@ -485,7 +497,8 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size) toggle ^= 1; } - memcpy(buffer, &g_cfg_str[i].str[1], size); + memcpy(buffer, &g_cfg_str[i].str[2], + size); ret = size; } break; |