summaryrefslogtreecommitdiff
path: root/drivers/staging/wilc1000
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-01-20 14:01:31 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-01-20 14:01:31 -0300
commitb4b7ff4b08e691656c9d77c758fc355833128ac0 (patch)
tree82fcb00e6b918026dc9f2d1f05ed8eee83874cc0 /drivers/staging/wilc1000
parent35acfa0fc609f2a2cd95cef4a6a9c3a5c38f1778 (diff)
Linux-libre 4.4-gnupck-4.4-gnu
Diffstat (limited to 'drivers/staging/wilc1000')
-rw-r--r--drivers/staging/wilc1000/Kconfig24
-rw-r--r--drivers/staging/wilc1000/Makefile14
-rw-r--r--drivers/staging/wilc1000/coreconfigurator.c1578
-rw-r--r--drivers/staging/wilc1000/coreconfigurator.h80
-rw-r--r--drivers/staging/wilc1000/host_interface.c8305
-rw-r--r--drivers/staging/wilc1000/host_interface.h594
-rw-r--r--drivers/staging/wilc1000/linux_mon.c218
-rw-r--r--drivers/staging/wilc1000/linux_wlan.c1625
-rw-r--r--drivers/staging/wilc1000/linux_wlan_common.h22
-rw-r--r--drivers/staging/wilc1000/linux_wlan_sdio.c51
-rw-r--r--drivers/staging/wilc1000/linux_wlan_spi.c116
-rw-r--r--drivers/staging/wilc1000/linux_wlan_spi.h6
-rw-r--r--drivers/staging/wilc1000/wilc_errorsupport.h67
-rw-r--r--drivers/staging/wilc1000/wilc_exported_buf.c71
-rw-r--r--drivers/staging/wilc1000/wilc_memory.c16
-rw-r--r--drivers/staging/wilc1000/wilc_memory.h66
-rw-r--r--drivers/staging/wilc1000/wilc_msgqueue.c160
-rw-r--r--drivers/staging/wilc1000/wilc_msgqueue.h27
-rw-r--r--drivers/staging/wilc1000/wilc_oswrapper.h29
-rw-r--r--drivers/staging/wilc1000/wilc_platform.h48
-rw-r--r--drivers/staging/wilc1000/wilc_sdio.c154
-rw-r--r--drivers/staging/wilc1000/wilc_spi.c383
-rw-r--r--drivers/staging/wilc1000/wilc_wfi_cfgoperations.c1387
-rw-r--r--drivers/staging/wilc1000/wilc_wfi_cfgoperations.h94
-rw-r--r--drivers/staging/wilc1000/wilc_wfi_netdevice.h121
-rw-r--r--drivers/staging/wilc1000/wilc_wlan.c951
-rw-r--r--drivers/staging/wilc1000/wilc_wlan.h99
-rw-r--r--drivers/staging/wilc1000/wilc_wlan_cfg.c189
-rw-r--r--drivers/staging/wilc1000/wilc_wlan_cfg.h22
-rw-r--r--drivers/staging/wilc1000/wilc_wlan_if.h1455
30 files changed, 5603 insertions, 12369 deletions
diff --git a/drivers/staging/wilc1000/Kconfig b/drivers/staging/wilc1000/Kconfig
index 51bbf468f..ee51b4278 100644
--- a/drivers/staging/wilc1000/Kconfig
+++ b/drivers/staging/wilc1000/Kconfig
@@ -1,15 +1,16 @@
-config WILC1000
- tristate "WILC1000 support (WiFi only)"
- depends on BROKEN
- depends on !S390
+config WILC1000_DRIVER
+ bool "WILC1000 support (WiFi only)"
depends on CFG80211 && WEXT_CORE && INET
- depends on MMC || SPI
---help---
This module only support IEEE 802.11n WiFi.
+if WILC1000_DRIVER
+
+config WILC1000
+ tristate
+
choice
prompt "Memory Allocation"
- depends on WILC1000
default WILC1000_PREALLOCATE_AT_LOADING_DRIVER
config WILC1000_PREALLOCATE_AT_LOADING_DRIVER
@@ -30,12 +31,12 @@ endchoice
choice
prompt "Bus Type"
- depends on WILC1000
default WILC1000_SDIO
- config WILC1000_SDIO
+config WILC1000_SDIO
bool "SDIO support"
depends on MMC
+ select WILC1000
---help---
This module adds support for the SDIO interface of adapters using
WILC1000 chipset. The Atmel WILC1000 SDIO is a full speed interface.
@@ -46,8 +47,9 @@ choice
To use this interface, pin9 (SDIO_SPI_CFG) must be grounded. Select
this if your platform is using the SDIO bus.
- config WILC1000_SPI
+config WILC1000_SPI
depends on SPI
+ select WILC1000
bool "SPI support"
---help---
This module adds support for the SPI interface of adapters using
@@ -61,7 +63,7 @@ endchoice
config WILC1000_HW_OOB_INTR
bool "Use out of band interrupt"
- depends on WILC1000 && WILC1000_SDIO
+ depends on WILC1000_SDIO
default n
---help---
This option enables out-of-band interrupt support for the WILC1000
@@ -69,3 +71,5 @@ config WILC1000_HW_OOB_INTR
mechanism for SDIO host controllers that don't support SDIO interrupt.
Select this option If the SDIO host controller in your platform
doesn't support SDIO time devision interrupt.
+
+endif
diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 30eb0090e..a1ca09f3d 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -1,6 +1,4 @@
obj-$(CONFIG_WILC1000) += wilc1000.o
-obj-$(CONFIG_WILC1000_PREALLOCATE_DURING_SYSTEM_BOOT) += wilc_exported_buf.o
-
ccflags-$(CONFIG_WILC1000_SDIO) += -DWILC_SDIO -DCOMPLEMENT_BOOT
ccflags-$(CONFIG_WILC1000_HW_OOB_INTR) += -DWILC_SDIO_IRQ_GPIO
@@ -11,14 +9,9 @@ ccflags-y += -DSTA_FIRMWARE="\"/*(DEBLOBBED)*/\"" \
-DP2P_CONCURRENCY_FIRMWARE="\"/*(DEBLOBBED)*/\""
ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 \
- -DPLL_WORKAROUND -DCONNECT_DIRECT -DAGING_ALG \
- -DWILC_PARSE_SCAN_IN_HOST -DDISABLE_PWRSAVE_AND_SCAN_DURING_IP \
- -Wno-unused-function -DUSE_WIRELESS -DWILC_DEBUGFS
+ -Wno-unused-function -DWILC_DEBUGFS
#ccflags-y += -DTCP_ACK_FILTER
-ccflags-$(CONFIG_WILC1000_PREALLOCATE_DURING_SYSTEM_BOOT) += -DMEMORY_STATIC \
- -DWILC_PREALLOC_AT_BOOT
-
ccflags-$(CONFIG_WILC1000_PREALLOCATE_AT_LOADING_DRIVER) += -DMEMORY_STATIC \
-DWILC_PREALLOC_AT_INSMOD
@@ -26,9 +19,10 @@ ccflags-$(CONFIG_WILC1000_DYNAMICALLY_ALLOCATE_MEMROY) += -DWILC_NORMAL_ALLOC
wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
- wilc_memory.o wilc_msgqueue.o \
+ wilc_msgqueue.o \
coreconfigurator.o host_interface.o \
- wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o
+ wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o \
+ wilc_wlan.o
wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o
wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o
diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 16a0abc97..9568bdb63 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -8,47 +8,25 @@
* @version 1.0
*/
-
-/*****************************************************************************/
-/* File Includes */
-/*****************************************************************************/
#include "coreconfigurator.h"
-/*****************************************************************************/
-/* Constants */
-/*****************************************************************************/
-#define INLINE static __inline
-#define PHY_802_11n
-#define MAX_CFG_PKTLEN 1450
-#define MSG_HEADER_LEN 4
-#define QUERY_MSG_TYPE 'Q'
-#define WRITE_MSG_TYPE 'W'
-#define RESP_MSG_TYPE 'R'
-#define WRITE_RESP_SUCCESS 1
-#define INVALID 255
-#define MAC_ADDR_LEN 6
+#include "wilc_wlan_if.h"
+#include "wilc_wlan.h"
+#include <linux/errno.h>
+#include <linux/slab.h>
#define TAG_PARAM_OFFSET (MAC_HDR_LEN + TIME_STAMP_LEN + \
BEACON_INTERVAL_LEN + CAP_INFO_LEN)
-/*****************************************************************************/
-/* Function Macros */
-/*****************************************************************************/
-
-
-/*****************************************************************************/
-/* Type Definitions */
-/*****************************************************************************/
-
/* Basic Frame Type Codes (2-bit) */
-typedef enum {
+enum basic_frame_type {
FRAME_TYPE_CONTROL = 0x04,
FRAME_TYPE_DATA = 0x08,
FRAME_TYPE_MANAGEMENT = 0x00,
FRAME_TYPE_RESERVED = 0x0C,
FRAME_TYPE_FORCE_32BIT = 0xFFFFFFFF
-} tenuBasicFrmType;
+};
/* Frame Type and Subtype Codes (6-bit) */
-typedef enum {
+enum sub_frame_type {
ASSOC_REQ = 0x00,
ASSOC_RSP = 0x10,
REASSOC_REQ = 0x20,
@@ -85,18 +63,10 @@ typedef enum {
BLOCKACK_REQ = 0x84,
BLOCKACK = 0x94,
FRAME_SUBTYPE_FORCE_32BIT = 0xFFFFFFFF
-} tenuFrmSubtype;
-
-/* Basic Frame Classes */
-typedef enum {
- CLASS1_FRAME_TYPE = 0x00,
- CLASS2_FRAME_TYPE = 0x01,
- CLASS3_FRAME_TYPE = 0x02,
- FRAME_CLASS_FORCE_32BIT = 0xFFFFFFFF
-} tenuFrameClass;
+};
/* Element ID of various Information Elements */
-typedef enum {
+enum info_element_id {
ISSID = 0, /* Service Set Identifier */
ISUPRATES = 1, /* Supported Rates */
IFHPARMS = 2, /* FH parameter set */
@@ -137,343 +107,13 @@ typedef enum {
IWMM = 221, /* WMM parameters */
IWPAELEMENT = 221, /* WPA Information Element */
INFOELEM_ID_FORCE_32BIT = 0xFFFFFFFF
-} tenuInfoElemID;
-
-
-typedef struct {
- char *pcRespBuffer;
- s32 s32MaxRespBuffLen;
- s32 s32BytesRead;
- bool bRespRequired;
-} tstrConfigPktInfo;
-
-
-
-/*****************************************************************************/
-/* Extern Variable Declarations */
-/*****************************************************************************/
-
-
-/*****************************************************************************/
-/* Extern Function Declarations */
-/*****************************************************************************/
-extern s32 SendRawPacket(s8 *ps8Packet, s32 s32PacketLen);
-extern void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length);
-extern void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length);
-extern void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length);
-/*****************************************************************************/
-/* Global Variables */
-/*****************************************************************************/
-static struct semaphore SemHandleSendPkt;
-static struct semaphore SemHandlePktResp;
-
-
-static tstrConfigPktInfo gstrConfigPktInfo;
-
-static u8 g_seqno;
-
-static s16 g_wid_num = -1;
-
-static u16 Res_Len;
-
-static u8 g_oper_mode = SET_CFG;
-
-/* WID Switches */
-static tstrWID gastrWIDs[] = {
- {WID_FIRMWARE_VERSION, WID_STR},
- {WID_PHY_VERSION, WID_STR},
- {WID_HARDWARE_VERSION, WID_STR},
- {WID_BSS_TYPE, WID_CHAR},
- {WID_QOS_ENABLE, WID_CHAR},
- {WID_11I_MODE, WID_CHAR},
- {WID_CURRENT_TX_RATE, WID_CHAR},
- {WID_LINKSPEED, WID_CHAR},
- {WID_RTS_THRESHOLD, WID_SHORT},
- {WID_FRAG_THRESHOLD, WID_SHORT},
- {WID_SSID, WID_STR},
- {WID_BSSID, WID_ADR},
- {WID_BEACON_INTERVAL, WID_SHORT},
- {WID_POWER_MANAGEMENT, WID_CHAR},
- {WID_LISTEN_INTERVAL, WID_CHAR},
- {WID_DTIM_PERIOD, WID_CHAR},
- {WID_CURRENT_CHANNEL, WID_CHAR},
- {WID_TX_POWER_LEVEL_11A, WID_CHAR},
- {WID_TX_POWER_LEVEL_11B, WID_CHAR},
- {WID_PREAMBLE, WID_CHAR},
- {WID_11G_OPERATING_MODE, WID_CHAR},
- {WID_MAC_ADDR, WID_ADR},
- {WID_IP_ADDRESS, WID_ADR},
- {WID_ACK_POLICY, WID_CHAR},
- {WID_PHY_ACTIVE_REG, WID_CHAR},
- {WID_AUTH_TYPE, WID_CHAR},
- {WID_REKEY_POLICY, WID_CHAR},
- {WID_REKEY_PERIOD, WID_INT},
- {WID_REKEY_PACKET_COUNT, WID_INT},
- {WID_11I_PSK, WID_STR},
- {WID_1X_KEY, WID_STR},
- {WID_1X_SERV_ADDR, WID_IP},
- {WID_SUPP_USERNAME, WID_STR},
- {WID_SUPP_PASSWORD, WID_STR},
- {WID_USER_CONTROL_ON_TX_POWER, WID_CHAR},
- {WID_MEMORY_ADDRESS, WID_INT},
- {WID_MEMORY_ACCESS_32BIT, WID_INT},
- {WID_MEMORY_ACCESS_16BIT, WID_SHORT},
- {WID_MEMORY_ACCESS_8BIT, WID_CHAR},
- {WID_SITE_SURVEY_RESULTS, WID_STR},
- {WID_PMKID_INFO, WID_STR},
- {WID_ASSOC_RES_INFO, WID_STR},
- {WID_MANUFACTURER, WID_STR}, /* 4 Wids added for the CAPI tool*/
- {WID_MODEL_NAME, WID_STR},
- {WID_MODEL_NUM, WID_STR},
- {WID_DEVICE_NAME, WID_STR},
- {WID_SSID_PROBE_REQ, WID_STR},
-
-#ifdef MAC_802_11N
- {WID_11N_ENABLE, WID_CHAR},
- {WID_11N_CURRENT_TX_MCS, WID_CHAR},
- {WID_TX_POWER_LEVEL_11N, WID_CHAR},
- {WID_11N_OPERATING_MODE, WID_CHAR},
- {WID_11N_SMPS_MODE, WID_CHAR},
- {WID_11N_PROT_MECH, WID_CHAR},
- {WID_11N_ERP_PROT_TYPE, WID_CHAR},
- {WID_11N_HT_PROT_TYPE, WID_CHAR},
- {WID_11N_PHY_ACTIVE_REG_VAL, WID_INT},
- {WID_11N_PRINT_STATS, WID_CHAR},
- {WID_11N_AUTORATE_TABLE, WID_BIN_DATA},
- {WID_HOST_CONFIG_IF_TYPE, WID_CHAR},
- {WID_HOST_DATA_IF_TYPE, WID_CHAR},
- {WID_11N_SIG_QUAL_VAL, WID_SHORT},
- {WID_11N_IMMEDIATE_BA_ENABLED, WID_CHAR},
- {WID_11N_TXOP_PROT_DISABLE, WID_CHAR},
- {WID_11N_SHORT_GI_20MHZ_ENABLE, WID_CHAR},
- {WID_SHORT_SLOT_ALLOWED, WID_CHAR},
- {WID_11W_ENABLE, WID_CHAR},
- {WID_11W_MGMT_PROT_REQ, WID_CHAR},
- {WID_2040_ENABLE, WID_CHAR},
- {WID_2040_COEXISTENCE, WID_CHAR},
- {WID_USER_SEC_CHANNEL_OFFSET, WID_CHAR},
- {WID_2040_CURR_CHANNEL_OFFSET, WID_CHAR},
- {WID_2040_40MHZ_INTOLERANT, WID_CHAR},
- {WID_HUT_RESTART, WID_CHAR},
- {WID_HUT_NUM_TX_PKTS, WID_INT},
- {WID_HUT_FRAME_LEN, WID_SHORT},
- {WID_HUT_TX_FORMAT, WID_CHAR},
- {WID_HUT_BANDWIDTH, WID_CHAR},
- {WID_HUT_OP_BAND, WID_CHAR},
- {WID_HUT_STBC, WID_CHAR},
- {WID_HUT_ESS, WID_CHAR},
- {WID_HUT_ANTSET, WID_CHAR},
- {WID_HUT_HT_OP_MODE, WID_CHAR},
- {WID_HUT_RIFS_MODE, WID_CHAR},
- {WID_HUT_SMOOTHING_REC, WID_CHAR},
- {WID_HUT_SOUNDING_PKT, WID_CHAR},
- {WID_HUT_HT_CODING, WID_CHAR},
- {WID_HUT_TEST_DIR, WID_CHAR},
- {WID_HUT_TXOP_LIMIT, WID_SHORT},
- {WID_HUT_DEST_ADDR, WID_ADR},
- {WID_HUT_TX_PATTERN, WID_BIN_DATA},
- {WID_HUT_TX_TIME_TAKEN, WID_INT},
- {WID_HUT_PHY_TEST_MODE, WID_CHAR},
- {WID_HUT_PHY_TEST_RATE_HI, WID_CHAR},
- {WID_HUT_PHY_TEST_RATE_LO, WID_CHAR},
- {WID_HUT_TX_TEST_TIME, WID_INT},
- {WID_HUT_LOG_INTERVAL, WID_INT},
- {WID_HUT_DISABLE_RXQ_REPLENISH, WID_CHAR},
- {WID_HUT_TEST_ID, WID_STR},
- {WID_HUT_KEY_ORIGIN, WID_CHAR},
- {WID_HUT_BCST_PERCENT, WID_CHAR},
- {WID_HUT_GROUP_CIPHER_TYPE, WID_CHAR},
- {WID_HUT_STATS, WID_BIN_DATA},
- {WID_HUT_TSF_TEST_MODE, WID_CHAR},
- {WID_HUT_SIG_QUAL_AVG, WID_SHORT},
- {WID_HUT_SIG_QUAL_AVG_CNT, WID_SHORT},
- {WID_HUT_TSSI_VALUE, WID_CHAR},
- {WID_HUT_MGMT_PERCENT, WID_CHAR},
- {WID_HUT_MGMT_BCST_PERCENT, WID_CHAR},
- {WID_HUT_MGMT_ALLOW_HT, WID_CHAR},
- {WID_HUT_UC_MGMT_TYPE, WID_CHAR},
- {WID_HUT_BC_MGMT_TYPE, WID_CHAR},
- {WID_HUT_UC_MGMT_FRAME_LEN, WID_SHORT},
- {WID_HUT_BC_MGMT_FRAME_LEN, WID_SHORT},
- {WID_HUT_11W_MFP_REQUIRED_TX, WID_CHAR},
- {WID_HUT_11W_MFP_PEER_CAPABLE, WID_CHAR},
- {WID_HUT_11W_TX_IGTK_ID, WID_CHAR},
- {WID_HUT_FC_TXOP_MOD, WID_CHAR},
- {WID_HUT_FC_PROT_TYPE, WID_CHAR},
- {WID_HUT_SEC_CCA_ASSERT, WID_CHAR},
-#endif /* MAC_802_11N */
};
-u16 g_num_total_switches = (sizeof(gastrWIDs) / sizeof(tstrWID));
-/*****************************************************************************/
-/* Static Function Declarations */
-/*****************************************************************************/
-
-
-
-/*****************************************************************************/
-/* Functions */
-/*****************************************************************************/
-INLINE u8 ascii_hex_to_dec(u8 num)
-{
- if ((num >= '0') && (num <= '9'))
- return (num - '0');
- else if ((num >= 'A') && (num <= 'F'))
- return (10 + (num - 'A'));
- else if ((num >= 'a') && (num <= 'f'))
- return (10 + (num - 'a'));
-
- return INVALID;
-}
-
-INLINE u8 get_hex_char(u8 inp)
-{
- u8 *d2htab = "0123456789ABCDEF";
-
- return d2htab[inp & 0xF];
-}
-
-/* This function extracts the MAC address held in a string in standard format */
-/* into another buffer as integers. */
-INLINE u16 extract_mac_addr(char *str, u8 *buff)
-{
- *buff = 0;
- while (*str != '\0') {
- if ((*str == ':') || (*str == '-'))
- *(++buff) = 0;
- else
- *buff = (*buff << 4) + ascii_hex_to_dec(*str);
-
- str++;
- }
-
- return MAC_ADDR_LEN;
-}
-
-/* This function creates MAC address in standard format from a buffer of */
-/* integers. */
-INLINE void create_mac_addr(u8 *str, u8 *buff)
-{
- u32 i = 0;
- u32 j = 0;
-
- for (i = 0; i < MAC_ADDR_LEN; i++) {
- str[j++] = get_hex_char((u8)((buff[i] >> 4) & 0x0F));
- str[j++] = get_hex_char((u8)(buff[i] & 0x0F));
- str[j++] = ':';
- }
- str[--j] = '\0';
-}
-
-/* This function converts the IP address string in dotted decimal format to */
-/* unsigned integer. This functionality is similar to the library function */
-/* inet_addr() but is reimplemented here since I could not confirm that */
-/* inet_addr is platform independent. */
-/* ips=>IP Address String in dotted decimal format */
-/* ipn=>Pointer to IP Address in integer format */
-INLINE u8 conv_ip_to_int(u8 *ips, u32 *ipn)
-{
- u8 i = 0;
- u8 ipb = 0;
- *ipn = 0;
- /* Integer to string for each component */
- while (ips[i] != '\0') {
- if (ips[i] == '.') {
- *ipn = ((*ipn) << 8) | ipb;
- ipb = 0;
- } else {
- ipb = ipb * 10 + ascii_hex_to_dec(ips[i]);
- }
-
- i++;
- }
-
- /* The last byte of the IP address is read in here */
- *ipn = ((*ipn) << 8) | ipb;
-
- return 0;
-}
-
-/* This function converts the IP address from integer format to dotted */
-/* decimal string format. Alternative to std library fn inet_ntoa(). */
-/* ips=>Buffer to hold IP Address String dotted decimal format (Min 17B) */
-/* ipn=>IP Address in integer format */
-INLINE u8 conv_int_to_ip(u8 *ips, u32 ipn)
-{
- u8 i = 0;
- u8 ipb = 0;
- u8 cnt = 0;
- u8 ipbsize = 0;
-
- for (cnt = 4; cnt > 0; cnt--) {
- ipb = (ipn >> (8 * (cnt - 1))) & 0xFF;
-
- if (ipb >= 100)
- ipbsize = 2;
- else if (ipb >= 10)
- ipbsize = 1;
- else
- ipbsize = 0;
-
- switch (ipbsize) {
- case 2:
- ips[i++] = get_hex_char(ipb / 100);
- ipb %= 100;
-
- case 1:
- ips[i++] = get_hex_char(ipb / 10);
- ipb %= 10;
-
- default:
- ips[i++] = get_hex_char(ipb);
- }
-
- if (cnt > 1)
- ips[i++] = '.';
- }
-
- ips[i] = '\0';
-
- return i;
-}
-
-INLINE tenuWIDtype get_wid_type(u32 wid_num)
-{
- /* Check for iconfig specific WID types first */
- if ((wid_num == WID_BSSID) ||
- (wid_num == WID_MAC_ADDR) ||
- (wid_num == WID_IP_ADDRESS) ||
- (wid_num == WID_HUT_DEST_ADDR)) {
- return WID_ADR;
- }
-
- if ((WID_1X_SERV_ADDR == wid_num) ||
- (WID_STACK_IP_ADDR == wid_num) ||
- (WID_STACK_NETMASK_ADDR == wid_num)) {
- return WID_IP;
- }
-
- /* Next check for standard WID types */
- if (wid_num < 0x1000)
- return WID_CHAR;
- else if (wid_num < 0x2000)
- return WID_SHORT;
- else if (wid_num < 0x3000)
- return WID_INT;
- else if (wid_num < 0x4000)
- return WID_STR;
- else if (wid_num < 0x5000)
- return WID_BIN_DATA;
-
- return WID_UNDEF;
-}
-
-
/* This function extracts the beacon period field from the beacon or probe */
/* response frame. */
-INLINE u16 get_beacon_period(u8 *data)
+static inline u16 get_beacon_period(u8 *data)
{
- u16 bcn_per = 0;
+ u16 bcn_per;
bcn_per = data[0];
bcn_per |= (data[1] << 8);
@@ -481,7 +121,7 @@ INLINE u16 get_beacon_period(u8 *data)
return bcn_per;
}
-INLINE u32 get_beacon_timestamp_lo(u8 *data)
+static inline u32 get_beacon_timestamp_lo(u8 *data)
{
u32 time_stamp = 0;
u32 index = MAC_HDR_LEN;
@@ -494,7 +134,7 @@ INLINE u32 get_beacon_timestamp_lo(u8 *data)
return time_stamp;
}
-INLINE u32 get_beacon_timestamp_hi(u8 *data)
+static inline u32 get_beacon_timestamp_hi(u8 *data)
{
u32 time_stamp = 0;
u32 index = (MAC_HDR_LEN + 4);
@@ -507,26 +147,18 @@ INLINE u32 get_beacon_timestamp_hi(u8 *data)
return time_stamp;
}
-/* This function extracts the 'frame type' bits from the MAC header of the */
-/* input frame. */
-/* Returns the value in the LSB of the returned value. */
-INLINE tenuBasicFrmType get_type(u8 *header)
-{
- return ((tenuBasicFrmType)(header[0] & 0x0C));
-}
-
/* This function extracts the 'frame type and sub type' bits from the MAC */
/* header of the input frame. */
/* Returns the value in the LSB of the returned value. */
-INLINE tenuFrmSubtype get_sub_type(u8 *header)
+static inline enum sub_frame_type get_sub_type(u8 *header)
{
- return ((tenuFrmSubtype)(header[0] & 0xFC));
+ return ((enum sub_frame_type)(header[0] & 0xFC));
}
/* This function extracts the 'to ds' bit from the MAC header of the input */
/* frame. */
/* Returns the value in the LSB of the returned value. */
-INLINE u8 get_to_ds(u8 *header)
+static inline u8 get_to_ds(u8 *header)
{
return (header[1] & 0x01);
}
@@ -534,28 +166,28 @@ INLINE u8 get_to_ds(u8 *header)
/* This function extracts the 'from ds' bit from the MAC header of the input */
/* frame. */
/* Returns the value in the LSB of the returned value. */
-INLINE u8 get_from_ds(u8 *header)
+static inline u8 get_from_ds(u8 *header)
{
return ((header[1] & 0x02) >> 1);
}
/* This function extracts the MAC Address in 'address1' field of the MAC */
/* header and updates the MAC Address in the allocated 'addr' variable. */
-INLINE void get_address1(u8 *pu8msa, u8 *addr)
+static inline void get_address1(u8 *pu8msa, u8 *addr)
{
memcpy(addr, pu8msa + 4, 6);
}
/* This function extracts the MAC Address in 'address2' field of the MAC */
/* header and updates the MAC Address in the allocated 'addr' variable. */
-INLINE void get_address2(u8 *pu8msa, u8 *addr)
+static inline void get_address2(u8 *pu8msa, u8 *addr)
{
memcpy(addr, pu8msa + 10, 6);
}
/* This function extracts the MAC Address in 'address3' field of the MAC */
/* header and updates the MAC Address in the allocated 'addr' variable. */
-INLINE void get_address3(u8 *pu8msa, u8 *addr)
+static inline void get_address3(u8 *pu8msa, u8 *addr)
{
memcpy(addr, pu8msa + 16, 6);
}
@@ -563,7 +195,7 @@ INLINE void get_address3(u8 *pu8msa, u8 *addr)
/* This function extracts the BSSID from the incoming WLAN packet based on */
/* the 'from ds' bit, and updates the MAC Address in the allocated 'addr' */
/* variable. */
-INLINE void get_BSSID(u8 *data, u8 *bssid)
+static inline void get_BSSID(u8 *data, u8 *bssid)
{
if (get_from_ds(data) == 1)
get_address2(data, bssid);
@@ -574,7 +206,7 @@ INLINE void get_BSSID(u8 *data, u8 *bssid)
}
/* This function extracts the SSID from a beacon/probe response frame */
-INLINE void get_ssid(u8 *data, u8 *ssid, u8 *p_ssid_len)
+static inline void get_ssid(u8 *data, u8 *ssid, u8 *p_ssid_len)
{
u8 len = 0;
u8 i = 0;
@@ -600,11 +232,11 @@ INLINE void get_ssid(u8 *data, u8 *ssid, u8 *p_ssid_len)
/* This function extracts the capability info field from the beacon or probe */
/* response frame. */
-INLINE u16 get_cap_info(u8 *data)
+static inline u16 get_cap_info(u8 *data)
{
u16 cap_info = 0;
u16 index = MAC_HDR_LEN;
- tenuFrmSubtype st;
+ enum sub_frame_type st;
st = get_sub_type(data);
@@ -621,9 +253,9 @@ INLINE u16 get_cap_info(u8 *data)
/* This function extracts the capability info field from the Association */
/* response frame. */
-INLINE u16 get_assoc_resp_cap_info(u8 *data)
+static inline u16 get_assoc_resp_cap_info(u8 *data)
{
- u16 cap_info = 0;
+ u16 cap_info;
cap_info = data[0];
cap_info |= (data[1] << 8);
@@ -631,11 +263,11 @@ INLINE u16 get_assoc_resp_cap_info(u8 *data)
return cap_info;
}
-/* This funcion extracts the association status code from the incoming */
+/* This function extracts the association status code from the incoming */
/* association response frame and returns association status code */
-INLINE u16 get_asoc_status(u8 *data)
+static inline u16 get_asoc_status(u8 *data)
{
- u16 asoc_status = 0;
+ u16 asoc_status;
asoc_status = data[3];
asoc_status = (asoc_status << 8) | data[2];
@@ -645,9 +277,9 @@ INLINE u16 get_asoc_status(u8 *data)
/* This function extracts association ID from the incoming association */
/* response frame */
-INLINE u16 get_asoc_id(u8 *data)
+static inline u16 get_asoc_id(u8 *data)
{
- u16 asoc_id = 0;
+ u16 asoc_id;
asoc_id = data[4];
asoc_id |= (data[5] << 8);
@@ -655,32 +287,9 @@ INLINE u16 get_asoc_id(u8 *data)
return asoc_id;
}
-/**
- * @brief initializes the Core Configurator
- * @details
- * @return Error code indicating success/failure
- * @note
- * @author mabubakr
- * @date 1 Mar 2012
- * @version 1.0
- */
-
-s32 CoreConfiguratorInit(void)
-{
- s32 s32Error = WILC_SUCCESS;
- PRINT_D(CORECONFIG_DBG, "CoreConfiguratorInit()\n");
-
- sema_init(&SemHandleSendPkt, 1);
- sema_init(&SemHandlePktResp, 0);
-
-
- memset((void *)(&gstrConfigPktInfo), 0, sizeof(tstrConfigPktInfo));
- return s32Error;
-}
-
u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
{
- u16 u16index = 0;
+ u16 u16index;
/*************************************************************************/
/* Beacon Frame - Frame Body */
@@ -698,11 +307,10 @@ u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
while (u16index < (u16RxLen - FCS_LEN)) {
if (pu8msa[u16index] == ITIM)
return &pu8msa[u16index];
- else
- u16index += (IE_HDR_LEN + pu8msa[u16index + 1]);
+ u16index += (IE_HDR_LEN + pu8msa[u16index + 1]);
}
- return 0;
+ return NULL;
}
/* This function gets the current channel information from
@@ -715,9 +323,8 @@ u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
while (index < (u16RxLen - FCS_LEN)) {
if (pu8msa[index] == IDSPARMS)
return pu8msa[index + 2];
- else
- /* Increment index by length information and header */
- index += pu8msa[index + 1] + IE_HDR_LEN;
+ /* Increment index by length information and header */
+ index += pu8msa[index + 1] + IE_HDR_LEN;
}
/* Return current channel information from the MIB, if beacon/probe */
@@ -726,23 +333,6 @@ u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
return 0; /* no MIB here */
}
-u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
-{
-#ifdef PHY_802_11n
-#ifdef FIVE_GHZ_BAND
- /* Get the current channel as its not set in */
- /* 802.11a beacons/probe response */
- return (get_rf_channel() + 1);
-#else /* FIVE_GHZ_BAND */
- /* Extract current channel information from */
- /* the beacon/probe response frame */
- return get_current_channel_802_11n(pu8msa, u16RxLen);
-#endif /* FIVE_GHZ_BAND */
-#else
- return 0;
-#endif /* PHY_802_11n */
-}
-
/**
* @brief parses the received 'N' message
* @details
@@ -754,9 +344,8 @@ u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
* @date 1 Mar 2012
* @version 1.0
*/
-s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
+s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
{
- s32 s32Error = WILC_SUCCESS;
tstrNetworkInfo *pstrNetworkInfo = NULL;
u8 u8MsgType = 0;
u8 u8MsgID = 0;
@@ -764,14 +353,14 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
u16 u16WidID = (u16)WID_NIL;
u16 u16WidLen = 0;
- u8 *pu8WidVal = 0;
+ u8 *pu8WidVal = NULL;
u8MsgType = pu8MsgBuffer[0];
/* Check whether the received message type is 'N' */
if ('N' != u8MsgType) {
PRINT_ER("Received Message format incorrect.\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
+ return -EFAULT;
}
/* Extract message ID */
@@ -791,21 +380,19 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
/* parse the WID value of the WID "WID_NEWORK_INFO" */
{
- u8 *pu8msa = 0;
+ u8 *pu8msa = NULL;
u16 u16RxLen = 0;
- u8 *pu8TimElm = 0;
- u8 *pu8IEs = 0;
+ u8 *pu8TimElm = NULL;
+ u8 *pu8IEs = NULL;
u16 u16IEsLen = 0;
u8 u8index = 0;
u32 u32Tsf_Lo;
u32 u32Tsf_Hi;
- pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
+ pstrNetworkInfo = kzalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
if (!pstrNetworkInfo)
return -ENOMEM;
- memset((void *)(pstrNetworkInfo), 0, sizeof(tstrNetworkInfo));
-
pstrNetworkInfo->s8rssi = pu8WidVal[0];
/* Assign a pointer to msa "Mac Header Start Address" */
@@ -817,11 +404,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
/* Get the cap_info */
pstrNetworkInfo->u16CapInfo = get_cap_info(pu8msa);
- #ifdef WILC_P2P
/* Get time-stamp [Low only 32 bit] */
pstrNetworkInfo->u32Tsf = get_beacon_timestamp_lo(pu8msa);
PRINT_D(CORECONFIG_DBG, "TSF :%x\n", pstrNetworkInfo->u32Tsf);
- #endif
/* Get full time-stamp [Low and High 64 bit] */
u32Tsf_Lo = get_beacon_timestamp_lo(pu8msa);
@@ -830,36 +415,37 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
pstrNetworkInfo->u64Tsf = u32Tsf_Lo | ((u64)u32Tsf_Hi << 32);
/* Get SSID */
- get_ssid(pu8msa, pstrNetworkInfo->au8ssid, &(pstrNetworkInfo->u8SsidLen));
+ get_ssid(pu8msa, pstrNetworkInfo->au8ssid, &pstrNetworkInfo->u8SsidLen);
/* Get BSSID */
get_BSSID(pu8msa, pstrNetworkInfo->au8bssid);
- /* Get the current channel */
- pstrNetworkInfo->u8channel = get_current_channel(pu8msa, (u16RxLen + FCS_LEN));
+ /*
+ * Extract current channel information from
+ * the beacon/probe response frame
+ */
+ pstrNetworkInfo->u8channel = get_current_channel_802_11n(pu8msa,
+ u16RxLen + FCS_LEN);
/* Get beacon period */
- u8index = (MAC_HDR_LEN + TIME_STAMP_LEN);
+ u8index = MAC_HDR_LEN + TIME_STAMP_LEN;
pstrNetworkInfo->u16BeaconPeriod = get_beacon_period(pu8msa + u8index);
u8index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;
/* Get DTIM Period */
- pu8TimElm = get_tim_elm(pu8msa, (u16RxLen + FCS_LEN), u8index);
- if (pu8TimElm != 0)
+ pu8TimElm = get_tim_elm(pu8msa, u16RxLen + FCS_LEN, u8index);
+ if (pu8TimElm != NULL)
pstrNetworkInfo->u8DtimPeriod = pu8TimElm[3];
pu8IEs = &pu8msa[MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN];
u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN);
if (u16IEsLen > 0) {
- pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, GFP_KERNEL);
+ pstrNetworkInfo->pu8IEs = kmemdup(pu8IEs, u16IEsLen,
+ GFP_KERNEL);
if (!pstrNetworkInfo->pu8IEs)
return -ENOMEM;
-
- memset((void *)(pstrNetworkInfo->pu8IEs), 0, u16IEsLen);
-
- memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen);
}
pstrNetworkInfo->u16IEsLen = u16IEsLen;
@@ -867,8 +453,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
*ppstrNetworkInfo = pstrNetworkInfo;
-ERRORHANDLER:
- return s32Error;
+ return 0;
}
/**
@@ -883,21 +468,21 @@ ERRORHANDLER:
*/
s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
{
- s32 s32Error = WILC_SUCCESS;
+ s32 s32Error = 0;
if (pstrNetworkInfo != NULL) {
if (pstrNetworkInfo->pu8IEs != NULL) {
kfree(pstrNetworkInfo->pu8IEs);
pstrNetworkInfo->pu8IEs = NULL;
} else {
- s32Error = WILC_FAIL;
+ s32Error = -EFAULT;
}
kfree(pstrNetworkInfo);
pstrNetworkInfo = NULL;
} else {
- s32Error = WILC_FAIL;
+ s32Error = -EFAULT;
}
return s32Error;
@@ -917,18 +502,16 @@ s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
tstrConnectRespInfo **ppstrConnectRespInfo)
{
- s32 s32Error = WILC_SUCCESS;
+ s32 s32Error = 0;
tstrConnectRespInfo *pstrConnectRespInfo = NULL;
u16 u16AssocRespLen = 0;
- u8 *pu8IEs = 0;
+ u8 *pu8IEs = NULL;
u16 u16IEsLen = 0;
- pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
+ pstrConnectRespInfo = kzalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
if (!pstrConnectRespInfo)
return -ENOMEM;
- memset((void *)(pstrConnectRespInfo), 0, sizeof(tstrConnectRespInfo));
-
/* u16AssocRespLen = pu8Buffer[0]; */
u16AssocRespLen = (u16)u32BufferLen;
@@ -946,19 +529,15 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
pu8IEs = &pu8Buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN);
- pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, GFP_KERNEL);
+ pstrConnectRespInfo->pu8RespIEs = kmemdup(pu8IEs, u16IEsLen, GFP_KERNEL);
if (!pstrConnectRespInfo->pu8RespIEs)
return -ENOMEM;
- memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, u16IEsLen);
-
- memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen);
pstrConnectRespInfo->u16RespIEsLen = u16IEsLen;
}
*ppstrConnectRespInfo = pstrConnectRespInfo;
-
return s32Error;
}
@@ -974,994 +553,27 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
*/
s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo)
{
- s32 s32Error = WILC_SUCCESS;
+ s32 s32Error = 0;
if (pstrConnectRespInfo != NULL) {
if (pstrConnectRespInfo->pu8RespIEs != NULL) {
kfree(pstrConnectRespInfo->pu8RespIEs);
pstrConnectRespInfo->pu8RespIEs = NULL;
} else {
- s32Error = WILC_FAIL;
+ s32Error = -EFAULT;
}
kfree(pstrConnectRespInfo);
pstrConnectRespInfo = NULL;
} else {
- s32Error = WILC_FAIL;
- }
-
- return s32Error;
-}
-
-#ifndef CONNECT_DIRECT
-s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE],
- wid_site_survey_reslts_s **ppstrSurveyResults,
- u32 *pu32SurveyResultsCount)
-{
- s32 s32Error = WILC_SUCCESS;
- wid_site_survey_reslts_s *pstrSurveyResults = NULL;
- u32 u32SurveyResultsCount = 0;
- u32 u32SurveyBytesLength = 0;
- u8 *pu8BufferPtr;
- u32 u32RcvdSurveyResultsNum = 2;
- u8 u8ReadSurveyResFragNum;
- u32 i;
- u32 j;
-
- for (i = 0; i < u32RcvdSurveyResultsNum; i++) {
- u32SurveyBytesLength = ppu8RcvdSiteSurveyResults[i][0];
-
-
- for (j = 0; j < u32SurveyBytesLength; j += SURVEY_RESULT_LENGTH) {
- u32SurveyResultsCount++;
- }
- }
-
- pstrSurveyResults = kmalloc_array(u32SurveyResultsCount,
- sizeof(wid_site_survey_reslts_s), GFP_KERNEL);
- if (!pstrSurveyResults)
- return -ENOMEM;
-
- memset((void *)(pstrSurveyResults), 0, u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s));
-
- u32SurveyResultsCount = 0;
-
- for (i = 0; i < u32RcvdSurveyResultsNum; i++) {
- pu8BufferPtr = ppu8RcvdSiteSurveyResults[i];
-
- u32SurveyBytesLength = pu8BufferPtr[0];
-
- /* TODO: mostafa: pu8BufferPtr[1] contains the fragment num */
- u8ReadSurveyResFragNum = pu8BufferPtr[1];
-
- pu8BufferPtr += 2;
-
- for (j = 0; j < u32SurveyBytesLength; j += SURVEY_RESULT_LENGTH) {
- memcpy(&pstrSurveyResults[u32SurveyResultsCount], pu8BufferPtr, SURVEY_RESULT_LENGTH);
- pu8BufferPtr += SURVEY_RESULT_LENGTH;
- u32SurveyResultsCount++;
- }
- }
-
-ERRORHANDLER:
- *ppstrSurveyResults = pstrSurveyResults;
- *pu32SurveyResultsCount = u32SurveyResultsCount;
-
- return s32Error;
-}
-
-
-s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults)
-{
- s32 s32Error = WILC_SUCCESS;
-
- if (pstrSurveyResults != NULL) {
- kfree(pstrSurveyResults);
- }
-
- return s32Error;
-}
-#endif
-
-/*****************************************************************************/
-/* */
-/* Function Name : ProcessCharWid */
-/* */
-/* Description : This function processes a WID of type WID_CHAR and */
-/* updates the cfg packet with the supplied value. */
-/* */
-/* Inputs : 1) Pointer to WID cfg structure */
-/* 2) Value to set */
-/* */
-/* Globals : */
-/* */
-/* Processing : */
-/* */
-/* Outputs : None */
-/* */
-/* Returns : None */
-/* */
-/* Issues : None */
-/* */
-/* Revision History: */
-/* */
-/* DD MM YYYY Author(s) Changes (Describe the changes made) */
-/* 08 01 2008 Ittiam Draft */
-/* */
-/*****************************************************************************/
-
-void ProcessCharWid(char *pcPacket, s32 *ps32PktLen,
- tstrWID *pstrWID, s8 *ps8WidVal)
-{
- u8 *pu8val = (u8 *)ps8WidVal;
- u8 u8val = 0;
- s32 s32PktLen = *ps32PktLen;
- if (pstrWID == NULL) {
- PRINT_WRN(CORECONFIG_DBG, "Can't set CHAR val 0x%x ,NULL structure\n", u8val);
- return;
- }
-
- /* WID */
- pcPacket[s32PktLen++] = (u8)(pstrWID->u16WIDid & 0xFF);
- pcPacket[s32PktLen++] = (u8)(pstrWID->u16WIDid >> 8) & 0xFF;
- if (g_oper_mode == SET_CFG) {
- u8val = *pu8val;
-
- /* Length */
- pcPacket[s32PktLen++] = sizeof(u8);
-
-
- /* Value */
- pcPacket[s32PktLen++] = u8val;
- }
- *ps32PktLen = s32PktLen;
-}
-
-/*****************************************************************************/
-/* */
-/* Function Name : ProcessShortWid */
-/* */
-/* Description : This function processes a WID of type WID_SHORT and */
-/* updates the cfg packet with the supplied value. */
-/* */
-/* Inputs : 1) Pointer to WID cfg structure */
-/* 2) Value to set */
-/* */
-/* Globals : */
-/* */
-/* Processing : */
-/* */
-/* Outputs : None */
-/* */
-/* Returns : None */
-/* */
-/* Issues : None */
-/* */
-/* Revision History: */
-/* */
-/* DD MM YYYY Author(s) Changes (Describe the changes made) */
-/* 08 01 2008 Ittiam Draft */
-/* */
-/*****************************************************************************/
-
-void ProcessShortWid(char *pcPacket, s32 *ps32PktLen,
- tstrWID *pstrWID, s8 *ps8WidVal)
-{
- u16 *pu16val = (u16 *)ps8WidVal;
- u16 u16val = 0;
- s32 s32PktLen = *ps32PktLen;
- if (pstrWID == NULL) {
- PRINT_WRN(CORECONFIG_DBG, "Can't set SHORT val 0x%x ,NULL structure\n", u16val);
- return;
- }
-
- /* WID */
- pcPacket[s32PktLen++] = (u8)(pstrWID->u16WIDid & 0xFF);
- pcPacket[s32PktLen++] = (u8)((pstrWID->u16WIDid >> 8) & 0xFF);
-
- if (g_oper_mode == SET_CFG) {
- u16val = *pu16val;
-
- /* Length */
- pcPacket[s32PktLen++] = sizeof(u16);
-
- /* Value */
- pcPacket[s32PktLen++] = (u8)(u16val & 0xFF);
- pcPacket[s32PktLen++] = (u8)((u16val >> 8) & 0xFF);
- }
- *ps32PktLen = s32PktLen;
-}
-
-/*****************************************************************************/
-/* */
-/* Function Name : ProcessIntWid */
-/* */
-/* Description : This function processes a WID of type WID_INT and */
-/* updates the cfg packet with the supplied value. */
-/* */
-/* Inputs : 1) Pointer to WID cfg structure */
-/* 2) Value to set */
-/* */
-/* Globals : */
-/* */
-/* Processing : */
-/* */
-/* Outputs : None */
-/* */
-/* Returns : None */
-/* */
-/* Issues : None */
-/* */
-/* Revision History: */
-/* */
-/* DD MM YYYY Author(s) Changes (Describe the changes made) */
-/* 08 01 2008 Ittiam Draft */
-/* */
-/*****************************************************************************/
-
-void ProcessIntWid(char *pcPacket, s32 *ps32PktLen,
- tstrWID *pstrWID, s8 *ps8WidVal)
-{
- u32 *pu32val = (u32 *)ps8WidVal;
- u32 u32val = 0;
- s32 s32PktLen = *ps32PktLen;
- if (pstrWID == NULL) {
- PRINT_WRN(CORECONFIG_DBG, "Can't set INT val 0x%x , NULL structure\n", u32val);
- return;
- }
-
- /* WID */
- pcPacket[s32PktLen++] = (u8)(pstrWID->u16WIDid & 0xFF);
- pcPacket[s32PktLen++] = (u8)((pstrWID->u16WIDid >> 8) & 0xFF);
-
- if (g_oper_mode == SET_CFG) {
- u32val = *pu32val;
-
- /* Length */
- pcPacket[s32PktLen++] = sizeof(u32);
-
- /* Value */
- pcPacket[s32PktLen++] = (u8)(u32val & 0xFF);
- pcPacket[s32PktLen++] = (u8)((u32val >> 8) & 0xFF);
- pcPacket[s32PktLen++] = (u8)((u32val >> 16) & 0xFF);
- pcPacket[s32PktLen++] = (u8)((u32val >> 24) & 0xFF);
- }
- *ps32PktLen = s32PktLen;
-}
-
-/*****************************************************************************/
-/* */
-/* Function Name : ProcessIPwid */
-/* */
-/* Description : This function processes a WID of type WID_IP and */
-/* updates the cfg packet with the supplied value. */
-/* */
-/* Inputs : 1) Pointer to WID cfg structure */
-/* 2) Value to set */
-/* */
-/* Globals : */
-/* */
-/* */
-/* Processing : */
-/* */
-/* Outputs : None */
-/* */
-/* Returns : None */
-/* */
-/* Issues : None */
-/* */
-/* Revision History: */
-/* */
-/* DD MM YYYY Author(s) Changes (Describe the changes made) */
-/* 08 01 2008 Ittiam Draft */
-/* */
-/*****************************************************************************/
-
-void ProcessIPwid(char *pcPacket, s32 *ps32PktLen,
- tstrWID *pstrWID, u8 *pu8ip)
-{
- u32 u32val = 0;
- s32 s32PktLen = *ps32PktLen;
-
- if (pstrWID == NULL) {
- PRINT_WRN(CORECONFIG_DBG, "Can't set IP Addr , NULL structure\n");
- return;
- }
-
- /* WID */
- pcPacket[s32PktLen++] = (u8)(pstrWID->u16WIDid & 0xFF);
- pcPacket[s32PktLen++] = (u8)((pstrWID->u16WIDid >> 8) & 0xFF);
-
- if (g_oper_mode == SET_CFG) {
- /* Length */
- pcPacket[s32PktLen++] = sizeof(u32);
-
- /* Convert the IP Address String to Integer */
- conv_ip_to_int(pu8ip, &u32val);
-
- /* Value */
- pcPacket[s32PktLen++] = (u8)(u32val & 0xFF);
- pcPacket[s32PktLen++] = (u8)((u32val >> 8) & 0xFF);
- pcPacket[s32PktLen++] = (u8)((u32val >> 16) & 0xFF);
- pcPacket[s32PktLen++] = (u8)((u32val >> 24) & 0xFF);
- }
- *ps32PktLen = s32PktLen;
-}
-
-/*****************************************************************************/
-/* */
-/* Function Name : ProcessStrWid */
-/* */
-/* Description : This function processes a WID of type WID_STR and */
-/* updates the cfg packet with the supplied value. */
-/* */
-/* Inputs : 1) Pointer to WID cfg structure */
-/* 2) Value to set */
-/* */
-/* Globals : */
-/* */
-/* Processing : */
-/* */
-/* Outputs : None */
-/* */
-/* Returns : None */
-/* */
-/* Issues : None */
-/* */
-/* Revision History: */
-/* */
-/* DD MM YYYY Author(s) Changes (Describe the changes made) */
-/* 08 01 2008 Ittiam Draft */
-/* */
-/*****************************************************************************/
-
-void ProcessStrWid(char *pcPacket, s32 *ps32PktLen,
- tstrWID *pstrWID, u8 *pu8val, s32 s32ValueSize)
-{
- u16 u16MsgLen = 0;
- u16 idx = 0;
- s32 s32PktLen = *ps32PktLen;
- if (pstrWID == NULL) {
- PRINT_WRN(CORECONFIG_DBG, "Can't set STR val, NULL structure\n");
- return;
- }
-
- /* WID */
- pcPacket[s32PktLen++] = (u8)(pstrWID->u16WIDid & 0xFF);
- pcPacket[s32PktLen++] = (u8)((pstrWID->u16WIDid >> 8) & 0xFF);
-
- if (g_oper_mode == SET_CFG) {
- /* Message Length */
- u16MsgLen = (u16)s32ValueSize;
-
- /* Length */
- pcPacket[s32PktLen++] = (u8)u16MsgLen;
-
- /* Value */
- for (idx = 0; idx < u16MsgLen; idx++)
- pcPacket[s32PktLen++] = pu8val[idx];
- }
- *ps32PktLen = s32PktLen;
-}
-
-/*****************************************************************************/
-/* */
-/* Function Name : ProcessAdrWid */
-/* */
-/* Description : This function processes a WID of type WID_ADR and */
-/* updates the cfg packet with the supplied value. */
-/* */
-/* Inputs : 1) Pointer to WID cfg structure */
-/* 2) Value to set */
-/* */
-/* Globals : */
-/* */
-/* Processing : */
-/* */
-/* Outputs : None */
-/* */
-/* Returns : None */
-/* */
-/* Issues : None */
-/* */
-/* Revision History: */
-/* */
-/* DD MM YYYY Author(s) Changes (Describe the changes made) */
-/* 08 01 2008 Ittiam Draft */
-/* */
-/*****************************************************************************/
-
-void ProcessAdrWid(char *pcPacket, s32 *ps32PktLen,
- tstrWID *pstrWID, u8 *pu8val)
-{
- u16 u16MsgLen = 0;
- s32 s32PktLen = *ps32PktLen;
-
- if (pstrWID == NULL) {
- PRINT_WRN(CORECONFIG_DBG, "Can't set Addr WID, NULL structure\n");
- return;
- }
-
- /* WID */
- pcPacket[s32PktLen++] = (u8)(pstrWID->u16WIDid & 0xFF);
- pcPacket[s32PktLen++] = (u8)((pstrWID->u16WIDid >> 8) & 0xFF);
-
- if (g_oper_mode == SET_CFG) {
- /* Message Length */
- u16MsgLen = MAC_ADDR_LEN;
-
- /* Length */
- pcPacket[s32PktLen++] = (u8)u16MsgLen;
-
- /* Value */
- extract_mac_addr(pu8val, pcPacket + s32PktLen);
- s32PktLen += u16MsgLen;
- }
- *ps32PktLen = s32PktLen;
-}
-
-/*****************************************************************************/
-/* */
-/* Function Name : ProcessBinWid */
-/* */
-/* Description : This function processes a WID of type WID_BIN_DATA and */
-/* updates the cfg packet with the supplied value. */
-/* */
-/* Inputs : 1) Pointer to WID cfg structure */
-/* 2) Name of file containing the binary data in text mode */
-/* */
-/* Globals : */
-/* */
-/* Processing : The binary data is expected to be supplied through a */
-/* file in text mode. This file is expected to be in the */
-/* finject format. It is parsed, converted to binary format */
-/* and copied into g_cfg_pkt for further processing. This */
-/* is obviously a round-about way of processing involving */
-/* multiple (re)conversions between bin & ascii formats. */
-/* But it is done nevertheless to retain uniformity and for */
-/* ease of debugging. */
-/* */
-/* Outputs : None */
-/* */
-/* Returns : None */
-/* */
-
-/* Issues : None */
-/* */
-/* Revision History: */
-/* */
-/* DD MM YYYY Author(s) Changes (Describe the changes made) */
-/* 08 01 2008 Ittiam Draft */
-/* */
-/*****************************************************************************/
-
-void ProcessBinWid(char *pcPacket, s32 *ps32PktLen,
- tstrWID *pstrWID, u8 *pu8val, s32 s32ValueSize)
-{
- u16 u16MsgLen = 0;
- u16 idx = 0;
- s32 s32PktLen = *ps32PktLen;
- u8 u8checksum = 0;
-
- if (pstrWID == NULL) {
- PRINT_WRN(CORECONFIG_DBG, "Can't set BIN val, NULL structure\n");
- return;
- }
-
- /* WID */
- pcPacket[s32PktLen++] = (u8)(pstrWID->u16WIDid & 0xFF);
- pcPacket[s32PktLen++] = (u8)((pstrWID->u16WIDid >> 8) & 0xFF);
-
- if (g_oper_mode == SET_CFG) {
- /* Message Length */
- u16MsgLen = (u16)s32ValueSize;
-
- /* Length */
- /* pcPacket[s32PktLen++] = (u8)u16MsgLen; */
- pcPacket[s32PktLen++] = (u8)(u16MsgLen & 0xFF);
- pcPacket[s32PktLen++] = (u8)((u16MsgLen >> 8) & 0xFF);
-
- /* Value */
- for (idx = 0; idx < u16MsgLen; idx++)
- pcPacket[s32PktLen++] = pu8val[idx];
-
- /* checksum */
- for (idx = 0; idx < u16MsgLen; idx++)
- u8checksum += pcPacket[MSG_HEADER_LEN + idx + 4];
-
- pcPacket[s32PktLen++] = u8checksum;
- }
- *ps32PktLen = s32PktLen;
-}
-
-
-/*****************************************************************************/
-/* */
-/* Function Name : further_process_response */
-/* */
-/* Description : This function parses the response frame got from the */
-/* device. */
-/* */
-/* Inputs : 1) The received response frame */
-/* 2) WID */
-/* 3) WID Length */
-/* 4) Output file handle */
-/* 5) Process Wid Number(i.e wid from --widn switch) */
-/* 6) Index the array in the Global Wid Structure. */
-/* */
-/* Globals : g_wid_num, gastrWIDs */
-/* */
-/* Processing : This function parses the response of the device depending*/
-/* WID type and writes it to the output file in Hex or */
-/* decimal notation depending on the --getx or --get switch.*/
-/* */
-/* Outputs : None */
-/* */
-/* Returns : 0 on Success & -2 on Failure */
-/* */
-/* Issues : None */
-/* */
-/* Revision History: */
-/* */
-/* DD MM YYYY Author(s) Changes (Describe the changes made) */
-/* 08 01 2009 Ittiam Draft */
-/* */
-/*****************************************************************************/
-
-s32 further_process_response(u8 *resp,
- u16 u16WIDid,
- u16 cfg_len,
- bool process_wid_num,
- u32 cnt,
- tstrWID *pstrWIDresult)
-{
- u32 retval = 0;
- u32 idx = 0;
- u8 cfg_chr = 0;
- u16 cfg_sht = 0;
- u32 cfg_int = 0;
- u8 cfg_str[256] = {0};
- tenuWIDtype enuWIDtype = WID_UNDEF;
-
- if (process_wid_num)
- enuWIDtype = get_wid_type(g_wid_num);
- else
- enuWIDtype = gastrWIDs[cnt].enuWIDtype;
-
-
- switch (enuWIDtype) {
- case WID_CHAR:
- cfg_chr = resp[idx];
- /*Set local copy of WID*/
- *(pstrWIDresult->ps8WidVal) = cfg_chr;
- break;
-
- case WID_SHORT:
- {
- u16 *pu16val = (u16 *)(pstrWIDresult->ps8WidVal);
- cfg_sht = MAKE_WORD16(resp[idx], resp[idx + 1]);
- /*Set local copy of WID*/
- /* pstrWIDresult->ps8WidVal = (s8*)(s32)cfg_sht; */
- *pu16val = cfg_sht;
- break;
- }
-
- case WID_INT:
- {
- u32 *pu32val = (u32 *)(pstrWIDresult->ps8WidVal);
- cfg_int = MAKE_WORD32(
- MAKE_WORD16(resp[idx], resp[idx + 1]),
- MAKE_WORD16(resp[idx + 2], resp[idx + 3])
- );
- /*Set local copy of WID*/
- /* pstrWIDresult->ps8WidVal = (s8*)cfg_int; */
- *pu32val = cfg_int;
- break;
- }
-
- case WID_STR:
- memcpy(cfg_str, resp + idx, cfg_len);
- /* cfg_str[cfg_len] = '\0'; //mostafa: no need currently for NULL termination */
- if (pstrWIDresult->s32ValueSize >= cfg_len) {
- memcpy(pstrWIDresult->ps8WidVal, cfg_str, cfg_len); /* mostafa: no need currently for the extra NULL byte */
- pstrWIDresult->s32ValueSize = cfg_len;
- } else {
- PRINT_ER("allocated WID buffer length is smaller than the received WID Length\n");
- retval = -2;
- }
-
- break;
-
- case WID_ADR:
- create_mac_addr(cfg_str, resp + idx);
-
- strncpy(pstrWIDresult->ps8WidVal, cfg_str, strlen(cfg_str));
- pstrWIDresult->ps8WidVal[strlen(cfg_str)] = '\0';
- break;
-
- case WID_IP:
- cfg_int = MAKE_WORD32(
- MAKE_WORD16(resp[idx], resp[idx + 1]),
- MAKE_WORD16(resp[idx + 2], resp[idx + 3])
- );
- conv_int_to_ip(cfg_str, cfg_int);
- break;
-
- case WID_BIN_DATA:
- if (pstrWIDresult->s32ValueSize >= cfg_len) {
- memcpy(pstrWIDresult->ps8WidVal, resp + idx, cfg_len);
- pstrWIDresult->s32ValueSize = cfg_len;
- } else {
- PRINT_ER("Allocated WID buffer length is smaller than the received WID Length Err(%d)\n", retval);
- retval = -2;
- }
- break;
-
- default:
- PRINT_ER("ERROR: Check config database: Error(%d)\n", retval);
- retval = -2;
- break;
- }
-
- return retval;
-}
-
-/*****************************************************************************/
-/* */
-/* Function Name : ParseResponse */
-/* */
-/* Description : This function parses the command-line options and */
-/* creates the config packets which can be sent to the WLAN */
-/* station. */
-/* */
-/* Inputs : 1) The received response frame */
-/* */
-/* Globals : g_opt_list, gastrWIDs */
-/* */
-/* Processing : This function parses the options and creates different */
-/* types of packets depending upon the WID-type */
-/* corresponding to the option. */
-/* */
-/* Outputs : None */
-/* */
-/* Returns : 0 on Success & -1 on Failure */
-/* */
-/* Issues : None */
-/* */
-/* Revision History: */
-/* */
-/* DD MM YYYY Author(s) Changes (Describe the changes made) */
-/* 08 01 2008 Ittiam Draft */
-/* */
-/*****************************************************************************/
-
-s32 ParseResponse(u8 *resp, tstrWID *pstrWIDcfgResult)
-{
- u16 u16RespLen = 0;
- u16 u16WIDid = 0;
- u16 cfg_len = 0;
- tenuWIDtype enuWIDtype = WID_UNDEF;
- bool num_wid_processed = false;
- u32 cnt = 0;
- u32 idx = 0;
- u32 ResCnt = 0;
- /* Check whether the received frame is a valid response */
- if (RESP_MSG_TYPE != resp[0]) {
- PRINT_INFO(CORECONFIG_DBG, "Received Message format incorrect.\n");
- return -1;
- }
-
- /* Extract Response Length */
- u16RespLen = MAKE_WORD16(resp[2], resp[3]);
- Res_Len = u16RespLen;
-
- for (idx = MSG_HEADER_LEN; idx < u16RespLen; ) {
- u16WIDid = MAKE_WORD16(resp[idx], resp[idx + 1]);
- cfg_len = resp[idx + 2];
- /* Incase of Bin Type Wid, the length is given by two byte field */
- enuWIDtype = get_wid_type(u16WIDid);
- if (WID_BIN_DATA == enuWIDtype) {
- cfg_len |= ((u16)resp[idx + 3] << 8) & 0xFF00;
- idx++;
- }
- idx += 3;
- if ((u16WIDid == g_wid_num) && (!num_wid_processed)) {
- num_wid_processed = true;
-
- if (-2 == further_process_response(&resp[idx], u16WIDid, cfg_len, true, 0, &pstrWIDcfgResult[ResCnt])) {
- return -2;
- }
- ResCnt++;
- } else {
- for (cnt = 0; cnt < g_num_total_switches; cnt++) {
- if (gastrWIDs[cnt].u16WIDid == u16WIDid) {
- if (-2 == further_process_response(&resp[idx], u16WIDid, cfg_len, false, cnt,
- &pstrWIDcfgResult[ResCnt])) {
- return -2;
- }
- ResCnt++;
- }
- }
- }
- idx += cfg_len;
- /* In case if BIN type Wid, The last byte of the Cfg packet is the */
- /* Checksum. The WID Length field does not accounts for the checksum. */
- /* The Checksum is discarded. */
- if (WID_BIN_DATA == enuWIDtype) {
- idx++;
- }
- }
-
- return 0;
-}
-
-/**
- * @brief parses the write response [just detects its status: success or failure]
- * @details
- * @param[in] pu8RespBuffer The Response to be parsed
- * @return Error code indicating Write Operation status:
- * WRITE_RESP_SUCCESS (1) => Write Success.
- * WILC_FAIL (-100) => Write Failure.
- * @note
- * @author Ittiam
- * @date 11 Aug 2009
- * @version 1.0
- */
-
-s32 ParseWriteResponse(u8 *pu8RespBuffer)
-{
- s32 s32Error = WILC_FAIL;
- u16 u16WIDtype = (u16)WID_NIL;
-
- /* Check whether the received frame is a valid response */
- if (RESP_MSG_TYPE != pu8RespBuffer[0]) {
- PRINT_ER("Received Message format incorrect.\n");
- return WILC_FAIL;
+ s32Error = -EFAULT;
}
- u16WIDtype = MAKE_WORD16(pu8RespBuffer[4], pu8RespBuffer[5]);
-
- /* Check for WID_STATUS ID and then check the length and status value */
- if ((u16WIDtype == WID_STATUS) &&
- (pu8RespBuffer[6] == 1) &&
- (pu8RespBuffer[7] == WRITE_RESP_SUCCESS)) {
- s32Error = WRITE_RESP_SUCCESS;
- return s32Error;
- }
-
- /* If the length or status are not as expected return failure */
- s32Error = WILC_FAIL;
return s32Error;
-
}
/**
- * @brief creates the header of the Configuration Packet
- * @details
- * @param[in,out] pcpacket The Configuration Packet
- * @param[in,out] ps32PacketLength Length of the Configuration Packet
- * @return Error code indicating success/failure
- * @note
- * @author aismail
- * @date 18 Feb 2012
- * @version 1.0
- */
-
-s32 CreatePacketHeader(char *pcpacket, s32 *ps32PacketLength)
-{
- s32 s32Error = WILC_SUCCESS;
- u16 u16MsgLen = (u16)(*ps32PacketLength);
- u16 u16MsgInd = 0;
-
- /* The format of the message is: */
- /* +-------------------------------------------------------------------+ */
- /* | Message Type | Message ID | Message Length |Message body | */
- /* +-------------------------------------------------------------------+ */
- /* | 1 Byte | 1 Byte | 2 Bytes | Message Length - 4 | */
- /* +-------------------------------------------------------------------+ */
-
- /* The format of a message body of a message type 'W' is: */
- /* +-------------------------------------------------------------------+ */
- /* | WID0 | WID0 Length | WID0 Value | ......................... | */
- /* +-------------------------------------------------------------------+ */
- /* | 2 Bytes | 1 Byte | WID0 Length | ......................... | */
- /* +-------------------------------------------------------------------+ */
-
-
-
- /* Message Type */
- if (g_oper_mode == SET_CFG)
- pcpacket[u16MsgInd++] = WRITE_MSG_TYPE;
- else
- pcpacket[u16MsgInd++] = QUERY_MSG_TYPE;
-
- /* Sequence Number */
- pcpacket[u16MsgInd++] = g_seqno++;
-
- /* Message Length */
- pcpacket[u16MsgInd++] = (u8)(u16MsgLen & 0xFF);
- pcpacket[u16MsgInd++] = (u8)((u16MsgLen >> 8) & 0xFF);
-
- *ps32PacketLength = u16MsgLen;
-
- return s32Error;
-}
-
-/**
- * @brief creates Configuration packet based on the Input WIDs
- * @details
- * @param[in] pstrWIDs WIDs to be sent in the configuration packet
- * @param[in] u32WIDsCount number of WIDs to be sent in the configuration packet
- * @param[out] ps8packet The created Configuration Packet
- * @param[out] ps32PacketLength Length of the created Configuration Packet
- * @return Error code indicating success/failure
- * @note
- * @author
- * @date 1 Mar 2012
- * @version 1.0
- */
-
-s32 CreateConfigPacket(s8 *ps8packet, s32 *ps32PacketLength,
- tstrWID *pstrWIDs, u32 u32WIDsCount)
-{
- s32 s32Error = WILC_SUCCESS;
- u32 u32idx = 0;
- *ps32PacketLength = MSG_HEADER_LEN;
- for (u32idx = 0; u32idx < u32WIDsCount; u32idx++) {
- switch (pstrWIDs[u32idx].enuWIDtype) {
- case WID_CHAR:
- ProcessCharWid(ps8packet, ps32PacketLength, &pstrWIDs[u32idx],
- pstrWIDs[u32idx].ps8WidVal);
- break;
-
- case WID_SHORT:
- ProcessShortWid(ps8packet, ps32PacketLength, &pstrWIDs[u32idx],
- pstrWIDs[u32idx].ps8WidVal);
- break;
-
- case WID_INT:
- ProcessIntWid(ps8packet, ps32PacketLength, &pstrWIDs[u32idx],
- pstrWIDs[u32idx].ps8WidVal);
- break;
-
- case WID_STR:
- ProcessStrWid(ps8packet, ps32PacketLength, &pstrWIDs[u32idx],
- pstrWIDs[u32idx].ps8WidVal, pstrWIDs[u32idx].s32ValueSize);
- break;
-
- case WID_IP:
- ProcessIPwid(ps8packet, ps32PacketLength, &pstrWIDs[u32idx],
- pstrWIDs[u32idx].ps8WidVal);
- break;
-
- case WID_BIN_DATA:
- ProcessBinWid(ps8packet, ps32PacketLength, &pstrWIDs[u32idx],
- pstrWIDs[u32idx].ps8WidVal, pstrWIDs[u32idx].s32ValueSize);
- break;
-
- default:
- PRINT_ER("ERROR: Check Config database\n");
- }
- }
-
- CreatePacketHeader(ps8packet, ps32PacketLength);
-
- return s32Error;
-}
-
-s32 ConfigWaitResponse(char *pcRespBuffer, s32 s32MaxRespBuffLen, s32 *ps32BytesRead,
- bool bRespRequired)
-{
- s32 s32Error = WILC_SUCCESS;
- /*bug 3878*/
- /*removed to caller function*/
- /*gstrConfigPktInfo.pcRespBuffer = pcRespBuffer;
- * gstrConfigPktInfo.s32MaxRespBuffLen = s32MaxRespBuffLen;
- * gstrConfigPktInfo.bRespRequired = bRespRequired;*/
-
-
- if (gstrConfigPktInfo.bRespRequired) {
- down(&SemHandlePktResp);
-
- *ps32BytesRead = gstrConfigPktInfo.s32BytesRead;
- }
-
- memset((void *)(&gstrConfigPktInfo), 0, sizeof(tstrConfigPktInfo));
-
- return s32Error;
-}
-
-s32 ConfigProvideResponse(char *pcRespBuffer, s32 s32RespLen)
-{
- s32 s32Error = WILC_SUCCESS;
-
- if (gstrConfigPktInfo.bRespRequired) {
- if (s32RespLen <= gstrConfigPktInfo.s32MaxRespBuffLen) {
- memcpy(gstrConfigPktInfo.pcRespBuffer, pcRespBuffer, s32RespLen);
- gstrConfigPktInfo.s32BytesRead = s32RespLen;
- } else {
- memcpy(gstrConfigPktInfo.pcRespBuffer, pcRespBuffer, gstrConfigPktInfo.s32MaxRespBuffLen);
- gstrConfigPktInfo.s32BytesRead = gstrConfigPktInfo.s32MaxRespBuffLen;
- PRINT_ER("BusProvideResponse() Response greater than the prepared Buffer Size\n");
- }
-
- up(&SemHandlePktResp);
- }
-
- return s32Error;
-}
-
-/**
- * @brief writes the received packet pu8RxPacket in the global Rx FIFO buffer
- * @details
- * @param[in] pu8RxPacket The received packet
- * @param[in] s32RxPacketLen Length of the received packet
- * @return Error code indicating success/failure
- * @note
- *
- * @author mabubakr
- * @date 1 Mar 2012
- * @version 1.0
- */
-
-s32 ConfigPktReceived(u8 *pu8RxPacket, s32 s32RxPacketLen)
-{
- s32 s32Error = WILC_SUCCESS;
- u8 u8MsgType = 0;
-
- u8MsgType = pu8RxPacket[0];
-
- switch (u8MsgType) {
- case 'R':
- ConfigProvideResponse(pu8RxPacket, s32RxPacketLen);
-
- break;
-
- case 'N':
- PRINT_INFO(CORECONFIG_DBG, "NetworkInfo packet received\n");
- NetworkInfoReceived(pu8RxPacket, s32RxPacketLen);
- break;
-
- case 'I':
- GnrlAsyncInfoReceived(pu8RxPacket, s32RxPacketLen);
- break;
-
- case 'S':
- host_int_ScanCompleteReceived(pu8RxPacket, s32RxPacketLen);
- break;
-
- default:
- PRINT_ER("ConfigPktReceived(): invalid received msg type at the Core Configurator\n");
- break;
- }
-
- return s32Error;
-}
-
-/**
- * @brief Deinitializes the Core Configurator
- * @details
- * @return Error code indicating success/failure
- * @note
- * @author mabubakr
- * @date 1 Mar 2012
- * @version 1.0
- */
-
-s32 CoreConfiguratorDeInit(void)
-{
- s32 s32Error = WILC_SUCCESS;
-
- PRINT_D(CORECONFIG_DBG, "CoreConfiguratorDeInit()\n");
-
-
- return s32Error;
-}
-
-/*Using the global handle of the driver*/
-extern wilc_wlan_oup_t *gpstrWlanOps;
-/**
* @brief sends certain Configuration Packet based on the input WIDs pstrWIDs
* using driver config layer
*
@@ -1976,52 +588,40 @@ extern wilc_wlan_oup_t *gpstrWlanOps;
* @date 1 Mar 2012
* @version 1.0
*/
-s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
- u32 u32WIDsCount, bool bRespRequired, u32 drvHandler)
+s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv)
{
s32 counter = 0, ret = 0;
- if (gpstrWlanOps == NULL) {
- PRINT_D(CORECONFIG_DBG, "Net Dev is still not initialized\n");
- return 1;
- } else {
- PRINT_D(CORECONFIG_DBG, "Net Dev is initialized\n");
- }
- if (gpstrWlanOps->wlan_cfg_set == NULL ||
- gpstrWlanOps->wlan_cfg_get == NULL) {
- PRINT_D(CORECONFIG_DBG, "Set and Get is still not initialized\n");
- return 1;
- } else {
- PRINT_D(CORECONFIG_DBG, "SET is initialized\n");
- }
- if (u8Mode == GET_CFG) {
- for (counter = 0; counter < u32WIDsCount; counter++) {
+
+ if (mode == GET_CFG) {
+ for (counter = 0; counter < count; counter++) {
PRINT_INFO(CORECONFIG_DBG, "Sending CFG packet [%d][%d]\n", !counter,
- (counter == u32WIDsCount - 1));
- if (!gpstrWlanOps->wlan_cfg_get(!counter,
- pstrWIDs[counter].u16WIDid,
- (counter == u32WIDsCount - 1), drvHandler)) {
+ (counter == count - 1));
+ if (!wilc_wlan_cfg_get(!counter,
+ wids[counter].id,
+ (counter == count - 1),
+ drv)) {
ret = -1;
printk("[Sendconfigpkt]Get Timed out\n");
break;
}
}
- /**
- * get the value
- **/
counter = 0;
- for (counter = 0; counter < u32WIDsCount; counter++) {
- pstrWIDs[counter].s32ValueSize = gpstrWlanOps->wlan_cfg_get_value(
- pstrWIDs[counter].u16WIDid,
- pstrWIDs[counter].ps8WidVal, pstrWIDs[counter].s32ValueSize);
+ for (counter = 0; counter < count; counter++) {
+ wids[counter].size = wilc_wlan_cfg_get_val(
+ wids[counter].id,
+ wids[counter].val,
+ wids[counter].size);
}
- } else if (u8Mode == SET_CFG) {
- for (counter = 0; counter < u32WIDsCount; counter++) {
- PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET WID:%x\n", pstrWIDs[counter].u16WIDid);
- if (!gpstrWlanOps->wlan_cfg_set(!counter,
- pstrWIDs[counter].u16WIDid, pstrWIDs[counter].ps8WidVal,
- pstrWIDs[counter].s32ValueSize,
- (counter == u32WIDsCount - 1), drvHandler)) {
+ } else if (mode == SET_CFG) {
+ for (counter = 0; counter < count; counter++) {
+ PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET WID:%x\n", wids[counter].id);
+ if (!wilc_wlan_cfg_set(!counter,
+ wids[counter].id,
+ wids[counter].val,
+ wids[counter].size,
+ (counter == count - 1),
+ drv)) {
ret = -1;
printk("[Sendconfigpkt]Set Timed out\n");
break;
diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index 3af193543..6294d929a 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -12,10 +12,7 @@
#define CORECONFIGURATOR_H
#include "wilc_wlan_if.h"
-/*****************************************************************************/
-/* Constants */
-/*****************************************************************************/
-/* Number of WID Options Supported */
+
#define NUM_BASIC_SWITCHES 45
#define NUM_FHSS_SWITCHES 0
@@ -24,14 +21,12 @@
#ifdef MAC_802_11N
#define NUM_11N_BASIC_SWITCHES 25
#define NUM_11N_HUT_SWITCHES 47
-#else /* MAC_802_11N */
+#else
#define NUM_11N_BASIC_SWITCHES 0
#define NUM_11N_HUT_SWITCHES 0
-#endif /* MAC_802_11N */
-
-extern u16 g_num_total_switches;
+#endif
-#define MAC_HDR_LEN 24 /* No Address4 - non-ESS */
+#define MAC_HDR_LEN 24
#define MAX_SSID_LEN 33
#define FCS_LEN 4
#define TIME_STAMP_LEN 8
@@ -41,32 +36,20 @@ extern u16 g_num_total_switches;
#define AID_LEN 2
#define IE_HDR_LEN 2
-/* Operating Mode: SET */
#define SET_CFG 0
-/* Operating Mode: GET */
#define GET_CFG 1
-#define MAX_PACKET_BUFF_SIZE 1596
-
#define MAX_STRING_LEN 256
#define MAX_SURVEY_RESULT_FRAG_SIZE MAX_STRING_LEN
#define SURVEY_RESULT_LENGTH 44
#define MAX_ASSOC_RESP_FRAME_SIZE MAX_STRING_LEN
-#define STATUS_MSG_LEN 12
#define MAC_CONNECTED 1
#define MAC_DISCONNECTED 0
-/*****************************************************************************/
-/* Function Macros */
-/*****************************************************************************/
#define MAKE_WORD16(lsb, msb) ((((u16)(msb) << 8) & 0xFF00) | (lsb))
#define MAKE_WORD32(lsw, msw) ((((u32)(msw) << 16) & 0xFFFF0000) | (lsw))
-/*****************************************************************************/
-/* Type Definitions */
-/*****************************************************************************/
-/* Status Codes for Authentication and Association Frames */
typedef enum {
SUCCESSFUL_STATUSCODE = 0,
UNSPEC_FAIL = 1,
@@ -87,20 +70,19 @@ typedef enum {
CONNECT_STS_FORCE_16_BIT = 0xFFFF
} tenuConnectSts;
-typedef struct {
- u16 u16WIDid;
- tenuWIDtype enuWIDtype;
- s32 s32ValueSize;
- s8 *ps8WidVal;
-
-} tstrWID;
+struct wid {
+ u16 id;
+ enum WID_TYPE type;
+ s32 size;
+ s8 *val;
+};
typedef struct {
u8 u8Full;
u8 u8Index;
s8 as8RSSI[NUM_RSSI];
} tstrRSSI;
-/* This structure is used to support parsing of the received 'N' message */
+
typedef struct {
s8 s8rssi;
u16 u16CapInfo;
@@ -110,23 +92,18 @@ typedef struct {
u16 u16BeaconPeriod;
u8 u8DtimPeriod;
u8 u8channel;
- unsigned long u32TimeRcvdInScanCached; /* of type unsigned long to be accepted by the linux kernel macro time_after() */
+ unsigned long u32TimeRcvdInScanCached;
unsigned long u32TimeRcvdInScan;
bool bNewNetwork;
-#ifdef AGING_ALG
u8 u8Found;
-#endif
-#ifdef WILC_P2P
- u32 u32Tsf; /* time-stamp [Low only 32 bit] */
-#endif
+ u32 u32Tsf;
u8 *pu8IEs;
u16 u16IEsLen;
void *pJoinParams;
tstrRSSI strRssi;
- u64 u64Tsf; /* time-stamp [Low and High 64 bit] */
+ u64 u64Tsf;
} tstrNetworkInfo;
-/* This structure is used to support parsing of the received Association Response frame */
typedef struct {
u16 u16capability;
u16 u16ConnectStatus;
@@ -150,39 +127,14 @@ typedef struct {
size_t ie_len;
} tstrDisconnectNotifInfo;
-#ifndef CONNECT_DIRECT
-typedef struct wid_site_survey_reslts {
- char SSID[MAX_SSID_LEN];
- u8 BssType;
- u8 Channel;
- u8 SecurityStatus;
- u8 BSSID[6];
- char RxPower;
- u8 Reserved;
-
-} wid_site_survey_reslts_s;
-#endif
-
-s32 CoreConfiguratorInit(void);
-s32 CoreConfiguratorDeInit(void);
-
-s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
- u32 u32WIDsCount, bool bRespRequired, u32 drvHandler);
-s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
+s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv);
+s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo);
s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
tstrConnectRespInfo **ppstrConnectRespInfo);
s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo);
-#ifndef CONNECT_DIRECT
-s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE],
- wid_site_survey_reslts_s **ppstrSurveyResults,
- u32 *pu32SurveyResultsCount);
-s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults);
-#endif
-
-s32 SendRawPacket(s8 *pspacket, s32 s32PacketLen);
void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length);
void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length);
void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length);
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 66fa67701..dbbe72c7e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1,21 +1,20 @@
+#include <linux/slab.h>
+#include <linux/time.h>
+#include <linux/kthread.h>
+#include <linux/delay.h>
#include "host_interface.h"
#include "coreconfigurator.h"
+#include "wilc_wlan_if.h"
+#include "wilc_msgqueue.h"
+#include <linux/etherdevice.h>
+#include "wilc_wfi_netdevice.h"
-extern s32 TransportInit(void);
-extern s32 TransportDeInit(void);
extern u8 connecting;
-#ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
extern struct timer_list hDuringIpTimer;
-#endif
-/*BugID_5137*/
extern u8 g_wilc_initialized;
-/*****************************************************************************/
-/* Macros */
-/*****************************************************************************/
-/* Message types of the Host IF Message Queue*/
#define HOST_IF_MSG_SCAN 0
#define HOST_IF_MSG_CONNECT 1
#define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO 2
@@ -62,432 +61,155 @@ extern u8 g_wilc_initialized;
#define BA_SESSION_DEFAULT_BUFFER_SIZE 16
#define BA_SESSION_DEFAULT_TIMEOUT 1000
#define BLOCK_ACK_REQ_SIZE 0x14
-/*****************************************************************************/
-/* Type Definitions */
-/*****************************************************************************/
-
-/*!
- * @struct tstrHostIFCfgParamAttr
- * @brief Structure to hold Host IF CFG Params Attributes
- * @details
- * @todo
- * @sa
- * @author Mai Daftedar
- * @date 02 April 2012
- * @version 1.0
- */
-typedef struct _tstrHostIFCfgParamAttr {
- tstrCfgParamVal pstrCfgParamVal;
-
-} tstrHostIFCfgParamAttr;
-
-/*!
- * @struct tstrHostIFwpaAttr
- * @brief Structure to hold Host IF Scan Attributes
- * @details
- * @todo
- * @sa
- * @author Mai Daftedar
- * @date 25 March 2012
- * @version 1.0
- */
-typedef struct _tstrHostIFwpaAttr {
- u8 *pu8key;
- const u8 *pu8macaddr;
- u8 *pu8seq;
- u8 u8seqlen;
- u8 u8keyidx;
- u8 u8Keylen;
- u8 u8Ciphermode;
-} tstrHostIFwpaAttr;
-
-
-/*!
- * @struct tstrHostIFwepAttr
- * @brief Structure to hold Host IF Scan Attributes
- * @details
- * @todo
- * @sa
- * @author Mai Daftedar
- * @date 25 March 2012
- * @version 1.0
- */
-typedef struct _tstrHostIFwepAttr {
- u8 *pu8WepKey;
- u8 u8WepKeylen;
- u8 u8Wepidx;
- u8 u8mode;
- AUTHTYPE_T tenuAuth_type;
-
-} tstrHostIFwepAttr;
-
-/*!
- * @struct tuniHostIFkeyAttr
- * @brief Structure to hold Host IF Scan Attributes
- * @details
- * @todo
- * @sa
- * @author Mai Daftedar
- * @date 25 March 2012
- * @version 1.0
- */
-typedef union _tuniHostIFkeyAttr {
- tstrHostIFwepAttr strHostIFwepAttr;
- tstrHostIFwpaAttr strHostIFwpaAttr;
- tstrHostIFpmkidAttr strHostIFpmkidAttr;
-} tuniHostIFkeyAttr;
-
-/*!
- * @struct tstrHostIFkeyAttr
- * @brief Structure to hold Host IF Scan Attributes
- * @details
- * @todo
- * @sa
- * @author Mai Daftedar
- * @date 25 March 2012
- * @version 1.0
- */
-typedef struct _tstrHostIFkeyAttr {
- tenuKeyType enuKeyType;
- u8 u8KeyAction;
- tuniHostIFkeyAttr uniHostIFkeyAttr;
-} tstrHostIFkeyAttr;
-
-
-
-
-/*!
- * @struct tstrHostIFscanAttr
- * @brief Structure to hold Host IF Scan Attributes
- * @details
- * @todo
- * @sa
- * @author Mostafa Abu Bakr
- * @date 25 March 2012
- * @version 1.0
- */
-typedef struct _tstrHostIFscanAttr {
- u8 u8ScanSource;
- u8 u8ScanType;
- u8 *pu8ChnlFreqList;
- u8 u8ChnlListLen;
- u8 *pu8IEs;
- size_t IEsLen;
- tWILCpfScanResult pfScanResult;
- void *pvUserArg;
- /*BugID_4189*/
- tstrHiddenNetwork strHiddenNetwork;
-
-} tstrHostIFscanAttr;
-
-/*!
- * @struct tstrHostIFconnectAttr
- * @brief Structure to hold Host IF Connect Attributes
- * @details
- * @todo
- * @sa
- * @author Mostafa Abu Bakr
- * @date 25 March 2012
- * @version 1.0
- */
-typedef struct _tstrHostIFconnectAttr {
- u8 *pu8bssid;
- u8 *pu8ssid;
- size_t ssidLen;
- u8 *pu8IEs;
- size_t IEsLen;
- u8 u8security;
- tWILCpfConnectResult pfConnectResult;
- void *pvUserArg;
- AUTHTYPE_T tenuAuth_type;
- u8 u8channel;
- void *pJoinParams;
-} tstrHostIFconnectAttr;
-
-/*!
- * @struct tstrRcvdGnrlAsyncInfo
- * @brief Structure to hold Received General Asynchronous info
- * @details
- * @todo
- * @sa
- * @author Mostafa Abu Bakr
- * @date 25 March 2012
- * @version 1.0
- */
-typedef struct _tstrRcvdGnrlAsyncInfo {
- u8 *pu8Buffer;
- u32 u32Length;
-} tstrRcvdGnrlAsyncInfo;
-
-/*!
- * @struct tstrHostIFSetChan
- * @brief Set Channel message body
- * @details
- * @todo
- * @sa
- * @author Mai Daftedar
- * @date 25 March 2012
- * @version 1.0
- */
-typedef struct _tstrHostIFSetChan {
- u8 u8SetChan;
-} tstrHostIFSetChan;
-
-/*!
- * @struct tstrHostIFSetChan
- * @brief Get Channel message body
- * @details
- * @todo
- * @sa
- * @author Mai Daftedar
- * @date 01 Jule 2012
- * @version 1.0
- */
-typedef struct _tstrHostIFGetChan {
- u8 u8GetChan;
-} tstrHostIFGetChan;
-
-/*bug3819: Add Scan acomplete notification to host*/
-/*!
- * @struct tstrScanComplete
- * @brief hold received Async. Scan Complete message body
- * @details
- * @todo
- * @sa
- * @author zsalah
- * @date 25 March 2012
- * @version 1.0
- */
-/*typedef struct _tstrScanComplete
- * {
- * u8* pu8Buffer;
- * u32 u32Length;
- * } tstrScanComplete;*/
-
-/*!
- * @struct tstrHostIFSetBeacon
- * @brief Set Beacon message body
- * @details
- * @todo
- * @sa
- * @author Adham Abozaeid
- * @date 10 July 2012
- * @version 1.0
- */
-typedef struct _tstrHostIFSetBeacon {
- u32 u32Interval; /*!< Beacon Interval. Period between two successive beacons on air */
- u32 u32DTIMPeriod; /*!< DTIM Period. Indicates how many Beacon frames
- * (including the current frame) appear before the next DTIM */
- u32 u32HeadLen; /*!< Length of the head buffer in bytes */
- u8 *pu8Head; /*!< Pointer to the beacon's head buffer. Beacon's head is the part
- * from the beacon's start till the TIM element, NOT including the TIM */
- u32 u32TailLen; /*!< Length of the tail buffer in bytes */
- u8 *pu8Tail; /*!< Pointer to the beacon's tail buffer. Beacon's tail starts just
- * after the TIM inormation element */
-} tstrHostIFSetBeacon;
-
-
-
-/*!
- * @struct tstrHostIFDelBeacon
- * @brief Del Beacon message body
- * @details
- * @todo
- * @sa
- * @author Adham Abozaeid
- * @date 15 July 2012
- * @version 1.0
- */
-typedef struct _tstrHostIFDelBeacon {
- u8 u8dummy;
-} tstrHostIFDelBeacon;
-
-/*!
- * @struct tstrHostIFSetMulti
- * @brief set Multicast filter Address
- * @details
- * @todo
- * @sa
- * @author Abdelrahman Sobhy
- * @date 30 August 2013
- * @version 1.0 Description
- */
-
-typedef struct {
- bool bIsEnabled;
- u32 u32count;
-} tstrHostIFSetMulti;
-
-/*!
- * @struct tstrHostIFDelAllSta
- * @brief Deauth station message body
- * @details
- * @todo
- * @sa
- * @author Mai Daftedar
- * @date 09 April 2014
- * @version 1.0 Description
- */
-
-typedef struct {
- u8 au8Sta_DelAllSta[MAX_NUM_STA][ETH_ALEN];
- u8 u8Num_AssocSta;
-} tstrHostIFDelAllSta;
-
-/*!
- * @struct tstrHostIFDelSta
- * @brief Delete station message body
- * @details
- * @todo
- * @sa
- * @author Adham Abozaeid
- * @date 15 July 2012
- * @version 1.0 Description
- */
-
-typedef struct {
- u8 au8MacAddr[ETH_ALEN];
-} tstrHostIFDelSta;
-
-/*!
- * @struct tstrTimerCb
- * @brief Timer callback message body
- * @details
- * @todo
- * @sa
- * @author Mostafa Abu Bakr
- * @date 25 March 2012
- * @version 1.0
- */
-typedef struct _tstrTimerCb {
- void *pvUsrArg; /*!< Private data passed at timer start */
-} tstrTimerCb;
-
-/*!
- * @struct tstrHostIfPowerMgmtParam
- * @brief Power management message body
- * @details
- * @todo
- * @sa
- * @author Adham Abozaeid
- * @date 24 November 2012
- * @version 1.0
- */
-typedef struct {
-
- bool bIsEnabled;
- u32 u32Timeout;
-} tstrHostIfPowerMgmtParam;
-
-/*!
- * @struct tstrHostIFSetIPAddr
- * @brief set IP Address message body
- * @details
- * @todo
- * @sa
- * @author Abdelrahman Sobhy
- * @date 30 August 2013
- * @version 1.0 Description
- */
-
-typedef struct {
- u8 *au8IPAddr;
+#define FALSE_FRMWR_CHANNEL 100
+
+struct cfg_param_attr {
+ struct cfg_param_val cfg_attr_info;
+};
+
+struct host_if_wpa_attr {
+ u8 *key;
+ const u8 *mac_addr;
+ u8 *seq;
+ u8 seq_len;
+ u8 index;
+ u8 key_len;
+ u8 mode;
+};
+
+struct host_if_wep_attr {
+ u8 *key;
+ u8 key_len;
+ u8 index;
+ u8 mode;
+ enum AUTHTYPE auth_type;
+};
+
+union host_if_key_attr {
+ struct host_if_wep_attr wep;
+ struct host_if_wpa_attr wpa;
+ struct host_if_pmkid_attr pmkid;
+};
+
+struct key_attr {
+ enum KEY_TYPE type;
+ u8 action;
+ union host_if_key_attr attr;
+};
+
+struct scan_attr {
+ u8 src;
+ u8 type;
+ u8 *ch_freq_list;
+ u8 ch_list_len;
+ u8 *ies;
+ size_t ies_len;
+ wilc_scan_result result;
+ void *arg;
+ struct hidden_network hidden_network;
+};
+
+struct connect_attr {
+ u8 *bssid;
+ u8 *ssid;
+ size_t ssid_len;
+ u8 *ies;
+ size_t ies_len;
+ u8 security;
+ wilc_connect_result result;
+ void *arg;
+ enum AUTHTYPE auth_type;
+ u8 ch;
+ void *params;
+};
+
+struct rcvd_async_info {
+ u8 *buffer;
+ u32 len;
+};
+
+struct channel_attr {
+ u8 set_ch;
+};
+
+struct beacon_attr {
+ u32 interval;
+ u32 dtim_period;
+ u32 head_len;
+ u8 *head;
+ u32 tail_len;
+ u8 *tail;
+};
+
+struct set_multicast {
+ bool enabled;
+ u32 cnt;
+};
+
+struct del_all_sta {
+ u8 del_all_sta[MAX_NUM_STA][ETH_ALEN];
+ u8 assoc_sta;
+};
+
+struct del_sta {
+ u8 mac_addr[ETH_ALEN];
+};
+
+struct power_mgmt_param {
+ bool enabled;
+ u32 timeout;
+};
+
+struct set_ip_addr {
+ u8 *ip_addr;
u8 idx;
-} tstrHostIFSetIPAddr;
-
-/*!
- * @struct tstrHostIfStaInactiveT
- * @brief Get station message body
- * @details
- * @todo
- * @sa
- * @author Mai Daftedar
- * @date 16 April 2013
- * @version 1.0
- */
-typedef struct {
- u8 mac[6];
+};
-} tstrHostIfStaInactiveT;
-/**/
-/*!
- * @union tuniHostIFmsgBody
- * @brief Message body for the Host Interface message_q
- * @details
- * @todo
- * @sa
- * @author Mostafa Abu Bakr
- * @date 25 March 2012
- * @version 1.0
- */
-typedef union _tuniHostIFmsgBody {
- tstrHostIFscanAttr strHostIFscanAttr; /*!< Host IF Scan Request Attributes message body */
- tstrHostIFconnectAttr strHostIFconnectAttr; /*!< Host IF Connect Request Attributes message body */
- tstrRcvdNetworkInfo strRcvdNetworkInfo; /*!< Received Asynchronous Network Info message body */
- tstrRcvdGnrlAsyncInfo strRcvdGnrlAsyncInfo; /*!< Received General Asynchronous Info message body */
- tstrHostIFkeyAttr strHostIFkeyAttr; /*!<>*/
- tstrHostIFCfgParamAttr strHostIFCfgParamAttr; /*! <CFG Parameter message Body> */
- tstrHostIFSetChan strHostIFSetChan;
- tstrHostIFGetChan strHostIFGetChan;
- tstrHostIFSetBeacon strHostIFSetBeacon; /*!< Set beacon message body */
- tstrHostIFDelBeacon strHostIFDelBeacon; /*!< Del beacon message body */
- tstrWILC_AddStaParam strAddStaParam; /*!< Add station message body */
- tstrHostIFDelSta strDelStaParam; /*!< Del Station message body */
- tstrWILC_AddStaParam strEditStaParam; /*!< Edit station message body */
- /* tstrScanComplete strScanComplete; / *Received Async. Scan Complete message body* / */
- tstrTimerCb strTimerCb; /*!< Timer callback message body */
- tstrHostIfPowerMgmtParam strPowerMgmtparam; /*!< Power Management message body */
- tstrHostIfStaInactiveT strHostIfStaInactiveT;
- tstrHostIFSetIPAddr strHostIfSetIP;
- tstrHostIfSetDrvHandler strHostIfSetDrvHandler;
- tstrHostIFSetMulti strHostIfSetMulti;
- tstrHostIfSetOperationMode strHostIfSetOperationMode;
- tstrHostIfSetMacAddress strHostIfSetMacAddress;
- tstrHostIfGetMacAddress strHostIfGetMacAddress;
- tstrHostIfBASessionInfo strHostIfBASessionInfo;
- #ifdef WILC_P2P
- tstrHostIfRemainOnChan strHostIfRemainOnChan;
- tstrHostIfRegisterFrame strHostIfRegisterFrame;
- #endif
- char *pUserData;
- tstrHostIFDelAllSta strHostIFDelAllSta;
-} tuniHostIFmsgBody;
-
-/*!
- * @struct tstrHostIFmsg
- * @brief Host Interface message
- * @details
- * @todo
- * @sa
- * @author Mostafa Abu Bakr
- * @date 25 March 2012
- * @version 1.0
- */
-typedef struct _tstrHostIFmsg {
- u16 u16MsgId; /*!< Message ID */
- tuniHostIFmsgBody uniHostIFmsgBody; /*!< Message body */
- tstrWILC_WFIDrv *drvHandler;
-} tstrHostIFmsg;
-
-#ifdef CONNECT_DIRECT
-typedef struct _tstrWidJoinReqExt {
- char SSID[MAX_SSID_LEN];
- u8 u8channel;
- u8 BSSID[6];
-} tstrWidJoinReqExt;
-#endif
-
-/*Bug4218: Parsing Join Param*/
-#ifdef WILC_PARSE_SCAN_IN_HOST
-/*Struct containg joinParam of each AP*/
-typedef struct _tstrJoinBssParam {
+struct sta_inactive_t {
+ u8 mac[6];
+};
+
+union message_body {
+ struct scan_attr scan_info;
+ struct connect_attr con_info;
+ struct rcvd_net_info net_info;
+ struct rcvd_async_info async_info;
+ struct key_attr key_info;
+ struct cfg_param_attr cfg_info;
+ struct channel_attr channel_info;
+ struct beacon_attr beacon_info;
+ struct add_sta_param add_sta_info;
+ struct del_sta del_sta_info;
+ struct add_sta_param edit_sta_info;
+ struct power_mgmt_param pwr_mgmt_info;
+ struct sta_inactive_t mac_info;
+ struct set_ip_addr ip_info;
+ struct drv_handler drv;
+ struct set_multicast multicast_info;
+ struct op_mode mode;
+ struct set_mac_addr set_mac_info;
+ struct get_mac_addr get_mac_info;
+ struct ba_session_info session_info;
+ struct remain_ch remain_on_ch;
+ struct reg_frame reg_frame;
+ char *data;
+ struct del_all_sta del_all_sta_info;
+};
+
+struct host_if_msg {
+ u16 id;
+ union message_body body;
+ struct host_if_drv *drv;
+};
+
+struct join_bss_param {
BSSTYPE_T bss_type;
u8 dtim_period;
u16 beacon_period;
u16 cap_info;
u8 au8bssid[6];
char ssid[MAX_SSID_LEN];
- u8 ssidLen;
+ u8 ssid_len;
u8 supp_rates[MAX_RATES_SUPPORTED + 1];
u8 ht_capable;
u8 wmm_cap;
@@ -498,1398 +220,949 @@ typedef struct _tstrJoinBssParam {
u8 rsn_pcip_policy[3];
u8 rsn_auth_policy[3];
u8 rsn_cap[2];
- struct _tstrJoinParam *nextJoinBss;
- #ifdef WILC_P2P
u32 tsf;
- u8 u8NoaEnbaled;
- u8 u8OppEnable;
- u8 u8CtWindow;
- u8 u8Count;
- u8 u8Index;
- u8 au8Duration[4];
- u8 au8Interval[4];
- u8 au8StartTime[4];
- #endif
-} tstrJoinBssParam;
-/*Bug4218: Parsing Join Param*/
-/*a linked list table containing needed join parameters entries for each AP found in most recent scan*/
-typedef struct _tstrBssTable {
- u8 u8noBssEntries;
- tstrJoinBssParam *head;
- tstrJoinBssParam *tail;
-} tstrBssTable;
-#endif /*WILC_PARSE_SCAN_IN_HOST*/
-
-typedef enum {
- SCAN_TIMER = 0,
- CONNECT_TIMER = 1,
- SCAN_CONNECT_TIMER_FORCE_32BIT = 0xFFFFFFFF
-} tenuScanConnTimer;
-
-/*****************************************************************************/
-/* */
-/* Global Variabls */
-/* */
-/*****************************************************************************/
-
-
-tstrWILC_WFIDrv *terminated_handle;
-tstrWILC_WFIDrv *gWFiDrvHandle;
-#ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
-bool g_obtainingIP = false;
-#endif
+ u8 noa_enabled;
+ u8 opp_enabled;
+ u8 ct_window;
+ u8 cnt;
+ u8 idx;
+ u8 duration[4];
+ u8 interval[4];
+ u8 start_time[4];
+};
+
+static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1];
+struct host_if_drv *terminated_handle;
+bool g_obtainingIP;
u8 P2P_LISTEN_STATE;
-static struct task_struct *HostIFthreadHandler;
-static WILC_MsgQueueHandle gMsgQHostIF;
-static struct semaphore hSemHostIFthrdEnd;
+static struct task_struct *hif_thread_handler;
+static WILC_MsgQueueHandle hif_msg_q;
+static struct semaphore hif_sema_thread;
+static struct semaphore hif_sema_driver;
+static struct semaphore hif_sema_wait_response;
+static struct semaphore hif_sema_deinit;
+static struct timer_list periodic_rssi;
-struct semaphore hSemDeinitDrvHandle;
-static struct semaphore hWaitResponse;
-struct semaphore hSemHostIntDeinit;
-struct timer_list g_hPeriodicRSSI;
+u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
+static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE];
+static bool scan_while_connected;
-u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
+static s8 rssi;
+static s8 link_speed;
+static u8 ch_no;
+static u8 set_ip[2][4];
+static u8 get_ip[2][4];
+static u32 inactive_time;
+static u8 del_beacon;
+static u32 clients_count;
-#ifndef CONNECT_DIRECT
-static u8 gapu8RcvdSurveyResults[2][MAX_SURVEY_RESULT_FRAG_SIZE];
-#endif
-
-static u8 gapu8RcvdAssocResp[MAX_ASSOC_RESP_FRAME_SIZE];
-
-bool gbScanWhileConnected = false;
-
-static s8 gs8Rssi;
-static s8 gs8lnkspd;
-static u8 gu8Chnl;
-static u8 gs8SetIP[2][4];
-static u8 gs8GetIP[2][4];
-#ifdef WILC_AP_EXTERNAL_MLME
-static u32 gu32InactiveTime;
-static u8 gu8DelBcn;
-#endif
-static u32 gu32WidConnRstHack;
-
-/*BugID_5137*/
-u8 *gu8FlushedJoinReq;
-u8 *gu8FlushedInfoElemAsoc;
-u8 gu8Flushed11iMode;
-u8 gu8FlushedAuthType;
-u32 gu32FlushedJoinReqSize;
-u32 gu32FlushedInfoElemAsocSize;
-u32 gu8FlushedJoinReqDrvHandler;
+static u8 *join_req;
+u8 *info_element;
+static u8 mode_11i;
+u8 auth_type;
+u32 join_req_size;
+static u32 info_element_size;
+static struct host_if_drv *join_req_drv;
#define REAL_JOIN_REQ 0
#define FLUSHED_JOIN_REQ 1
-#define FLUSHED_BYTE_POS 79 /* Position the byte indicating flushing in the flushed request */
+#define FLUSHED_BYTE_POS 79
-/*Bug4218: Parsing Join Param*/
-#ifdef WILC_PARSE_SCAN_IN_HOST
-/*Bug4218: Parsing Join Param*/
static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);
-#endif /*WILC_PARSE_SCAN_IN_HOST*/
extern void chip_sleep_manually(u32 u32SleepTime);
extern int linux_wlan_get_num_conn_ifcs(void);
-/**
- * @brief Handle_SetChannel
- * @details Sending config packet to firmware to set channel
- * @param[in] tstrHostIFSetChan* pstrHostIFSetChan
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-static s32 Handle_SetChannel(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetChan *pstrHostIFSetChan)
+static int add_handler_in_list(struct host_if_drv *handler)
{
+ int i;
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
+ for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) {
+ if (!wfidrv_list[i]) {
+ wfidrv_list[i] = handler;
+ return 0;
+ }
+ }
- /*prepare configuration packet*/
- strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL;
- strWID.enuWIDtype = WID_CHAR;
- strWID.ps8WidVal = (char *)&(pstrHostIFSetChan->u8SetChan);
- strWID.s32ValueSize = sizeof(char);
+ return -ENOBUFS;
+}
- PRINT_D(HOSTINF_DBG, "Setting channel\n");
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error) {
- PRINT_ER("Failed to set channel\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
- }
- WILC_CATCH(s32Error)
- {
+static int remove_handler_in_list(struct host_if_drv *handler)
+{
+ int i;
+ for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) {
+ if (wfidrv_list[i] == handler) {
+ wfidrv_list[i] = NULL;
+ return 0;
+ }
}
- return s32Error;
+ return -EINVAL;
}
-/**
- * @brief Handle_SetWfiDrvHandler
- * @details Sending config packet to firmware to set driver handler
- * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-static s32 Handle_SetWfiDrvHandler(tstrHostIfSetDrvHandler *pstrHostIfSetDrvHandler)
+
+static int get_id_from_handler(struct host_if_drv *handler)
{
+ int i;
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)((pstrHostIfSetDrvHandler->u32Address));
+ if (!handler)
+ return 0;
+ for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) {
+ if (wfidrv_list[i] == handler)
+ return i;
+ }
- /*prepare configuration packet*/
- strWID.u16WIDid = (u16)WID_SET_DRV_HANDLER;
- strWID.enuWIDtype = WID_INT;
- strWID.ps8WidVal = (s8 *)&(pstrHostIfSetDrvHandler->u32Address);
- strWID.s32ValueSize = sizeof(u32);
+ return 0;
+}
- /*Sending Cfg*/
+static struct host_if_drv *get_handler_from_id(int id)
+{
+ if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list))
+ return NULL;
+ return wfidrv_list[id];
+}
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+static s32 Handle_SetChannel(struct host_if_drv *hif_drv,
+ struct channel_attr *pstrHostIFSetChan)
+{
+ s32 result = 0;
+ struct wid wid;
+ wid.id = (u16)WID_CURRENT_CHANNEL;
+ wid.type = WID_CHAR;
+ wid.val = (char *)&pstrHostIFSetChan->set_ch;
+ wid.size = sizeof(char);
- if ((pstrHostIfSetDrvHandler->u32Address) == (u32)NULL)
- up(&hSemDeinitDrvHandle);
+ PRINT_D(HOSTINF_DBG, "Setting channel\n");
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
- if (s32Error) {
- PRINT_ER("Failed to set driver handler\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
- }
- WILC_CATCH(s32Error)
- {
-
+ if (result) {
+ PRINT_ER("Failed to set channel\n");
+ return -EINVAL;
}
- return s32Error;
+ return result;
}
-/**
- * @brief Handle_SetWfiAPDrvHandler
- * @details Sending config packet to firmware to set driver handler
- * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-static s32 Handle_SetOperationMode(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetOperationMode *pstrHostIfSetOperationMode)
+static s32 Handle_SetWfiDrvHandler(struct host_if_drv *hif_drv,
+ struct drv_handler *pstrHostIfSetDrvHandler)
{
+ s32 result = 0;
+ struct wid wid;
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
+ wid.id = (u16)WID_SET_DRV_HANDLER;
+ wid.type = WID_INT;
+ wid.val = (s8 *)&pstrHostIfSetDrvHandler->handler;
+ wid.size = sizeof(u32);
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ pstrHostIfSetDrvHandler->handler);
- /*prepare configuration packet*/
- strWID.u16WIDid = (u16)WID_SET_OPERATION_MODE;
- strWID.enuWIDtype = WID_INT;
- strWID.ps8WidVal = (s8 *)&(pstrHostIfSetOperationMode->u32Mode);
- strWID.s32ValueSize = sizeof(u32);
+ if (!hif_drv)
+ up(&hif_sema_driver);
- /*Sending Cfg*/
- PRINT_INFO(HOSTINF_DBG, "pstrWFIDrv= %p\n", pstrWFIDrv);
+ if (result) {
+ PRINT_ER("Failed to set driver handler\n");
+ return -EINVAL;
+ }
+
+ return result;
+}
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv,
+ struct op_mode *pstrHostIfSetOperationMode)
+{
+ s32 result = 0;
+ struct wid wid;
+ wid.id = (u16)WID_SET_OPERATION_MODE;
+ wid.type = WID_INT;
+ wid.val = (s8 *)&pstrHostIfSetOperationMode->mode;
+ wid.size = sizeof(u32);
- if ((pstrHostIfSetOperationMode->u32Mode) == (u32)NULL)
- up(&hSemDeinitDrvHandle);
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if ((pstrHostIfSetOperationMode->mode) == IDLE_MODE)
+ up(&hif_sema_driver);
- if (s32Error) {
+ if (result) {
PRINT_ER("Failed to set driver handler\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
- }
- WILC_CATCH(s32Error)
- {
-
+ return -EINVAL;
}
- return s32Error;
+ return result;
}
-/**
- * @brief host_int_set_IPAddress
- * @details Setting IP address params in message queue
- * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-s32 Handle_set_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx)
+s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
{
-
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
+ s32 result = 0;
+ struct wid wid;
char firmwareIPAddress[4] = {0};
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
if (pu8IPAddr[0] < 192)
pu8IPAddr[0] = 0;
PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %pI4\n", idx, pu8IPAddr);
- memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN);
-
- /*prepare configuration packet*/
- strWID.u16WIDid = (u16)WID_IP_ADDRESS;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = (u8 *)pu8IPAddr;
- strWID.s32ValueSize = IP_ALEN;
-
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ memcpy(set_ip[idx], pu8IPAddr, IP_ALEN);
+ wid.id = (u16)WID_IP_ADDRESS;
+ wid.type = WID_STR;
+ wid.val = (u8 *)pu8IPAddr;
+ wid.size = IP_ALEN;
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
- host_int_get_ipaddress(drvHandler, firmwareIPAddress, idx);
+ host_int_get_ipaddress(hif_drv, firmwareIPAddress, idx);
- if (s32Error) {
- PRINT_D(HOSTINF_DBG, "Failed to set IP address\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
- } else {
- PRINT_INFO(HOSTINF_DBG, "IP address set\n");
+ if (result) {
+ PRINT_ER("Failed to set IP address\n");
+ return -EINVAL;
}
- WILC_CATCH(s32Error)
- {
-
- }
+ PRINT_INFO(HOSTINF_DBG, "IP address set\n");
- return s32Error;
+ return result;
}
-
-/**
- * @brief Handle_get_IPAddress
- * @details Setting IP address params in message queue
- * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-s32 Handle_get_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx)
+s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
{
+ s32 result = 0;
+ struct wid wid;
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
-
- /*prepare configuration packet*/
- strWID.u16WIDid = (u16)WID_IP_ADDRESS;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = WILC_MALLOC(IP_ALEN);
- strWID.s32ValueSize = IP_ALEN;
+ wid.id = (u16)WID_IP_ADDRESS;
+ wid.type = WID_STR;
+ wid.val = kmalloc(IP_ALEN, GFP_KERNEL);
+ wid.size = IP_ALEN;
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ result = send_config_pkt(GET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
- PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.ps8WidVal);
+ PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val);
- memcpy(gs8GetIP[idx], strWID.ps8WidVal, IP_ALEN);
+ memcpy(get_ip[idx], wid.val, IP_ALEN);
- /*get the value by searching the local copy*/
- kfree(strWID.ps8WidVal);
+ kfree(wid.val);
- if (memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0)
- host_int_setup_ipaddress(pstrWFIDrv, gs8SetIP[idx], idx);
+ if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0)
+ host_int_setup_ipaddress(hif_drv, set_ip[idx], idx);
- if (s32Error != WILC_SUCCESS) {
+ if (result != 0) {
PRINT_ER("Failed to get IP address\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
- } else {
- PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx);
- PRINT_INFO(HOSTINF_DBG, "%pI4\n", gs8GetIP[idx]);
- PRINT_INFO(HOSTINF_DBG, "\n");
+ return -EINVAL;
}
- WILC_CATCH(s32Error)
- {
-
- }
+ PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx);
+ PRINT_INFO(HOSTINF_DBG, "%pI4\n", get_ip[idx]);
+ PRINT_INFO(HOSTINF_DBG, "\n");
- return s32Error;
+ return result;
}
-
-/*BugId_5077*/
-/**
- * @brief Handle_SetMacAddress
- * @details Setting mac address
- * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler
- * @return Error code.
- * @author Amr Abdel-Moghny
- * @date November 2013
- * @version 7.0
- */
-static s32 Handle_SetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetMacAddress *pstrHostIfSetMacAddress)
+static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv,
+ struct set_mac_addr *pstrHostIfSetMacAddress)
{
+ s32 result = 0;
+ struct wid wid;
+ u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
- u8 *mac_buf = WILC_MALLOC(ETH_ALEN);
-
- if (mac_buf == NULL) {
+ if (!mac_buf) {
PRINT_ER("No buffer to send mac address\n");
- return WILC_FAIL;
- }
- memcpy(mac_buf, pstrHostIfSetMacAddress->u8MacAddress, ETH_ALEN);
-
- /*prepare configuration packet*/
- strWID.u16WIDid = (u16)WID_MAC_ADDR;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = mac_buf;
- strWID.s32ValueSize = ETH_ALEN;
- PRINT_D(GENERIC_DBG, "mac addr = :%x:%x:%x:%x:%x:%x\n", strWID.ps8WidVal[0], strWID.ps8WidVal[1], strWID.ps8WidVal[2], strWID.ps8WidVal[3], strWID.ps8WidVal[4], strWID.ps8WidVal[5]);
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error) {
- PRINT_ER("Failed to set mac address\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
+ return -EFAULT;
}
+ memcpy(mac_buf, pstrHostIfSetMacAddress->mac_addr, ETH_ALEN);
- WILC_CATCH(s32Error)
- {
+ wid.id = (u16)WID_MAC_ADDR;
+ wid.type = WID_STR;
+ wid.val = mac_buf;
+ wid.size = ETH_ALEN;
+ PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val);
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result) {
+ PRINT_ER("Failed to set mac address\n");
+ result = -EFAULT;
}
+
kfree(mac_buf);
- return s32Error;
+ return result;
}
-
-/*BugID_5213*/
-/**
- * @brief Handle_GetMacAddress
- * @details Getting mac address
- * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler
- * @return Error code.
- * @author Amr Abdel-Moghny
- * @date JAN 2013
- * @version 8.0
- */
-static s32 Handle_GetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfGetMacAddress *pstrHostIfGetMacAddress)
+static s32 Handle_GetMacAddress(struct host_if_drv *hif_drv,
+ struct get_mac_addr *pstrHostIfGetMacAddress)
{
+ s32 result = 0;
+ struct wid wid;
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
+ wid.id = (u16)WID_MAC_ADDR;
+ wid.type = WID_STR;
+ wid.val = pstrHostIfGetMacAddress->mac_addr;
+ wid.size = ETH_ALEN;
- /*prepare configuration packet*/
- strWID.u16WIDid = (u16)WID_MAC_ADDR;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = pstrHostIfGetMacAddress->u8MacAddress;
- strWID.s32ValueSize = ETH_ALEN;
+ result = send_config_pkt(GET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
- /*Sending Cfg*/
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, false, (u32)drvHandler);
- if (s32Error) {
+ if (result) {
PRINT_ER("Failed to get mac address\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
- }
- WILC_CATCH(s32Error)
- {
-
+ result = -EFAULT;
}
- up(&hWaitResponse);
+ up(&hif_sema_wait_response);
- return s32Error;
+ return result;
}
-
-/**
- * @brief Handle_CfgParam
- * @details Sending config packet to firmware to set CFG params
- * @param[in] tstrHostIFCfgParamAttr* strHostIFCfgParamAttr
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-static s32 Handle_CfgParam(tstrWILC_WFIDrv *drvHandler, tstrHostIFCfgParamAttr *strHostIFCfgParamAttr)
+static s32 Handle_CfgParam(struct host_if_drv *hif_drv,
+ struct cfg_param_attr *strHostIFCfgParamAttr)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWIDList[32];
+ s32 result = 0;
+ struct wid strWIDList[32];
u8 u8WidCnt = 0;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
-
-
- down(&(pstrWFIDrv->gtOsCfgValuesSem));
+ down(&hif_drv->gtOsCfgValuesSem);
PRINT_D(HOSTINF_DBG, "Setting CFG params\n");
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BSS_TYPE) {
- /*----------------------------------------------------------*/
- /*Input Value: INFRASTRUCTURE = 1, */
- /* INDEPENDENT= 2, */
- /* ANY_BSS= 3 */
- /*----------------------------------------------------------*/
- /* validate input then copy>> need to check value 4 and 5 */
- if (strHostIFCfgParamAttr->pstrCfgParamVal.bss_type < 6) {
- strWIDList[u8WidCnt].u16WIDid = WID_BSS_TYPE;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.bss_type;
- strWIDList[u8WidCnt].enuWIDtype = WID_CHAR;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(char);
- pstrWFIDrv->strCfgValues.bss_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.bss_type;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & BSS_TYPE) {
+ if (strHostIFCfgParamAttr->cfg_attr_info.bss_type < 6) {
+ strWIDList[u8WidCnt].id = WID_BSS_TYPE;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.bss_type;
+ strWIDList[u8WidCnt].type = WID_CHAR;
+ strWIDList[u8WidCnt].size = sizeof(char);
+ hif_drv->strCfgValues.bss_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.bss_type;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("check value 6 over\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTH_TYPE) {
- /*------------------------------------------------------*/
- /*Input Values: OPEN_SYSTEM = 0, */
- /* SHARED_KEY = 1, */
- /* ANY = 2 */
- /*------------------------------------------------------*/
- /*validate Possible values*/
- if ((strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 1 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 2 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 5) {
- strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TYPE;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_type;
- strWIDList[u8WidCnt].enuWIDtype = WID_CHAR;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(char);
- pstrWFIDrv->strCfgValues.auth_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.auth_type;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & AUTH_TYPE) {
+ if ((strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 1 || (strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 2 || (strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 5) {
+ strWIDList[u8WidCnt].id = WID_AUTH_TYPE;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.auth_type;
+ strWIDList[u8WidCnt].type = WID_CHAR;
+ strWIDList[u8WidCnt].size = sizeof(char);
+ hif_drv->strCfgValues.auth_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.auth_type;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("Impossible value \n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTHEN_TIMEOUT) {
- /* range is 1 to 65535. */
- if (strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout < 65536) {
- strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TIMEOUT;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout;
- strWIDList[u8WidCnt].enuWIDtype = WID_SHORT;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(u16);
- pstrWFIDrv->strCfgValues.auth_timeout = strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & AUTHEN_TIMEOUT) {
+ if (strHostIFCfgParamAttr->cfg_attr_info.auth_timeout > 0 && strHostIFCfgParamAttr->cfg_attr_info.auth_timeout < 65536) {
+ strWIDList[u8WidCnt].id = WID_AUTH_TIMEOUT;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.auth_timeout;
+ strWIDList[u8WidCnt].type = WID_SHORT;
+ strWIDList[u8WidCnt].size = sizeof(u16);
+ hif_drv->strCfgValues.auth_timeout = strHostIFCfgParamAttr->cfg_attr_info.auth_timeout;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("Range(1 ~ 65535) over\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & POWER_MANAGEMENT) {
- /*-----------------------------------------------------------*/
- /*Input Values: NO_POWERSAVE = 0, */
- /* MIN_FAST_PS = 1, */
- /* MAX_FAST_PS = 2, */
- /* MIN_PSPOLL_PS = 3, */
- /* MAX_PSPOLL_PS = 4 */
- /*----------------------------------------------------------*/
- if (strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode < 5) {
- strWIDList[u8WidCnt].u16WIDid = WID_POWER_MANAGEMENT;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode;
- strWIDList[u8WidCnt].enuWIDtype = WID_CHAR;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(char);
- pstrWFIDrv->strCfgValues.power_mgmt_mode = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & POWER_MANAGEMENT) {
+ if (strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode < 5) {
+ strWIDList[u8WidCnt].id = WID_POWER_MANAGEMENT;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode;
+ strWIDList[u8WidCnt].type = WID_CHAR;
+ strWIDList[u8WidCnt].size = sizeof(char);
+ hif_drv->strCfgValues.power_mgmt_mode = (u8)strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("Invalide power mode\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_SHORT) {
- /* range from 1 to 256 */
- if ((strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit < 256)) {
- strWIDList[u8WidCnt].u16WIDid = WID_SHORT_RETRY_LIMIT;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit;
- strWIDList[u8WidCnt].enuWIDtype = WID_SHORT;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(u16);
- pstrWFIDrv->strCfgValues.short_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & RETRY_SHORT) {
+ if ((strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit > 0) && (strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit < 256)) {
+ strWIDList[u8WidCnt].id = WID_SHORT_RETRY_LIMIT;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit;
+ strWIDList[u8WidCnt].type = WID_SHORT;
+ strWIDList[u8WidCnt].size = sizeof(u16);
+ hif_drv->strCfgValues.short_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("Range(1~256) over\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_LONG) {
- /* range from 1 to 256 */
- if ((strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit < 256)) {
- strWIDList[u8WidCnt].u16WIDid = WID_LONG_RETRY_LIMIT;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & RETRY_LONG) {
+ if ((strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit > 0) && (strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit < 256)) {
+ strWIDList[u8WidCnt].id = WID_LONG_RETRY_LIMIT;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit;
- strWIDList[u8WidCnt].enuWIDtype = WID_SHORT;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(u16);
- pstrWFIDrv->strCfgValues.long_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit;
+ strWIDList[u8WidCnt].type = WID_SHORT;
+ strWIDList[u8WidCnt].size = sizeof(u16);
+ hif_drv->strCfgValues.long_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("Range(1~256) over\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & FRAG_THRESHOLD) {
-
- if (strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold < 7937) {
- strWIDList[u8WidCnt].u16WIDid = WID_FRAG_THRESHOLD;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold;
- strWIDList[u8WidCnt].enuWIDtype = WID_SHORT;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(u16);
- pstrWFIDrv->strCfgValues.frag_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & FRAG_THRESHOLD) {
+ if (strHostIFCfgParamAttr->cfg_attr_info.frag_threshold > 255 && strHostIFCfgParamAttr->cfg_attr_info.frag_threshold < 7937) {
+ strWIDList[u8WidCnt].id = WID_FRAG_THRESHOLD;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.frag_threshold;
+ strWIDList[u8WidCnt].type = WID_SHORT;
+ strWIDList[u8WidCnt].size = sizeof(u16);
+ hif_drv->strCfgValues.frag_threshold = strHostIFCfgParamAttr->cfg_attr_info.frag_threshold;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("Threshold Range fail\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RTS_THRESHOLD) {
- /* range 256 to 65535 */
- if (strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold < 65536) {
- strWIDList[u8WidCnt].u16WIDid = WID_RTS_THRESHOLD;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold;
- strWIDList[u8WidCnt].enuWIDtype = WID_SHORT;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(u16);
- pstrWFIDrv->strCfgValues.rts_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & RTS_THRESHOLD) {
+ if (strHostIFCfgParamAttr->cfg_attr_info.rts_threshold > 255 && strHostIFCfgParamAttr->cfg_attr_info.rts_threshold < 65536) {
+ strWIDList[u8WidCnt].id = WID_RTS_THRESHOLD;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.rts_threshold;
+ strWIDList[u8WidCnt].type = WID_SHORT;
+ strWIDList[u8WidCnt].size = sizeof(u16);
+ hif_drv->strCfgValues.rts_threshold = strHostIFCfgParamAttr->cfg_attr_info.rts_threshold;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("Threshold Range fail\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PREAMBLE) {
- /*-----------------------------------------------------*/
- /*Input Values: Short= 0, */
- /* Long= 1, */
- /* Auto= 2 */
- /*------------------------------------------------------*/
- if (strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type < 3) {
- strWIDList[u8WidCnt].u16WIDid = WID_PREAMBLE;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type;
- strWIDList[u8WidCnt].enuWIDtype = WID_CHAR;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(char);
- pstrWFIDrv->strCfgValues.preamble_type = strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & PREAMBLE) {
+ if (strHostIFCfgParamAttr->cfg_attr_info.preamble_type < 3) {
+ strWIDList[u8WidCnt].id = WID_PREAMBLE;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.preamble_type;
+ strWIDList[u8WidCnt].type = WID_CHAR;
+ strWIDList[u8WidCnt].size = sizeof(char);
+ hif_drv->strCfgValues.preamble_type = strHostIFCfgParamAttr->cfg_attr_info.preamble_type;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("Preamle Range(0~2) over\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SHORT_SLOT_ALLOWED) {
- if (strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed < 2) {
- strWIDList[u8WidCnt].u16WIDid = WID_SHORT_SLOT_ALLOWED;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed;
- strWIDList[u8WidCnt].enuWIDtype = WID_CHAR;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(char);
- pstrWFIDrv->strCfgValues.short_slot_allowed = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & SHORT_SLOT_ALLOWED) {
+ if (strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed < 2) {
+ strWIDList[u8WidCnt].id = WID_SHORT_SLOT_ALLOWED;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed;
+ strWIDList[u8WidCnt].type = WID_CHAR;
+ strWIDList[u8WidCnt].size = sizeof(char);
+ hif_drv->strCfgValues.short_slot_allowed = (u8)strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("Short slot(2) over\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & TXOP_PROT_DISABLE) {
- /*Description: used to Disable RTS-CTS protection for TXOP burst*/
- /*transmission when the acknowledgement policy is No-Ack or Block-Ack */
- /* this information is useful for external supplicant */
- /*Input Values: 1 for enable and 0 for disable. */
- if (strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled < 2) {
- strWIDList[u8WidCnt].u16WIDid = WID_11N_TXOP_PROT_DISABLE;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled;
- strWIDList[u8WidCnt].enuWIDtype = WID_CHAR;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(char);
- pstrWFIDrv->strCfgValues.txop_prot_disabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & TXOP_PROT_DISABLE) {
+ if (strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled < 2) {
+ strWIDList[u8WidCnt].id = WID_11N_TXOP_PROT_DISABLE;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled;
+ strWIDList[u8WidCnt].type = WID_CHAR;
+ strWIDList[u8WidCnt].size = sizeof(char);
+ hif_drv->strCfgValues.txop_prot_disabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("TXOP prot disable\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BEACON_INTERVAL) {
- /* range is 1 to 65535. */
- if (strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval < 65536) {
- strWIDList[u8WidCnt].u16WIDid = WID_BEACON_INTERVAL;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval;
- strWIDList[u8WidCnt].enuWIDtype = WID_SHORT;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(u16);
- pstrWFIDrv->strCfgValues.beacon_interval = strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & BEACON_INTERVAL) {
+ if (strHostIFCfgParamAttr->cfg_attr_info.beacon_interval > 0 && strHostIFCfgParamAttr->cfg_attr_info.beacon_interval < 65536) {
+ strWIDList[u8WidCnt].id = WID_BEACON_INTERVAL;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.beacon_interval;
+ strWIDList[u8WidCnt].type = WID_SHORT;
+ strWIDList[u8WidCnt].size = sizeof(u16);
+ hif_drv->strCfgValues.beacon_interval = strHostIFCfgParamAttr->cfg_attr_info.beacon_interval;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("Beacon interval(1~65535) fail\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & DTIM_PERIOD) {
- /* range is 1 to 255. */
- if (strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period < 256) {
- strWIDList[u8WidCnt].u16WIDid = WID_DTIM_PERIOD;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period;
- strWIDList[u8WidCnt].enuWIDtype = WID_CHAR;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(char);
- pstrWFIDrv->strCfgValues.dtim_period = strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & DTIM_PERIOD) {
+ if (strHostIFCfgParamAttr->cfg_attr_info.dtim_period > 0 && strHostIFCfgParamAttr->cfg_attr_info.dtim_period < 256) {
+ strWIDList[u8WidCnt].id = WID_DTIM_PERIOD;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.dtim_period;
+ strWIDList[u8WidCnt].type = WID_CHAR;
+ strWIDList[u8WidCnt].size = sizeof(char);
+ hif_drv->strCfgValues.dtim_period = strHostIFCfgParamAttr->cfg_attr_info.dtim_period;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("DTIM range(1~255) fail\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY) {
- /*----------------------------------------------------------------------*/
- /*Input Values: SITE_SURVEY_1CH = 0, i.e.: currently set channel */
- /* SITE_SURVEY_ALL_CH = 1, */
- /* SITE_SURVEY_OFF = 2 */
- /*----------------------------------------------------------------------*/
- if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled < 3) {
- strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled;
- strWIDList[u8WidCnt].enuWIDtype = WID_CHAR;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(char);
- pstrWFIDrv->strCfgValues.site_survey_enabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & SITE_SURVEY) {
+ if (strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled < 3) {
+ strWIDList[u8WidCnt].id = WID_SITE_SURVEY;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled;
+ strWIDList[u8WidCnt].type = WID_CHAR;
+ strWIDList[u8WidCnt].size = sizeof(char);
+ hif_drv->strCfgValues.site_survey_enabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("Site survey disable\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY_SCAN_TIME) {
- /* range is 1 to 65535. */
- if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time < 65536) {
- strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY_SCAN_TIME;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time;
- strWIDList[u8WidCnt].enuWIDtype = WID_SHORT;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(u16);
- pstrWFIDrv->strCfgValues.site_survey_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & SITE_SURVEY_SCAN_TIME) {
+ if (strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time < 65536) {
+ strWIDList[u8WidCnt].id = WID_SITE_SURVEY_SCAN_TIME;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time;
+ strWIDList[u8WidCnt].type = WID_SHORT;
+ strWIDList[u8WidCnt].size = sizeof(u16);
+ hif_drv->strCfgValues.site_survey_scan_time = strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("Site survey scan time(1~65535) over\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & ACTIVE_SCANTIME) {
- /* range is 1 to 65535. */
- if (strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time < 65536) {
- strWIDList[u8WidCnt].u16WIDid = WID_ACTIVE_SCAN_TIME;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time;
- strWIDList[u8WidCnt].enuWIDtype = WID_SHORT;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(u16);
- pstrWFIDrv->strCfgValues.active_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & ACTIVE_SCANTIME) {
+ if (strHostIFCfgParamAttr->cfg_attr_info.active_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.active_scan_time < 65536) {
+ strWIDList[u8WidCnt].id = WID_ACTIVE_SCAN_TIME;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.active_scan_time;
+ strWIDList[u8WidCnt].type = WID_SHORT;
+ strWIDList[u8WidCnt].size = sizeof(u16);
+ hif_drv->strCfgValues.active_scan_time = strHostIFCfgParamAttr->cfg_attr_info.active_scan_time;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("Active scan time(1~65535) over\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PASSIVE_SCANTIME) {
- /* range is 1 to 65535. */
- if (strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time < 65536) {
- strWIDList[u8WidCnt].u16WIDid = WID_PASSIVE_SCAN_TIME;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time;
- strWIDList[u8WidCnt].enuWIDtype = WID_SHORT;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(u16);
- pstrWFIDrv->strCfgValues.passive_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time;
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & PASSIVE_SCANTIME) {
+ if (strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time < 65536) {
+ strWIDList[u8WidCnt].id = WID_PASSIVE_SCAN_TIME;
+ strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time;
+ strWIDList[u8WidCnt].type = WID_SHORT;
+ strWIDList[u8WidCnt].size = sizeof(u16);
+ hif_drv->strCfgValues.passive_scan_time = strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("Passive scan time(1~65535) over\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & CURRENT_TX_RATE) {
- CURRENT_TX_RATE_T curr_tx_rate = strHostIFCfgParamAttr->pstrCfgParamVal.curr_tx_rate;
- /*----------------------------------------------------------------------*/
- /*Rates: 1 2 5.5 11 6 9 12 18 24 36 48 54 Auto */
- /*InputValues: 1 2 3 4 5 6 7 8 9 10 11 12 0 */
- /*----------------------------------------------------------------------*/
- /* validate rate */
+ if (strHostIFCfgParamAttr->cfg_attr_info.flag & CURRENT_TX_RATE) {
+ enum CURRENT_TXRATE curr_tx_rate = strHostIFCfgParamAttr->cfg_attr_info.curr_tx_rate;
+
if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1
|| curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5
|| curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6
|| curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12
|| curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24
|| curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) {
- strWIDList[u8WidCnt].u16WIDid = WID_CURRENT_TX_RATE;
- strWIDList[u8WidCnt].ps8WidVal = (s8 *)&curr_tx_rate;
- strWIDList[u8WidCnt].enuWIDtype = WID_SHORT;
- strWIDList[u8WidCnt].s32ValueSize = sizeof(u16);
- pstrWFIDrv->strCfgValues.curr_tx_rate = (u8)curr_tx_rate;
+ strWIDList[u8WidCnt].id = WID_CURRENT_TX_RATE;
+ strWIDList[u8WidCnt].val = (s8 *)&curr_tx_rate;
+ strWIDList[u8WidCnt].type = WID_SHORT;
+ strWIDList[u8WidCnt].size = sizeof(u16);
+ hif_drv->strCfgValues.curr_tx_rate = (u8)curr_tx_rate;
} else {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ PRINT_ER("out of TX rate\n");
+ result = -EINVAL;
+ goto ERRORHANDLER;
}
u8WidCnt++;
}
- s32Error = SendConfigPkt(SET_CFG, strWIDList, u8WidCnt, false, (u32)pstrWFIDrv);
- if (s32Error)
+ result = send_config_pkt(SET_CFG, strWIDList, u8WidCnt,
+ get_id_from_handler(hif_drv));
+
+ if (result)
PRINT_ER("Error in setting CFG params\n");
- WILC_CATCH(s32Error)
- {
- }
- up(&(pstrWFIDrv->gtOsCfgValuesSem));
- return s32Error;
+ERRORHANDLER:
+ up(&hif_drv->gtOsCfgValuesSem);
+ return result;
}
-
-/**
- * @brief Handle_wait_msg_q_empty
- * @details this should be the last msg and then the msg Q becomes idle
- * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
static s32 Handle_wait_msg_q_empty(void)
{
- s32 s32Error = WILC_SUCCESS;
-
g_wilc_initialized = 0;
- up(&hWaitResponse);
- return s32Error;
+ up(&hif_sema_wait_response);
+ return 0;
}
-/**
- * @brief Handle_Scan
- * @details Sending config packet to firmware to set the scan params
- * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr)
+static s32 Handle_Scan(struct host_if_drv *hif_drv,
+ struct scan_attr *pstrHostIFscanAttr)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWIDList[5];
+ s32 result = 0;
+ struct wid strWIDList[5];
u32 u32WidsCount = 0;
u32 i;
u8 *pu8Buffer;
u8 valuesize = 0;
u8 *pu8HdnNtwrksWidVal = NULL;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler;
PRINT_D(HOSTINF_DBG, "Setting SCAN params\n");
- PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", pstrWFIDrv->enuHostIFstate);
+ PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", hif_drv->enuHostIFstate);
- pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = pstrHostIFscanAttr->pfScanResult;
- pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid = pstrHostIFscanAttr->pvUserArg;
+ hif_drv->usr_scan_req.pfUserScanResult = pstrHostIFscanAttr->result;
+ hif_drv->usr_scan_req.u32UserScanPvoid = pstrHostIFscanAttr->arg;
- #ifdef WILC_P2P
- #endif
-
- if ((pstrWFIDrv->enuHostIFstate >= HOST_IF_SCANNING) && (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTED)) {
- /* here we either in HOST_IF_SCANNING, HOST_IF_WAITING_CONN_REQ or HOST_IF_WAITING_CONN_RESP */
- PRINT_D(GENERIC_DBG, "Don't scan we are already in [%d] state\n", pstrWFIDrv->enuHostIFstate);
- WILC_ERRORREPORT(s32Error, WILC_BUSY);
+ if ((hif_drv->enuHostIFstate >= HOST_IF_SCANNING) && (hif_drv->enuHostIFstate < HOST_IF_CONNECTED)) {
+ PRINT_D(GENERIC_DBG, "Don't scan we are already in [%d] state\n", hif_drv->enuHostIFstate);
+ PRINT_ER("Already scan\n");
+ result = -EBUSY;
+ goto ERRORHANDLER;
}
- #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
if (g_obtainingIP || connecting) {
PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n");
- WILC_ERRORREPORT(s32Error, WILC_BUSY);
+ PRINT_ER("Don't do obss scan\n");
+ result = -EBUSY;
+ goto ERRORHANDLER;
}
- #endif
PRINT_D(HOSTINF_DBG, "Setting SCAN params\n");
+ hif_drv->usr_scan_req.u32RcvdChCount = 0;
- pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount = 0;
-
- /*BugID_4189*/
- strWIDList[u32WidsCount].u16WIDid = (u16)WID_SSID_PROBE_REQ;
- strWIDList[u32WidsCount].enuWIDtype = WID_STR;
+ strWIDList[u32WidsCount].id = (u16)WID_SSID_PROBE_REQ;
+ strWIDList[u32WidsCount].type = WID_STR;
- for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++)
- valuesize += ((pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen) + 1);
- pu8HdnNtwrksWidVal = WILC_MALLOC(valuesize + 1);
- strWIDList[u32WidsCount].ps8WidVal = pu8HdnNtwrksWidVal;
- if (strWIDList[u32WidsCount].ps8WidVal != NULL) {
- pu8Buffer = strWIDList[u32WidsCount].ps8WidVal;
+ for (i = 0; i < pstrHostIFscanAttr->hidden_network.u8ssidnum; i++)
+ valuesize += ((pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen) + 1);
+ pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL);
+ strWIDList[u32WidsCount].val = pu8HdnNtwrksWidVal;
+ if (strWIDList[u32WidsCount].val) {
+ pu8Buffer = strWIDList[u32WidsCount].val;
- *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum;
+ *pu8Buffer++ = pstrHostIFscanAttr->hidden_network.u8ssidnum;
- PRINT_D(HOSTINF_DBG, "In Handle_ProbeRequest number of ssid %d\n", pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum);
+ PRINT_D(HOSTINF_DBG, "In Handle_ProbeRequest number of ssid %d\n", pstrHostIFscanAttr->hidden_network.u8ssidnum);
- for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) {
- *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen;
- memcpy(pu8Buffer, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen);
- pu8Buffer += pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen;
+ for (i = 0; i < pstrHostIFscanAttr->hidden_network.u8ssidnum; i++) {
+ *pu8Buffer++ = pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen;
+ memcpy(pu8Buffer, pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen);
+ pu8Buffer += pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen;
}
-
-
- strWIDList[u32WidsCount].s32ValueSize = (s32)(valuesize + 1);
+ strWIDList[u32WidsCount].size = (s32)(valuesize + 1);
u32WidsCount++;
}
- /*filling cfg param array*/
-
- /* if((pstrHostIFscanAttr->pu8IEs != NULL) && (pstrHostIFscanAttr->IEsLen != 0)) */
{
- /* IEs to be inserted in Probe Request */
- strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_PROBE;
- strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA;
- strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8IEs;
- strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->IEsLen;
+ strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_PROBE;
+ strWIDList[u32WidsCount].type = WID_BIN_DATA;
+ strWIDList[u32WidsCount].val = pstrHostIFscanAttr->ies;
+ strWIDList[u32WidsCount].size = pstrHostIFscanAttr->ies_len;
u32WidsCount++;
}
- /*Scan Type*/
- strWIDList[u32WidsCount].u16WIDid = WID_SCAN_TYPE;
- strWIDList[u32WidsCount].enuWIDtype = WID_CHAR;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(char);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanType));
+ strWIDList[u32WidsCount].id = WID_SCAN_TYPE;
+ strWIDList[u32WidsCount].type = WID_CHAR;
+ strWIDList[u32WidsCount].size = sizeof(char);
+ strWIDList[u32WidsCount].val = (s8 *)&pstrHostIFscanAttr->type;
u32WidsCount++;
- /*list of channels to be scanned*/
- strWIDList[u32WidsCount].u16WIDid = WID_SCAN_CHANNEL_LIST;
- strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA;
+ strWIDList[u32WidsCount].id = WID_SCAN_CHANNEL_LIST;
+ strWIDList[u32WidsCount].type = WID_BIN_DATA;
- /* Bug 4648: Convert channel numbers to start from 0 not 1. */
- if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL && pstrHostIFscanAttr->u8ChnlListLen > 0) {
+ if (pstrHostIFscanAttr->ch_freq_list &&
+ pstrHostIFscanAttr->ch_list_len > 0) {
int i;
- for (i = 0; i < pstrHostIFscanAttr->u8ChnlListLen; i++) {
- if (pstrHostIFscanAttr->pu8ChnlFreqList[i] > 0)
- pstrHostIFscanAttr->pu8ChnlFreqList[i] = pstrHostIFscanAttr->pu8ChnlFreqList[i] - 1;
+ for (i = 0; i < pstrHostIFscanAttr->ch_list_len; i++) {
+ if (pstrHostIFscanAttr->ch_freq_list[i] > 0)
+ pstrHostIFscanAttr->ch_freq_list[i] = pstrHostIFscanAttr->ch_freq_list[i] - 1;
}
}
- strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8ChnlFreqList;
- strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->u8ChnlListLen;
+ strWIDList[u32WidsCount].val = pstrHostIFscanAttr->ch_freq_list;
+ strWIDList[u32WidsCount].size = pstrHostIFscanAttr->ch_list_len;
u32WidsCount++;
- /*Scan Request*/
- strWIDList[u32WidsCount].u16WIDid = WID_START_SCAN_REQ;
- strWIDList[u32WidsCount].enuWIDtype = WID_CHAR;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(char);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanSource));
+ strWIDList[u32WidsCount].id = WID_START_SCAN_REQ;
+ strWIDList[u32WidsCount].type = WID_CHAR;
+ strWIDList[u32WidsCount].size = sizeof(char);
+ strWIDList[u32WidsCount].val = (s8 *)&pstrHostIFscanAttr->src;
u32WidsCount++;
- /*keep the state as is , no need to change it*/
- /* gWFiDrvHandle->enuHostIFstate = HOST_IF_SCANNING; */
+ if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED)
+ scan_while_connected = true;
+ else if (hif_drv->enuHostIFstate == HOST_IF_IDLE)
+ scan_while_connected = false;
- if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED)
- gbScanWhileConnected = true;
- else if (pstrWFIDrv->enuHostIFstate == HOST_IF_IDLE)
- gbScanWhileConnected = false;
+ result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
+ get_id_from_handler(hif_drv));
- s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, (u32)pstrWFIDrv);
-
- if (s32Error) {
+ if (result)
PRINT_ER("Failed to send scan paramters config packet\n");
- WILC_ERRORREPORT(s32Error, s32Error);
- } else {
+ else
PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n");
- }
- WILC_CATCH(s32Error)
- {
- del_timer(&pstrWFIDrv->hScanTimer);
- /*if there is an ongoing scan request*/
- Handle_ScanDone(drvHandler, SCAN_EVENT_ABORTED);
+ERRORHANDLER:
+ if (result) {
+ del_timer(&hif_drv->hScanTimer);
+ Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED);
}
- /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */
- if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) {
- kfree(pstrHostIFscanAttr->pu8ChnlFreqList);
- pstrHostIFscanAttr->pu8ChnlFreqList = NULL;
- }
+ kfree(pstrHostIFscanAttr->ch_freq_list);
+ pstrHostIFscanAttr->ch_freq_list = NULL;
- /* Deallocate pstrHostIFscanAttr->pu8IEs which was previously allocated by the sending thread */
- if (pstrHostIFscanAttr->pu8IEs != NULL) {
- kfree(pstrHostIFscanAttr->pu8IEs);
- pstrHostIFscanAttr->pu8IEs = NULL;
- }
- if (pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo != NULL) {
- kfree(pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo);
- pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo = NULL;
- }
-
- /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */
- if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) {
- kfree(pstrHostIFscanAttr->pu8ChnlFreqList);
- pstrHostIFscanAttr->pu8ChnlFreqList = NULL;
- }
+ kfree(pstrHostIFscanAttr->ies);
+ pstrHostIFscanAttr->ies = NULL;
+ kfree(pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo);
+ pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo = NULL;
- if (pu8HdnNtwrksWidVal != NULL)
- kfree(pu8HdnNtwrksWidVal);
+ kfree(pu8HdnNtwrksWidVal);
- return s32Error;
+ return result;
}
-/**
- * @brief Handle_ScanDone
- * @details Call scan notification callback function
- * @param[in] NONE
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-static s32 Handle_ScanDone(tstrWILC_WFIDrv *drvHandler, tenuScanEvent enuEvent)
+static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
+ enum scan_event enuEvent)
{
- s32 s32Error = WILC_SUCCESS;
-
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
-
-
+ s32 result = 0;
u8 u8abort_running_scan;
- tstrWID strWID;
-
+ struct wid wid;
PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n");
- /*BugID_4978*/
- /*Ask FW to abort the running scan, if any*/
if (enuEvent == SCAN_EVENT_ABORTED) {
PRINT_D(GENERIC_DBG, "Abort running scan\n");
u8abort_running_scan = 1;
- strWID.u16WIDid = (u16)WID_ABORT_RUNNING_SCAN;
- strWID.enuWIDtype = WID_CHAR;
- strWID.ps8WidVal = (s8 *)&u8abort_running_scan;
- strWID.s32ValueSize = sizeof(char);
-
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error != WILC_SUCCESS) {
+ wid.id = (u16)WID_ABORT_RUNNING_SCAN;
+ wid.type = WID_CHAR;
+ wid.val = (s8 *)&u8abort_running_scan;
+ wid.size = sizeof(char);
+
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+
+ if (result) {
PRINT_ER("Failed to set abort running scan\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
- }
- WILC_CATCH(s32Error)
- {
+ result = -EFAULT;
}
}
- if (pstrWFIDrv == NULL) {
+ if (!hif_drv) {
PRINT_ER("Driver handler is NULL\n");
- return s32Error;
+ return result;
}
- /*if there is an ongoing scan request*/
- if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) {
- pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(enuEvent, NULL,
- pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL);
- /*delete current scan request*/
- pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL;
+ if (hif_drv->usr_scan_req.pfUserScanResult) {
+ hif_drv->usr_scan_req.pfUserScanResult(enuEvent, NULL,
+ hif_drv->usr_scan_req.u32UserScanPvoid, NULL);
+ hif_drv->usr_scan_req.pfUserScanResult = NULL;
}
- return s32Error;
+ return result;
}
-/**
- * @brief Handle_Connect
- * @details Sending config packet to firmware to starting connection
- * @param[in] tstrHostIFconnectAttr* pstrHostIFconnectAttr
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
u8 u8ConnectedSSID[6] = {0};
-static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *pstrHostIFconnectAttr)
+static s32 Handle_Connect(struct host_if_drv *hif_drv,
+ struct connect_attr *pstrHostIFconnectAttr)
{
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler;
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWIDList[8];
+ s32 result = 0;
+ struct wid strWIDList[8];
u32 u32WidsCount = 0, dummyval = 0;
- /* char passphrase[] = "12345678"; */
- #ifndef CONNECT_DIRECT
- s32 s32Err = WILC_SUCCESS;
- u32 i;
- u8 u8bssDscListIndex;
- wid_site_survey_reslts_s *pstrSurveyResults = NULL;
- #else
u8 *pu8CurrByte = NULL;
- /*Bug4218: Parsing Join Param*/
- #ifdef WILC_PARSE_SCAN_IN_HOST
- tstrJoinBssParam *ptstrJoinBssParam;
- #endif /*WILC_PARSE_SCAN_IN_HOST*/
-
- #endif
+ struct join_bss_param *ptstrJoinBssParam;
PRINT_D(GENERIC_DBG, "Handling connect request\n");
- #ifndef CONNECT_DIRECT
- memset(gapu8RcvdSurveyResults[0], 0, MAX_SURVEY_RESULT_FRAG_SIZE);
- memset(gapu8RcvdSurveyResults[1], 0, MAX_SURVEY_RESULT_FRAG_SIZE);
-
-
- PRINT_D(HOSTINF_DBG, "Getting site survey results\n");
- s32Err = host_int_get_site_survey_results(pstrWFIDrv,
- gapu8RcvdSurveyResults,
- MAX_SURVEY_RESULT_FRAG_SIZE);
- if (s32Err) {
- PRINT_ER("Failed to get site survey results\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
-
- }
- s32Err = ParseSurveyResults(gapu8RcvdSurveyResults, &pstrSurveyResults,
- &pstrWFIDrv->u32SurveyResultsCount);
-
-
- if (s32Err == WILC_SUCCESS) {
- /* use the parsed info in pstrSurveyResults, then deallocate it */
- PRINT_D(HOSTINF_DBG, "Copying site survey results in global structure, then deallocate\n");
- for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) {
- memcpy(&pstrWFIDrv->astrSurveyResults[i], &pstrSurveyResults[i],
- sizeof(wid_site_survey_reslts_s));
- }
-
- DeallocateSurveyResults(pstrSurveyResults);
- } else {
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
- PRINT_ER("ParseSurveyResults() Error(%d)\n", s32Err);
- }
-
-
- for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) {
- if (memcmp(pstrWFIDrv->astrSurveyResults[i].SSID,
- pstrHostIFconnectAttr->pu8ssid,
- pstrHostIFconnectAttr->ssidLen) == 0) {
- PRINT_INFO(HOSTINF_DBG, "Network with required SSID is found %s\n", pstrHostIFconnectAttr->pu8ssid);
- if (pstrHostIFconnectAttr->pu8bssid == NULL) {
- /* BSSID is not passed from the user, so decision of matching
- * is done by SSID only */
- PRINT_INFO(HOSTINF_DBG, "BSSID is not passed from the user\n");
- break;
- } else {
- /* BSSID is also passed from the user, so decision of matching
- * should consider also this passed BSSID */
-
- if (memcmp(pstrWFIDrv->astrSurveyResults[i].BSSID,
- pstrHostIFconnectAttr->pu8bssid,
- 6) == 0) {
- PRINT_INFO(HOSTINF_DBG, "BSSID is passed from the user and matched\n");
- break;
- }
- }
- }
- }
-
- if (i < pstrWFIDrv->u32SurveyResultsCount) {
- u8bssDscListIndex = i;
-
- PRINT_INFO(HOSTINF_DBG, "Connecting to network of Bss Idx%d and SSID %s and channel%d\n",
- u8bssDscListIndex, pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].SSID,
- pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].Channel);
-
- PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n");
-
- if (pstrHostIFconnectAttr->pu8bssid != NULL) {
- pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = WILC_MALLOC(6);
- memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6);
- }
-
- pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen;
- if (pstrHostIFconnectAttr->pu8ssid != NULL) {
- pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1);
- memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid,
- pstrHostIFconnectAttr->ssidLen);
- pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0';
- }
-
- pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen;
- if (pstrHostIFconnectAttr->pu8IEs != NULL) {
- pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen);
- memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs,
- pstrHostIFconnectAttr->IEsLen);
- }
-
- pstrWFIDrv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security;
- pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type;
- pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult;
- pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg;
-
-
- /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */
- /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */
- {
- /* IEs to be inserted in Association Request */
- strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE;
- strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA;
- strWIDList[u32WidsCount].ps8WidVal = pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs;
- strWIDList[u32WidsCount].s32ValueSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen;
- u32WidsCount++;
- }
- strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE;
- strWIDList[u32WidsCount].enuWIDtype = WID_CHAR;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(char);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrWFIDrv->strWILC_UsrConnReq.u8security));
- u32WidsCount++;
-
- PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security);
-
- strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE;
- strWIDList[u32WidsCount].enuWIDtype = WID_CHAR;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(char);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type);
- u32WidsCount++;
-
- PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type);
- /*
- * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK;
- * strWIDList[u32WidsCount].enuWIDtype = WID_STR;
- * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase);
- * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase);
- * u32WidsCount++;
- */
-
- strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ;
- strWIDList[u32WidsCount].enuWIDtype = WID_CHAR;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(char);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)&u8bssDscListIndex;
- u32WidsCount++;
-
- /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the
- * firmware at chip reset when processing the WIDs of the Connect Request.
- * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */
- /* ////////////////////// */
- gu32WidConnRstHack = 0;
- /* ////////////////////// */
-
- s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, (u32)pstrWFIDrv);
- if (s32Error) {
- PRINT_ER("Handle_Connect()] failed to send config packet\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
- } else {
- pstrWFIDrv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP;
- }
-
- } else {
- PRINT_ER("Required BSSID not found\n");
- WILC_ERRORREPORT(s32Error, WILC_NOT_FOUND);
- }
-
- #else
-
- /* if we try to connect to an already connected AP then discard the request */
-
- if (memcmp(pstrHostIFconnectAttr->pu8bssid, u8ConnectedSSID, ETH_ALEN) == 0) {
-
- s32Error = WILC_SUCCESS;
+ if (memcmp(pstrHostIFconnectAttr->bssid, u8ConnectedSSID, ETH_ALEN) == 0) {
+ result = 0;
PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n");
- return s32Error;
+ return result;
}
PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n");
- /*Bug4218: Parsing Join Param*/
- #ifdef WILC_PARSE_SCAN_IN_HOST
- ptstrJoinBssParam = (tstrJoinBssParam *)pstrHostIFconnectAttr->pJoinParams;
- if (ptstrJoinBssParam == NULL) {
+ ptstrJoinBssParam = (struct join_bss_param *)pstrHostIFconnectAttr->params;
+ if (!ptstrJoinBssParam) {
PRINT_ER("Required BSSID not found\n");
- WILC_ERRORREPORT(s32Error, WILC_NOT_FOUND);
+ result = -ENOENT;
+ goto ERRORHANDLER;
}
- #endif /*WILC_PARSE_SCAN_IN_HOST*/
- if (pstrHostIFconnectAttr->pu8bssid != NULL) {
- pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = WILC_MALLOC(6);
- memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6);
+ if (pstrHostIFconnectAttr->bssid) {
+ hif_drv->usr_conn_req.pu8bssid = kmalloc(6, GFP_KERNEL);
+ memcpy(hif_drv->usr_conn_req.pu8bssid, pstrHostIFconnectAttr->bssid, 6);
}
- pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen;
- if (pstrHostIFconnectAttr->pu8ssid != NULL) {
- pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1);
- memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid,
- pstrHostIFconnectAttr->ssidLen);
- pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0';
+ hif_drv->usr_conn_req.ssidLen = pstrHostIFconnectAttr->ssid_len;
+ if (pstrHostIFconnectAttr->ssid) {
+ hif_drv->usr_conn_req.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssid_len + 1, GFP_KERNEL);
+ memcpy(hif_drv->usr_conn_req.pu8ssid,
+ pstrHostIFconnectAttr->ssid,
+ pstrHostIFconnectAttr->ssid_len);
+ hif_drv->usr_conn_req.pu8ssid[pstrHostIFconnectAttr->ssid_len] = '\0';
}
- pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen;
- if (pstrHostIFconnectAttr->pu8IEs != NULL) {
- pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen);
- memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs,
- pstrHostIFconnectAttr->IEsLen);
+ hif_drv->usr_conn_req.ConnReqIEsLen = pstrHostIFconnectAttr->ies_len;
+ if (pstrHostIFconnectAttr->ies) {
+ hif_drv->usr_conn_req.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL);
+ memcpy(hif_drv->usr_conn_req.pu8ConnReqIEs,
+ pstrHostIFconnectAttr->ies,
+ pstrHostIFconnectAttr->ies_len);
}
- pstrWFIDrv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security;
- pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type;
- pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult;
- pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg;
+ hif_drv->usr_conn_req.u8security = pstrHostIFconnectAttr->security;
+ hif_drv->usr_conn_req.tenuAuth_type = pstrHostIFconnectAttr->auth_type;
+ hif_drv->usr_conn_req.pfUserConnectResult = pstrHostIFconnectAttr->result;
+ hif_drv->usr_conn_req.u32UserConnectPvoid = pstrHostIFconnectAttr->arg;
- strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT;
- strWIDList[u32WidsCount].enuWIDtype = WID_INT;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(u32);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval));
+ strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT;
+ strWIDList[u32WidsCount].type = WID_INT;
+ strWIDList[u32WidsCount].size = sizeof(u32);
+ strWIDList[u32WidsCount].val = (s8 *)(&(dummyval));
u32WidsCount++;
- strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT;
- strWIDList[u32WidsCount].enuWIDtype = WID_INT;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(u32);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval));
+ strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT;
+ strWIDList[u32WidsCount].type = WID_INT;
+ strWIDList[u32WidsCount].size = sizeof(u32);
+ strWIDList[u32WidsCount].val = (s8 *)(&(dummyval));
u32WidsCount++;
- strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT;
- strWIDList[u32WidsCount].enuWIDtype = WID_INT;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(u32);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval));
+ strWIDList[u32WidsCount].id = WID_FAILED_COUNT;
+ strWIDList[u32WidsCount].type = WID_INT;
+ strWIDList[u32WidsCount].size = sizeof(u32);
+ strWIDList[u32WidsCount].val = (s8 *)(&(dummyval));
u32WidsCount++;
- /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */
- /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */
{
- /* IEs to be inserted in Association Request */
- strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE;
- strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA;
- strWIDList[u32WidsCount].ps8WidVal = pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs;
- strWIDList[u32WidsCount].s32ValueSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen;
+ strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
+ strWIDList[u32WidsCount].type = WID_BIN_DATA;
+ strWIDList[u32WidsCount].val = hif_drv->usr_conn_req.pu8ConnReqIEs;
+ strWIDList[u32WidsCount].size = hif_drv->usr_conn_req.ConnReqIEsLen;
u32WidsCount++;
- /*BugID_5137*/
- if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) {
-
- gu32FlushedInfoElemAsocSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen;
- gu8FlushedInfoElemAsoc = WILC_MALLOC(gu32FlushedInfoElemAsocSize);
- memcpy(gu8FlushedInfoElemAsoc, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs,
- gu32FlushedInfoElemAsocSize);
+ if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
+ info_element_size = hif_drv->usr_conn_req.ConnReqIEsLen;
+ info_element = kmalloc(info_element_size, GFP_KERNEL);
+ memcpy(info_element, hif_drv->usr_conn_req.pu8ConnReqIEs,
+ info_element_size);
}
}
- strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE;
- strWIDList[u32WidsCount].enuWIDtype = WID_CHAR;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(char);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrWFIDrv->strWILC_UsrConnReq.u8security));
+ strWIDList[u32WidsCount].id = (u16)WID_11I_MODE;
+ strWIDList[u32WidsCount].type = WID_CHAR;
+ strWIDList[u32WidsCount].size = sizeof(char);
+ strWIDList[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.u8security;
u32WidsCount++;
- /*BugID_5137*/
- if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7))
- gu8Flushed11iMode = pstrWFIDrv->strWILC_UsrConnReq.u8security;
-
- PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security);
+ if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
+ mode_11i = hif_drv->usr_conn_req.u8security;
+ PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", hif_drv->usr_conn_req.u8security);
- strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE;
- strWIDList[u32WidsCount].enuWIDtype = WID_CHAR;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(char);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type);
+ strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE;
+ strWIDList[u32WidsCount].type = WID_CHAR;
+ strWIDList[u32WidsCount].size = sizeof(char);
+ strWIDList[u32WidsCount].val = (s8 *)(&hif_drv->usr_conn_req.tenuAuth_type);
u32WidsCount++;
- /*BugID_5137*/
- if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7))
- gu8FlushedAuthType = (u8)pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type;
-
- PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type);
- /*
- * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK;
- * strWIDList[u32WidsCount].enuWIDtype = WID_STR;
- * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase);
- * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase);
- * u32WidsCount++;
- */
+ if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
+ auth_type = (u8)hif_drv->usr_conn_req.tenuAuth_type;
+ PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", hif_drv->usr_conn_req.tenuAuth_type);
PRINT_D(HOSTINF_DBG, "Connecting to network of SSID %s on channel %d\n",
- pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->u8channel);
-
+ hif_drv->usr_conn_req.pu8ssid, pstrHostIFconnectAttr->ch);
-#ifndef WILC_PARSE_SCAN_IN_HOST
- strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED;
- strWIDList[u32WidsCount].enuWIDtype = WID_STR;
- strWIDList[u32WidsCount].s32ValueSize = MAX_SSID_LEN + 7;
- strWIDList[u32WidsCount].ps8WidVal = WILC_MALLOC(strWIDList[u32WidsCount].s32ValueSize);
+ strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED;
+ strWIDList[u32WidsCount].type = WID_STR;
+ strWIDList[u32WidsCount].size = 112;
+ strWIDList[u32WidsCount].val = kmalloc(strWIDList[u32WidsCount].size, GFP_KERNEL);
- if (strWIDList[u32WidsCount].ps8WidVal == NULL)
- WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
-
- pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal;
-
- if (pstrHostIFconnectAttr->pu8ssid != NULL) {
- memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen);
- pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0';
- }
- pu8CurrByte += MAX_SSID_LEN;
- if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) {
- *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel;
- } else {
- PRINT_ER("Channel out of range\n");
- *(pu8CurrByte++) = 0xFF;
+ if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
+ join_req_size = strWIDList[u32WidsCount].size;
+ join_req = kmalloc(join_req_size, GFP_KERNEL);
}
- if (pstrHostIFconnectAttr->pu8bssid != NULL)
- memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6);
- pu8CurrByte += 6;
-
- /* keep the buffer at the start of the allocated pointer to use it with the free*/
- pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal;
-
- #else
-
- strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED;
- strWIDList[u32WidsCount].enuWIDtype = WID_STR;
-
- /*Sending NoA attributes during connection*/
- strWIDList[u32WidsCount].s32ValueSize = 112; /* 79; */
- strWIDList[u32WidsCount].ps8WidVal = WILC_MALLOC(strWIDList[u32WidsCount].s32ValueSize);
-
- /*BugID_5137*/
- if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) {
- gu32FlushedJoinReqSize = strWIDList[u32WidsCount].s32ValueSize;
- gu8FlushedJoinReq = WILC_MALLOC(gu32FlushedJoinReqSize);
+ if (!strWIDList[u32WidsCount].val) {
+ result = -EFAULT;
+ goto ERRORHANDLER;
}
- if (strWIDList[u32WidsCount].ps8WidVal == NULL)
- WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
-
- pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal;
+ pu8CurrByte = strWIDList[u32WidsCount].val;
- if (pstrHostIFconnectAttr->pu8ssid != NULL) {
- memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen);
- pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0';
+ if (pstrHostIFconnectAttr->ssid) {
+ memcpy(pu8CurrByte, pstrHostIFconnectAttr->ssid, pstrHostIFconnectAttr->ssid_len);
+ pu8CurrByte[pstrHostIFconnectAttr->ssid_len] = '\0';
}
pu8CurrByte += MAX_SSID_LEN;
-
- /* BSS type*/
*(pu8CurrByte++) = INFRASTRUCTURE;
- /* Channel*/
- if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) {
- *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel;
+
+ if ((pstrHostIFconnectAttr->ch >= 1) && (pstrHostIFconnectAttr->ch <= 14)) {
+ *(pu8CurrByte++) = pstrHostIFconnectAttr->ch;
} else {
PRINT_ER("Channel out of range\n");
*(pu8CurrByte++) = 0xFF;
}
- /* Cap Info*/
*(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF;
*(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF;
PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8)));
- /* sa*/
- if (pstrHostIFconnectAttr->pu8bssid != NULL)
- memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6);
+ if (pstrHostIFconnectAttr->bssid)
+ memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6);
pu8CurrByte += 6;
- /* bssid*/
- if (pstrHostIFconnectAttr->pu8bssid != NULL)
- memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6);
+ if (pstrHostIFconnectAttr->bssid)
+ memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6);
pu8CurrByte += 6;
- /* Beacon Period*/
*(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF;
*(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF;
PRINT_D(HOSTINF_DBG, "* Beacon Period %d*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8)));
- /* DTIM Period*/
*(pu8CurrByte++) = ptstrJoinBssParam->dtim_period;
PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1)));
- /* Supported rates*/
+
memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1);
pu8CurrByte += (MAX_RATES_SUPPORTED + 1);
- /* wmm cap*/
*(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap;
PRINT_D(HOSTINF_DBG, "* wmm cap%d*\n", (*(pu8CurrByte - 1)));
- /* uapsd cap*/
*(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap;
- /* ht cap*/
*(pu8CurrByte++) = ptstrJoinBssParam->ht_capable;
- /* copy this information to the user request */
- pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable = ptstrJoinBssParam->ht_capable;
+ hif_drv->usr_conn_req.IsHTCapable = ptstrJoinBssParam->ht_capable;
- /* rsn found*/
*(pu8CurrByte++) = ptstrJoinBssParam->rsn_found;
PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1));
- /* rsn group policy*/
*(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy;
PRINT_D(HOSTINF_DBG, "* rsn group policy %0x*\n", (*(pu8CurrByte - 1)));
- /* mode_802_11i*/
*(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i;
PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1)));
- /* rsn pcip policy*/
+
memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy));
pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy);
- /* rsn auth policy*/
memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy));
pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy);
- /* rsn auth policy*/
memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap));
pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap);
- /*BugID_5137*/
*(pu8CurrByte++) = REAL_JOIN_REQ;
+ *(pu8CurrByte++) = ptstrJoinBssParam->noa_enabled;
- #ifdef WILC_P2P
- *(pu8CurrByte++) = ptstrJoinBssParam->u8NoaEnbaled;
- if (ptstrJoinBssParam->u8NoaEnbaled) {
+ if (ptstrJoinBssParam->noa_enabled) {
PRINT_D(HOSTINF_DBG, "NOA present\n");
*(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF;
@@ -1897,105 +1170,83 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps
*(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF;
*(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF;
- *(pu8CurrByte++) = ptstrJoinBssParam->u8Index;
-
- *(pu8CurrByte++) = ptstrJoinBssParam->u8OppEnable;
-
- if (ptstrJoinBssParam->u8OppEnable)
- *(pu8CurrByte++) = ptstrJoinBssParam->u8CtWindow;
-
- *(pu8CurrByte++) = ptstrJoinBssParam->u8Count;
+ *(pu8CurrByte++) = ptstrJoinBssParam->opp_enabled;
+ *(pu8CurrByte++) = ptstrJoinBssParam->idx;
- memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, sizeof(ptstrJoinBssParam->au8Duration));
+ if (ptstrJoinBssParam->opp_enabled)
+ *(pu8CurrByte++) = ptstrJoinBssParam->ct_window;
- pu8CurrByte += sizeof(ptstrJoinBssParam->au8Duration);
+ *(pu8CurrByte++) = ptstrJoinBssParam->cnt;
- memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, sizeof(ptstrJoinBssParam->au8Interval));
+ memcpy(pu8CurrByte, ptstrJoinBssParam->duration, sizeof(ptstrJoinBssParam->duration));
+ pu8CurrByte += sizeof(ptstrJoinBssParam->duration);
- pu8CurrByte += sizeof(ptstrJoinBssParam->au8Interval);
-
- memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, sizeof(ptstrJoinBssParam->au8StartTime));
-
- pu8CurrByte += sizeof(ptstrJoinBssParam->au8StartTime);
+ memcpy(pu8CurrByte, ptstrJoinBssParam->interval, sizeof(ptstrJoinBssParam->interval));
+ pu8CurrByte += sizeof(ptstrJoinBssParam->interval);
+ memcpy(pu8CurrByte, ptstrJoinBssParam->start_time, sizeof(ptstrJoinBssParam->start_time));
+ pu8CurrByte += sizeof(ptstrJoinBssParam->start_time);
} else
PRINT_D(HOSTINF_DBG, "NOA not present\n");
- #endif
-
- /* keep the buffer at the start of the allocated pointer to use it with the free*/
- pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal;
-
-
- #endif /* #ifdef WILC_PARSE_SCAN_IN_HOST*/
+ pu8CurrByte = strWIDList[u32WidsCount].val;
u32WidsCount++;
- /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the
- * firmware at chip reset when processing the WIDs of the Connect Request.
- * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */
- /* ////////////////////// */
- gu32WidConnRstHack = 0;
- /* ////////////////////// */
-
- /*BugID_5137*/
- if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) {
- memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize);
- gu8FlushedJoinReqDrvHandler = (u32)pstrWFIDrv;
+ if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
+ memcpy(join_req, pu8CurrByte, join_req_size);
+ join_req_drv = hif_drv;
}
PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n");
- if (pstrHostIFconnectAttr->pu8bssid != NULL) {
- memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->pu8bssid, ETH_ALEN);
+ if (pstrHostIFconnectAttr->bssid) {
+ memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->bssid, ETH_ALEN);
- PRINT_D(GENERIC_DBG, "save Bssid = %x:%x:%x:%x:%x:%x\n", (pstrHostIFconnectAttr->pu8bssid[0]), (pstrHostIFconnectAttr->pu8bssid[1]), (pstrHostIFconnectAttr->pu8bssid[2]), (pstrHostIFconnectAttr->pu8bssid[3]), (pstrHostIFconnectAttr->pu8bssid[4]), (pstrHostIFconnectAttr->pu8bssid[5]));
- PRINT_D(GENERIC_DBG, "save bssid = %x:%x:%x:%x:%x:%x\n", (u8ConnectedSSID[0]), (u8ConnectedSSID[1]), (u8ConnectedSSID[2]), (u8ConnectedSSID[3]), (u8ConnectedSSID[4]), (u8ConnectedSSID[5]));
+ PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->bssid);
+ PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID);
}
- s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, (u32)pstrWFIDrv);
- if (s32Error) {
- PRINT_ER("Handle_Connect()] failed to send config packet\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
+ result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
+ get_id_from_handler(hif_drv));
+ if (result) {
+ PRINT_ER("failed to send config packet\n");
+ result = -EFAULT;
+ goto ERRORHANDLER;
} else {
PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n");
- pstrWFIDrv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP;
+ hif_drv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP;
}
- #endif
- WILC_CATCH(s32Error)
- {
+ERRORHANDLER:
+ if (result) {
tstrConnectInfo strConnectInfo;
- del_timer(&pstrWFIDrv->hConnectTimer);
+ del_timer(&hif_drv->hConnectTimer);
PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n");
memset(&strConnectInfo, 0, sizeof(tstrConnectInfo));
- if (pstrHostIFconnectAttr->pfConnectResult != NULL) {
- if (pstrHostIFconnectAttr->pu8bssid != NULL)
- memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6);
+ if (pstrHostIFconnectAttr->result) {
+ if (pstrHostIFconnectAttr->bssid)
+ memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->bssid, 6);
- if (pstrHostIFconnectAttr->pu8IEs != NULL) {
- strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen;
- strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen);
+ if (pstrHostIFconnectAttr->ies) {
+ strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->ies_len;
+ strConnectInfo.pu8ReqIEs = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL);
memcpy(strConnectInfo.pu8ReqIEs,
- pstrHostIFconnectAttr->pu8IEs,
- pstrHostIFconnectAttr->IEsLen);
+ pstrHostIFconnectAttr->ies,
+ pstrHostIFconnectAttr->ies_len);
}
- pstrHostIFconnectAttr->pfConnectResult(CONN_DISCONN_EVENT_CONN_RESP,
+ pstrHostIFconnectAttr->result(CONN_DISCONN_EVENT_CONN_RESP,
&strConnectInfo,
MAC_DISCONNECTED,
NULL,
- pstrHostIFconnectAttr->pvUserArg);
- /*Change state to idle*/
- pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE;
- /* Deallocation */
- if (strConnectInfo.pu8ReqIEs != NULL) {
- kfree(strConnectInfo.pu8ReqIEs);
- strConnectInfo.pu8ReqIEs = NULL;
- }
+ pstrHostIFconnectAttr->arg);
+ hif_drv->enuHostIFstate = HOST_IF_IDLE;
+ kfree(strConnectInfo.pu8ReqIEs);
+ strConnectInfo.pu8ReqIEs = NULL;
} else {
PRINT_ER("Connect callback function pointer is NULL\n");
@@ -2003,259 +1254,174 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps
}
PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n");
- /* Deallocate pstrHostIFconnectAttr->pu8bssid which was prevoisuly allocated by the sending thread */
- if (pstrHostIFconnectAttr->pu8bssid != NULL) {
- kfree(pstrHostIFconnectAttr->pu8bssid);
- pstrHostIFconnectAttr->pu8bssid = NULL;
- }
+ kfree(pstrHostIFconnectAttr->bssid);
+ pstrHostIFconnectAttr->bssid = NULL;
- /* Deallocate pstrHostIFconnectAttr->pu8ssid which was prevoisuly allocated by the sending thread */
- if (pstrHostIFconnectAttr->pu8ssid != NULL) {
- kfree(pstrHostIFconnectAttr->pu8ssid);
- pstrHostIFconnectAttr->pu8ssid = NULL;
- }
+ kfree(pstrHostIFconnectAttr->ssid);
+ pstrHostIFconnectAttr->ssid = NULL;
- /* Deallocate pstrHostIFconnectAttr->pu8IEs which was prevoisuly allocated by the sending thread */
- if (pstrHostIFconnectAttr->pu8IEs != NULL) {
- kfree(pstrHostIFconnectAttr->pu8IEs);
- pstrHostIFconnectAttr->pu8IEs = NULL;
- }
+ kfree(pstrHostIFconnectAttr->ies);
+ pstrHostIFconnectAttr->ies = NULL;
- if (pu8CurrByte != NULL)
- kfree(pu8CurrByte);
- return s32Error;
+ kfree(pu8CurrByte);
+ return result;
}
-/**
- * @brief Handle_FlushConnect
- * @details Sending config packet to firmware to flush an old connection
- * after switching FW from station one to hybrid one
- * @param[in] void * drvHandler
- * @return Error code.
- * @author Amr Abdel-Moghny
- * @date 19 DEC 2013
- * @version 8.0
- */
-
-static s32 Handle_FlushConnect(tstrWILC_WFIDrv *drvHandler)
+static s32 Handle_FlushConnect(struct host_if_drv *hif_drv)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWIDList[5];
+ s32 result = 0;
+ struct wid strWIDList[5];
u32 u32WidsCount = 0;
u8 *pu8CurrByte = NULL;
-
- /* IEs to be inserted in Association Request */
- strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE;
- strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA;
- strWIDList[u32WidsCount].ps8WidVal = gu8FlushedInfoElemAsoc;
- strWIDList[u32WidsCount].s32ValueSize = gu32FlushedInfoElemAsocSize;
+ strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
+ strWIDList[u32WidsCount].type = WID_BIN_DATA;
+ strWIDList[u32WidsCount].val = info_element;
+ strWIDList[u32WidsCount].size = info_element_size;
u32WidsCount++;
- strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE;
- strWIDList[u32WidsCount].enuWIDtype = WID_CHAR;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(char);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(gu8Flushed11iMode));
+ strWIDList[u32WidsCount].id = (u16)WID_11I_MODE;
+ strWIDList[u32WidsCount].type = WID_CHAR;
+ strWIDList[u32WidsCount].size = sizeof(char);
+ strWIDList[u32WidsCount].val = (s8 *)(&(mode_11i));
u32WidsCount++;
-
-
- strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE;
- strWIDList[u32WidsCount].enuWIDtype = WID_CHAR;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(char);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&gu8FlushedAuthType);
+ strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE;
+ strWIDList[u32WidsCount].type = WID_CHAR;
+ strWIDList[u32WidsCount].size = sizeof(char);
+ strWIDList[u32WidsCount].val = (s8 *)(&auth_type);
u32WidsCount++;
-
- #ifdef WILC_PARSE_SCAN_IN_HOST
- strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED;
- strWIDList[u32WidsCount].enuWIDtype = WID_STR;
- strWIDList[u32WidsCount].s32ValueSize = gu32FlushedJoinReqSize;
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)gu8FlushedJoinReq;
- pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal;
+ strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED;
+ strWIDList[u32WidsCount].type = WID_STR;
+ strWIDList[u32WidsCount].size = join_req_size;
+ strWIDList[u32WidsCount].val = (s8 *)join_req;
+ pu8CurrByte = strWIDList[u32WidsCount].val;
pu8CurrByte += FLUSHED_BYTE_POS;
*(pu8CurrByte) = FLUSHED_JOIN_REQ;
u32WidsCount++;
- #endif
-
- s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, gu8FlushedJoinReqDrvHandler);
- if (s32Error) {
- PRINT_ER("Handle_Flush_Connect()] failed to send config packet\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
+ result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
+ get_id_from_handler(join_req_drv));
+ if (result) {
+ PRINT_ER("failed to send config packet\n");
+ result = -EINVAL;
}
- WILC_CATCH(s32Error)
- {
-
- }
-
- return s32Error;
+ return result;
}
-/**
- * @brief Handle_ConnectTimeout
- * @details Call connect notification callback function indicating connection failure
- * @param[in] NONE
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler)
+static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv)
{
- s32 s32Error = WILC_SUCCESS;
+ s32 result = 0;
tstrConnectInfo strConnectInfo;
- tstrWID strWID;
+ struct wid wid;
u16 u16DummyReasonCode = 0;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler;
- if (pstrWFIDrv == NULL) {
+ if (!hif_drv) {
PRINT_ER("Driver handler is NULL\n");
- return s32Error;
+ return result;
}
- pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE;
-
- gbScanWhileConnected = false;
+ hif_drv->enuHostIFstate = HOST_IF_IDLE;
+ scan_while_connected = false;
memset(&strConnectInfo, 0, sizeof(tstrConnectInfo));
-
- /* First, we will notify the upper layer with the Connection failure {through the Connect Callback function},
- * then we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying
- * WID_DISCONNECT} */
- if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) {
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) {
+ if (hif_drv->usr_conn_req.pfUserConnectResult) {
+ if (hif_drv->usr_conn_req.pu8bssid) {
memcpy(strConnectInfo.au8bssid,
- pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6);
+ hif_drv->usr_conn_req.pu8bssid, 6);
}
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) {
- strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen;
- strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen);
+ if (hif_drv->usr_conn_req.pu8ConnReqIEs) {
+ strConnectInfo.ReqIEsLen = hif_drv->usr_conn_req.ConnReqIEsLen;
+ strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->usr_conn_req.ConnReqIEsLen, GFP_KERNEL);
memcpy(strConnectInfo.pu8ReqIEs,
- pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs,
- pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen);
+ hif_drv->usr_conn_req.pu8ConnReqIEs,
+ hif_drv->usr_conn_req.ConnReqIEsLen);
}
- pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP,
- &strConnectInfo,
- MAC_DISCONNECTED,
- NULL,
- pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid);
+ hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP,
+ &strConnectInfo,
+ MAC_DISCONNECTED,
+ NULL,
+ hif_drv->usr_conn_req.u32UserConnectPvoid);
- /* Deallocation of strConnectInfo.pu8ReqIEs */
- if (strConnectInfo.pu8ReqIEs != NULL) {
- kfree(strConnectInfo.pu8ReqIEs);
- strConnectInfo.pu8ReqIEs = NULL;
- }
+ kfree(strConnectInfo.pu8ReqIEs);
+ strConnectInfo.pu8ReqIEs = NULL;
} else {
PRINT_ER("Connect callback function pointer is NULL\n");
}
- /* Here we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying
- * WID_DISCONNECT} */
- strWID.u16WIDid = (u16)WID_DISCONNECT;
- strWID.enuWIDtype = WID_CHAR;
- strWID.ps8WidVal = (s8 *)&u16DummyReasonCode;
- strWID.s32ValueSize = sizeof(char);
+ wid.id = (u16)WID_DISCONNECT;
+ wid.type = WID_CHAR;
+ wid.val = (s8 *)&u16DummyReasonCode;
+ wid.size = sizeof(char);
PRINT_D(HOSTINF_DBG, "Sending disconnect request\n");
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv);
- if (s32Error)
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result)
PRINT_ER("Failed to send dissconect config packet\n");
- /* Deallocation of the Saved Connect Request in the global Handle */
- pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0;
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) {
- kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid);
- pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL;
- }
+ hif_drv->usr_conn_req.ssidLen = 0;
+ kfree(hif_drv->usr_conn_req.pu8ssid);
+ kfree(hif_drv->usr_conn_req.pu8bssid);
+ hif_drv->usr_conn_req.ConnReqIEsLen = 0;
+ kfree(hif_drv->usr_conn_req.pu8ConnReqIEs);
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) {
- kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid);
- pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL;
- }
+ eth_zero_addr(u8ConnectedSSID);
- pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0;
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) {
- kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs);
- pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL;
+ if (join_req && join_req_drv == hif_drv) {
+ kfree(join_req);
+ join_req = NULL;
}
- memset(u8ConnectedSSID, 0, ETH_ALEN);
- /*BugID_5213*/
- /*Freeing flushed join request params on connect timeout*/
- if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) {
- kfree(gu8FlushedJoinReq);
- gu8FlushedJoinReq = NULL;
- }
- if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) {
- kfree(gu8FlushedInfoElemAsoc);
- gu8FlushedInfoElemAsoc = NULL;
+ if (info_element && join_req_drv == hif_drv) {
+ kfree(info_element);
+ info_element = NULL;
}
- return s32Error;
+ return result;
}
-/**
- * @brief Handle_RcvdNtwrkInfo
- * @details Handling received network information
- * @param[in] tstrRcvdNetworkInfo* pstrRcvdNetworkInfo
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-static s32 Handle_RcvdNtwrkInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdNetworkInfo *pstrRcvdNetworkInfo)
+static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv,
+ struct rcvd_net_info *pstrRcvdNetworkInfo)
{
u32 i;
bool bNewNtwrkFound;
-
-
-
- s32 s32Error = WILC_SUCCESS;
+ s32 result = 0;
tstrNetworkInfo *pstrNetworkInfo = NULL;
void *pJoinParams = NULL;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
-
-
-
bNewNtwrkFound = true;
PRINT_INFO(HOSTINF_DBG, "Handling received network info\n");
- /*if there is a an ongoing scan request*/
- if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) {
+ if (hif_drv->usr_scan_req.pfUserScanResult) {
PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n");
- ParseNetworkInfo(pstrRcvdNetworkInfo->pu8Buffer, &pstrNetworkInfo);
- if ((pstrNetworkInfo == NULL)
- || (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult == NULL)) {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ parse_network_info(pstrRcvdNetworkInfo->buffer, &pstrNetworkInfo);
+ if ((!pstrNetworkInfo) ||
+ (!hif_drv->usr_scan_req.pfUserScanResult)) {
+ PRINT_ER("driver is null\n");
+ result = -EINVAL;
+ goto done;
}
- /* check whether this network is discovered before */
- for (i = 0; i < pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount; i++) {
-
- if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid != NULL) &&
- (pstrNetworkInfo->au8bssid != NULL)) {
- if (memcmp(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid,
- pstrNetworkInfo->au8bssid, 6) == 0) {
- if (pstrNetworkInfo->s8rssi <= pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi) {
- /*we have already found this network with better rssi, so keep the old cached one and don't
- * send anything to the upper layer */
+ for (i = 0; i < hif_drv->usr_scan_req.u32RcvdChCount; i++) {
+ if ((hif_drv->usr_scan_req.astrFoundNetworkInfo[i].au8bssid) &&
+ (pstrNetworkInfo->au8bssid)) {
+ if (memcmp(hif_drv->usr_scan_req.astrFoundNetworkInfo[i].au8bssid,
+ pstrNetworkInfo->au8bssid, 6) == 0) {
+ if (pstrNetworkInfo->s8rssi <= hif_drv->usr_scan_req.astrFoundNetworkInfo[i].s8rssi) {
PRINT_D(HOSTINF_DBG, "Network previously discovered\n");
goto done;
} else {
- /* here the same already found network is found again but with a better rssi, so just update
- * the rssi for this cached network and send this updated network to the upper layer but
- * don't add a new record for it */
- pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi = pstrNetworkInfo->s8rssi;
+ hif_drv->usr_scan_req.astrFoundNetworkInfo[i].s8rssi = pstrNetworkInfo->s8rssi;
bNewNtwrkFound = false;
break;
}
@@ -2263,82 +1429,52 @@ static s32 Handle_RcvdNtwrkInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdNetworkInfo
}
}
- if (bNewNtwrkFound == true) {
- /* here it is confirmed that it is a new discovered network,
- * so add its record then call the User CallBack function */
-
+ if (bNewNtwrkFound) {
PRINT_D(HOSTINF_DBG, "New network found\n");
- if (pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) {
- pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi;
+ if (hif_drv->usr_scan_req.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) {
+ hif_drv->usr_scan_req.astrFoundNetworkInfo[hif_drv->usr_scan_req.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi;
- if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid != NULL)
- && (pstrNetworkInfo->au8bssid != NULL)) {
- memcpy(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid,
- pstrNetworkInfo->au8bssid, 6);
+ if (hif_drv->usr_scan_req.astrFoundNetworkInfo[hif_drv->usr_scan_req.u32RcvdChCount].au8bssid &&
+ pstrNetworkInfo->au8bssid) {
+ memcpy(hif_drv->usr_scan_req.astrFoundNetworkInfo[hif_drv->usr_scan_req.u32RcvdChCount].au8bssid,
+ pstrNetworkInfo->au8bssid, 6);
- pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount++;
+ hif_drv->usr_scan_req.u32RcvdChCount++;
pstrNetworkInfo->bNewNetwork = true;
- /*Bug4218: Parsing Join Param*/
- /* add new BSS to JoinBssTable */
- #ifdef WILC_PARSE_SCAN_IN_HOST
pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo);
- #endif /*WILC_PARSE_SCAN_IN_HOST*/
-
- pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo,
- pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid,
- pJoinParams);
-
+ hif_drv->usr_scan_req.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo,
+ hif_drv->usr_scan_req.u32UserScanPvoid,
+ pJoinParams);
}
} else {
PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n");
}
} else {
pstrNetworkInfo->bNewNetwork = false;
- /* just call the User CallBack function to send the same discovered network with its updated RSSI */
- pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo,
- pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL);
+ hif_drv->usr_scan_req.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo,
+ hif_drv->usr_scan_req.u32UserScanPvoid, NULL);
}
}
-
- WILC_CATCH(s32Error)
- {
-
- }
-
done:
- /* Deallocate pstrRcvdNetworkInfo->pu8Buffer which was prevoisuly allocated by the sending thread */
- if (pstrRcvdNetworkInfo->pu8Buffer != NULL) {
- kfree(pstrRcvdNetworkInfo->pu8Buffer);
- pstrRcvdNetworkInfo->pu8Buffer = NULL;
- }
+ kfree(pstrRcvdNetworkInfo->buffer);
+ pstrRcvdNetworkInfo->buffer = NULL;
- /*free structure allocated*/
- if (pstrNetworkInfo != NULL) {
+ if (pstrNetworkInfo) {
DeallocateNetworkInfo(pstrNetworkInfo);
pstrNetworkInfo = NULL;
}
- return s32Error;
+ return result;
}
-/**
- * @brief Handle_RcvdGnrlAsyncInfo
- * @details Handling received asynchrous general network information
- * @param[in] tstrRcvdGnrlAsyncInfo* pstrRcvdGnrlAsyncInfo
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsyncInfo *pstrRcvdGnrlAsyncInfo)
+static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,
+ struct rcvd_async_info *pstrRcvdGnrlAsyncInfo)
{
- /* TODO: mostafa: till now, this function just handles only the received mac status msg, */
- /* which carries only 1 WID which have WID ID = WID_STATUS */
- s32 s32Error = WILC_SUCCESS;
+ s32 result = 0;
u8 u8MsgType = 0;
u8 u8MsgID = 0;
u16 u16MsgLen = 0;
@@ -2349,49 +1485,40 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy
u8 u8MacStatusAdditionalInfo;
tstrConnectInfo strConnectInfo;
tstrDisconnectNotifInfo strDisconnectNotifInfo;
- s32 s32Err = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler;
+ s32 s32Err = 0;
- if (pstrWFIDrv == NULL)
+ if (!hif_drv) {
PRINT_ER("Driver handler is NULL\n");
- PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", pstrWFIDrv->enuHostIFstate,
- pstrRcvdGnrlAsyncInfo->pu8Buffer[7]);
-
- if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) ||
- (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) ||
- pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) {
- if ((pstrRcvdGnrlAsyncInfo->pu8Buffer == NULL) ||
- (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL)) {
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ return -ENODEV;
+ }
+ PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", hif_drv->enuHostIFstate,
+ pstrRcvdGnrlAsyncInfo->buffer[7]);
+
+ if ((hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) ||
+ (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) ||
+ hif_drv->usr_scan_req.pfUserScanResult) {
+ if (!pstrRcvdGnrlAsyncInfo->buffer ||
+ !hif_drv->usr_conn_req.pfUserConnectResult) {
+ PRINT_ER("driver is null\n");
+ return -EINVAL;
}
- u8MsgType = pstrRcvdGnrlAsyncInfo->pu8Buffer[0];
+ u8MsgType = pstrRcvdGnrlAsyncInfo->buffer[0];
- /* Check whether the received message type is 'I' */
if ('I' != u8MsgType) {
PRINT_ER("Received Message format incorrect.\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
+ return -EFAULT;
}
- /* Extract message ID */
- u8MsgID = pstrRcvdGnrlAsyncInfo->pu8Buffer[1];
-
- /* Extract message Length */
- u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[2], pstrRcvdGnrlAsyncInfo->pu8Buffer[3]);
-
- /* Extract WID ID [expected to be = WID_STATUS] */
- u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[4], pstrRcvdGnrlAsyncInfo->pu8Buffer[5]);
-
- /* Extract WID Length [expected to be = 1] */
- u8WidLen = pstrRcvdGnrlAsyncInfo->pu8Buffer[6];
-
- /* get the WID value [expected to be one of two values: either MAC_CONNECTED = (1) or MAC_DISCONNECTED = (0)] */
- u8MacStatus = pstrRcvdGnrlAsyncInfo->pu8Buffer[7];
- u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->pu8Buffer[8];
- u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->pu8Buffer[9];
+ u8MsgID = pstrRcvdGnrlAsyncInfo->buffer[1];
+ u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->buffer[2], pstrRcvdGnrlAsyncInfo->buffer[3]);
+ u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->buffer[4], pstrRcvdGnrlAsyncInfo->buffer[5]);
+ u8WidLen = pstrRcvdGnrlAsyncInfo->buffer[6];
+ u8MacStatus = pstrRcvdGnrlAsyncInfo->buffer[7];
+ u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->buffer[8];
+ u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->buffer[9];
PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo);
- if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) {
- /* our station had sent Association Request frame, so here it will get the Association Response frame then parse it */
+ if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) {
u32 u32RcvdAssocRespInfoLen;
tstrConnectRespInfo *pstrConnectRespInfo = NULL;
@@ -2400,40 +1527,35 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy
memset(&strConnectInfo, 0, sizeof(tstrConnectInfo));
if (u8MacStatus == MAC_CONNECTED) {
- memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE);
+ memset(rcv_assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE);
- host_int_get_assoc_res_info(pstrWFIDrv,
- gapu8RcvdAssocResp,
+ host_int_get_assoc_res_info(hif_drv,
+ rcv_assoc_resp,
MAX_ASSOC_RESP_FRAME_SIZE,
&u32RcvdAssocRespInfoLen);
PRINT_INFO(HOSTINF_DBG, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen);
if (u32RcvdAssocRespInfoLen != 0) {
-
PRINT_D(HOSTINF_DBG, "Parsing association response\n");
- s32Err = ParseAssocRespInfo(gapu8RcvdAssocResp, u32RcvdAssocRespInfoLen,
+ s32Err = ParseAssocRespInfo(rcv_assoc_resp, u32RcvdAssocRespInfoLen,
&pstrConnectRespInfo);
if (s32Err) {
PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err);
} else {
- /* use the necessary parsed Info from the Received Association Response */
strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus;
if (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE) {
PRINT_INFO(HOSTINF_DBG, "Association response received : Successful connection status\n");
- if (pstrConnectRespInfo->pu8RespIEs != NULL) {
+ if (pstrConnectRespInfo->pu8RespIEs) {
strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen;
-
-
- strConnectInfo.pu8RespIEs = WILC_MALLOC(pstrConnectRespInfo->u16RespIEsLen);
+ strConnectInfo.pu8RespIEs = kmalloc(pstrConnectRespInfo->u16RespIEsLen, GFP_KERNEL);
memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs,
pstrConnectRespInfo->u16RespIEsLen);
}
}
- /* deallocate the Assoc. Resp. parsed structure as it is not needed anymore */
- if (pstrConnectRespInfo != NULL) {
+ if (pstrConnectRespInfo) {
DeallocateAssocRespInfo(pstrConnectRespInfo);
pstrConnectRespInfo = NULL;
}
@@ -2441,623 +1563,430 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy
}
}
- /* The station has just received mac status and it also received assoc. response which
- * it was waiting for.
- * So check first the matching between the received mac status and the received status code in Asoc Resp */
if ((u8MacStatus == MAC_CONNECTED) &&
(strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) {
PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
- memset(u8ConnectedSSID, 0, ETH_ALEN);
+ eth_zero_addr(u8ConnectedSSID);
} else if (u8MacStatus == MAC_DISCONNECTED) {
PRINT_ER("Received MAC status is MAC_DISCONNECTED\n");
- memset(u8ConnectedSSID, 0, ETH_ALEN);
+ eth_zero_addr(u8ConnectedSSID);
}
- /* TODO: mostafa: correct BSSID should be retrieved from actual BSSID received from AP */
- /* through a structure of type tstrConnectRespInfo */
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) {
+ if (hif_drv->usr_conn_req.pu8bssid) {
PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n");
- memcpy(strConnectInfo.au8bssid, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6);
+ memcpy(strConnectInfo.au8bssid, hif_drv->usr_conn_req.pu8bssid, 6);
if ((u8MacStatus == MAC_CONNECTED) &&
(strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) {
- memcpy(pstrWFIDrv->au8AssociatedBSSID,
- pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, ETH_ALEN);
+ memcpy(hif_drv->au8AssociatedBSSID,
+ hif_drv->usr_conn_req.pu8bssid, ETH_ALEN);
}
}
-
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) {
- strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen;
- strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen);
+ if (hif_drv->usr_conn_req.pu8ConnReqIEs) {
+ strConnectInfo.ReqIEsLen = hif_drv->usr_conn_req.ConnReqIEsLen;
+ strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->usr_conn_req.ConnReqIEsLen, GFP_KERNEL);
memcpy(strConnectInfo.pu8ReqIEs,
- pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs,
- pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen);
+ hif_drv->usr_conn_req.pu8ConnReqIEs,
+ hif_drv->usr_conn_req.ConnReqIEsLen);
}
+ del_timer(&hif_drv->hConnectTimer);
+ hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP,
+ &strConnectInfo,
+ u8MacStatus,
+ NULL,
+ hif_drv->usr_conn_req.u32UserConnectPvoid);
- del_timer(&pstrWFIDrv->hConnectTimer);
- pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP,
- &strConnectInfo,
- u8MacStatus,
- NULL,
- pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid);
-
-
- /* if received mac status is MAC_CONNECTED and
- * received status code in Asoc Resp is SUCCESSFUL_STATUSCODE, change state to CONNECTED
- * else change state to IDLE */
if ((u8MacStatus == MAC_CONNECTED) &&
(strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) {
- #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
-
- host_int_set_power_mgmt(pstrWFIDrv, 0, 0);
- #endif
+ host_int_set_power_mgmt(hif_drv, 0, 0);
PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n");
- pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTED;
+ hif_drv->enuHostIFstate = HOST_IF_CONNECTED;
- #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n");
g_obtainingIP = true;
mod_timer(&hDuringIpTimer,
jiffies + msecs_to_jiffies(10000));
- #endif
-
- #ifdef WILC_PARSE_SCAN_IN_HOST
- /* open a BA session if possible */
- /* if(pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable) */
-
- #endif
-
- /* host_int_addBASession(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid,0, */
- /* BA_SESSION_DEFAULT_BUFFER_SIZE,BA_SESSION_DEFAULT_TIMEOUT); */
} else {
PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus);
- pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE;
- gbScanWhileConnected = false;
+ hif_drv->enuHostIFstate = HOST_IF_IDLE;
+ scan_while_connected = false;
}
- /* Deallocation */
- if (strConnectInfo.pu8RespIEs != NULL) {
- kfree(strConnectInfo.pu8RespIEs);
- strConnectInfo.pu8RespIEs = NULL;
- }
-
- if (strConnectInfo.pu8ReqIEs != NULL) {
- kfree(strConnectInfo.pu8ReqIEs);
- strConnectInfo.pu8ReqIEs = NULL;
- }
-
-
- pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0;
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) {
- kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid);
- pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL;
- }
-
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) {
- kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid);
- pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL;
- }
-
- pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0;
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) {
- kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs);
- pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL;
- }
+ kfree(strConnectInfo.pu8RespIEs);
+ strConnectInfo.pu8RespIEs = NULL;
+ kfree(strConnectInfo.pu8ReqIEs);
+ strConnectInfo.pu8ReqIEs = NULL;
+ hif_drv->usr_conn_req.ssidLen = 0;
+ kfree(hif_drv->usr_conn_req.pu8ssid);
+ kfree(hif_drv->usr_conn_req.pu8bssid);
+ hif_drv->usr_conn_req.ConnReqIEsLen = 0;
+ kfree(hif_drv->usr_conn_req.pu8ConnReqIEs);
} else if ((u8MacStatus == MAC_DISCONNECTED) &&
- (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED)) {
- /* Disassociation or Deauthentication frame has been received */
+ (hif_drv->enuHostIFstate == HOST_IF_CONNECTED)) {
PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n");
memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo));
- if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) {
+ if (hif_drv->usr_scan_req.pfUserScanResult) {
PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n");
- del_timer(&pstrWFIDrv->hScanTimer);
- Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED);
+ del_timer(&hif_drv->hScanTimer);
+ Handle_ScanDone((void *)hif_drv, SCAN_EVENT_ABORTED);
}
strDisconnectNotifInfo.u16reason = 0;
strDisconnectNotifInfo.ie = NULL;
strDisconnectNotifInfo.ie_len = 0;
- if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) {
- #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
-
+ if (hif_drv->usr_conn_req.pfUserConnectResult) {
g_obtainingIP = false;
- host_int_set_power_mgmt(pstrWFIDrv, 0, 0);
- #endif
-
- pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF,
- NULL,
- 0,
- &strDisconnectNotifInfo,
- pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid);
+ host_int_set_power_mgmt(hif_drv, 0, 0);
+ hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF,
+ NULL,
+ 0,
+ &strDisconnectNotifInfo,
+ hif_drv->usr_conn_req.u32UserConnectPvoid);
} else {
PRINT_ER("Connect result callback function is NULL\n");
}
- memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN);
-
+ eth_zero_addr(hif_drv->au8AssociatedBSSID);
- /* Deallocation */
+ hif_drv->usr_conn_req.ssidLen = 0;
+ kfree(hif_drv->usr_conn_req.pu8ssid);
+ kfree(hif_drv->usr_conn_req.pu8bssid);
+ hif_drv->usr_conn_req.ConnReqIEsLen = 0;
+ kfree(hif_drv->usr_conn_req.pu8ConnReqIEs);
- /* if Information Elements were retrieved from the Received deauth/disassoc frame, then they
- * should be deallocated here */
- /*
- * if(strDisconnectNotifInfo.ie != NULL)
- * {
- * kfree(strDisconnectNotifInfo.ie);
- * strDisconnectNotifInfo.ie = NULL;
- * }
- */
-
- pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0;
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) {
- kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid);
- pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL;
+ if (join_req && join_req_drv == hif_drv) {
+ kfree(join_req);
+ join_req = NULL;
}
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) {
- kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid);
- pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL;
+ if (info_element && join_req_drv == hif_drv) {
+ kfree(info_element);
+ info_element = NULL;
}
- pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0;
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) {
- kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs);
- pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL;
- }
-
- /*BugID_5213*/
- /*Freeing flushed join request params on receiving*/
- /*MAC_DISCONNECTED while connected*/
- if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) {
- kfree(gu8FlushedJoinReq);
- gu8FlushedJoinReq = NULL;
- }
- if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) {
- kfree(gu8FlushedInfoElemAsoc);
- gu8FlushedInfoElemAsoc = NULL;
- }
-
- pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE;
- gbScanWhileConnected = false;
+ hif_drv->enuHostIFstate = HOST_IF_IDLE;
+ scan_while_connected = false;
} else if ((u8MacStatus == MAC_DISCONNECTED) &&
- (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL)) {
+ (hif_drv->usr_scan_req.pfUserScanResult)) {
PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW while scanning\n");
PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n");
- /*Abort the running scan*/
- del_timer(&pstrWFIDrv->hScanTimer);
- if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult)
- Handle_ScanDone(pstrWFIDrv, SCAN_EVENT_ABORTED);
+ del_timer(&hif_drv->hScanTimer);
+ if (hif_drv->usr_scan_req.pfUserScanResult)
+ Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED);
}
-
}
- WILC_CATCH(s32Error)
- {
-
- }
+ kfree(pstrRcvdGnrlAsyncInfo->buffer);
+ pstrRcvdGnrlAsyncInfo->buffer = NULL;
- /* Deallocate pstrRcvdGnrlAsyncInfo->pu8Buffer which was prevoisuly allocated by the sending thread */
- if (pstrRcvdGnrlAsyncInfo->pu8Buffer != NULL) {
- kfree(pstrRcvdGnrlAsyncInfo->pu8Buffer);
- pstrRcvdGnrlAsyncInfo->pu8Buffer = NULL;
- }
-
- return s32Error;
+ return result;
}
-/**
- * @brief Handle_Key
- * @details Sending config packet to firmware to set key
- * @param[in] tstrHostIFkeyAttr* pstrHostIFkeyAttr
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr)
+static int Handle_Key(struct host_if_drv *hif_drv,
+ struct key_attr *pstrHostIFkeyAttr)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- #ifdef WILC_AP_EXTERNAL_MLME
- tstrWID strWIDList[5];
- #endif
+ s32 result = 0;
+ struct wid wid;
+ struct wid strWIDList[5];
u8 i;
u8 *pu8keybuf;
s8 s8idxarray[1];
s8 ret = 0;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
-
-
- switch (pstrHostIFkeyAttr->enuKeyType) {
-
+ switch (pstrHostIFkeyAttr->type) {
case WEP:
-#ifdef WILC_AP_EXTERNAL_MLME
- if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) {
-
+ if (pstrHostIFkeyAttr->action & ADDKEY_AP) {
PRINT_D(HOSTINF_DBG, "Handling WEP key\n");
- PRINT_D(GENERIC_DBG, "ID Hostint is %d\n", (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx));
- strWIDList[0].u16WIDid = (u16)WID_11I_MODE;
- strWIDList[0].enuWIDtype = WID_CHAR;
- strWIDList[0].s32ValueSize = sizeof(char);
- strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8mode));
-
- strWIDList[1].u16WIDid = WID_AUTH_TYPE;
- strWIDList[1].enuWIDtype = WID_CHAR;
- strWIDList[1].s32ValueSize = sizeof(char);
- strWIDList[1].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type));
-
- strWIDList[2].u16WIDid = (u16)WID_KEY_ID;
- strWIDList[2].enuWIDtype = WID_CHAR;
+ PRINT_D(GENERIC_DBG, "ID Hostint is %d\n", pstrHostIFkeyAttr->attr.wep.index);
+ strWIDList[0].id = (u16)WID_11I_MODE;
+ strWIDList[0].type = WID_CHAR;
+ strWIDList[0].size = sizeof(char);
+ strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.mode;
- strWIDList[2].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx));
- strWIDList[2].s32ValueSize = sizeof(char);
+ strWIDList[1].id = WID_AUTH_TYPE;
+ strWIDList[1].type = WID_CHAR;
+ strWIDList[1].size = sizeof(char);
+ strWIDList[1].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.auth_type;
+ strWIDList[2].id = (u16)WID_KEY_ID;
+ strWIDList[2].type = WID_CHAR;
- pu8keybuf = WILC_MALLOC(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen);
+ strWIDList[2].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.index;
+ strWIDList[2].size = sizeof(char);
+ pu8keybuf = kmemdup(pstrHostIFkeyAttr->attr.wep.key,
+ pstrHostIFkeyAttr->attr.wep.key_len,
+ GFP_KERNEL);
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send Key\n");
- return -1;
+ return -ENOMEM;
}
- memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey,
- pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen);
-
-
- kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey);
-
- strWIDList[3].u16WIDid = (u16)WID_WEP_KEY_VALUE;
- strWIDList[3].enuWIDtype = WID_STR;
- strWIDList[3].s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen;
- strWIDList[3].ps8WidVal = (s8 *)pu8keybuf;
+ kfree(pstrHostIFkeyAttr->attr.wep.key);
+ strWIDList[3].id = (u16)WID_WEP_KEY_VALUE;
+ strWIDList[3].type = WID_STR;
+ strWIDList[3].size = pstrHostIFkeyAttr->attr.wep.key_len;
+ strWIDList[3].val = (s8 *)pu8keybuf;
- s32Error = SendConfigPkt(SET_CFG, strWIDList, 4, true, (u32)pstrWFIDrv);
+ result = send_config_pkt(SET_CFG, strWIDList, 4,
+ get_id_from_handler(hif_drv));
kfree(pu8keybuf);
-
-
}
-#endif
- if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) {
+ if (pstrHostIFkeyAttr->action & ADDKEY) {
PRINT_D(HOSTINF_DBG, "Handling WEP key\n");
- pu8keybuf = WILC_MALLOC(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2);
- if (pu8keybuf == NULL) {
+ pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len + 2, GFP_KERNEL);
+ if (!pu8keybuf) {
PRINT_ER("No buffer to send Key\n");
- return -1;
+ return -ENOMEM;
}
- pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx;
-
- memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, 1);
-
- memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey,
- pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen);
-
- kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey);
-
- strWID.u16WIDid = (u16)WID_ADD_WEP_KEY;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = (s8 *)pu8keybuf;
- strWID.s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2;
-
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ pu8keybuf[0] = pstrHostIFkeyAttr->attr.wep.index;
+ memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->attr.wep.key_len, 1);
+ memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->attr.wep.key,
+ pstrHostIFkeyAttr->attr.wep.key_len);
+ kfree(pstrHostIFkeyAttr->attr.wep.key);
+
+ wid.id = (u16)WID_ADD_WEP_KEY;
+ wid.type = WID_STR;
+ wid.val = (s8 *)pu8keybuf;
+ wid.size = pstrHostIFkeyAttr->attr.wep.key_len + 2;
+
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
kfree(pu8keybuf);
- } else if (pstrHostIFkeyAttr->u8KeyAction & REMOVEKEY) {
-
+ } else if (pstrHostIFkeyAttr->action & REMOVEKEY) {
PRINT_D(HOSTINF_DBG, "Removing key\n");
- strWID.u16WIDid = (u16)WID_REMOVE_WEP_KEY;
- strWID.enuWIDtype = WID_STR;
+ wid.id = (u16)WID_REMOVE_WEP_KEY;
+ wid.type = WID_STR;
- s8idxarray[0] = (s8)pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx;
- strWID.ps8WidVal = s8idxarray;
- strWID.s32ValueSize = 1;
+ s8idxarray[0] = (s8)pstrHostIFkeyAttr->attr.wep.index;
+ wid.val = s8idxarray;
+ wid.size = 1;
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
} else {
- strWID.u16WIDid = (u16)WID_KEY_ID;
- strWID.enuWIDtype = WID_CHAR;
- strWID.ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx));
- strWID.s32ValueSize = sizeof(char);
+ wid.id = (u16)WID_KEY_ID;
+ wid.type = WID_CHAR;
+ wid.val = (s8 *)&pstrHostIFkeyAttr->attr.wep.index;
+ wid.size = sizeof(char);
PRINT_D(HOSTINF_DBG, "Setting default key index\n");
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
}
- up(&(pstrWFIDrv->hSemTestKeyBlock));
+ up(&hif_drv->hSemTestKeyBlock);
break;
case WPARxGtk:
- #ifdef WILC_AP_EXTERNAL_MLME
- if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) {
- pu8keybuf = WILC_MALLOC(RX_MIC_KEY_MSG_LEN);
- if (pu8keybuf == NULL) {
+ if (pstrHostIFkeyAttr->action & ADDKEY_AP) {
+ pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
+ if (!pu8keybuf) {
PRINT_ER("No buffer to send RxGTK Key\n");
- ret = -1;
+ ret = -ENOMEM;
goto _WPARxGtk_end_case_;
}
- memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN);
-
-
- /*|----------------------------------------------------------------------------|
- * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key |
- * |------------|---------|-------|------------|---------------|----------------|
- | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/
-
-
+ if (pstrHostIFkeyAttr->attr.wpa.seq)
+ memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->attr.wpa.seq, 8);
- if (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq != NULL)
- memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8);
+ memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->attr.wpa.index, 1);
+ memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->attr.wpa.key_len, 1);
+ memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->attr.wpa.key,
+ pstrHostIFkeyAttr->attr.wpa.key_len);
+ strWIDList[0].id = (u16)WID_11I_MODE;
+ strWIDList[0].type = WID_CHAR;
+ strWIDList[0].size = sizeof(char);
+ strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wpa.mode;
- memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1);
+ strWIDList[1].id = (u16)WID_ADD_RX_GTK;
+ strWIDList[1].type = WID_STR;
+ strWIDList[1].val = (s8 *)pu8keybuf;
+ strWIDList[1].size = RX_MIC_KEY_MSG_LEN;
- memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1);
-
- memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key,
- pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen);
- /* pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = 0X51; */
- strWIDList[0].u16WIDid = (u16)WID_11I_MODE;
- strWIDList[0].enuWIDtype = WID_CHAR;
- strWIDList[0].s32ValueSize = sizeof(char);
- strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode));
-
- strWIDList[1].u16WIDid = (u16)WID_ADD_RX_GTK;
- strWIDList[1].enuWIDtype = WID_STR;
- strWIDList[1].ps8WidVal = (s8 *)pu8keybuf;
- strWIDList[1].s32ValueSize = RX_MIC_KEY_MSG_LEN;
-
- s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, (u32)pstrWFIDrv);
+ result = send_config_pkt(SET_CFG, strWIDList, 2,
+ get_id_from_handler(hif_drv));
kfree(pu8keybuf);
-
- /* ////////////////////////// */
- up(&(pstrWFIDrv->hSemTestKeyBlock));
- /* ///////////////////////// */
+ up(&hif_drv->hSemTestKeyBlock);
}
- #endif
- if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) {
+ if (pstrHostIFkeyAttr->action & ADDKEY) {
PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n");
- pu8keybuf = WILC_MALLOC(RX_MIC_KEY_MSG_LEN);
+ pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send RxGTK Key\n");
- ret = -1;
+ ret = -ENOMEM;
goto _WPARxGtk_end_case_;
}
- memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN);
-
-
- /*|----------------------------------------------------------------------------|
- * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key |
- * |------------|---------|-------|------------|---------------|----------------|
- | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/
-
- if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED)
- memcpy(pu8keybuf, pstrWFIDrv->au8AssociatedBSSID, ETH_ALEN);
+ if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED)
+ memcpy(pu8keybuf, hif_drv->au8AssociatedBSSID, ETH_ALEN);
else
PRINT_ER("Couldn't handle WPARxGtk while enuHostIFstate is not HOST_IF_CONNECTED\n");
- memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8);
+ memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->attr.wpa.seq, 8);
+ memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->attr.wpa.index, 1);
+ memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->attr.wpa.key_len, 1);
+ memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->attr.wpa.key,
+ pstrHostIFkeyAttr->attr.wpa.key_len);
- memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1);
+ wid.id = (u16)WID_ADD_RX_GTK;
+ wid.type = WID_STR;
+ wid.val = (s8 *)pu8keybuf;
+ wid.size = RX_MIC_KEY_MSG_LEN;
- memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1);
- memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key,
- pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen);
-
- strWID.u16WIDid = (u16)WID_ADD_RX_GTK;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = (s8 *)pu8keybuf;
- strWID.s32ValueSize = RX_MIC_KEY_MSG_LEN;
-
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
kfree(pu8keybuf);
-
- /* ////////////////////////// */
- up(&(pstrWFIDrv->hSemTestKeyBlock));
- /* ///////////////////////// */
+ up(&hif_drv->hSemTestKeyBlock);
}
_WPARxGtk_end_case_:
- kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key);
- kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq);
- if (ret == -1)
+ kfree(pstrHostIFkeyAttr->attr.wpa.key);
+ kfree(pstrHostIFkeyAttr->attr.wpa.seq);
+ if (ret)
return ret;
break;
case WPAPtk:
- #ifdef WILC_AP_EXTERNAL_MLME
- if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) {
-
-
- pu8keybuf = WILC_MALLOC(PTK_KEY_MSG_LEN + 1);
-
-
-
- if (pu8keybuf == NULL) {
+ if (pstrHostIFkeyAttr->action & ADDKEY_AP) {
+ pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL);
+ if (!pu8keybuf) {
PRINT_ER("No buffer to send PTK Key\n");
- ret = -1;
+ ret = -ENOMEM;
goto _WPAPtk_end_case_;
-
}
- /*|-----------------------------------------------------------------------------|
- * |Station address | keyidx |Key Length |Temporal Key | Rx Michael Key |Tx Michael Key |
- * |----------------|------------ |--------------|----------------|---------------|
- | 6 bytes | 1 byte | 1byte | 16 bytes | 8 bytes | 8 bytes |
- |-----------------------------------------------------------------------------|*/
-
- memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */
-
- memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1);
- memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1);
- /*16 byte TK*/
- memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key,
- pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen);
+ memcpy(pu8keybuf, pstrHostIFkeyAttr->attr.wpa.mac_addr, 6);
+ memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->attr.wpa.index, 1);
+ memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->attr.wpa.key_len, 1);
+ memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->attr.wpa.key,
+ pstrHostIFkeyAttr->attr.wpa.key_len);
+ strWIDList[0].id = (u16)WID_11I_MODE;
+ strWIDList[0].type = WID_CHAR;
+ strWIDList[0].size = sizeof(char);
+ strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wpa.mode;
- strWIDList[0].u16WIDid = (u16)WID_11I_MODE;
- strWIDList[0].enuWIDtype = WID_CHAR;
- strWIDList[0].s32ValueSize = sizeof(char);
- strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode));
+ strWIDList[1].id = (u16)WID_ADD_PTK;
+ strWIDList[1].type = WID_STR;
+ strWIDList[1].val = (s8 *)pu8keybuf;
+ strWIDList[1].size = PTK_KEY_MSG_LEN + 1;
- strWIDList[1].u16WIDid = (u16)WID_ADD_PTK;
- strWIDList[1].enuWIDtype = WID_STR;
- strWIDList[1].ps8WidVal = (s8 *)pu8keybuf;
- strWIDList[1].s32ValueSize = PTK_KEY_MSG_LEN + 1;
-
- s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, (u32)pstrWFIDrv);
+ result = send_config_pkt(SET_CFG, strWIDList, 2,
+ get_id_from_handler(hif_drv));
kfree(pu8keybuf);
-
- /* ////////////////////////// */
- up(&(pstrWFIDrv->hSemTestKeyBlock));
- /* ///////////////////////// */
+ up(&hif_drv->hSemTestKeyBlock);
}
- #endif
- if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) {
-
-
- pu8keybuf = WILC_MALLOC(PTK_KEY_MSG_LEN);
-
-
-
- if (pu8keybuf == NULL) {
+ if (pstrHostIFkeyAttr->action & ADDKEY) {
+ pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL);
+ if (!pu8keybuf) {
PRINT_ER("No buffer to send PTK Key\n");
- ret = -1;
+ ret = -ENOMEM;
goto _WPAPtk_end_case_;
-
}
- /*|-----------------------------------------------------------------------------|
- * |Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key |
- * |----------------|------------|--------------|----------------|---------------|
- | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes |
- |-----------------------------------------------------------------------------|*/
-
- memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */
+ memcpy(pu8keybuf, pstrHostIFkeyAttr->attr.wpa.mac_addr, 6);
+ memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->attr.wpa.key_len, 1);
+ memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->attr.wpa.key,
+ pstrHostIFkeyAttr->attr.wpa.key_len);
- memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1);
- /*16 byte TK*/
- memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key,
- pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen);
+ wid.id = (u16)WID_ADD_PTK;
+ wid.type = WID_STR;
+ wid.val = (s8 *)pu8keybuf;
+ wid.size = PTK_KEY_MSG_LEN;
-
- strWID.u16WIDid = (u16)WID_ADD_PTK;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = (s8 *)pu8keybuf;
- strWID.s32ValueSize = PTK_KEY_MSG_LEN;
-
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
kfree(pu8keybuf);
-
- /* ////////////////////////// */
- up(&(pstrWFIDrv->hSemTestKeyBlock));
- /* ///////////////////////// */
+ up(&hif_drv->hSemTestKeyBlock);
}
_WPAPtk_end_case_:
- kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key);
- if (ret == -1)
+ kfree(pstrHostIFkeyAttr->attr.wpa.key);
+ if (ret)
return ret;
break;
-
case PMKSA:
PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n");
- pu8keybuf = WILC_MALLOC((pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1);
- if (pu8keybuf == NULL) {
+ pu8keybuf = kmalloc((pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL);
+ if (!pu8keybuf) {
PRINT_ER("No buffer to send PMKSA Key\n");
- return -1;
+ return -ENOMEM;
}
- pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid;
+ pu8keybuf[0] = pstrHostIFkeyAttr->attr.pmkid.numpmkid;
- for (i = 0; i < pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; i++) {
-
- memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, ETH_ALEN);
- memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, PMKID_LEN);
+ for (i = 0; i < pstrHostIFkeyAttr->attr.pmkid.numpmkid; i++) {
+ memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->attr.pmkid.pmkidlist[i].bssid, ETH_ALEN);
+ memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), pstrHostIFkeyAttr->attr.pmkid.pmkidlist[i].pmkid, PMKID_LEN);
}
- strWID.u16WIDid = (u16)WID_PMKID_INFO;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = (s8 *)pu8keybuf;
- strWID.s32ValueSize = (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1;
+ wid.id = (u16)WID_PMKID_INFO;
+ wid.type = WID_STR;
+ wid.val = (s8 *)pu8keybuf;
+ wid.size = (pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1;
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
kfree(pu8keybuf);
break;
}
- if (s32Error)
+ if (result)
PRINT_ER("Failed to send key config packet\n");
-
- return s32Error;
+ return result;
}
-
-/**
- * @brief Handle_Disconnect
- * @details Sending config packet to firmware to disconnect
- * @param[in] NONE
- * @return NONE
- * @author
- * @date
- * @version 1.0
- */
-static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler)
+static void Handle_Disconnect(struct host_if_drv *hif_drv)
{
- tstrWID strWID;
+ struct wid wid;
- s32 s32Error = WILC_SUCCESS;
+ s32 result = 0;
u16 u16DummyReasonCode = 0;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
-
-
- strWID.u16WIDid = (u16)WID_DISCONNECT;
- strWID.enuWIDtype = WID_CHAR;
- strWID.ps8WidVal = (s8 *)&u16DummyReasonCode;
- strWID.s32ValueSize = sizeof(char);
-
+ wid.id = (u16)WID_DISCONNECT;
+ wid.type = WID_CHAR;
+ wid.val = (s8 *)&u16DummyReasonCode;
+ wid.size = sizeof(char);
PRINT_D(HOSTINF_DBG, "Sending disconnect request\n");
- #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
-
g_obtainingIP = false;
- host_int_set_power_mgmt(pstrWFIDrv, 0, 0);
- #endif
+ host_int_set_power_mgmt(hif_drv, 0, 0);
- memset(u8ConnectedSSID, 0, ETH_ALEN);
+ eth_zero_addr(u8ConnectedSSID);
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv);
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
- if (s32Error) {
+ if (result) {
PRINT_ER("Failed to send dissconect config packet\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
} else {
tstrDisconnectNotifInfo strDisconnectNotifInfo;
@@ -3067,486 +1996,304 @@ static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler)
strDisconnectNotifInfo.ie = NULL;
strDisconnectNotifInfo.ie_len = 0;
- if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) {
- del_timer(&pstrWFIDrv->hScanTimer);
- pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL,
- pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL);
+ if (hif_drv->usr_scan_req.pfUserScanResult) {
+ del_timer(&hif_drv->hScanTimer);
+ hif_drv->usr_scan_req.pfUserScanResult(SCAN_EVENT_ABORTED, NULL,
+ hif_drv->usr_scan_req.u32UserScanPvoid, NULL);
- pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL;
+ hif_drv->usr_scan_req.pfUserScanResult = NULL;
}
- if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) {
-
- /*BugID_5193*/
- /*Stop connect timer, if connection in progress*/
- if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) {
+ if (hif_drv->usr_conn_req.pfUserConnectResult) {
+ if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) {
PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n");
- del_timer(&pstrWFIDrv->hConnectTimer);
+ del_timer(&hif_drv->hConnectTimer);
}
- pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL,
- 0, &strDisconnectNotifInfo, pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid);
+ hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL,
+ 0, &strDisconnectNotifInfo, hif_drv->usr_conn_req.u32UserConnectPvoid);
} else {
- PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL\n");
+ PRINT_ER("usr_conn_req.pfUserConnectResult = NULL\n");
}
- gbScanWhileConnected = false;
-
- pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE;
-
- memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN);
+ scan_while_connected = false;
+ hif_drv->enuHostIFstate = HOST_IF_IDLE;
- /* Deallocation */
- pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0;
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) {
- kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid);
- pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL;
- }
+ eth_zero_addr(hif_drv->au8AssociatedBSSID);
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) {
- kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid);
- pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL;
- }
+ hif_drv->usr_conn_req.ssidLen = 0;
+ kfree(hif_drv->usr_conn_req.pu8ssid);
+ kfree(hif_drv->usr_conn_req.pu8bssid);
+ hif_drv->usr_conn_req.ConnReqIEsLen = 0;
+ kfree(hif_drv->usr_conn_req.pu8ConnReqIEs);
- pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0;
- if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) {
- kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs);
- pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL;
+ if (join_req && join_req_drv == hif_drv) {
+ kfree(join_req);
+ join_req = NULL;
}
-
- /*BugID_5137*/
- if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) {
- kfree(gu8FlushedJoinReq);
- gu8FlushedJoinReq = NULL;
- }
- if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) {
- kfree(gu8FlushedInfoElemAsoc);
- gu8FlushedInfoElemAsoc = NULL;
+ if (info_element && join_req_drv == hif_drv) {
+ kfree(info_element);
+ info_element = NULL;
}
-
- }
-
- WILC_CATCH(s32Error)
- {
-
}
- /* ////////////////////////// */
- up(&(pstrWFIDrv->hSemTestDisconnectBlock));
- /* ///////////////////////// */
-
+ up(&hif_drv->hSemTestDisconnectBlock);
}
-
-void resolve_disconnect_aberration(tstrWILC_WFIDrv *drvHandler)
+void resolve_disconnect_aberration(struct host_if_drv *hif_drv)
{
- tstrWILC_WFIDrv *pstrWFIDrv;
-
- pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
- if (pstrWFIDrv == NULL)
+ if (!hif_drv)
return;
- if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTING)) {
+ if ((hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (hif_drv->enuHostIFstate == HOST_IF_CONNECTING)) {
PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n");
- host_int_disconnect(pstrWFIDrv, 1);
- }
-}
-static s32 Switch_Log_Terminal(tstrWILC_WFIDrv *drvHandler)
-{
-
-
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- static char dummy = 9;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
-
- strWID.u16WIDid = (u16)WID_LOGTerminal_Switch;
- strWID.enuWIDtype = WID_CHAR;
- strWID.ps8WidVal = &dummy;
- strWID.s32ValueSize = sizeof(char);
-
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
-
-
- if (s32Error) {
- PRINT_D(HOSTINF_DBG, "Failed to switch log terminal\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
- } else {
- PRINT_INFO(HOSTINF_DBG, "MAC address set ::\n");
-
-
- }
-
- WILC_CATCH(s32Error)
- {
-
+ host_int_disconnect(hif_drv, 1);
}
-
- return s32Error;
}
-/**
- * @brief Handle_GetChnl
- * @details Sending config packet to get channel
- * @param[in] NONE
- * @return NONE
- *
- * @author
- * @date
- * @version 1.0
- */
-static s32 Handle_GetChnl(tstrWILC_WFIDrv *drvHandler)
+static s32 Handle_GetChnl(struct host_if_drv *hif_drv)
{
+ s32 result = 0;
+ struct wid wid;
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
-
- strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL;
- strWID.enuWIDtype = WID_CHAR;
- strWID.ps8WidVal = (s8 *)&gu8Chnl;
- strWID.s32ValueSize = sizeof(char);
+ wid.id = (u16)WID_CURRENT_CHANNEL;
+ wid.type = WID_CHAR;
+ wid.val = (s8 *)&ch_no;
+ wid.size = sizeof(char);
PRINT_D(HOSTINF_DBG, "Getting channel value\n");
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- /*get the value by searching the local copy*/
- if (s32Error) {
- PRINT_ER("Failed to get channel number\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
- }
-
-
- WILC_CATCH(s32Error)
- {
+ result = send_config_pkt(GET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result) {
+ PRINT_ER("Failed to get channel number\n");
+ result = -EFAULT;
}
- up(&(pstrWFIDrv->hSemGetCHNL));
-
- return s32Error;
-
+ up(&hif_drv->hSemGetCHNL);
+ return result;
}
-
-/**
- * @brief Handle_GetRssi
- * @details Sending config packet to get RSSI
- * @param[in] NONE
- * @return NONE
- * @author
- * @date
- * @version 1.0
- */
-static void Handle_GetRssi(tstrWILC_WFIDrv *drvHandler)
+static void Handle_GetRssi(struct host_if_drv *hif_drv)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
+ s32 result = 0;
+ struct wid wid;
- strWID.u16WIDid = (u16)WID_RSSI;
- strWID.enuWIDtype = WID_CHAR;
- strWID.ps8WidVal = &gs8Rssi;
- strWID.s32ValueSize = sizeof(char);
+ wid.id = (u16)WID_RSSI;
+ wid.type = WID_CHAR;
+ wid.val = &rssi;
+ wid.size = sizeof(char);
- /*Sending Cfg*/
PRINT_D(HOSTINF_DBG, "Getting RSSI value\n");
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error) {
+ result = send_config_pkt(GET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result) {
PRINT_ER("Failed to get RSSI value\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
- }
-
- WILC_CATCH(s32Error)
- {
-
+ result = -EFAULT;
}
- up(&(pstrWFIDrv->hSemGetRSSI));
-
+ up(&hif_drv->hSemGetRSSI);
}
-
-static void Handle_GetLinkspeed(tstrWILC_WFIDrv *drvHandler)
+static void Handle_GetLinkspeed(struct host_if_drv *hif_drv)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
+ s32 result = 0;
+ struct wid wid;
- gs8lnkspd = 0;
+ link_speed = 0;
+
+ wid.id = (u16)WID_LINKSPEED;
+ wid.type = WID_CHAR;
+ wid.val = &link_speed;
+ wid.size = sizeof(char);
- strWID.u16WIDid = (u16)WID_LINKSPEED;
- strWID.enuWIDtype = WID_CHAR;
- strWID.ps8WidVal = &gs8lnkspd;
- strWID.s32ValueSize = sizeof(char);
- /*Sending Cfg*/
PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n");
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error) {
+ result = send_config_pkt(GET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result) {
PRINT_ER("Failed to get LINKSPEED value\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
- }
-
- WILC_CATCH(s32Error)
- {
-
+ result = -EFAULT;
}
- up(&(pstrWFIDrv->hSemGetLINKSPEED));
-
+ up(&hif_drv->hSemGetLINKSPEED);
}
-s32 Handle_GetStatistics(tstrWILC_WFIDrv *drvHandler, tstrStatistics *pstrStatistics)
+s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
{
- tstrWID strWIDList[5];
- uint32_t u32WidsCount = 0, s32Error = 0;
+ struct wid strWIDList[5];
+ u32 u32WidsCount = 0, result = 0;
- strWIDList[u32WidsCount].u16WIDid = WID_LINKSPEED;
- strWIDList[u32WidsCount].enuWIDtype = WID_CHAR;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(char);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u8LinkSpeed));
+ strWIDList[u32WidsCount].id = WID_LINKSPEED;
+ strWIDList[u32WidsCount].type = WID_CHAR;
+ strWIDList[u32WidsCount].size = sizeof(char);
+ strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u8LinkSpeed;
u32WidsCount++;
- strWIDList[u32WidsCount].u16WIDid = WID_RSSI;
- strWIDList[u32WidsCount].enuWIDtype = WID_CHAR;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(char);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->s8RSSI));
+ strWIDList[u32WidsCount].id = WID_RSSI;
+ strWIDList[u32WidsCount].type = WID_CHAR;
+ strWIDList[u32WidsCount].size = sizeof(char);
+ strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->s8RSSI;
u32WidsCount++;
- strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT;
- strWIDList[u32WidsCount].enuWIDtype = WID_INT;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(u32);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxCount));
+ strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT;
+ strWIDList[u32WidsCount].type = WID_INT;
+ strWIDList[u32WidsCount].size = sizeof(u32);
+ strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u32TxCount;
u32WidsCount++;
- strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT;
- strWIDList[u32WidsCount].enuWIDtype = WID_INT;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(u32);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32RxCount));
+ strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT;
+ strWIDList[u32WidsCount].type = WID_INT;
+ strWIDList[u32WidsCount].size = sizeof(u32);
+ strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u32RxCount;
u32WidsCount++;
- strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT;
- strWIDList[u32WidsCount].enuWIDtype = WID_INT;
- strWIDList[u32WidsCount].s32ValueSize = sizeof(u32);
- strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxFailureCount));
+ strWIDList[u32WidsCount].id = WID_FAILED_COUNT;
+ strWIDList[u32WidsCount].type = WID_INT;
+ strWIDList[u32WidsCount].size = sizeof(u32);
+ strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u32TxFailureCount;
u32WidsCount++;
- s32Error = SendConfigPkt(GET_CFG, strWIDList, u32WidsCount, false, (u32)drvHandler);
+ result = send_config_pkt(GET_CFG, strWIDList, u32WidsCount,
+ get_id_from_handler(hif_drv));
- if (s32Error) {
+ if (result)
PRINT_ER("Failed to send scan paramters config packet\n");
- /* WILC_ERRORREPORT(s32Error, s32Error); */
- }
- up(&hWaitResponse);
- return 0;
+ up(&hif_sema_wait_response);
+ return 0;
}
-
-#ifdef WILC_AP_EXTERNAL_MLME
-
-
-/**
- * @brief Handle_Get_InActiveTime
- * @details Sending config packet to set mac adddress for station and
- * get inactive time
- * @param[in] NONE
- * @return NONE
- *
- * @author
- * @date
- * @version 1.0
- */
-static s32 Handle_Get_InActiveTime(tstrWILC_WFIDrv *drvHandler, tstrHostIfStaInactiveT *strHostIfStaInactiveT)
+static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv,
+ struct sta_inactive_t *strHostIfStaInactiveT)
{
-
- s32 s32Error = WILC_SUCCESS;
+ s32 result = 0;
u8 *stamac;
- tstrWID strWID;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
-
+ struct wid wid;
- strWID.u16WIDid = (u16)WID_SET_STA_MAC_INACTIVE_TIME;
- strWID.enuWIDtype = WID_STR;
- strWID.s32ValueSize = ETH_ALEN;
- strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize);
+ wid.id = (u16)WID_SET_STA_MAC_INACTIVE_TIME;
+ wid.type = WID_STR;
+ wid.size = ETH_ALEN;
+ wid.val = kmalloc(wid.size, GFP_KERNEL);
-
- stamac = strWID.ps8WidVal;
+ stamac = wid.val;
memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN);
-
PRINT_D(CFG80211_DBG, "SETING STA inactive time\n");
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- /*get the value by searching the local copy*/
- if (s32Error) {
+ if (result) {
PRINT_ER("Failed to SET incative time\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
+ return -EFAULT;
}
+ wid.id = (u16)WID_GET_INACTIVE_TIME;
+ wid.type = WID_INT;
+ wid.val = (s8 *)&inactive_time;
+ wid.size = sizeof(u32);
- strWID.u16WIDid = (u16)WID_GET_INACTIVE_TIME;
- strWID.enuWIDtype = WID_INT;
- strWID.ps8WidVal = (s8 *)&gu32InactiveTime;
- strWID.s32ValueSize = sizeof(u32);
+ result = send_config_pkt(GET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
-
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- /*get the value by searching the local copy*/
- if (s32Error) {
+ if (result) {
PRINT_ER("Failed to get incative time\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
- }
-
-
- PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", gu32InactiveTime);
-
- up(&(pstrWFIDrv->hSemInactiveTime));
- WILC_CATCH(s32Error)
- {
-
+ return -EFAULT;
}
+ PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", inactive_time);
- return s32Error;
-
-
+ up(&hif_drv->hSemInactiveTime);
+ return result;
}
-
-/**
- * @brief Handle_AddBeacon
- * @details Sending config packet to add beacon
- * @param[in] tstrHostIFSetBeacon* pstrSetBeaconParam
- * @return NONE
- * @author
- * @date
- * @version 1.0
- */
-static void Handle_AddBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetBeacon *pstrSetBeaconParam)
+static void Handle_AddBeacon(struct host_if_drv *hif_drv,
+ struct beacon_attr *pstrSetBeaconParam)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
+ s32 result = 0;
+ struct wid wid;
u8 *pu8CurrByte;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
PRINT_D(HOSTINF_DBG, "Adding BEACON\n");
- strWID.u16WIDid = (u16)WID_ADD_BEACON;
- strWID.enuWIDtype = WID_BIN;
- strWID.s32ValueSize = pstrSetBeaconParam->u32HeadLen + pstrSetBeaconParam->u32TailLen + 16;
- strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize);
- if (strWID.ps8WidVal == NULL)
- WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
-
- pu8CurrByte = strWID.ps8WidVal;
- *pu8CurrByte++ = (pstrSetBeaconParam->u32Interval & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 8) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 16) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 24) & 0xFF);
-
- *pu8CurrByte++ = (pstrSetBeaconParam->u32DTIMPeriod & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 8) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 16) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 24) & 0xFF);
-
- *pu8CurrByte++ = (pstrSetBeaconParam->u32HeadLen & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 8) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 16) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 24) & 0xFF);
-
- memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Head, pstrSetBeaconParam->u32HeadLen);
- pu8CurrByte += pstrSetBeaconParam->u32HeadLen;
-
- *pu8CurrByte++ = (pstrSetBeaconParam->u32TailLen & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 8) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 16) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 24) & 0xFF);
-
- /* Bug 4599 : if tail length = 0 skip copying */
- if (pstrSetBeaconParam->pu8Tail > 0)
- memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Tail, pstrSetBeaconParam->u32TailLen);
- pu8CurrByte += pstrSetBeaconParam->u32TailLen;
-
-
-
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv);
- if (s32Error) {
+ wid.id = (u16)WID_ADD_BEACON;
+ wid.type = WID_BIN;
+ wid.size = pstrSetBeaconParam->head_len + pstrSetBeaconParam->tail_len + 16;
+ wid.val = kmalloc(wid.size, GFP_KERNEL);
+ if (!wid.val)
+ goto ERRORHANDLER;
+
+ pu8CurrByte = wid.val;
+ *pu8CurrByte++ = (pstrSetBeaconParam->interval & 0xFF);
+ *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 8) & 0xFF);
+ *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 16) & 0xFF);
+ *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 24) & 0xFF);
+
+ *pu8CurrByte++ = (pstrSetBeaconParam->dtim_period & 0xFF);
+ *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 8) & 0xFF);
+ *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 16) & 0xFF);
+ *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 24) & 0xFF);
+
+ *pu8CurrByte++ = (pstrSetBeaconParam->head_len & 0xFF);
+ *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 8) & 0xFF);
+ *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 16) & 0xFF);
+ *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 24) & 0xFF);
+
+ memcpy(pu8CurrByte, pstrSetBeaconParam->head, pstrSetBeaconParam->head_len);
+ pu8CurrByte += pstrSetBeaconParam->head_len;
+
+ *pu8CurrByte++ = (pstrSetBeaconParam->tail_len & 0xFF);
+ *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 8) & 0xFF);
+ *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 16) & 0xFF);
+ *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 24) & 0xFF);
+
+ if (pstrSetBeaconParam->tail > 0)
+ memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len);
+ pu8CurrByte += pstrSetBeaconParam->tail_len;
+
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result)
PRINT_ER("Failed to send add beacon config packet\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
- }
- WILC_CATCH(s32Error)
- {
- }
- kfree(strWID.ps8WidVal);
- kfree(pstrSetBeaconParam->pu8Head);
- kfree(pstrSetBeaconParam->pu8Tail);
+ERRORHANDLER:
+ kfree(wid.val);
+ kfree(pstrSetBeaconParam->head);
+ kfree(pstrSetBeaconParam->tail);
}
-
-/**
- * @brief Handle_AddBeacon
- * @details Sending config packet to delete beacon
- * @param[in] tstrHostIFDelBeacon* pstrDelBeacon
- * @return NONE
- * @author
- * @date
- * @version 1.0
- */
-static void Handle_DelBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelBeacon *pstrDelBeacon)
+static void Handle_DelBeacon(struct host_if_drv *hif_drv)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
+ s32 result = 0;
+ struct wid wid;
u8 *pu8CurrByte;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
- strWID.u16WIDid = (u16)WID_DEL_BEACON;
- strWID.enuWIDtype = WID_CHAR;
- strWID.s32ValueSize = sizeof(char);
- strWID.ps8WidVal = &gu8DelBcn;
+ wid.id = (u16)WID_DEL_BEACON;
+ wid.type = WID_CHAR;
+ wid.size = sizeof(char);
+ wid.val = &del_beacon;
- if (strWID.ps8WidVal == NULL)
- WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
+ if (!wid.val)
+ return;
- pu8CurrByte = strWID.ps8WidVal;
+ pu8CurrByte = wid.val;
PRINT_D(HOSTINF_DBG, "Deleting BEACON\n");
- /* TODO: build del beacon message*/
-
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv);
- if (s32Error) {
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result)
PRINT_ER("Failed to send delete beacon config packet\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
- }
-
- WILC_CATCH(s32Error)
- {
- }
}
-
-/**
- * @brief WILC_HostIf_PackStaParam
- * @details Handling packing of the station params in a buffer
- * @param[in] u8* pu8Buffer, tstrWILC_AddStaParam* pstrStationParam
- * @return NONE
- * @author
- * @date
- * @version 1.0
- */
-static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, tstrWILC_AddStaParam *pstrStationParam)
+static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer,
+ struct add_sta_param *pstrStationParam)
{
u8 *pu8CurrByte;
@@ -3591,534 +2338,376 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, tstrWILC_AddStaParam *pstrSta
return pu8CurrByte - pu8Buffer;
}
-/**
- * @brief Handle_AddStation
- * @details Sending config packet to add station
- * @param[in] tstrWILC_AddStaParam* pstrStationParam
- * @return NONE
- * @author
- * @date
- * @version 1.0
- */
-static void Handle_AddStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam *pstrStationParam)
+static void Handle_AddStation(struct host_if_drv *hif_drv,
+ struct add_sta_param *pstrStationParam)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
+ s32 result = 0;
+ struct wid wid;
u8 *pu8CurrByte;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
PRINT_D(HOSTINF_DBG, "Handling add station\n");
- strWID.u16WIDid = (u16)WID_ADD_STA;
- strWID.enuWIDtype = WID_BIN;
- strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates;
+ wid.id = (u16)WID_ADD_STA;
+ wid.type = WID_BIN;
+ wid.size = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates;
- strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize);
- if (strWID.ps8WidVal == NULL)
- WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
+ wid.val = kmalloc(wid.size, GFP_KERNEL);
+ if (!wid.val)
+ goto ERRORHANDLER;
- pu8CurrByte = strWID.ps8WidVal;
+ pu8CurrByte = wid.val;
pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv);
- if (s32Error != WILC_SUCCESS) {
-
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result != 0)
PRINT_ER("Failed to send add station config packet\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
- }
- WILC_CATCH(s32Error)
- {
- }
+ERRORHANDLER:
kfree(pstrStationParam->pu8Rates);
- kfree(strWID.ps8WidVal);
+ kfree(wid.val);
}
-/**
- * @brief Handle_DelAllSta
- * @details Sending config packet to delete station
- * @param[in] tstrHostIFDelSta* pstrDelStaParam
- * @return NONE
- * @author
- * @date
- * @version 1.0
- */
-static void Handle_DelAllSta(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelAllSta *pstrDelAllStaParam)
+static void Handle_DelAllSta(struct host_if_drv *hif_drv,
+ struct del_all_sta *pstrDelAllStaParam)
{
- s32 s32Error = WILC_SUCCESS;
-
- tstrWID strWID;
+ s32 result = 0;
+ struct wid wid;
u8 *pu8CurrByte;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
u8 i;
u8 au8Zero_Buff[6] = {0};
- strWID.u16WIDid = (u16)WID_DEL_ALL_STA;
- strWID.enuWIDtype = WID_STR;
- strWID.s32ValueSize = (pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1;
+ wid.id = (u16)WID_DEL_ALL_STA;
+ wid.type = WID_STR;
+ wid.size = (pstrDelAllStaParam->assoc_sta * ETH_ALEN) + 1;
PRINT_D(HOSTINF_DBG, "Handling delete station\n");
- strWID.ps8WidVal = WILC_MALLOC((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1);
- if (strWID.ps8WidVal == NULL)
- WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
+ wid.val = kmalloc((pstrDelAllStaParam->assoc_sta * ETH_ALEN) + 1, GFP_KERNEL);
+ if (!wid.val)
+ goto ERRORHANDLER;
- pu8CurrByte = strWID.ps8WidVal;
+ pu8CurrByte = wid.val;
- *(pu8CurrByte++) = pstrDelAllStaParam->u8Num_AssocSta;
+ *(pu8CurrByte++) = pstrDelAllStaParam->assoc_sta;
for (i = 0; i < MAX_NUM_STA; i++) {
- if (memcmp(pstrDelAllStaParam->au8Sta_DelAllSta[i], au8Zero_Buff, ETH_ALEN))
- memcpy(pu8CurrByte, pstrDelAllStaParam->au8Sta_DelAllSta[i], ETH_ALEN);
+ if (memcmp(pstrDelAllStaParam->del_all_sta[i], au8Zero_Buff, ETH_ALEN))
+ memcpy(pu8CurrByte, pstrDelAllStaParam->del_all_sta[i], ETH_ALEN);
else
continue;
pu8CurrByte += ETH_ALEN;
}
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error) {
-
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result)
PRINT_ER("Failed to send add station config packet\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
- }
- WILC_CATCH(s32Error)
- {
- }
- kfree(strWID.ps8WidVal);
+ERRORHANDLER:
+ kfree(wid.val);
- up(&hWaitResponse);
+ up(&hif_sema_wait_response);
}
-
-/**
- * @brief Handle_DelStation
- * @details Sending config packet to delete station
- * @param[in] tstrHostIFDelSta* pstrDelStaParam
- * @return NONE
- * @author
- * @date
- * @version 1.0
- */
-static void Handle_DelStation(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelSta *pstrDelStaParam)
+static void Handle_DelStation(struct host_if_drv *hif_drv,
+ struct del_sta *pstrDelStaParam)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
+ s32 result = 0;
+ struct wid wid;
u8 *pu8CurrByte;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
- strWID.u16WIDid = (u16)WID_REMOVE_STA;
- strWID.enuWIDtype = WID_BIN;
- strWID.s32ValueSize = ETH_ALEN;
+ wid.id = (u16)WID_REMOVE_STA;
+ wid.type = WID_BIN;
+ wid.size = ETH_ALEN;
PRINT_D(HOSTINF_DBG, "Handling delete station\n");
- strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize);
- if (strWID.ps8WidVal == NULL)
- WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
-
- pu8CurrByte = strWID.ps8WidVal;
+ wid.val = kmalloc(wid.size, GFP_KERNEL);
+ if (!wid.val)
+ goto ERRORHANDLER;
- memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN);
+ pu8CurrByte = wid.val;
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv);
- if (s32Error) {
+ memcpy(pu8CurrByte, pstrDelStaParam->mac_addr, ETH_ALEN);
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result)
PRINT_ER("Failed to send add station config packet\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
- }
- WILC_CATCH(s32Error)
- {
- }
- kfree(strWID.ps8WidVal);
+ERRORHANDLER:
+ kfree(wid.val);
}
-
-/**
- * @brief Handle_EditStation
- * @details Sending config packet to edit station
- * @param[in] tstrWILC_AddStaParam* pstrStationParam
- * @return NONE
- * @author
- * @date
- * @version 1.0
- */
-static void Handle_EditStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam *pstrStationParam)
+static void Handle_EditStation(struct host_if_drv *hif_drv,
+ struct add_sta_param *pstrStationParam)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
+ s32 result = 0;
+ struct wid wid;
u8 *pu8CurrByte;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
- strWID.u16WIDid = (u16)WID_EDIT_STA;
- strWID.enuWIDtype = WID_BIN;
- strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates;
+ wid.id = (u16)WID_EDIT_STA;
+ wid.type = WID_BIN;
+ wid.size = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates;
PRINT_D(HOSTINF_DBG, "Handling edit station\n");
- strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize);
- if (strWID.ps8WidVal == NULL)
- WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
+ wid.val = kmalloc(wid.size, GFP_KERNEL);
+ if (!wid.val)
+ goto ERRORHANDLER;
- pu8CurrByte = strWID.ps8WidVal;
+ pu8CurrByte = wid.val;
pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv);
- if (s32Error) {
-
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result)
PRINT_ER("Failed to send edit station config packet\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
- }
- WILC_CATCH(s32Error)
- {
- }
+ERRORHANDLER:
kfree(pstrStationParam->pu8Rates);
- kfree(strWID.ps8WidVal);
+ kfree(wid.val);
}
-#endif /*WILC_AP_EXTERNAL_MLME*/
-
-#ifdef WILC_P2P
-/**
- * @brief Handle_RemainOnChan
- * @details Sending config packet to edit station
- * @param[in] tstrWILC_AddStaParam* pstrStationParam
- * @return NONE
- * @author
- * @date
- * @version 1.0
- */
-static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan)
+
+static int Handle_RemainOnChan(struct host_if_drv *hif_drv,
+ struct remain_ch *pstrHostIfRemainOnChan)
{
- s32 s32Error = WILC_SUCCESS;
+ s32 result = 0;
u8 u8remain_on_chan_flag;
- tstrWID strWID;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler;
-
- /*If it's a pendig remain-on-channel, don't overwrite gWFiDrvHandle values (since incoming msg is garbbage)*/
- if (!pstrWFIDrv->u8RemainOnChan_pendingreq) {
- pstrWFIDrv->strHostIfRemainOnChan.pVoid = pstrHostIfRemainOnChan->pVoid;
- pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired;
- pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady;
- pstrWFIDrv->strHostIfRemainOnChan.u16Channel = pstrHostIfRemainOnChan->u16Channel;
- pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID;
+ struct wid wid;
+
+ if (!hif_drv->remain_on_ch_pending) {
+ hif_drv->remain_on_ch.pVoid = pstrHostIfRemainOnChan->pVoid;
+ hif_drv->remain_on_ch.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired;
+ hif_drv->remain_on_ch.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady;
+ hif_drv->remain_on_ch.u16Channel = pstrHostIfRemainOnChan->u16Channel;
+ hif_drv->remain_on_ch.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID;
} else {
- /*Set the channel to use it as a wid val*/
- pstrHostIfRemainOnChan->u16Channel = pstrWFIDrv->strHostIfRemainOnChan.u16Channel;
+ pstrHostIfRemainOnChan->u16Channel = hif_drv->remain_on_ch.u16Channel;
}
- if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) {
+ if (hif_drv->usr_scan_req.pfUserScanResult) {
PRINT_INFO(GENERIC_DBG, "Required to remain on chan while scanning return\n");
- pstrWFIDrv->u8RemainOnChan_pendingreq = 1;
- WILC_ERRORREPORT(s32Error, WILC_BUSY);
+ hif_drv->remain_on_ch_pending = 1;
+ result = -EBUSY;
+ goto ERRORHANDLER;
}
- if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) {
+ if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) {
PRINT_INFO(GENERIC_DBG, "Required to remain on chan while connecting return\n");
- WILC_ERRORREPORT(s32Error, WILC_BUSY);
+ result = -EBUSY;
+ goto ERRORHANDLER;
}
- #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
if (g_obtainingIP || connecting) {
PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n");
- WILC_ERRORREPORT(s32Error, WILC_BUSY);
+ result = -EBUSY;
+ goto ERRORHANDLER;
}
- #endif
PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", pstrHostIfRemainOnChan->u16Channel);
u8remain_on_chan_flag = true;
- strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN;
- strWID.enuWIDtype = WID_STR;
- strWID.s32ValueSize = 2;
- strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize);
-
- if (strWID.ps8WidVal == NULL)
- WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
+ wid.id = (u16)WID_REMAIN_ON_CHAN;
+ wid.type = WID_STR;
+ wid.size = 2;
+ wid.val = kmalloc(wid.size, GFP_KERNEL);
+ if (!wid.val) {
+ result = -ENOMEM;
+ goto ERRORHANDLER;
+ }
- strWID.ps8WidVal[0] = u8remain_on_chan_flag;
- strWID.ps8WidVal[1] = (s8)pstrHostIfRemainOnChan->u16Channel;
+ wid.val[0] = u8remain_on_chan_flag;
+ wid.val[1] = (s8)pstrHostIfRemainOnChan->u16Channel;
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error != WILC_SUCCESS)
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result != 0)
PRINT_ER("Failed to set remain on channel\n");
- WILC_CATCH(-1)
+ERRORHANDLER:
{
P2P_LISTEN_STATE = 1;
- pstrWFIDrv->hRemainOnChannel.data = (unsigned long)pstrWFIDrv;
- mod_timer(&pstrWFIDrv->hRemainOnChannel,
+ hif_drv->hRemainOnChannel.data = (unsigned long)hif_drv;
+ mod_timer(&hif_drv->hRemainOnChannel,
jiffies +
msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration));
- /*Calling CFG ready_on_channel*/
- if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady)
- pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady(pstrWFIDrv->strHostIfRemainOnChan.pVoid);
+ if (hif_drv->remain_on_ch.pRemainOnChanReady)
+ hif_drv->remain_on_ch.pRemainOnChanReady(hif_drv->remain_on_ch.pVoid);
- if (pstrWFIDrv->u8RemainOnChan_pendingreq)
- pstrWFIDrv->u8RemainOnChan_pendingreq = 0;
+ if (hif_drv->remain_on_ch_pending)
+ hif_drv->remain_on_ch_pending = 0;
}
- return s32Error;
+
+ return result;
}
-/**
- * @brief Handle_RegisterFrame
- * @details
- * @param[in]
- * @return NONE
- * @author
- * @date
- * @version 1.0
- */
-static int Handle_RegisterFrame(tstrWILC_WFIDrv *drvHandler, tstrHostIfRegisterFrame *pstrHostIfRegisterFrame)
+static int Handle_RegisterFrame(struct host_if_drv *hif_drv,
+ struct reg_frame *pstrHostIfRegisterFrame)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
+ s32 result = 0;
+ struct wid wid;
u8 *pu8CurrByte;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
PRINT_D(HOSTINF_DBG, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame->bReg, pstrHostIfRegisterFrame->u16FrameType);
- /*prepare configuration packet*/
- strWID.u16WIDid = (u16)WID_REGISTER_FRAME;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = WILC_MALLOC(sizeof(u16) + 2);
- if (strWID.ps8WidVal == NULL)
- WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
+ wid.id = (u16)WID_REGISTER_FRAME;
+ wid.type = WID_STR;
+ wid.val = kmalloc(sizeof(u16) + 2, GFP_KERNEL);
+ if (!wid.val)
+ return -ENOMEM;
- pu8CurrByte = strWID.ps8WidVal;
+ pu8CurrByte = wid.val;
*pu8CurrByte++ = pstrHostIfRegisterFrame->bReg;
*pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid;
- memcpy(pu8CurrByte, &(pstrHostIfRegisterFrame->u16FrameType), sizeof(u16));
+ memcpy(pu8CurrByte, &pstrHostIfRegisterFrame->u16FrameType,
+ sizeof(u16));
+ wid.size = sizeof(u16) + 2;
- strWID.s32ValueSize = sizeof(u16) + 2;
-
-
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error) {
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result) {
PRINT_ER("Failed to frame register config packet\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
+ result = -EINVAL;
}
-
- WILC_CATCH(s32Error)
- {
- }
-
- return s32Error;
-
+ return result;
}
-/**
- * @brief Handle_ListenStateExpired
- * @details Handle of listen state expiration
- * @param[in] NONE
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-#define FALSE_FRMWR_CHANNEL 100
-static u32 Handle_ListenStateExpired(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan)
+static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv,
+ struct remain_ch *pstrHostIfRemainOnChan)
{
u8 u8remain_on_chan_flag;
- tstrWID strWID;
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler;
+ struct wid wid;
+ s32 result = 0;
PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n");
- /*BugID_5477*/
- /*Make sure we are already in listen state*/
- /*This is to handle duplicate expiry messages (listen timer fired and supplicant called cancel_remain_on_channel())*/
if (P2P_LISTEN_STATE) {
u8remain_on_chan_flag = false;
- strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN;
- strWID.enuWIDtype = WID_STR;
- strWID.s32ValueSize = 2;
- strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize);
+ wid.id = (u16)WID_REMAIN_ON_CHAN;
+ wid.type = WID_STR;
+ wid.size = 2;
+ wid.val = kmalloc(wid.size, GFP_KERNEL);
- if (strWID.ps8WidVal == NULL)
+ if (!wid.val)
PRINT_ER("Failed to allocate memory\n");
- strWID.ps8WidVal[0] = u8remain_on_chan_flag;
- strWID.ps8WidVal[1] = FALSE_FRMWR_CHANNEL;
+ wid.val[0] = u8remain_on_chan_flag;
+ wid.val[1] = FALSE_FRMWR_CHANNEL;
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error != WILC_SUCCESS) {
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result != 0) {
PRINT_ER("Failed to set remain on channel\n");
goto _done_;
}
- if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired) {
- pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired(pstrWFIDrv->strHostIfRemainOnChan.pVoid
- , pstrHostIfRemainOnChan->u32ListenSessionID);
+ if (hif_drv->remain_on_ch.pRemainOnChanExpired) {
+ hif_drv->remain_on_ch.pRemainOnChanExpired(hif_drv->remain_on_ch.pVoid,
+ pstrHostIfRemainOnChan->u32ListenSessionID);
}
P2P_LISTEN_STATE = 0;
} else {
PRINT_D(GENERIC_DBG, "Not in listen state\n");
- s32Error = WILC_FAIL;
+ result = -EFAULT;
}
_done_:
- return s32Error;
+ return result;
}
-
-/**
- * @brief ListenTimerCB
- * @details Callback function of remain-on-channel timer
- * @param[in] NONE
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
static void ListenTimerCB(unsigned long arg)
{
- s32 s32Error = WILC_SUCCESS;
- tstrHostIFmsg strHostIFmsg;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg;
- /*Stopping remain-on-channel timer*/
- del_timer(&pstrWFIDrv->hRemainOnChannel);
-
- /* prepare the Timer Callback message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_LISTEN_TIMER_FIRED;
- strHostIFmsg.drvHandler = pstrWFIDrv;
- strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID;
-
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
+ s32 result = 0;
+ struct host_if_msg msg;
+ struct host_if_drv *hif_drv = (struct host_if_drv *)arg;
- }
+ del_timer(&hif_drv->hRemainOnChannel);
+
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED;
+ msg.drv = hif_drv;
+ msg.body.remain_on_ch.u32ListenSessionID = hif_drv->remain_on_ch.u32ListenSessionID;
+
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc_mq_send fail\n");
}
-#endif
-
-
-/**
- * @brief Handle_EditStation
- * @details Sending config packet to edit station
- * @param[in] tstrWILC_AddStaParam* pstrStationParam
- * @return NONE
- * @author
- * @date
- * @version 1.0
- */
-static void Handle_PowerManagement(tstrWILC_WFIDrv *drvHandler, tstrHostIfPowerMgmtParam *strPowerMgmtParam)
+
+static void Handle_PowerManagement(struct host_if_drv *hif_drv,
+ struct power_mgmt_param *strPowerMgmtParam)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
+ s32 result = 0;
+ struct wid wid;
s8 s8PowerMode;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
- strWID.u16WIDid = (u16)WID_POWER_MANAGEMENT;
+ wid.id = (u16)WID_POWER_MANAGEMENT;
- if (strPowerMgmtParam->bIsEnabled == true)
+ if (strPowerMgmtParam->enabled)
s8PowerMode = MIN_FAST_PS;
else
s8PowerMode = NO_POWERSAVE;
PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode);
- strWID.ps8WidVal = &s8PowerMode;
- strWID.s32ValueSize = sizeof(char);
+ wid.val = &s8PowerMode;
+ wid.size = sizeof(char);
PRINT_D(HOSTINF_DBG, "Handling Power Management\n");
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error) {
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result)
PRINT_ER("Failed to send power management config packet\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
- }
-
- WILC_CATCH(s32Error)
- {
-
- }
}
-/**
- * @brief Handle_SetMulticastFilter
- * @details Set Multicast filter in firmware
- * @param[in] tstrHostIFSetMulti* strHostIfSetMulti
- * @return NONE
- * @author asobhy
- * @date
- * @version 1.0
- */
-static void Handle_SetMulticastFilter(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetMulti *strHostIfSetMulti)
+static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv,
+ struct set_multicast *strHostIfSetMulti)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
+ s32 result = 0;
+ struct wid wid;
u8 *pu8CurrByte;
PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n");
- strWID.u16WIDid = (u16)WID_SETUP_MULTICAST_FILTER;
- strWID.enuWIDtype = WID_BIN;
- strWID.s32ValueSize = sizeof(tstrHostIFSetMulti) + ((strHostIfSetMulti->u32count) * ETH_ALEN);
- strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize);
- if (strWID.ps8WidVal == NULL)
- WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
-
- pu8CurrByte = strWID.ps8WidVal;
- *pu8CurrByte++ = (strHostIfSetMulti->bIsEnabled & 0xFF);
- *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 8) & 0xFF);
- *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 16) & 0xFF);
- *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 24) & 0xFF);
-
- *pu8CurrByte++ = (strHostIfSetMulti->u32count & 0xFF);
- *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 8) & 0xFF);
- *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 16) & 0xFF);
- *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 24) & 0xFF);
-
- if ((strHostIfSetMulti->u32count) > 0)
- memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->u32count) * ETH_ALEN));
-
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)drvHandler);
- if (s32Error) {
+ wid.id = (u16)WID_SETUP_MULTICAST_FILTER;
+ wid.type = WID_BIN;
+ wid.size = sizeof(struct set_multicast) + ((strHostIfSetMulti->cnt) * ETH_ALEN);
+ wid.val = kmalloc(wid.size, GFP_KERNEL);
+ if (!wid.val)
+ goto ERRORHANDLER;
+
+ pu8CurrByte = wid.val;
+ *pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF);
+ *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 8) & 0xFF);
+ *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 16) & 0xFF);
+ *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 24) & 0xFF);
+
+ *pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF);
+ *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF);
+ *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 16) & 0xFF);
+ *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 24) & 0xFF);
+
+ if ((strHostIfSetMulti->cnt) > 0)
+ memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->cnt) * ETH_ALEN));
+
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result)
PRINT_ER("Failed to send setup multicast config packet\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
- }
-
- WILC_CATCH(s32Error)
- {
- }
- kfree(strWID.ps8WidVal);
+ERRORHANDLER:
+ kfree(wid.val);
}
-
-/*BugID_5222*/
-/**
- * @brief Handle_AddBASession
- * @details Add block ack session
- * @param[in] tstrHostIFSetMulti* strHostIfSetMulti
- * @return NONE
- * @author Amr Abdel-Moghny
- * @date Feb. 2014
- * @version 9.0
- */
-static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo)
+static s32 Handle_AddBASession(struct host_if_drv *hif_drv,
+ struct ba_session_info *strHostIfBASessionInfo)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
+ s32 result = 0;
+ struct wid wid;
int AddbaTimeout = 100;
char *ptr = NULL;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n",
strHostIfBASessionInfo->au8Bssid[0],
@@ -4128,84 +2717,60 @@ static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionI
strHostIfBASessionInfo->u16SessionTimeout,
strHostIfBASessionInfo->u8Ted);
- strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE);
- strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE;
- ptr = strWID.ps8WidVal;
- /* *ptr++ = 0x14; */
+ wid.id = (u16)WID_11E_P_ACTION_REQ;
+ wid.type = WID_STR;
+ wid.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL);
+ wid.size = BLOCK_ACK_REQ_SIZE;
+ ptr = wid.val;
*ptr++ = 0x14;
*ptr++ = 0x3;
*ptr++ = 0x0;
memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN);
ptr += ETH_ALEN;
*ptr++ = strHostIfBASessionInfo->u8Ted;
- /* BA Policy*/
*ptr++ = 1;
- /* Buffer size*/
*ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF);
*ptr++ = ((strHostIfBASessionInfo->u16BufferSize >> 16) & 0xFF);
- /* BA timeout*/
*ptr++ = (strHostIfBASessionInfo->u16SessionTimeout & 0xFF);
*ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF);
- /* ADDBA timeout*/
*ptr++ = (AddbaTimeout & 0xFF);
*ptr++ = ((AddbaTimeout >> 16) & 0xFF);
- /* Group Buffer Max Frames*/
*ptr++ = 8;
- /* Group Buffer Timeout */
*ptr++ = 0;
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error)
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result)
PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n");
-
- strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ;
- strWID.enuWIDtype = WID_STR;
- strWID.s32ValueSize = 15;
- ptr = strWID.ps8WidVal;
- /* *ptr++ = 0x14; */
+ wid.id = (u16)WID_11E_P_ACTION_REQ;
+ wid.type = WID_STR;
+ wid.size = 15;
+ ptr = wid.val;
*ptr++ = 15;
*ptr++ = 7;
*ptr++ = 0x2;
memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN);
ptr += ETH_ALEN;
- /* TID*/
*ptr++ = strHostIfBASessionInfo->u8Ted;
- /* Max Num MSDU */
*ptr++ = 8;
- /* BA timeout*/
*ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF);
*ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF);
- /*Ack-Policy */
*ptr++ = 3;
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
-
- if (strWID.ps8WidVal != NULL)
- kfree(strWID.ps8WidVal);
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
- return s32Error;
+ kfree(wid.val);
+ return result;
}
-
-/*BugID_5222*/
-/**
- * @brief Handle_DelBASession
- * @details Delete block ack session
- * @param[in] tstrHostIFSetMulti* strHostIfSetMulti
- * @return NONE
- * @author Amr Abdel-Moghny
- * @date Feb. 2013
- * @version 9.0
- */
-static s32 Handle_DelBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo)
+static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv,
+ struct ba_session_info *strHostIfBASessionInfo)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
+ s32 result = 0;
+ struct wid wid;
char *ptr = NULL;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n",
strHostIfBASessionInfo->au8Bssid[0],
@@ -4213,326 +2778,230 @@ static s32 Handle_DelBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionI
strHostIfBASessionInfo->au8Bssid[2],
strHostIfBASessionInfo->u8Ted);
- strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE);
- strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE;
- ptr = strWID.ps8WidVal;
- /* *ptr++ = 0x14; */
+ wid.id = (u16)WID_DEL_ALL_RX_BA;
+ wid.type = WID_STR;
+ wid.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL);
+ wid.size = BLOCK_ACK_REQ_SIZE;
+ ptr = wid.val;
*ptr++ = 0x14;
*ptr++ = 0x3;
*ptr++ = 0x2;
memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN);
ptr += ETH_ALEN;
*ptr++ = strHostIfBASessionInfo->u8Ted;
- /* BA direction = recipent*/
*ptr++ = 0;
- /* Delba Reason */
- *ptr++ = 32; /* Unspecific QOS reason */
+ *ptr++ = 32;
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error)
+ result = send_config_pkt(SET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result)
PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n");
+ kfree(wid.val);
- strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ;
- strWID.enuWIDtype = WID_STR;
- strWID.s32ValueSize = 15;
- ptr = strWID.ps8WidVal;
- /* *ptr++ = 0x14; */
- *ptr++ = 15;
- *ptr++ = 7;
- *ptr++ = 0x3;
- memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN);
- ptr += ETH_ALEN;
- /* TID*/
- *ptr++ = strHostIfBASessionInfo->u8Ted;
-
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
-
- if (strWID.ps8WidVal != NULL)
- kfree(strWID.ps8WidVal);
-
- /*BugID_5222*/
- up(&hWaitResponse);
-
- return s32Error;
+ up(&hif_sema_wait_response);
+ return result;
}
-
-/**
- * @brief Handle_DelAllRxBASessions
- * @details Delete all Rx BA sessions
- * @param[in] tstrHostIFSetMulti* strHostIfSetMulti
- * @return NONE
- * @author Abdelrahman Sobhy
- * @date Feb. 2013
- * @version 9.0
- */
-static s32 Handle_DelAllRxBASessions(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo)
-{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- char *ptr = NULL;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
-
- PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n",
- strHostIfBASessionInfo->au8Bssid[0],
- strHostIfBASessionInfo->au8Bssid[1],
- strHostIfBASessionInfo->au8Bssid[2],
- strHostIfBASessionInfo->u8Ted);
-
- strWID.u16WIDid = (u16)WID_DEL_ALL_RX_BA;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE);
- strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE;
- ptr = strWID.ps8WidVal;
- *ptr++ = 0x14;
- *ptr++ = 0x3;
- *ptr++ = 0x2;
- memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN);
- ptr += ETH_ALEN;
- *ptr++ = strHostIfBASessionInfo->u8Ted;
- /* BA direction = recipent*/
- *ptr++ = 0;
- /* Delba Reason */
- *ptr++ = 32; /* Unspecific QOS reason */
-
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error)
- PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n");
-
-
- if (strWID.ps8WidVal != NULL)
- kfree(strWID.ps8WidVal);
-
- /*BugID_5222*/
- up(&hWaitResponse);
-
- return s32Error;
-
-}
-
-/**
- * @brief hostIFthread
- * @details Main thread to handle message queue requests
- * @param[in] void* pvArg
- * @return NONE
- * @author
- * @date
- * @version 1.0
- */
static int hostIFthread(void *pvArg)
{
u32 u32Ret;
- tstrHostIFmsg strHostIFmsg;
- tstrWILC_WFIDrv *pstrWFIDrv;
+ struct host_if_msg msg;
+ struct host_if_drv *hif_drv;
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
while (1) {
- WILC_MsgQueueRecv(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), &u32Ret);
- pstrWFIDrv = (tstrWILC_WFIDrv *)strHostIFmsg.drvHandler;
- if (strHostIFmsg.u16MsgId == HOST_IF_MSG_EXIT) {
+ wilc_mq_recv(&hif_msg_q, &msg, sizeof(struct host_if_msg), &u32Ret);
+ hif_drv = (struct host_if_drv *)msg.drv;
+ if (msg.id == HOST_IF_MSG_EXIT) {
PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n");
break;
}
-
- /*Re-Queue HIF message*/
if ((!g_wilc_initialized)) {
PRINT_D(GENERIC_DBG, "--WAIT--");
usleep_range(200 * 1000, 200 * 1000);
- WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
+ wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
continue;
}
- if (strHostIFmsg.u16MsgId == HOST_IF_MSG_CONNECT && pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) {
+ if (msg.id == HOST_IF_MSG_CONNECT &&
+ hif_drv->usr_scan_req.pfUserScanResult) {
PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n");
- WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
+ wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
usleep_range(2 * 1000, 2 * 1000);
continue;
}
- switch (strHostIFmsg.u16MsgId) {
+ switch (msg.id) {
case HOST_IF_MSG_Q_IDLE:
Handle_wait_msg_q_empty();
break;
case HOST_IF_MSG_SCAN:
- Handle_Scan(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr);
+ Handle_Scan(msg.drv, &msg.body.scan_info);
break;
case HOST_IF_MSG_CONNECT:
- Handle_Connect(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr);
+ Handle_Connect(msg.drv, &msg.body.con_info);
break;
- /*BugID_5137*/
case HOST_IF_MSG_FLUSH_CONNECT:
- Handle_FlushConnect(strHostIFmsg.drvHandler);
+ Handle_FlushConnect(msg.drv);
break;
case HOST_IF_MSG_RCVD_NTWRK_INFO:
- Handle_RcvdNtwrkInfo(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo);
+ Handle_RcvdNtwrkInfo(msg.drv, &msg.body.net_info);
break;
case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO:
- Handle_RcvdGnrlAsyncInfo(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo);
+ Handle_RcvdGnrlAsyncInfo(msg.drv, &msg.body.async_info);
break;
case HOST_IF_MSG_KEY:
- Handle_Key(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr);
+ Handle_Key(msg.drv, &msg.body.key_info);
break;
case HOST_IF_MSG_CFG_PARAMS:
- Handle_CfgParam(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFCfgParamAttr);
+ Handle_CfgParam(msg.drv, &msg.body.cfg_info);
break;
case HOST_IF_MSG_SET_CHANNEL:
- Handle_SetChannel(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFSetChan);
+ Handle_SetChannel(msg.drv, &msg.body.channel_info);
break;
case HOST_IF_MSG_DISCONNECT:
- Handle_Disconnect(strHostIFmsg.drvHandler);
+ Handle_Disconnect(msg.drv);
break;
case HOST_IF_MSG_RCVD_SCAN_COMPLETE:
- del_timer(&pstrWFIDrv->hScanTimer);
+ del_timer(&hif_drv->hScanTimer);
PRINT_D(HOSTINF_DBG, "scan completed successfully\n");
- /*BugID_5213*/
- /*Allow chip sleep, only if both interfaces are not connected*/
if (!linux_wlan_get_num_conn_ifcs())
chip_sleep_manually(INFINITE_SLEEP_TIME);
- Handle_ScanDone(strHostIFmsg.drvHandler, SCAN_EVENT_DONE);
+ Handle_ScanDone(msg.drv, SCAN_EVENT_DONE);
- #ifdef WILC_P2P
- if (pstrWFIDrv->u8RemainOnChan_pendingreq)
- Handle_RemainOnChan(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan);
- #endif
+ if (hif_drv->remain_on_ch_pending)
+ Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch);
break;
case HOST_IF_MSG_GET_RSSI:
- Handle_GetRssi(strHostIFmsg.drvHandler);
+ Handle_GetRssi(msg.drv);
break;
case HOST_IF_MSG_GET_LINKSPEED:
- Handle_GetLinkspeed(strHostIFmsg.drvHandler);
+ Handle_GetLinkspeed(msg.drv);
break;
case HOST_IF_MSG_GET_STATISTICS:
- Handle_GetStatistics(strHostIFmsg.drvHandler, (tstrStatistics *)strHostIFmsg.uniHostIFmsgBody.pUserData);
+ Handle_GetStatistics(msg.drv, (struct rf_info *)msg.body.data);
break;
case HOST_IF_MSG_GET_CHNL:
- Handle_GetChnl(strHostIFmsg.drvHandler);
+ Handle_GetChnl(msg.drv);
break;
-#ifdef WILC_AP_EXTERNAL_MLME
case HOST_IF_MSG_ADD_BEACON:
- Handle_AddBeacon(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFSetBeacon);
+ Handle_AddBeacon(msg.drv, &msg.body.beacon_info);
break;
case HOST_IF_MSG_DEL_BEACON:
- Handle_DelBeacon(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFDelBeacon);
+ Handle_DelBeacon(msg.drv);
break;
case HOST_IF_MSG_ADD_STATION:
- Handle_AddStation(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strAddStaParam);
+ Handle_AddStation(msg.drv, &msg.body.add_sta_info);
break;
case HOST_IF_MSG_DEL_STATION:
- Handle_DelStation(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strDelStaParam);
+ Handle_DelStation(msg.drv, &msg.body.del_sta_info);
break;
case HOST_IF_MSG_EDIT_STATION:
- Handle_EditStation(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strEditStaParam);
+ Handle_EditStation(msg.drv, &msg.body.edit_sta_info);
break;
case HOST_IF_MSG_GET_INACTIVETIME:
- Handle_Get_InActiveTime(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfStaInactiveT);
+ Handle_Get_InActiveTime(msg.drv, &msg.body.mac_info);
break;
-#endif /*WILC_AP_EXTERNAL_MLME*/
case HOST_IF_MSG_SCAN_TIMER_FIRED:
PRINT_D(HOSTINF_DBG, "Scan Timeout\n");
- Handle_ScanDone(strHostIFmsg.drvHandler, SCAN_EVENT_ABORTED);
+ Handle_ScanDone(msg.drv, SCAN_EVENT_ABORTED);
break;
case HOST_IF_MSG_CONNECT_TIMER_FIRED:
PRINT_D(HOSTINF_DBG, "Connect Timeout\n");
- Handle_ConnectTimeout(strHostIFmsg.drvHandler);
+ Handle_ConnectTimeout(msg.drv);
break;
case HOST_IF_MSG_POWER_MGMT:
- Handle_PowerManagement(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strPowerMgmtparam);
+ Handle_PowerManagement(msg.drv, &msg.body.pwr_mgmt_info);
break;
case HOST_IF_MSG_SET_WFIDRV_HANDLER:
- Handle_SetWfiDrvHandler(&strHostIFmsg.uniHostIFmsgBody.strHostIfSetDrvHandler);
+ Handle_SetWfiDrvHandler(msg.drv,
+ &msg.body.drv);
break;
case HOST_IF_MSG_SET_OPERATION_MODE:
- Handle_SetOperationMode(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfSetOperationMode);
+ Handle_SetOperationMode(msg.drv, &msg.body.mode);
break;
case HOST_IF_MSG_SET_IPADDRESS:
PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n");
- Handle_set_IPAddress(strHostIFmsg.drvHandler, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx);
+ Handle_set_IPAddress(msg.drv, msg.body.ip_info.ip_addr, msg.body.ip_info.idx);
break;
case HOST_IF_MSG_GET_IPADDRESS:
PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n");
- Handle_get_IPAddress(strHostIFmsg.drvHandler, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx);
+ Handle_get_IPAddress(msg.drv, msg.body.ip_info.ip_addr, msg.body.ip_info.idx);
break;
- /*BugID_5077*/
case HOST_IF_MSG_SET_MAC_ADDRESS:
- Handle_SetMacAddress(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfSetMacAddress);
+ Handle_SetMacAddress(msg.drv, &msg.body.set_mac_info);
break;
- /*BugID_5213*/
case HOST_IF_MSG_GET_MAC_ADDRESS:
- Handle_GetMacAddress(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfGetMacAddress);
+ Handle_GetMacAddress(msg.drv, &msg.body.get_mac_info);
break;
-#ifdef WILC_P2P
case HOST_IF_MSG_REMAIN_ON_CHAN:
PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n");
- Handle_RemainOnChan(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan);
+ Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch);
break;
case HOST_IF_MSG_REGISTER_FRAME:
PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n");
- Handle_RegisterFrame(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame);
+ Handle_RegisterFrame(msg.drv, &msg.body.reg_frame);
break;
case HOST_IF_MSG_LISTEN_TIMER_FIRED:
- Handle_ListenStateExpired(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan);
+ Handle_ListenStateExpired(msg.drv, &msg.body.remain_on_ch);
break;
- #endif
case HOST_IF_MSG_SET_MULTICAST_FILTER:
PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n");
- Handle_SetMulticastFilter(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfSetMulti);
+ Handle_SetMulticastFilter(msg.drv, &msg.body.multicast_info);
break;
- /*BugID_5222*/
case HOST_IF_MSG_ADD_BA_SESSION:
- Handle_AddBASession(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo);
+ Handle_AddBASession(msg.drv, &msg.body.session_info);
break;
case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS:
- Handle_DelAllRxBASessions(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo);
+ Handle_DelAllRxBASessions(msg.drv, &msg.body.session_info);
break;
case HOST_IF_MSG_DEL_ALL_STA:
- Handle_DelAllSta(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFDelAllSta);
+ Handle_DelAllSta(msg.drv, &msg.body.del_all_sta_info);
break;
default:
@@ -4542,2900 +3011,1727 @@ static int hostIFthread(void *pvArg)
}
PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n");
- up(&hSemHostIFthrdEnd);
+ up(&hif_sema_thread);
return 0;
}
static void TimerCB_Scan(unsigned long arg)
{
void *pvArg = (void *)arg;
- tstrHostIFmsg strHostIFmsg;
+ struct host_if_msg msg;
- /* prepare the Timer Callback message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
- strHostIFmsg.drvHandler = pvArg;
- strHostIFmsg.u16MsgId = HOST_IF_MSG_SCAN_TIMER_FIRED;
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.drv = pvArg;
+ msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED;
- /* send the message */
- WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
+ wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
}
static void TimerCB_Connect(unsigned long arg)
{
void *pvArg = (void *)arg;
- tstrHostIFmsg strHostIFmsg;
+ struct host_if_msg msg;
- /* prepare the Timer Callback message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
- strHostIFmsg.drvHandler = pvArg;
- strHostIFmsg.u16MsgId = HOST_IF_MSG_CONNECT_TIMER_FIRED;
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.drv = pvArg;
+ msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED;
- /* send the message */
- WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
+ wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
}
-
-/**
- * @brief removes wpa/wpa2 keys
- * @details only in BSS STA mode if External Supplicant support is enabled.
- * removes all WPA/WPA2 station key entries from MAC hardware.
- * @param[in,out] handle to the wifi driver
- * @param[in] 6 bytes of Station Adress in the station entry table
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-/* Check implementation in core adding 9 bytes to the input! */
-s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress)
+s32 host_int_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
+ struct wid wid;
- strWID.u16WIDid = (u16)WID_REMOVE_KEY;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = (s8 *)pu8StaAddress;
- strWID.s32ValueSize = 6;
-
- return s32Error;
+ wid.id = (u16)WID_REMOVE_KEY;
+ wid.type = WID_STR;
+ wid.val = (s8 *)pu8StaAddress;
+ wid.size = 6;
+ return 0;
}
-/**
- * @brief removes WEP key
- * @details valid only in BSS STA mode if External Supplicant support is enabled.
- * remove a WEP key entry from MAC HW.
- * The BSS Station automatically finds the index of the entry using its
- * BSS ID and removes that entry from the MAC hardware.
- * @param[in,out] handle to the wifi driver
- * @param[in] 6 bytes of Station Adress in the station entry table
- * @return Error code indicating success/failure
- * @note NO need for the STA add since it is not used for processing
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8keyIdx)
+int host_int_remove_wep_key(struct host_if_drv *hif_drv, u8 index)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
-
-
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
-
- /* prepare the Remove Wep Key Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
-
-
- strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = REMOVEKEY;
- strHostIFmsg.drvHandler = hWFIDrv;
+ int result = 0;
+ struct host_if_msg msg;
+ if (!hif_drv) {
+ result = -EFAULT;
+ PRINT_ER("Failed to send setup multicast config packet\n");
+ return result;
+ }
+ memset(&msg, 0, sizeof(struct host_if_msg));
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8keyIdx;
+ msg.id = HOST_IF_MSG_KEY;
+ msg.body.key_info.type = WEP;
+ msg.body.key_info.action = REMOVEKEY;
+ msg.drv = hif_drv;
+ msg.body.key_info.attr.wep.index = index;
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
PRINT_ER("Error in sending message queue : Request to remove WEP key\n");
- down(&(pstrWFIDrv->hSemTestKeyBlock));
-
- WILC_CATCH(s32Error)
- {
+ down(&hif_drv->hSemTestKeyBlock);
- }
- return s32Error;
+ return result;
}
-/**
- * @brief sets WEP default key
- * @details Sets the index of the WEP encryption key in use,
- * in the key table
- * @param[in,out] handle to the wifi driver
- * @param[in] key index ( 0, 1, 2, 3)
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index)
+int host_int_set_wep_default_key(struct host_if_drv *hif_drv, u8 index)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
-
-
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ int result = 0;
+ struct host_if_msg msg;
- /* prepare the Key Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
-
-
- strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = DEFAULTKEY;
- strHostIFmsg.drvHandler = hWFIDrv;
+ if (!hif_drv) {
+ result = -EFAULT;
+ PRINT_ER("driver is null\n");
+ return result;
+ }
+ memset(&msg, 0, sizeof(struct host_if_msg));
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Index;
+ msg.id = HOST_IF_MSG_KEY;
+ msg.body.key_info.type = WEP;
+ msg.body.key_info.action = DEFAULTKEY;
+ msg.drv = hif_drv;
+ msg.body.key_info.attr.wep.index = index;
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
PRINT_ER("Error in sending message queue : Default key index\n");
- down(&(pstrWFIDrv->hSemTestKeyBlock));
-
- WILC_CATCH(s32Error)
- {
-
- }
+ down(&hif_drv->hSemTestKeyBlock);
- return s32Error;
+ return result;
}
-/**
- * @brief sets WEP deafault key
- * @details valid only in BSS STA mode if External Supplicant support is enabled.
- * sets WEP key entry into MAC hardware when it receives the
- * corresponding request from NDIS.
- * @param[in,out] handle to the wifi driver
- * @param[in] message containing WEP Key in the following format
- *|---------------------------------------|
- *|Key ID Value | Key Length | Key |
- *|-------------|------------|------------|
- | 1byte | 1byte | Key Length |
- ||---------------------------------------|
- |
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx)
+int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
+ const u8 *key,
+ u8 len,
+ u8 index)
{
+ int result = 0;
+ struct host_if_msg msg;
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
-
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
-
-
- /* prepare the Key Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
-
-
- strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY;
- strHostIFmsg.drvHandler = hWFIDrv;
-
-
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = WILC_MALLOC(u8WepKeylen);
-
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey,
- pu8WepKey, u8WepKeylen);
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
+ memset(&msg, 0, sizeof(struct host_if_msg));
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen);
+ msg.id = HOST_IF_MSG_KEY;
+ msg.body.key_info.type = WEP;
+ msg.body.key_info.action = ADDKEY;
+ msg.drv = hif_drv;
+ msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL);
+ if (!msg.body.key_info.attr.wep.key)
+ return -ENOMEM;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx;
+ msg.body.key_info.attr.wep.key_len = len;
+ msg.body.key_info.attr.wep.index = index;
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
PRINT_ER("Error in sending message queue :WEP Key\n");
- down(&(pstrWFIDrv->hSemTestKeyBlock));
-
- WILC_CATCH(s32Error)
- {
-
- }
- return s32Error;
+ down(&hif_drv->hSemTestKeyBlock);
+ return result;
}
-#ifdef WILC_AP_EXTERNAL_MLME
-/**
- *
- * @brief host_int_add_wep_key_bss_ap
- * @details valid only in BSS AP mode if External Supplicant support is enabled.
- * sets WEP key entry into MAC hardware when it receives the
- *
- * corresponding request from NDIS.
- * @param[in,out] handle to the wifi driver
- *
- *
- * @return Error code indicating success/failure
- * @note
- * @author mdaftedar
- * @date 28 FEB 2013
- * @version 1.0
- */
-s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, AUTHTYPE_T tenuAuth_type)
+int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
+ const u8 *key,
+ u8 len,
+ u8 index,
+ u8 mode,
+ enum AUTHTYPE auth_type)
{
+ int result = 0;
+ struct host_if_msg msg;
+ int i;
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
- u8 i;
-
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
-
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
- /* prepare the Key Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
if (INFO) {
- for (i = 0; i < u8WepKeylen; i++)
- PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", pu8WepKey[i]);
+ for (i = 0; i < len; i++)
+ PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", key[i]);
}
- strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP;
- strHostIFmsg.drvHandler = hWFIDrv;
-
-
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = WILC_MALLOC((u8WepKeylen));
-
-
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey,
- pu8WepKey, (u8WepKeylen));
-
+ msg.id = HOST_IF_MSG_KEY;
+ msg.body.key_info.type = WEP;
+ msg.body.key_info.action = ADDKEY_AP;
+ msg.drv = hif_drv;
+ msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL);
+ if (!msg.body.key_info.attr.wep.key)
+ return -ENOMEM;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen);
+ msg.body.key_info.attr.wep.key_len = len;
+ msg.body.key_info.attr.wep.index = index;
+ msg.body.key_info.attr.wep.mode = mode;
+ msg.body.key_info.attr.wep.auth_type = auth_type;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwepAttr.u8mode = u8mode;
-
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type = tenuAuth_type;
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
-
- if (s32Error)
+ if (result)
PRINT_ER("Error in sending message queue :WEP Key\n");
- down(&(pstrWFIDrv->hSemTestKeyBlock));
-
- WILC_CATCH(s32Error)
- {
-
- }
- return s32Error;
+ down(&hif_drv->hSemTestKeyBlock);
+ return result;
}
-#endif
-/**
- * @brief adds ptk Key
- * @details
- * @param[in,out] handle to the wifi driver
- * @param[in] message containing PTK Key in the following format
- *|-----------------------------------------------------------------------------|
- *|Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key |
- *|----------------|------------|--------------|----------------|---------------|
- | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes |
- ||-----------------------------------------------------------------------------|
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen,
- const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx)
+
+s32 host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk,
+ u8 u8PtkKeylen, const u8 *mac_addr,
+ const u8 *pu8RxMic, const u8 *pu8TxMic,
+ u8 mode, u8 u8Ciphermode, u8 u8Idx)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
+ s32 result = 0;
+ struct host_if_msg msg;
u8 u8KeyLen = u8PtkKeylen;
u32 i;
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
- if (pu8RxMic != NULL)
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
+
+ if (pu8RxMic)
u8KeyLen += RX_MIC_KEY_LEN;
- if (pu8TxMic != NULL)
- u8KeyLen += TX_MIC_KEY_LEN;
- /* prepare the Key Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ if (pu8TxMic)
+ u8KeyLen += TX_MIC_KEY_LEN;
+ memset(&msg, 0, sizeof(struct host_if_msg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WPAPtk;
- #ifdef WILC_AP_EXTERNAL_MLME
+ msg.id = HOST_IF_MSG_KEY;
+ msg.body.key_info.type = WPAPtk;
if (mode == AP_MODE) {
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8Idx;
+ msg.body.key_info.action = ADDKEY_AP;
+ msg.body.key_info.attr.wpa.index = u8Idx;
}
- #endif
if (mode == STATION_MODE)
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY;
-
-
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = WILC_MALLOC(u8PtkKeylen);
-
+ msg.body.key_info.action = ADDKEY;
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key,
- pu8Ptk, u8PtkKeylen);
+ msg.body.key_info.attr.wpa.key = kmalloc(u8PtkKeylen, GFP_KERNEL);
+ memcpy(msg.body.key_info.attr.wpa.key, pu8Ptk, u8PtkKeylen);
- if (pu8RxMic != NULL) {
-
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16,
- pu8RxMic, RX_MIC_KEY_LEN);
+ if (pu8RxMic) {
+ memcpy(msg.body.key_info.attr.wpa.key + 16, pu8RxMic, RX_MIC_KEY_LEN);
if (INFO) {
for (i = 0; i < RX_MIC_KEY_LEN; i++)
PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, pu8RxMic[i]);
}
}
- if (pu8TxMic != NULL) {
-
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24,
- pu8TxMic, TX_MIC_KEY_LEN);
+ if (pu8TxMic) {
+ memcpy(msg.body.key_info.attr.wpa.key + 24, pu8TxMic, TX_MIC_KEY_LEN);
if (INFO) {
for (i = 0; i < TX_MIC_KEY_LEN; i++)
PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, pu8TxMic[i]);
}
}
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen;
+ msg.body.key_info.attr.wpa.key_len = u8KeyLen;
+ msg.body.key_info.attr.wpa.mac_addr = mac_addr;
+ msg.body.key_info.attr.wpa.mode = u8Ciphermode;
+ msg.drv = hif_drv;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr = mac_addr;
- strHostIFmsg.drvHandler = hWFIDrv;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
-
- if (s32Error)
+ if (result)
PRINT_ER("Error in sending message queue: PTK Key\n");
- /* ////////////// */
- down(&(pstrWFIDrv->hSemTestKeyBlock));
- /* /////// */
-
- WILC_CATCH(s32Error)
- {
-
- }
+ down(&hif_drv->hSemTestKeyBlock);
- return s32Error;
+ return result;
}
-/**
- * @brief adds Rx GTk Key
- * @details
- * @param[in,out] handle to the wifi driver
- * @param[in] pu8RxGtk : contains temporal key | Rx Mic | Tx Mic
- * u8GtkKeylen :The total key length
- *
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen,
- u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC,
- const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode)
+s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk,
+ u8 u8GtkKeylen, u8 u8KeyIdx,
+ u32 u32KeyRSClen, const u8 *KeyRSC,
+ const u8 *pu8RxMic, const u8 *pu8TxMic,
+ u8 mode, u8 u8Ciphermode)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
+ s32 result = 0;
+ struct host_if_msg msg;
u8 u8KeyLen = u8GtkKeylen;
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
- /* prepare the Key Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
-
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
+ memset(&msg, 0, sizeof(struct host_if_msg));
- if (pu8RxMic != NULL)
+ if (pu8RxMic)
u8KeyLen += RX_MIC_KEY_LEN;
- if (pu8TxMic != NULL)
+
+ if (pu8TxMic)
u8KeyLen += TX_MIC_KEY_LEN;
- if (KeyRSC != NULL) {
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = WILC_MALLOC(u32KeyRSClen);
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq,
- KeyRSC, u32KeyRSClen);
+ if (KeyRSC) {
+ msg.body.key_info.attr.wpa.seq = kmalloc(u32KeyRSClen, GFP_KERNEL);
+ memcpy(msg.body.key_info.attr.wpa.seq, KeyRSC, u32KeyRSClen);
}
+ msg.id = HOST_IF_MSG_KEY;
+ msg.body.key_info.type = WPARxGtk;
+ msg.drv = hif_drv;
- strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WPARxGtk;
- strHostIFmsg.drvHandler = hWFIDrv;
-
- #ifdef WILC_AP_EXTERNAL_MLME
if (mode == AP_MODE) {
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode;
+ msg.body.key_info.action = ADDKEY_AP;
+ msg.body.key_info.attr.wpa.mode = u8Ciphermode;
}
- #endif
if (mode == STATION_MODE)
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY;
-
-
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = WILC_MALLOC(u8KeyLen);
-
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key,
- pu8RxGtk, u8GtkKeylen);
+ msg.body.key_info.action = ADDKEY;
- if (pu8RxMic != NULL) {
+ msg.body.key_info.attr.wpa.key = kmalloc(u8KeyLen, GFP_KERNEL);
+ memcpy(msg.body.key_info.attr.wpa.key, pu8RxGtk, u8GtkKeylen);
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16,
- pu8RxMic, RX_MIC_KEY_LEN);
+ if (pu8RxMic)
+ memcpy(msg.body.key_info.attr.wpa.key + 16, pu8RxMic,
+ RX_MIC_KEY_LEN);
- }
- if (pu8TxMic != NULL) {
-
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24,
- pu8TxMic, TX_MIC_KEY_LEN);
-
- }
+ if (pu8TxMic)
+ memcpy(msg.body.key_info.attr.wpa.key + 24, pu8TxMic,
+ TX_MIC_KEY_LEN);
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8KeyIdx;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen;
+ msg.body.key_info.attr.wpa.index = u8KeyIdx;
+ msg.body.key_info.attr.wpa.key_len = u8KeyLen;
+ msg.body.key_info.attr.wpa.seq_len = u32KeyRSClen;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
- uniHostIFkeyAttr.strHostIFwpaAttr.u8seqlen = u32KeyRSClen;
-
-
-
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
PRINT_ER("Error in sending message queue: RX GTK\n");
- /* ////////////// */
- down(&(pstrWFIDrv->hSemTestKeyBlock));
- /* /////// */
- WILC_CATCH(s32Error)
- {
+ down(&hif_drv->hSemTestKeyBlock);
- }
- return s32Error;
+ return result;
}
-/**
- * @brief host_int_set_pmkid_info
- * @details caches the pmkid valid only in BSS STA mode if External Supplicant
- * support is enabled. This Function sets the PMKID in firmware
- * when host drivr receives the corresponding request from NDIS.
- * The firmware then includes theset PMKID in the appropriate
- * management frames
- * @param[in,out] handle to the wifi driver
- * @param[in] message containing PMKID Info in the following format
- *|-----------------------------------------------------------------|
- *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] |
- *|-----------|------------|----------|-------|----------|----------|
- | 1 | 6 | 16 | ... | 6 | 16 |
- ||-----------------------------------------------------------------|
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray)
+s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr *pu8PmkidInfoArray)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
+ s32 result = 0;
+ struct host_if_msg msg;
u32 i;
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
-
- /* prepare the Key Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = PMKSA;
- strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY;
- strHostIFmsg.drvHandler = hWFIDrv;
+ msg.id = HOST_IF_MSG_KEY;
+ msg.body.key_info.type = PMKSA;
+ msg.body.key_info.action = ADDKEY;
+ msg.drv = hif_drv;
for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) {
-
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, &pu8PmkidInfoArray->pmkidlist[i].bssid,
- ETH_ALEN);
-
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, &pu8PmkidInfoArray->pmkidlist[i].pmkid,
- PMKID_LEN);
+ memcpy(msg.body.key_info.attr.pmkid.pmkidlist[i].bssid,
+ &pu8PmkidInfoArray->pmkidlist[i].bssid, ETH_ALEN);
+ memcpy(msg.body.key_info.attr.pmkid.pmkidlist[i].pmkid,
+ &pu8PmkidInfoArray->pmkidlist[i].pmkid, PMKID_LEN);
}
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
PRINT_ER(" Error in sending messagequeue: PMKID Info\n");
- WILC_CATCH(s32Error)
- {
-
- }
-
- return s32Error;
+ return result;
}
-/**
- * @brief gets the cached the pmkid info
- * @details valid only in BSS STA mode if External Supplicant
- * support is enabled. This Function sets the PMKID in firmware
- * when host drivr receives the corresponding request from NDIS.
- * The firmware then includes theset PMKID in the appropriate
- * management frames
- * @param[in,out] handle to the wifi driver,
- * message containing PMKID Info in the following format
- *|-----------------------------------------------------------------|
- *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] |
- *|-----------|------------|----------|-------|----------|----------|
- | 1 | 6 | 16 | ... | 6 | 16 |
- ||-----------------------------------------------------------------|
- * @param[in]
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray,
- u32 u32PmkidInfoLen)
+s32 host_int_get_pmkid_info(struct host_if_drv *hif_drv,
+ u8 *pu8PmkidInfoArray,
+ u32 u32PmkidInfoLen)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
+ struct wid wid;
- strWID.u16WIDid = (u16)WID_PMKID_INFO;
- strWID.enuWIDtype = WID_STR;
- strWID.s32ValueSize = u32PmkidInfoLen;
- strWID.ps8WidVal = pu8PmkidInfoArray;
+ wid.id = (u16)WID_PMKID_INFO;
+ wid.type = WID_STR;
+ wid.size = u32PmkidInfoLen;
+ wid.val = pu8PmkidInfoArray;
- return s32Error;
+ return 0;
}
-/**
- * @brief sets the pass phrase
- * @details AP/STA mode. This function gives the pass phrase used to
- * generate the Pre-Shared Key when WPA/WPA2 is enabled
- * The length of the field can vary from 8 to 64 bytes,
- * the lower layer should get the
- * @param[in,out] handle to the wifi driver,
- * @param[in] String containing PSK
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase,
- u8 u8Psklength)
+s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv,
+ u8 *pu8PassPhrase,
+ u8 u8Psklength)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
+ struct wid wid;
- /*validating psk length*/
if ((u8Psklength > 7) && (u8Psklength < 65)) {
- strWID.u16WIDid = (u16)WID_11I_PSK;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = pu8PassPhrase;
- strWID.s32ValueSize = u8Psklength;
+ wid.id = (u16)WID_11I_PSK;
+ wid.type = WID_STR;
+ wid.val = pu8PassPhrase;
+ wid.size = u8Psklength;
}
- return s32Error;
+ return 0;
}
-/**
- * @brief host_int_get_MacAddress
- * @details gets mac address
- * @param[in,out] handle to the wifi driver,
- *
- * @return Error code indicating success/failure
- * @note
- * @author mdaftedar
- * @date 19 April 2012
- * @version 1.0
- */
-s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress)
+
+s32 host_int_get_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
{
- s32 s32Error = WILC_SUCCESS;
- tstrHostIFmsg strHostIFmsg;
+ s32 result = 0;
+ struct host_if_msg msg;
+ memset(&msg, 0, sizeof(struct host_if_msg));
- /* prepare the Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ msg.id = HOST_IF_MSG_GET_MAC_ADDRESS;
+ msg.body.get_mac_info.mac_addr = pu8MacAddress;
+ msg.drv = hif_drv;
- strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_MAC_ADDRESS;
- strHostIFmsg.uniHostIFmsgBody.strHostIfGetMacAddress.u8MacAddress = pu8MacAddress;
- strHostIFmsg.drvHandler = hWFIDrv;
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error) {
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result) {
PRINT_ER("Failed to send get mac address\n");
- return WILC_FAIL;
+ return -EFAULT;
}
- down(&hWaitResponse);
- return s32Error;
+ down(&hif_sema_wait_response);
+ return result;
}
-/**
- * @brief host_int_set_MacAddress
- * @details sets mac address
- * @param[in,out] handle to the wifi driver,
- *
- * @return Error code indicating success/failure
- * @note
- * @author mabubakr
- * @date 16 July 2012
- * @version 1.0
- */
-s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress)
+s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
{
- s32 s32Error = WILC_SUCCESS;
- tstrHostIFmsg strHostIFmsg;
+ s32 result = 0;
+ struct host_if_msg msg;
PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]);
- /* prepare setting mac address message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_MAC_ADDRESS;
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfSetMacAddress.u8MacAddress, pu8MacAddress, ETH_ALEN);
- strHostIFmsg.drvHandler = hWFIDrv;
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.id = HOST_IF_MSG_SET_MAC_ADDRESS;
+ memcpy(msg.body.set_mac_info.mac_addr, pu8MacAddress, ETH_ALEN);
+ msg.drv = hif_drv;
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error) {
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
PRINT_ER("Failed to send message queue: Set mac address\n");
- WILC_ERRORREPORT(s32Error, s32Error);
- }
- WILC_CATCH(s32Error)
- {
-
- }
-
- return s32Error;
+ return result;
}
-/**
- * @brief host_int_get_RSNAConfigPSKPassPhrase
- * @details gets the pass phrase:AP/STA mode. This function gets the pass phrase used to
- * generate the Pre-Shared Key when WPA/WPA2 is enabled
- * The length of the field can vary from 8 to 64 bytes,
- * the lower layer should get the
- * @param[in,out] handle to the wifi driver,
- * String containing PSK
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv,
- u8 *pu8PassPhrase, u8 u8Psklength)
+s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv,
+ u8 *pu8PassPhrase, u8 u8Psklength)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
+ struct wid wid;
- strWID.u16WIDid = (u16)WID_11I_PSK;
- strWID.enuWIDtype = WID_STR;
- strWID.s32ValueSize = u8Psklength;
- strWID.ps8WidVal = pu8PassPhrase;
+ wid.id = (u16)WID_11I_PSK;
+ wid.type = WID_STR;
+ wid.size = u8Psklength;
+ wid.val = pu8PassPhrase;
- return s32Error;
+ return 0;
}
-/**
- * @brief host_int_get_site_survey_results
- * @details gets the site survey results
- * @param[in,out] handle to the wifi driver,
- * Message containing site survey results in the
- * following format
- *|---------------------------------------------------|
- | MsgLength | fragNo. | MsgBodyLength | MsgBody |
- ||-----------|-----------|---------------|-----------|
- | 1 | 1 | 1 | 1 |
- | ----------------------------------------- | ----------------
- |
- ||---------------------------------------|
- | Network1 | Netweork2 | ... | Network5 |
- ||---------------------------------------|
- | 44 | 44 | ... | 44 |
- | -------------------------- | ---------------------------------------
- |
- ||---------------------------------------------------------------------|
- | SSID | BSS Type | Channel | Security Status| BSSID | RSSI |Reserved |
- |
- |
- ||------|----------|---------|----------------|-------|------|---------|
- | 33 | 1 | 1 | 1 | 6 | 1 | 1 |
- ||---------------------------------------------------------------------|
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-#ifndef CONNECT_DIRECT
-s32 host_int_get_site_survey_results(tstrWILC_WFIDrv *hWFIDrv,
- u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE],
- u32 u32MaxSiteSrvyFragLen)
+s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID astrWIDList[2];
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
+ struct wid wid;
- astrWIDList[0].u16WIDid = (u16)WID_SITE_SURVEY_RESULTS;
- astrWIDList[0].enuWIDtype = WID_STR;
- astrWIDList[0].ps8WidVal = ppu8RcvdSiteSurveyResults[0];
- astrWIDList[0].s32ValueSize = u32MaxSiteSrvyFragLen;
+ wid.id = (u16)WID_START_SCAN_REQ;
+ wid.type = WID_CHAR;
+ wid.val = (s8 *)&scanSource;
+ wid.size = sizeof(char);
- astrWIDList[1].u16WIDid = (u16)WID_SITE_SURVEY_RESULTS;
- astrWIDList[1].enuWIDtype = WID_STR;
- astrWIDList[1].ps8WidVal = ppu8RcvdSiteSurveyResults[1];
- astrWIDList[1].s32ValueSize = u32MaxSiteSrvyFragLen;
-
- s32Error = SendConfigPkt(GET_CFG, astrWIDList, 2, true, (u32)pstrWFIDrv);
-
- /*get the value by searching the local copy*/
- if (s32Error) {
- PRINT_ER("Failed to send config packet to get survey results\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
- }
-
- WILC_CATCH(s32Error)
- {
-
- }
-
- return s32Error;
-}
-#endif
-
-/**
- * @brief sets a start scan request
- * @details
- * @param[in,out] handle to the wifi driver,
- * @param[in] Scan Source one of the following values
- * DEFAULT_SCAN 0
- * USER_SCAN BIT0
- * OBSS_PERIODIC_SCAN BIT1
- * OBSS_ONETIME_SCAN BIT2
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource)
-{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
-
- strWID.u16WIDid = (u16)WID_START_SCAN_REQ;
- strWID.enuWIDtype = WID_CHAR;
- strWID.ps8WidVal = (s8 *)&scanSource;
- strWID.s32ValueSize = sizeof(char);
-
- return s32Error;
+ return 0;
}
-/**
- * @brief host_int_get_start_scan_req
- * @details gets a start scan request
- * @param[in,out] handle to the wifi driver,
- * @param[in] Scan Source one of the following values
- * DEFAULT_SCAN 0
- * USER_SCAN BIT0
- * OBSS_PERIODIC_SCAN BIT1
- * OBSS_ONETIME_SCAN BIT2
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-
-s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource)
+s32 host_int_get_start_scan_req(struct host_if_drv *hif_drv, u8 *pu8ScanSource)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
+ struct wid wid;
- strWID.u16WIDid = (u16)WID_START_SCAN_REQ;
- strWID.enuWIDtype = WID_CHAR;
- strWID.ps8WidVal = (s8 *)pu8ScanSource;
- strWID.s32ValueSize = sizeof(char);
+ wid.id = (u16)WID_START_SCAN_REQ;
+ wid.type = WID_CHAR;
+ wid.val = (s8 *)pu8ScanSource;
+ wid.size = sizeof(char);
- return s32Error;
+ return 0;
}
-/**
- * @brief host_int_set_join_req
- * @details sets a join request
- * @param[in,out] handle to the wifi driver,
- * @param[in] Index of the bss descriptor
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid,
- const u8 *pu8ssid, size_t ssidLen,
- const u8 *pu8IEs, size_t IEsLen,
- tWILCpfConnectResult pfConnectResult, void *pvUserArg,
- u8 u8security, AUTHTYPE_T tenuAuth_type,
- u8 u8channel,
- void *pJoinParams)
+s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
+ const u8 *pu8ssid, size_t ssidLen,
+ const u8 *pu8IEs, size_t IEsLen,
+ wilc_connect_result pfConnectResult, void *pvUserArg,
+ u8 u8security, enum AUTHTYPE tenuAuth_type,
+ u8 u8channel, void *pJoinParams)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
- tenuScanConnTimer enuScanConnTimer;
+ s32 result = 0;
+ struct host_if_msg msg;
- if (pstrWFIDrv == NULL || pfConnectResult == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
-
- if (hWFIDrv == NULL) {
- PRINT_ER("Driver not initialized: gWFiDrvHandle = NULL\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
+ if (!hif_drv || !pfConnectResult) {
+ PRINT_ER("Driver is null\n");
+ return -EFAULT;
}
- if (pJoinParams == NULL) {
+ if (!pJoinParams) {
PRINT_ER("Unable to Join - JoinParams is NULL\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
-
+ return -EFAULT;
}
-/*
- * if(gWFiDrvHandle->strWILC_UsrScanReq.u32RcvdChCount == 0)
- * {
- * PRINT_ER("No scan results exist: Scanning should be done\n");
- * WILC_ERRORREPORT(s32Error, WILC_FAIL);
- * }
- */
- /* prepare the Connect Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_CONNECT;
+ memset(&msg, 0, sizeof(struct host_if_msg));
- strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.u8security = u8security;
- strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.tenuAuth_type = tenuAuth_type;
- strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.u8channel = u8channel;
- strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pfConnectResult = pfConnectResult;
- strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pvUserArg = pvUserArg;
- strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pJoinParams = pJoinParams;
- strHostIFmsg.drvHandler = hWFIDrv;
+ msg.id = HOST_IF_MSG_CONNECT;
- if (pu8bssid != NULL) {
- strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid = WILC_MALLOC(6); /* will be deallocated by the receiving thread */
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid,
- pu8bssid, 6);
- }
+ msg.body.con_info.security = u8security;
+ msg.body.con_info.auth_type = tenuAuth_type;
+ msg.body.con_info.ch = u8channel;
+ msg.body.con_info.result = pfConnectResult;
+ msg.body.con_info.arg = pvUserArg;
+ msg.body.con_info.params = pJoinParams;
+ msg.drv = hif_drv ;
- if (pu8ssid != NULL) {
- strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.ssidLen = ssidLen;
- strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid = WILC_MALLOC(ssidLen); /* will be deallocated by the receiving thread */
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid,
+ if (pu8bssid) {
+ msg.body.con_info.bssid = kmalloc(6, GFP_KERNEL);
+ memcpy(msg.body.con_info.bssid, pu8bssid, 6);
+ }
- pu8ssid, ssidLen);
+ if (pu8ssid) {
+ msg.body.con_info.ssid_len = ssidLen;
+ msg.body.con_info.ssid = kmalloc(ssidLen, GFP_KERNEL);
+ memcpy(msg.body.con_info.ssid, pu8ssid, ssidLen);
}
- if (pu8IEs != NULL) {
- strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.IEsLen = IEsLen;
- strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs = WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs,
- pu8IEs, IEsLen);
+ if (pu8IEs) {
+ msg.body.con_info.ies_len = IEsLen;
+ msg.body.con_info.ies = kmalloc(IEsLen, GFP_KERNEL);
+ memcpy(msg.body.con_info.ies, pu8IEs, IEsLen);
}
- if (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTING)
- pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTING;
+ if (hif_drv->enuHostIFstate < HOST_IF_CONNECTING)
+ hif_drv->enuHostIFstate = HOST_IF_CONNECTING;
else
- PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", pstrWFIDrv->enuHostIFstate);
+ PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", hif_drv->enuHostIFstate);
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error) {
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result) {
PRINT_ER("Failed to send message queue: Set join request\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
+ return -EFAULT;
}
- enuScanConnTimer = CONNECT_TIMER;
- pstrWFIDrv->hConnectTimer.data = (unsigned long)hWFIDrv;
- mod_timer(&pstrWFIDrv->hConnectTimer,
+ hif_drv->hConnectTimer.data = (unsigned long)hif_drv;
+ mod_timer(&hif_drv->hConnectTimer,
jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT));
- WILC_CATCH(s32Error)
- {
-
- }
-
- return s32Error;
+ return result;
}
-/**
- * @brief Flush a join request parameters to FW, but actual connection
- * @details The function is called in situation where WILC is connected to AP and
- * required to switch to hybrid FW for P2P connection
- * @param[in] handle to the wifi driver,
- * @return Error code indicating success/failure
- * @note
- * @author Amr Abdel-Moghny
- * @date 19 DEC 2013
- * @version 8.0
- */
-
-s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv)
+s32 host_int_flush_join_req(struct host_if_drv *hif_drv)
{
- s32 s32Error = WILC_SUCCESS;
- tstrHostIFmsg strHostIFmsg;
-
- if (!gu8FlushedJoinReq) {
- s32Error = WILC_FAIL;
- return s32Error;
- }
+ s32 result = 0;
+ struct host_if_msg msg;
+ if (!join_req)
+ return -EFAULT;
- if (hWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
-
+ if (!hif_drv) {
+ PRINT_ER("Driver is null\n");
+ return -EFAULT;
+ }
- strHostIFmsg.u16MsgId = HOST_IF_MSG_FLUSH_CONNECT;
- strHostIFmsg.drvHandler = hWFIDrv;
+ msg.id = HOST_IF_MSG_FLUSH_CONNECT;
+ msg.drv = hif_drv;
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error) {
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result) {
PRINT_ER("Failed to send message queue: Flush join request\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
+ return -EFAULT;
}
- WILC_CATCH(s32Error)
- {
-
- }
- return s32Error;
+ return result;
}
-/**
- * @brief host_int_disconnect
- * @details disconnects from the currently associated network
- * @param[in,out] handle to the wifi driver,
- * @param[in] Reason Code of the Disconnection
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode)
+s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)
{
- s32 s32Error = WILC_SUCCESS;
- tstrHostIFmsg strHostIFmsg;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
-
- if (pstrWFIDrv == NULL) {
- PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
- }
+ s32 result = 0;
+ struct host_if_msg msg;
- if (pstrWFIDrv == NULL) {
- PRINT_ER("gWFiDrvHandle = NULL\n");
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
+ if (!hif_drv) {
+ PRINT_ER("Driver is null\n");
+ return -EFAULT;
}
- /* prepare the Disconnect Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_DISCONNECT;
- strHostIFmsg.drvHandler = hWFIDrv;
+ msg.id = HOST_IF_MSG_DISCONNECT;
+ msg.drv = hif_drv;
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
PRINT_ER("Failed to send message queue: disconnect\n");
- /* ////////////// */
- down(&(pstrWFIDrv->hSemTestDisconnectBlock));
- /* /////// */
- WILC_CATCH(s32Error)
- {
-
- }
+ down(&hif_drv->hSemTestDisconnectBlock);
- return s32Error;
+ return result;
}
-/**
- * @brief host_int_disconnect_station
- * @details disconnects a sta
- * @param[in,out] handle to the wifi driver,
- * @param[in] Association Id of the station to be disconnected
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id)
+s32 host_int_disconnect_station(struct host_if_drv *hif_drv, u8 assoc_id)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
+ struct wid wid;
- strWID.u16WIDid = (u16)WID_DISCONNECT;
- strWID.enuWIDtype = WID_CHAR;
- strWID.ps8WidVal = (s8 *)&assoc_id;
- strWID.s32ValueSize = sizeof(char);
+ wid.id = (u16)WID_DISCONNECT;
+ wid.type = WID_CHAR;
+ wid.val = (s8 *)&assoc_id;
+ wid.size = sizeof(char);
- return s32Error;
+ return 0;
}
-/**
- * @brief host_int_get_assoc_req_info
- * @details gets a Association request info
- * @param[in,out] handle to the wifi driver,
- * Message containg assoc. req info in the following format
- * ------------------------------------------------------------------------
- | Management Frame Format |
- ||-------------------------------------------------------------------|
- ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS |
- ||-------------|--------|--|--|-----|----------------|----------|----|
- | 2 |2 |6 |6 |6 | 2 |0 - 2312 | 4 |
- ||-------------------------------------------------------------------|
- | |
- | Association Request Frame - Frame Body |
- ||-------------------------------------------------------------------|
- | Capability Information | Listen Interval | SSID | Supported Rates |
- ||------------------------|-----------------|------|-----------------|
- | 2 | 2 | 2-34 | 3-10 |
- | ---------------------------------------------------------------------
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-
-s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo,
- u32 u32AssocReqInfoLen)
+s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv,
+ u8 *pu8AssocReqInfo,
+ u32 u32AssocReqInfoLen)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
+ struct wid wid;
- strWID.u16WIDid = (u16)WID_ASSOC_REQ_INFO;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = pu8AssocReqInfo;
- strWID.s32ValueSize = u32AssocReqInfoLen;
+ wid.id = (u16)WID_ASSOC_REQ_INFO;
+ wid.type = WID_STR;
+ wid.val = pu8AssocReqInfo;
+ wid.size = u32AssocReqInfoLen;
-
- return s32Error;
+ return 0;
}
-/**
- * @brief gets a Association Response info
- * @details
- * @param[in,out] handle to the wifi driver,
- * Message containg assoc. resp info
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo,
- u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen)
+s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
+ u8 *pu8AssocRespInfo,
+ u32 u32MaxAssocRespInfoLen,
+ u32 *pu32RcvdAssocRespInfoLen)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
+ s32 result = 0;
+ struct wid wid;
- if (pstrWFIDrv == NULL) {
- PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ if (!hif_drv) {
+ PRINT_ER("Driver is null\n");
+ return -EFAULT;
}
- strWID.u16WIDid = (u16)WID_ASSOC_RES_INFO;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = pu8AssocRespInfo;
- strWID.s32ValueSize = u32MaxAssocRespInfoLen;
+ wid.id = (u16)WID_ASSOC_RES_INFO;
+ wid.type = WID_STR;
+ wid.val = pu8AssocRespInfo;
+ wid.size = u32MaxAssocRespInfoLen;
-
- /* Sending Configuration packet */
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error) {
- PRINT_ER("Failed to send association response config packet\n");
+ result = send_config_pkt(GET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+ if (result) {
*pu32RcvdAssocRespInfoLen = 0;
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
+ PRINT_ER("Failed to send association response config packet\n");
+ return -EINVAL;
} else {
- *pu32RcvdAssocRespInfoLen = strWID.s32ValueSize;
+ *pu32RcvdAssocRespInfoLen = wid.size;
}
- WILC_CATCH(s32Error)
- {
-
- }
- return s32Error;
+ return result;
}
-/**
- * @brief gets a Association Response info
- * @details Valid only in STA mode. This function gives the RSSI
- * values observed in all the channels at the time of scanning.
- * The length of the field is 1 greater that the total number of
- * channels supported. Byte 0 contains the number of channels while
- * each of Byte N contains the observed RSSI value for the channel index N.
- * @param[in,out] handle to the wifi driver,
- * array of scanned channels' RSSI
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,
- u32 u32RxPowerLevelLen)
+s32 host_int_get_rx_power_level(struct host_if_drv *hif_drv,
+ u8 *pu8RxPowerLevel,
+ u32 u32RxPowerLevelLen)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */
+ struct wid wid;
- strWID.u16WIDid = (u16)WID_RX_POWER_LEVEL;
- strWID.enuWIDtype = WID_STR;
- strWID.ps8WidVal = pu8RxPowerLevel;
- strWID.s32ValueSize = u32RxPowerLevelLen;
+ wid.id = (u16)WID_RX_POWER_LEVEL;
+ wid.type = WID_STR;
+ wid.val = pu8RxPowerLevel;
+ wid.size = u32RxPowerLevelLen;
-
- return s32Error;
+ return 0;
}
-/**
- * @brief sets a channel
- * @details
- * @param[in,out] handle to the wifi driver,
- * @param[in] Index of the channel to be set
- *|-------------------------------------------------------------------|
- | CHANNEL1 CHANNEL2 .... CHANNEL14 |
- | Input: 1 2 14 |
- ||-------------------------------------------------------------------|
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum)
+int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
-
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
-
- /* prepare the set channel message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_CHANNEL;
- strHostIFmsg.uniHostIFmsgBody.strHostIFSetChan.u8SetChan = u8ChNum;
- strHostIFmsg.drvHandler = hWFIDrv;
-
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
+ int result;
+ struct host_if_msg msg;
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
}
- return s32Error;
-}
-
-
-s32 host_int_wait_msg_queue_idle(void)
-{
- s32 s32Error = WILC_SUCCESS;
-
- tstrHostIFmsg strHostIFmsg;
-
- /* prepare the set driver handler message */
-
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_Q_IDLE;
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.id = HOST_IF_MSG_SET_CHANNEL;
+ msg.body.channel_info.set_ch = channel;
+ msg.drv = hif_drv;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result) {
+ PRINT_ER("wilc mq send fail\n");
+ return -EINVAL;
}
- /* wait untill MSG Q is empty */
- down(&hWaitResponse);
-
- return s32Error;
-
+ return 0;
}
-s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address)
+int host_int_wait_msg_queue_idle(void)
{
- s32 s32Error = WILC_SUCCESS;
-
- tstrHostIFmsg strHostIFmsg;
-
-
- /* prepare the set driver handler message */
-
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_WFIDRV_HANDLER;
- strHostIFmsg.uniHostIFmsgBody.strHostIfSetDrvHandler.u32Address = u32address;
- /* strHostIFmsg.drvHandler=hWFIDrv; */
-
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
+ int result = 0;
+ struct host_if_msg msg;
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.id = HOST_IF_MSG_Q_IDLE;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result) {
+ PRINT_ER("wilc mq send fail\n");
+ result = -EINVAL;
}
- return s32Error;
-}
-
+ down(&hif_sema_wait_response);
+ return result;
+}
-s32 host_int_set_operation_mode(tstrWILC_WFIDrv *hWFIDrv, u32 u32mode)
+int host_int_set_wfi_drv_handler(struct host_if_drv *hif_drv)
{
- s32 s32Error = WILC_SUCCESS;
-
- tstrHostIFmsg strHostIFmsg;
+ int result = 0;
+ struct host_if_msg msg;
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER;
+ msg.body.drv.handler = get_id_from_handler(hif_drv);
+ msg.drv = hif_drv;
- /* prepare the set driver handler message */
-
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_OPERATION_MODE;
- strHostIFmsg.uniHostIFmsgBody.strHostIfSetOperationMode.u32Mode = u32mode;
- strHostIFmsg.drvHandler = hWFIDrv;
-
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
-
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result) {
+ PRINT_ER("wilc mq send fail\n");
+ result = -EINVAL;
}
- return s32Error;
+ return result;
}
-/**
- * @brief gets the current channel index
- * @details
- * @param[in,out] handle to the wifi driver,
- * current channel index
- *|-----------------------------------------------------------------------|
- | CHANNEL1 CHANNEL2 .... CHANNEL14 |
- | Input: 1 2 14 |
- ||-----------------------------------------------------------------------|
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo)
+int host_int_set_operation_mode(struct host_if_drv *hif_drv, u32 mode)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
-
- if (pstrWFIDrv == NULL) {
- PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
- }
-
- /* prepare the Get Channel Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ int result = 0;
+ struct host_if_msg msg;
- strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_CHNL;
- strHostIFmsg.drvHandler = hWFIDrv;
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.id = HOST_IF_MSG_SET_OPERATION_MODE;
+ msg.body.mode.mode = mode;
+ msg.drv = hif_drv;
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- PRINT_ER("Failed to send get host channel param's message queue ");
- down(&(pstrWFIDrv->hSemGetCHNL));
- /* gu8Chnl = 11; */
-
- *pu8ChNo = gu8Chnl;
-
- WILC_CATCH(s32Error)
- {
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result) {
+ PRINT_ER("wilc mq send fail\n");
+ result = -EINVAL;
}
- return s32Error;
-
-
+ return result;
}
-
-/**
- * @brief host_int_test_set_int_wid
- * @details Test function for setting wids
- * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32 u32TestMemAddr
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_test_set_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 u32TestMemAddr)
+s32 host_int_get_host_chnl_num(struct host_if_drv *hif_drv, u8 *pu8ChNo)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
+ s32 result = 0;
+ struct host_if_msg msg;
-
- if (pstrWFIDrv == NULL) {
- PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
}
- /*prepare configuration packet*/
- strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS;
- strWID.enuWIDtype = WID_INT;
- strWID.ps8WidVal = (char *)&u32TestMemAddr;
- strWID.s32ValueSize = sizeof(u32);
+ memset(&msg, 0, sizeof(struct host_if_msg));
- /*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- if (s32Error) {
- PRINT_ER("Test Function: Failed to set wid value\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
- } else {
- PRINT_D(HOSTINF_DBG, "Successfully set wid value\n");
+ msg.id = HOST_IF_MSG_GET_CHNL;
+ msg.drv = hif_drv;
- }
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc mq send fail\n");
+ down(&hif_drv->hSemGetCHNL);
- WILC_CATCH(s32Error)
- {
+ *pu8ChNo = ch_no;
- }
- return s32Error;
+ return result;
}
-#ifdef WILC_AP_EXTERNAL_MLME
-/**
- * @brief host_int_get_inactive_time
- * @details
- * @param[in,out] handle to the wifi driver,
- * current sta macaddress, inactive_time
- * @return
- * @note
- * @author
- * @date
- * @version 1.0
- */
-s32 host_int_get_inactive_time(tstrWILC_WFIDrv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime)
+s32 host_int_get_inactive_time(struct host_if_drv *hif_drv,
+ const u8 *mac, u32 *pu32InactiveTime)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
+ s32 result = 0;
+ struct host_if_msg msg;
- if (pstrWFIDrv == NULL) {
- PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
}
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
-
-
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfStaInactiveT.mac,
- mac, ETH_ALEN);
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ memcpy(msg.body.mac_info.mac, mac, ETH_ALEN);
- strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_INACTIVETIME;
- strHostIFmsg.drvHandler = hWFIDrv;
+ msg.id = HOST_IF_MSG_GET_INACTIVETIME;
+ msg.drv = hif_drv;
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
PRINT_ER("Failed to send get host channel param's message queue ");
- down(&(pstrWFIDrv->hSemInactiveTime));
+ down(&hif_drv->hSemInactiveTime);
- *pu32InactiveTime = gu32InactiveTime;
+ *pu32InactiveTime = inactive_time;
- WILC_CATCH(s32Error)
- {
- }
-
- return s32Error;
+ return result;
}
-#endif
-/**
- * @brief host_int_test_get_int_wid
- * @details Test function for getting wids
- * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32* pu32TestMemAddr
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_test_get_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 *pu32TestMemAddr)
-{
-
- s32 s32Error = WILC_SUCCESS;
- tstrWID strWID;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
+s32 host_int_test_get_int_wid(struct host_if_drv *hif_drv, u32 *pu32TestMemAddr)
+{
+ s32 result = 0;
+ struct wid wid;
- if (pstrWFIDrv == NULL) {
- PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
}
- strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS;
- strWID.enuWIDtype = WID_INT;
- strWID.ps8WidVal = (s8 *)pu32TestMemAddr;
- strWID.s32ValueSize = sizeof(u32);
+ wid.id = (u16)WID_MEMORY_ADDRESS;
+ wid.type = WID_INT;
+ wid.val = (s8 *)pu32TestMemAddr;
+ wid.size = sizeof(u32);
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
- /*get the value by searching the local copy*/
- if (s32Error) {
- PRINT_ER("Test Function: Failed to get wid value\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
+ result = send_config_pkt(GET_CFG, &wid, 1,
+ get_id_from_handler(hif_drv));
+
+ if (result) {
+ PRINT_ER("Failed to get wid value\n");
+ return -EINVAL;
} else {
PRINT_D(HOSTINF_DBG, "Successfully got wid value\n");
-
}
- WILC_CATCH(s32Error)
- {
-
- }
- return s32Error;
+ return result;
}
-
-/**
- * @brief host_int_get_rssi
- * @details gets the currently maintained RSSI value for the station.
- * The received signal strength value in dB.
- * The range of valid values is -128 to 0.
- * @param[in,out] handle to the wifi driver,
- * rssi value in dB
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi)
+s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
{
- s32 s32Error = WILC_SUCCESS;
- tstrHostIFmsg strHostIFmsg;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
+ s32 result = 0;
+ struct host_if_msg msg;
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.id = HOST_IF_MSG_GET_RSSI;
+ msg.drv = hif_drv;
- /* prepare the Get RSSI Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
-
- strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_RSSI;
- strHostIFmsg.drvHandler = hWFIDrv;
-
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error) {
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result) {
PRINT_ER("Failed to send get host channel param's message queue ");
- return WILC_FAIL;
+ return -EFAULT;
}
- down(&(pstrWFIDrv->hSemGetRSSI));
-
+ down(&hif_drv->hSemGetRSSI);
- if (ps8Rssi == NULL) {
+ if (!ps8Rssi) {
PRINT_ER("RSS pointer value is null");
- return WILC_FAIL;
+ return -EFAULT;
}
+ *ps8Rssi = rssi;
- *ps8Rssi = gs8Rssi;
-
-
- return s32Error;
+ return result;
}
-s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd)
+s32 host_int_get_link_speed(struct host_if_drv *hif_drv, s8 *ps8lnkspd)
{
- tstrHostIFmsg strHostIFmsg;
- s32 s32Error = WILC_SUCCESS;
-
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
-
+ struct host_if_msg msg;
+ s32 result = 0;
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.id = HOST_IF_MSG_GET_LINKSPEED;
+ msg.drv = hif_drv;
- /* prepare the Get LINKSPEED Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
-
- strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_LINKSPEED;
- strHostIFmsg.drvHandler = hWFIDrv;
-
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error) {
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result) {
PRINT_ER("Failed to send GET_LINKSPEED to message queue ");
- return WILC_FAIL;
+ return -EFAULT;
}
- down(&(pstrWFIDrv->hSemGetLINKSPEED));
-
+ down(&hif_drv->hSemGetLINKSPEED);
- if (ps8lnkspd == NULL) {
+ if (!ps8lnkspd) {
PRINT_ER("LINKSPEED pointer value is null");
- return WILC_FAIL;
+ return -EFAULT;
}
+ *ps8lnkspd = link_speed;
- *ps8lnkspd = gs8lnkspd;
-
-
- return s32Error;
+ return result;
}
-s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics *pstrStatistics)
+s32 host_int_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
{
- s32 s32Error = WILC_SUCCESS;
- tstrHostIFmsg strHostIFmsg;
+ s32 result = 0;
+ struct host_if_msg msg;
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.id = HOST_IF_MSG_GET_STATISTICS;
+ msg.body.data = (char *)pstrStatistics;
+ msg.drv = hif_drv;
- /* prepare the Get RSSI Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
-
- strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_STATISTICS;
- strHostIFmsg.uniHostIFmsgBody.pUserData = (char *)pstrStatistics;
- strHostIFmsg.drvHandler = hWFIDrv;
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error) {
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result) {
PRINT_ER("Failed to send get host channel param's message queue ");
- return WILC_FAIL;
+ return -EFAULT;
}
- down(&hWaitResponse);
- return s32Error;
+ down(&hif_sema_wait_response);
+ return result;
}
-
-/**
- * @brief host_int_scan
- * @details scans a set of channels
- * @param[in,out] handle to the wifi driver,
- * @param[in] Scan source
- * Scan Type PASSIVE_SCAN = 0,
- * ACTIVE_SCAN = 1
- * Channels Array
- * Channels Array length
- * Scan Callback function
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource,
- u8 u8ScanType, u8 *pu8ChnlFreqList,
- u8 u8ChnlListLen, const u8 *pu8IEs,
- size_t IEsLen, tWILCpfScanResult ScanResult,
- void *pvUserArg, tstrHiddenNetwork *pstrHiddenNetwork)
+s32 host_int_scan(struct host_if_drv *hif_drv, u8 u8ScanSource,
+ u8 u8ScanType, u8 *pu8ChnlFreqList,
+ u8 u8ChnlListLen, const u8 *pu8IEs,
+ size_t IEsLen, wilc_scan_result ScanResult,
+ void *pvUserArg, struct hidden_network *pstrHiddenNetwork)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
- tenuScanConnTimer enuScanConnTimer;
-
- if (pstrWFIDrv == NULL || ScanResult == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ s32 result = 0;
+ struct host_if_msg msg;
+ if (!hif_drv || !ScanResult) {
+ PRINT_ER("hif_drv or ScanResult = NULL\n");
+ return -EFAULT;
+ }
- /* prepare the Scan Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_SCAN;
+ msg.id = HOST_IF_MSG_SCAN;
- if (pstrHiddenNetwork != NULL) {
- strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.strHiddenNetwork.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo;
- strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.strHiddenNetwork.u8ssidnum = pstrHiddenNetwork->u8ssidnum;
+ if (pstrHiddenNetwork) {
+ msg.body.scan_info.hidden_network.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo;
+ msg.body.scan_info.hidden_network.u8ssidnum = pstrHiddenNetwork->u8ssidnum;
} else
PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n");
- strHostIFmsg.drvHandler = hWFIDrv;
- strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ScanSource = u8ScanSource;
- strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ScanType = u8ScanType;
- strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pfScanResult = ScanResult;
- strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pvUserArg = pvUserArg;
+ msg.drv = hif_drv;
+ msg.body.scan_info.src = u8ScanSource;
+ msg.body.scan_info.type = u8ScanType;
+ msg.body.scan_info.result = ScanResult;
+ msg.body.scan_info.arg = pvUserArg;
- strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ChnlListLen = u8ChnlListLen;
- strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList = WILC_MALLOC(u8ChnlListLen); /* will be deallocated by the receiving thread */
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList,
- pu8ChnlFreqList, u8ChnlListLen);
+ msg.body.scan_info.ch_list_len = u8ChnlListLen;
+ msg.body.scan_info.ch_freq_list = kmalloc(u8ChnlListLen, GFP_KERNEL);
+ memcpy(msg.body.scan_info.ch_freq_list, pu8ChnlFreqList, u8ChnlListLen);
- strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.IEsLen = IEsLen;
- strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs = WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */
- memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs,
- pu8IEs, IEsLen);
+ msg.body.scan_info.ies_len = IEsLen;
+ msg.body.scan_info.ies = kmalloc(IEsLen, GFP_KERNEL);
+ memcpy(msg.body.scan_info.ies, pu8IEs, IEsLen);
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error) {
- PRINT_ER("Error in sending message queue scanning parameters: Error(%d)\n", s32Error);
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result) {
+ PRINT_ER("Error in sending message queue\n");
+ return -EINVAL;
}
- enuScanConnTimer = SCAN_TIMER;
PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n");
- pstrWFIDrv->hScanTimer.data = (unsigned long)hWFIDrv;
- mod_timer(&pstrWFIDrv->hScanTimer,
+ hif_drv->hScanTimer.data = (unsigned long)hif_drv;
+ mod_timer(&hif_drv->hScanTimer,
jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT));
- WILC_CATCH(s32Error)
- {
-
- }
- return s32Error;
-
+ return result;
}
-/**
- * @brief hif_set_cfg
- * @details sets configuration wids values
- * @param[in,out] handle to the wifi driver,
- * @param[in] WID, WID value
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, tstrCfgParamVal *pstrCfgParamVal)
-{
-
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
-
- tstrHostIFmsg strHostIFmsg;
-
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
- /* prepare the WiphyParams Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_CFG_PARAMS;
- strHostIFmsg.uniHostIFmsgBody.strHostIFCfgParamAttr.pstrCfgParamVal = *pstrCfgParamVal;
- strHostIFmsg.drvHandler = hWFIDrv;
-
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
+s32 hif_set_cfg(struct host_if_drv *hif_drv,
+ struct cfg_param_val *pstrCfgParamVal)
+{
+ s32 result = 0;
+ struct host_if_msg msg;
- WILC_CATCH(s32Error)
- {
+ if (!hif_drv) {
+ PRINT_ER("hif_drv NULL\n");
+ return -EFAULT;
}
- return s32Error;
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.id = HOST_IF_MSG_CFG_PARAMS;
+ msg.body.cfg_info.cfg_attr_info = *pstrCfgParamVal;
+ msg.drv = hif_drv;
-}
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ return result;
+}
-/**
- * @brief hif_get_cfg
- * @details gets configuration wids values
- * @param[in,out] handle to the wifi driver,
- * WID value
- * @param[in] WID,
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- *
- * @date 8 March 2012
- * @version 1.0
- */
-s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value)
+s32 hif_get_cfg(struct host_if_drv *hif_drv, u16 u16WID, u16 *pu16WID_Value)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
+ s32 result = 0;
- down(&(pstrWFIDrv->gtOsCfgValuesSem));
+ down(&hif_drv->gtOsCfgValuesSem);
- if (pstrWFIDrv == NULL) {
- PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n");
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ if (!hif_drv) {
+ PRINT_ER("hif_drv NULL\n");
+ return -EFAULT;
}
PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n");
switch (u16WID) {
-
case WID_BSS_TYPE:
- *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.bss_type;
+ *pu16WID_Value = (u16)hif_drv->strCfgValues.bss_type;
break;
case WID_AUTH_TYPE:
- *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.auth_type;
+ *pu16WID_Value = (u16)hif_drv->strCfgValues.auth_type;
break;
case WID_AUTH_TIMEOUT:
- *pu16WID_Value = pstrWFIDrv->strCfgValues.auth_timeout;
+ *pu16WID_Value = hif_drv->strCfgValues.auth_timeout;
break;
case WID_POWER_MANAGEMENT:
- *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.power_mgmt_mode;
+ *pu16WID_Value = (u16)hif_drv->strCfgValues.power_mgmt_mode;
break;
case WID_SHORT_RETRY_LIMIT:
- *pu16WID_Value = pstrWFIDrv->strCfgValues.short_retry_limit;
+ *pu16WID_Value = hif_drv->strCfgValues.short_retry_limit;
break;
case WID_LONG_RETRY_LIMIT:
- *pu16WID_Value = pstrWFIDrv->strCfgValues.long_retry_limit;
+ *pu16WID_Value = hif_drv->strCfgValues.long_retry_limit;
break;
case WID_FRAG_THRESHOLD:
- *pu16WID_Value = pstrWFIDrv->strCfgValues.frag_threshold;
+ *pu16WID_Value = hif_drv->strCfgValues.frag_threshold;
break;
case WID_RTS_THRESHOLD:
- *pu16WID_Value = pstrWFIDrv->strCfgValues.rts_threshold;
+ *pu16WID_Value = hif_drv->strCfgValues.rts_threshold;
break;
case WID_PREAMBLE:
- *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.preamble_type;
+ *pu16WID_Value = (u16)hif_drv->strCfgValues.preamble_type;
break;
case WID_SHORT_SLOT_ALLOWED:
- *pu16WID_Value = (u16) pstrWFIDrv->strCfgValues.short_slot_allowed;
+ *pu16WID_Value = (u16) hif_drv->strCfgValues.short_slot_allowed;
break;
case WID_11N_TXOP_PROT_DISABLE:
- *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.txop_prot_disabled;
+ *pu16WID_Value = (u16)hif_drv->strCfgValues.txop_prot_disabled;
break;
case WID_BEACON_INTERVAL:
- *pu16WID_Value = pstrWFIDrv->strCfgValues.beacon_interval;
+ *pu16WID_Value = hif_drv->strCfgValues.beacon_interval;
break;
case WID_DTIM_PERIOD:
- *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.dtim_period;
+ *pu16WID_Value = (u16)hif_drv->strCfgValues.dtim_period;
break;
case WID_SITE_SURVEY:
- *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.site_survey_enabled;
+ *pu16WID_Value = (u16)hif_drv->strCfgValues.site_survey_enabled;
break;
case WID_SITE_SURVEY_SCAN_TIME:
- *pu16WID_Value = pstrWFIDrv->strCfgValues.site_survey_scan_time;
+ *pu16WID_Value = hif_drv->strCfgValues.site_survey_scan_time;
break;
case WID_ACTIVE_SCAN_TIME:
- *pu16WID_Value = pstrWFIDrv->strCfgValues.active_scan_time;
+ *pu16WID_Value = hif_drv->strCfgValues.active_scan_time;
break;
case WID_PASSIVE_SCAN_TIME:
- *pu16WID_Value = pstrWFIDrv->strCfgValues.passive_scan_time;
+ *pu16WID_Value = hif_drv->strCfgValues.passive_scan_time;
break;
case WID_CURRENT_TX_RATE:
- *pu16WID_Value = pstrWFIDrv->strCfgValues.curr_tx_rate;
+ *pu16WID_Value = hif_drv->strCfgValues.curr_tx_rate;
break;
default:
break;
}
- up(&(pstrWFIDrv->gtOsCfgValuesSem));
-
- WILC_CATCH(s32Error)
- {
- }
- return s32Error;
-
-}
+ up(&hif_drv->gtOsCfgValuesSem);
-/*****************************************************************************/
-/* Notification Functions */
-/*****************************************************************************/
-/**
- * @brief notifies host with join and leave requests
- * @details This function prepares an Information frame having the
- * information about a joining/leaving station.
- * @param[in,out] handle to the wifi driver,
- * @param[in] 6 byte Sta Adress
- * Join or leave flag:
- * Join = 1,
- * Leave =0
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-void host_int_send_join_leave_info_to_host
- (u16 assocId, u8 *stationAddr, bool joining)
-{
+ return result;
}
-/**
- * @brief notifies host with stations found in scan
- * @details sends the beacon/probe response from scan
- * @param[in,out] handle to the wifi driver,
- * @param[in] Sta Address,
- * Frame length,
- * Rssi of the Station found
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
static void GetPeriodicRSSI(unsigned long arg)
{
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg;
+ struct host_if_drv *hif_drv = (struct host_if_drv *)arg;
- if (pstrWFIDrv == NULL) {
+ if (!hif_drv) {
PRINT_ER("Driver handler is NULL\n");
return;
}
- if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) {
- s32 s32Error = WILC_SUCCESS;
- tstrHostIFmsg strHostIFmsg;
+ if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) {
+ s32 result = 0;
+ struct host_if_msg msg;
- /* prepare the Get RSSI Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_RSSI;
- strHostIFmsg.drvHandler = pstrWFIDrv;
+ msg.id = HOST_IF_MSG_GET_RSSI;
+ msg.drv = hif_drv;
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error) {
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result) {
PRINT_ER("Failed to send get host channel param's message queue ");
return;
}
}
- g_hPeriodicRSSI.data = (unsigned long)pstrWFIDrv;
- mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000));
-}
-
-
-void host_int_send_network_info_to_host
- (u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi)
-{
+ periodic_rssi.data = (unsigned long)hif_drv;
+ mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000));
}
-/**
- * @brief host_int_init
- * @details host interface initialization function
- * @param[in,out] handle to the wifi driver,
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-static u32 u32Intialized;
-static u32 msgQ_created;
-static u32 clients_count;
-s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
+s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv;
-
- /*if(u32Intialized == 1)
- * {
- * PRINT_D(HOSTINF_DBG,"Host interface is previously initialized\n");
- * *phWFIDrv = (WILC_WFIDrvHandle)gWFiDrvHandle; //Will be adjusted later for P2P
- * return 0;
- * } */
- PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1);
+ s32 result = 0;
+ struct host_if_drv *hif_drv;
+ int err;
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
- gbScanWhileConnected = false;
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
- sema_init(&hWaitResponse, 0);
+ PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1);
+ scan_while_connected = false;
+ sema_init(&hif_sema_wait_response, 0);
- /*Allocate host interface private structure*/
- pstrWFIDrv = WILC_MALLOC(sizeof(tstrWILC_WFIDrv));
- if (pstrWFIDrv == NULL) {
- /* WILC_ERRORREPORT(s32Error,WILC_NO_MEM); */
- s32Error = WILC_NO_MEM;
- PRINT_ER("Failed to allocate memory\n");
+ hif_drv = kzalloc(sizeof(struct host_if_drv), GFP_KERNEL);
+ if (!hif_drv) {
+ result = -ENOMEM;
+ goto _fail_;
+ }
+ *hif_drv_handler = hif_drv;
+ err = add_handler_in_list(hif_drv);
+ if (err) {
+ result = -EFAULT;
goto _fail_timer_2;
}
- memset(pstrWFIDrv, 0, sizeof(tstrWILC_WFIDrv));
- /*return driver handle to user*/
- *phWFIDrv = pstrWFIDrv;
- /*save into globl handle*/
-
- #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
g_obtainingIP = false;
- #endif
- PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", pstrWFIDrv);
- /* /////////////////////////////////////// */
+ PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", hif_drv);
if (clients_count == 0) {
- sema_init(&hSemHostIFthrdEnd, 0);
- sema_init(&hSemDeinitDrvHandle, 0);
- /*BugID_5348*/
- sema_init(&hSemHostIntDeinit, 1);
+ sema_init(&hif_sema_thread, 0);
+ sema_init(&hif_sema_driver, 0);
+ sema_init(&hif_sema_deinit, 1);
}
- sema_init(&(pstrWFIDrv->hSemTestKeyBlock), 0);
- sema_init(&(pstrWFIDrv->hSemTestDisconnectBlock), 0);
- sema_init(&(pstrWFIDrv->hSemGetRSSI), 0);
- sema_init(&(pstrWFIDrv->hSemGetLINKSPEED), 0);
- sema_init(&(pstrWFIDrv->hSemGetCHNL), 0);
- sema_init(&(pstrWFIDrv->hSemInactiveTime), 0);
-
- /* /////////////////////////////////////// */
-
-
+ sema_init(&hif_drv->hSemTestKeyBlock, 0);
+ sema_init(&hif_drv->hSemTestDisconnectBlock, 0);
+ sema_init(&hif_drv->hSemGetRSSI, 0);
+ sema_init(&hif_drv->hSemGetLINKSPEED, 0);
+ sema_init(&hif_drv->hSemGetCHNL, 0);
+ sema_init(&hif_drv->hSemInactiveTime, 0);
PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count);
if (clients_count == 0) {
- s32Error = WILC_MsgQueueCreate(&gMsgQHostIF);
+ result = wilc_mq_create(&hif_msg_q);
- if (s32Error < 0) {
+ if (result < 0) {
PRINT_ER("Failed to creat MQ\n");
goto _fail_;
}
- msgQ_created = 1;
- HostIFthreadHandler = kthread_run(hostIFthread, NULL, "WILC_kthread");
- if (IS_ERR(HostIFthreadHandler)) {
+
+ hif_thread_handler = kthread_run(hostIFthread, wilc,
+ "WILC_kthread");
+
+ if (IS_ERR(hif_thread_handler)) {
PRINT_ER("Failed to creat Thread\n");
- s32Error = WILC_FAIL;
+ result = -EFAULT;
goto _fail_mq_;
}
- setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI,
- (unsigned long)pstrWFIDrv);
- mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000));
+ setup_timer(&periodic_rssi, GetPeriodicRSSI,
+ (unsigned long)hif_drv);
+ mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000));
}
+ setup_timer(&hif_drv->hScanTimer, TimerCB_Scan, 0);
- setup_timer(&pstrWFIDrv->hScanTimer, TimerCB_Scan, 0);
-
- setup_timer(&pstrWFIDrv->hConnectTimer, TimerCB_Connect, 0);
-
- #ifdef WILC_P2P
- /*Remain on channel timer*/
- setup_timer(&pstrWFIDrv->hRemainOnChannel, ListenTimerCB, 0);
- #endif
-
- sema_init(&(pstrWFIDrv->gtOsCfgValuesSem), 1);
- down(&(pstrWFIDrv->gtOsCfgValuesSem));
+ setup_timer(&hif_drv->hConnectTimer, TimerCB_Connect, 0);
- pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE;
- /* gWFiDrvHandle->bPendingConnRequest = false; */
+ setup_timer(&hif_drv->hRemainOnChannel, ListenTimerCB, 0);
- /*Initialize CFG WIDS Defualt Values*/
+ sema_init(&hif_drv->gtOsCfgValuesSem, 1);
+ down(&hif_drv->gtOsCfgValuesSem);
- pstrWFIDrv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF;
- pstrWFIDrv->strCfgValues.scan_source = DEFAULT_SCAN;
- pstrWFIDrv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME;
- pstrWFIDrv->strCfgValues.passive_scan_time = PASSIVE_SCAN_TIME;
- pstrWFIDrv->strCfgValues.curr_tx_rate = AUTORATE;
+ hif_drv->enuHostIFstate = HOST_IF_IDLE;
+ hif_drv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF;
+ hif_drv->strCfgValues.scan_source = DEFAULT_SCAN;
+ hif_drv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME;
+ hif_drv->strCfgValues.passive_scan_time = PASSIVE_SCAN_TIME;
+ hif_drv->strCfgValues.curr_tx_rate = AUTORATE;
-
- #ifdef WILC_P2P
-
- pstrWFIDrv->u64P2p_MgmtTimeout = 0;
-
- #endif
+ hif_drv->u64P2p_MgmtTimeout = 0;
PRINT_INFO(HOSTINF_DBG, "Initialization values, Site survey value: %d\n Scan source: %d\n Active scan time: %d\n Passive scan time: %d\nCurrent tx Rate = %d\n",
- pstrWFIDrv->strCfgValues.site_survey_enabled, pstrWFIDrv->strCfgValues.scan_source,
- pstrWFIDrv->strCfgValues.active_scan_time, pstrWFIDrv->strCfgValues.passive_scan_time,
- pstrWFIDrv->strCfgValues.curr_tx_rate);
-
-
- up(&(pstrWFIDrv->gtOsCfgValuesSem));
-
- /*TODO Code to setup simulation to be removed later*/
- /*Intialize configurator module*/
- s32Error = CoreConfiguratorInit();
- if (s32Error < 0) {
- PRINT_ER("Failed to initialize core configurator\n");
- goto _fail_mem_;
- }
+ hif_drv->strCfgValues.site_survey_enabled, hif_drv->strCfgValues.scan_source,
+ hif_drv->strCfgValues.active_scan_time, hif_drv->strCfgValues.passive_scan_time,
+ hif_drv->strCfgValues.curr_tx_rate);
- u32Intialized = 1;
- clients_count++; /* increase number of created entities */
+ up(&hif_drv->gtOsCfgValuesSem);
- return s32Error;
+ clients_count++;
+ return result;
-_fail_mem_:
- if (pstrWFIDrv != NULL)
- kfree(pstrWFIDrv);
-#ifdef WILC_P2P
- del_timer_sync(&pstrWFIDrv->hRemainOnChannel);
-#endif
_fail_timer_2:
- up(&(pstrWFIDrv->gtOsCfgValuesSem));
- del_timer_sync(&pstrWFIDrv->hConnectTimer);
- del_timer_sync(&pstrWFIDrv->hScanTimer);
- kthread_stop(HostIFthreadHandler);
+ up(&hif_drv->gtOsCfgValuesSem);
+ del_timer_sync(&hif_drv->hConnectTimer);
+ del_timer_sync(&hif_drv->hScanTimer);
+ kthread_stop(hif_thread_handler);
_fail_mq_:
- WILC_MsgQueueDestroy(&gMsgQHostIF);
+ wilc_mq_destroy(&hif_msg_q);
_fail_:
- return s32Error;
-
-
+ return result;
}
-/**
- * @brief host_int_deinit
- * @details host interface initialization function
- * @param[in,out] handle to the wifi driver,
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-
-s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv)
-{
- s32 s32Error = WILC_SUCCESS;
- tstrHostIFmsg strHostIFmsg;
-
- /*obtain driver handle*/
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- /*if(u32Intialized == 0)
- * {
- * PRINT_ER("Host Interface is not initialized\n");
- * return 0;
- * }*/
-
- /*BugID_5348*/
+s32 host_int_deinit(struct host_if_drv *hif_drv)
+{
+ s32 result = 0;
+ struct host_if_msg msg;
+ int ret;
- if (pstrWFIDrv == NULL) {
- PRINT_ER("pstrWFIDrv = NULL\n");
+ if (!hif_drv) {
+ PRINT_ER("hif_drv = NULL\n");
return 0;
}
- down(&hSemHostIntDeinit);
+ down(&hif_sema_deinit);
- terminated_handle = pstrWFIDrv;
+ terminated_handle = hif_drv;
PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count);
- /*BugID_5348*/
- /*Destroy all timers before acquiring hSemDeinitDrvHandle*/
- /*to guarantee handling all messages befor proceeding*/
- if (del_timer_sync(&pstrWFIDrv->hScanTimer)) {
+ if (del_timer_sync(&hif_drv->hScanTimer))
PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n");
- /* msleep(HOST_IF_SCAN_TIMEOUT+1000); */
- }
- if (del_timer_sync(&pstrWFIDrv->hConnectTimer)) {
+ if (del_timer_sync(&hif_drv->hConnectTimer))
PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n");
- /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */
- }
-
- if (del_timer_sync(&g_hPeriodicRSSI)) {
+ if (del_timer_sync(&periodic_rssi))
PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n");
- /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */
- }
- #ifdef WILC_P2P
- /*Destroy Remain-onchannel Timer*/
- del_timer_sync(&pstrWFIDrv->hRemainOnChannel);
- #endif
+ del_timer_sync(&hif_drv->hRemainOnChannel);
host_int_set_wfi_drv_handler(NULL);
- down(&hSemDeinitDrvHandle);
-
+ down(&hif_sema_driver);
- /*Calling the CFG80211 scan done function with the abort flag set to true*/
- if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) {
- pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL,
- pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL);
+ if (hif_drv->usr_scan_req.pfUserScanResult) {
+ hif_drv->usr_scan_req.pfUserScanResult(SCAN_EVENT_ABORTED, NULL,
+ hif_drv->usr_scan_req.u32UserScanPvoid, NULL);
- pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL;
+ hif_drv->usr_scan_req.pfUserScanResult = NULL;
}
- /*deinit configurator and simulator*/
- CoreConfiguratorDeInit();
- pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE;
+ hif_drv->enuHostIFstate = HOST_IF_IDLE;
- gbScanWhileConnected = false;
+ scan_while_connected = false;
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
if (clients_count == 1) {
- if (del_timer_sync(&g_hPeriodicRSSI)) {
+ if (del_timer_sync(&periodic_rssi))
PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n");
- /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */
- }
- strHostIFmsg.u16MsgId = HOST_IF_MSG_EXIT;
- strHostIFmsg.drvHandler = hWFIDrv;
+ msg.id = HOST_IF_MSG_EXIT;
+ msg.drv = hif_drv;
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error != WILC_SUCCESS)
- PRINT_ER("Error in sending deinit's message queue message function: Error(%d)\n", s32Error);
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result != 0)
+ PRINT_ER("Error in sending deinit's message queue message function: Error(%d)\n", result);
- down(&hSemHostIFthrdEnd);
+ down(&hif_sema_thread);
- WILC_MsgQueueDestroy(&gMsgQHostIF);
- msgQ_created = 0;
+ wilc_mq_destroy(&hif_msg_q);
}
- down(&(pstrWFIDrv->gtOsCfgValuesSem));
+ down(&hif_drv->gtOsCfgValuesSem);
- /*Setting the gloabl driver handler with NULL*/
- u32Intialized = 0;
- /* gWFiDrvHandle = NULL; */
- if (pstrWFIDrv != NULL) {
- kfree(pstrWFIDrv);
- /* pstrWFIDrv=NULL; */
+ ret = remove_handler_in_list(hif_drv);
+ if (ret)
+ result = -ENOENT;
- }
+ kfree(hif_drv);
- clients_count--; /* Decrease number of created entities */
+ clients_count--;
terminated_handle = NULL;
- up(&hSemHostIntDeinit);
- return s32Error;
+ up(&hif_sema_deinit);
+ return result;
}
-
-/**
- * @brief NetworkInfoReceived
- * @details function to to be called when network info packet is received
- * @param[in] pu8Buffer the received packet
- * @param[in] u32Length length of the received packet
- * @return none
- * @note
- * @author
- * @date 1 Mar 2012
- * @version 1.0
- */
void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length)
{
- s32 s32Error = WILC_SUCCESS;
- tstrHostIFmsg strHostIFmsg;
- u32 drvHandler;
- tstrWILC_WFIDrv *pstrWFIDrv = NULL;
+ s32 result = 0;
+ struct host_if_msg msg;
+ int id;
+ struct host_if_drv *hif_drv = NULL;
- drvHandler = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
- pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
+ id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
+ hif_drv = get_handler_from_id(id);
-
-
-
- if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) {
- PRINT_ER("NetworkInfo received but driver not init[%p]\n", pstrWFIDrv);
+ if (!hif_drv || hif_drv == terminated_handle) {
+ PRINT_ER("NetworkInfo received but driver not init[%p]\n", hif_drv);
return;
}
- /* prepare the Asynchronous Network Info message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_NTWRK_INFO;
- strHostIFmsg.drvHandler = pstrWFIDrv;
+ msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO;
+ msg.drv = hif_drv;
- strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.u32Length = u32Length;
- strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer = WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */
- memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer,
- pu8Buffer, u32Length);
+ msg.body.net_info.len = u32Length;
+ msg.body.net_info.buffer = kmalloc(u32Length, GFP_KERNEL);
+ memcpy(msg.body.net_info.buffer, pu8Buffer, u32Length);
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", s32Error);
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", result);
}
-/**
- * @brief GnrlAsyncInfoReceived
- * @details function to be called when general Asynchronous info packet is received
- * @param[in] pu8Buffer the received packet
- * @param[in] u32Length length of the received packet
- * @return none
- * @note
- * @author
- * @date 15 Mar 2012
- * @version 1.0
- */
void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length)
{
- s32 s32Error = WILC_SUCCESS;
- tstrHostIFmsg strHostIFmsg;
- u32 drvHandler;
- tstrWILC_WFIDrv *pstrWFIDrv = NULL;
+ s32 result = 0;
+ struct host_if_msg msg;
+ int id;
+ struct host_if_drv *hif_drv = NULL;
- /*BugID_5348*/
- down(&hSemHostIntDeinit);
+ down(&hif_sema_deinit);
- drvHandler = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
- pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
+ id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
+ hif_drv = get_handler_from_id(id);
PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n");
-
- if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) {
+ if (!hif_drv || hif_drv == terminated_handle) {
PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n");
- /*BugID_5348*/
- up(&hSemHostIntDeinit);
+ up(&hif_sema_deinit);
return;
}
- if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL) {
- /* received mac status is not needed when there is no current Connect Request */
+ if (!hif_drv->usr_conn_req.pfUserConnectResult) {
PRINT_ER("Received mac status is not needed when there is no current Connect Reques\n");
- /*BugID_5348*/
- up(&hSemHostIntDeinit);
+ up(&hif_sema_deinit);
return;
}
- /* prepare the General Asynchronous Info message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO;
+ msg.drv = hif_drv;
- strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO;
- strHostIFmsg.drvHandler = pstrWFIDrv;
+ msg.body.async_info.len = u32Length;
+ msg.body.async_info.buffer = kmalloc(u32Length, GFP_KERNEL);
+ memcpy(msg.body.async_info.buffer, pu8Buffer, u32Length);
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("Error in sending message queue asynchronous message info: Error(%d)\n", result);
- strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.u32Length = u32Length;
- strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer = WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */
- memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer,
- pu8Buffer, u32Length);
-
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- PRINT_ER("Error in sending message queue asynchronous message info: Error(%d)\n", s32Error);
-
- /*BugID_5348*/
- up(&hSemHostIntDeinit);
+ up(&hif_sema_deinit);
}
-/**
- * @brief host_int_ScanCompleteReceived
- * @details Setting scan complete received notifcation in message queue
- * @param[in] u8* pu8Buffer, u32 u32Length
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length)
{
- s32 s32Error = WILC_SUCCESS;
- tstrHostIFmsg strHostIFmsg;
- u32 drvHandler;
- tstrWILC_WFIDrv *pstrWFIDrv = NULL;
-
- drvHandler = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
- pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler;
+ s32 result = 0;
+ struct host_if_msg msg;
+ int id;
+ struct host_if_drv *hif_drv = NULL;
+ id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
+ hif_drv = get_handler_from_id(id);
- PRINT_D(GENERIC_DBG, "Scan notification received %p\n", pstrWFIDrv);
+ PRINT_D(GENERIC_DBG, "Scan notification received %p\n", hif_drv);
- if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle)
+ if (!hif_drv || hif_drv == terminated_handle)
return;
- /*if there is an ongoing scan request*/
- if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) {
- /* prepare theScan Done message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ if (hif_drv->usr_scan_req.pfUserScanResult) {
+ memset(&msg, 0, sizeof(struct host_if_msg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_SCAN_COMPLETE;
- strHostIFmsg.drvHandler = pstrWFIDrv;
+ msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE;
+ msg.drv = hif_drv;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("Error in sending message queue scan complete parameters: Error(%d)\n", result);
+ }
- /* will be deallocated by the receiving thread */
- /*no need to send message body*/
+ return;
+}
- /*strHostIFmsg.uniHostIFmsgBody.strScanComplete.u32Length = u32Length;
- * strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer = (u8*)WILC_MALLOC(u32Length);
- * memcpy(strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer,
- * pu8Buffer, u32Length); */
+s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID,
+ u32 u32duration, u16 chan,
+ wilc_remain_on_chan_expired RemainOnChanExpired,
+ wilc_remain_on_chan_ready RemainOnChanReady,
+ void *pvUserArg)
+{
+ s32 result = 0;
+ struct host_if_msg msg;
- /* send the message */
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- PRINT_ER("Error in sending message queue scan complete parameters: Error(%d)\n", s32Error);
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
}
+ memset(&msg, 0, sizeof(struct host_if_msg));
- return;
+ msg.id = HOST_IF_MSG_REMAIN_ON_CHAN;
+ msg.body.remain_on_ch.u16Channel = chan;
+ msg.body.remain_on_ch.pRemainOnChanExpired = RemainOnChanExpired;
+ msg.body.remain_on_ch.pRemainOnChanReady = RemainOnChanReady;
+ msg.body.remain_on_ch.pVoid = pvUserArg;
+ msg.body.remain_on_ch.u32duration = u32duration;
+ msg.body.remain_on_ch.u32ListenSessionID = u32SessionID;
+ msg.drv = hif_drv;
+
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc mq send fail\n");
+ return result;
}
-#ifdef WILC_P2P
-/**
- * @brief host_int_remain_on_channel
- * @details
- * @param[in] Handle to wifi driver
- * Duration to remain on channel
- * Channel to remain on
- * Pointer to fn to be called on receive frames in listen state
- * Pointer to remain-on-channel expired fn
- * Priv
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-s32 host_int_remain_on_channel(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, tWILCpfRemainOnChanExpired RemainOnChanExpired, tWILCpfRemainOnChanReady RemainOnChanReady, void *pvUserArg)
+s32 host_int_ListenStateExpired(struct host_if_drv *hif_drv, u32 u32SessionID)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
-
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
-
- /* prepare the remainonchan Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
-
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_REMAIN_ON_CHAN;
- strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u16Channel = chan;
- strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.pRemainOnChanExpired = RemainOnChanExpired;
- strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.pRemainOnChanReady = RemainOnChanReady;
- strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.pVoid = pvUserArg;
- strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32duration = u32duration;
- strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID;
- strHostIFmsg.drvHandler = hWFIDrv;
-
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
+ s32 result = 0;
+ struct host_if_msg msg;
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
}
- return s32Error;
-}
+ del_timer(&hif_drv->hRemainOnChannel);
-/**
- * @brief host_int_ListenStateExpired
- * @details
- * @param[in] Handle to wifi driver
- * Duration to remain on channel
- * Channel to remain on
- * Pointer to fn to be called on receive frames in listen state
- * Pointer to remain-on-channel expired fn
- * Priv
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID)
-{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
-
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
-
- /*Stopping remain-on-channel timer*/
- del_timer(&pstrWFIDrv->hRemainOnChannel);
-
- /* prepare the timer fire Message */
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
- strHostIFmsg.u16MsgId = HOST_IF_MSG_LISTEN_TIMER_FIRED;
- strHostIFmsg.drvHandler = hWFIDrv;
- strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID;
-
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED;
+ msg.drv = hif_drv;
+ msg.body.remain_on_ch.u32ListenSessionID = u32SessionID;
- }
- return s32Error;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc mq send fail\n");
+
+ return result;
}
-/**
- * @brief host_int_frame_register
- * @details
- * @param[in] Handle to wifi driver
- * @return Error code.
- * @author
- * @date
- * @version 1.0*/
-s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bReg)
+s32 host_int_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
+ s32 result = 0;
+ struct host_if_msg msg;
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_REGISTER_FRAME;
+ msg.id = HOST_IF_MSG_REGISTER_FRAME;
switch (u16FrameType) {
case ACTION:
PRINT_D(HOSTINF_DBG, "ACTION\n");
- strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.u8Regid = ACTION_FRM_IDX;
+ msg.body.reg_frame.u8Regid = ACTION_FRM_IDX;
break;
case PROBE_REQ:
PRINT_D(HOSTINF_DBG, "PROBE REQ\n");
- strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.u8Regid = PROBE_REQ_IDX;
+ msg.body.reg_frame.u8Regid = PROBE_REQ_IDX;
break;
default:
PRINT_D(HOSTINF_DBG, "Not valid frame type\n");
break;
}
- strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.u16FrameType = u16FrameType;
- strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.bReg = bReg;
- strHostIFmsg.drvHandler = hWFIDrv;
-
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
-
- }
-
- return s32Error;
+ msg.body.reg_frame.u16FrameType = u16FrameType;
+ msg.body.reg_frame.bReg = bReg;
+ msg.drv = hif_drv;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc mq send fail\n");
+ return result;
}
-#endif
-
-#ifdef WILC_AP_EXTERNAL_MLME
-/**
- * @brief host_int_add_beacon
- * @details Setting add beacon params in message queue
- * @param[in] WILC_WFIDrvHandle hWFIDrv, u32 u32Interval,
- * u32 u32DTIMPeriod,u32 u32HeadLen, u8* pu8Head,
- * u32 u32TailLen, u8* pu8Tail
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval,
- u32 u32DTIMPeriod,
- u32 u32HeadLen, u8 *pu8Head,
- u32 u32TailLen, u8 *pu8Tail)
+
+s32 host_int_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval,
+ u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head,
+ u32 u32TailLen, u8 *pu8Tail)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
- tstrHostIFSetBeacon *pstrSetBeaconParam = &strHostIFmsg.uniHostIFmsgBody.strHostIFSetBeacon;
+ s32 result = 0;
+ struct host_if_msg msg;
+ struct beacon_attr *pstrSetBeaconParam = &msg.body.beacon_info;
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n");
+ msg.id = HOST_IF_MSG_ADD_BEACON;
+ msg.drv = hif_drv;
+ pstrSetBeaconParam->interval = u32Interval;
+ pstrSetBeaconParam->dtim_period = u32DTIMPeriod;
+ pstrSetBeaconParam->head_len = u32HeadLen;
+ pstrSetBeaconParam->head = kmemdup(pu8Head, u32HeadLen, GFP_KERNEL);
+ if (!pstrSetBeaconParam->head) {
+ result = -ENOMEM;
+ goto ERRORHANDLER;
+ }
+ pstrSetBeaconParam->tail_len = u32TailLen;
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_BEACON;
- strHostIFmsg.drvHandler = hWFIDrv;
- pstrSetBeaconParam->u32Interval = u32Interval;
- pstrSetBeaconParam->u32DTIMPeriod = u32DTIMPeriod;
- pstrSetBeaconParam->u32HeadLen = u32HeadLen;
- pstrSetBeaconParam->pu8Head = WILC_MALLOC(u32HeadLen);
- if (pstrSetBeaconParam->pu8Head == NULL)
- WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
- memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen);
- pstrSetBeaconParam->u32TailLen = u32TailLen;
-
- /* Bug 4599 : if tail length = 0 skip allocating & copying */
if (u32TailLen > 0) {
- pstrSetBeaconParam->pu8Tail = WILC_MALLOC(u32TailLen);
- if (pstrSetBeaconParam->pu8Tail == NULL)
- WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
- memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen);
+ pstrSetBeaconParam->tail = kmemdup(pu8Tail, u32TailLen,
+ GFP_KERNEL);
+ if (!pstrSetBeaconParam->tail) {
+ result = -ENOMEM;
+ goto ERRORHANDLER;
+ }
} else {
- pstrSetBeaconParam->pu8Tail = NULL;
+ pstrSetBeaconParam->tail = NULL;
}
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc mq send fail\n");
- WILC_CATCH(s32Error)
- {
- if (pstrSetBeaconParam->pu8Head != NULL)
- kfree(pstrSetBeaconParam->pu8Head);
+ERRORHANDLER:
+ if (result) {
+ kfree(pstrSetBeaconParam->head);
- if (pstrSetBeaconParam->pu8Tail != NULL)
- kfree(pstrSetBeaconParam->pu8Tail);
+ kfree(pstrSetBeaconParam->tail);
}
- return s32Error;
-
+ return result;
}
-
-/**
- * @brief host_int_del_beacon
- * @details Setting add beacon params in message queue
- * @param[in] WILC_WFIDrvHandle hWFIDrv
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv)
+s32 host_int_del_beacon(struct host_if_drv *hif_drv)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
+ s32 result = 0;
+ struct host_if_msg msg;
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_BEACON;
- strHostIFmsg.drvHandler = hWFIDrv;
+ msg.id = HOST_IF_MSG_DEL_BEACON;
+ msg.drv = hif_drv;
PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n");
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- WILC_ERRORCHECK(s32Error);
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc_mq_send fail\n");
- WILC_CATCH(s32Error)
- {
- }
- return s32Error;
+ return result;
}
-
-/**
- * @brief host_int_add_station
- * @details Setting add station params in message queue
- * @param[in] WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam* pstrStaParams
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams)
+s32 host_int_add_station(struct host_if_drv *hif_drv,
+ struct add_sta_param *pstrStaParams)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
- tstrWILC_AddStaParam *pstrAddStationMsg = &strHostIFmsg.uniHostIFmsgBody.strAddStaParam;
-
+ s32 result = 0;
+ struct host_if_msg msg;
+ struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info;
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n");
+ msg.id = HOST_IF_MSG_ADD_STATION;
+ msg.drv = hif_drv;
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_STATION;
- strHostIFmsg.drvHandler = hWFIDrv;
-
- memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam));
+ memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param));
if (pstrAddStationMsg->u8NumRates > 0) {
- u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates);
+ u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL);
- WILC_NULLCHECK(s32Error, rates);
+ if (!rates)
+ return -ENOMEM;
memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
pstrAddStationMsg->pu8Rates = rates;
}
-
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
-
- WILC_CATCH(s32Error)
- {
- }
- return s32Error;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc_mq_send fail\n");
+ return result;
}
-/**
- * @brief host_int_del_station
- * @details Setting delete station params in message queue
- * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-s32 host_int_del_station(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8MacAddr)
+s32 host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
- tstrHostIFDelSta *pstrDelStationMsg = &strHostIFmsg.uniHostIFmsgBody.strDelStaParam;
+ s32 result = 0;
+ struct host_if_msg msg;
+ struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info;
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n");
+ msg.id = HOST_IF_MSG_DEL_STATION;
+ msg.drv = hif_drv;
-
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_STATION;
- strHostIFmsg.drvHandler = hWFIDrv;
-
- /*BugID_4795: Handling situation of deleting all stations*/
- if (pu8MacAddr == NULL)
- memset(pstrDelStationMsg->au8MacAddr, 255, ETH_ALEN);
+ if (!pu8MacAddr)
+ eth_broadcast_addr(pstrDelStationMsg->mac_addr);
else
- memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN);
+ memcpy(pstrDelStationMsg->mac_addr, pu8MacAddr, ETH_ALEN);
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
-
- WILC_CATCH(s32Error)
- {
- }
- return s32Error;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc_mq_send fail\n");
+ return result;
}
-/**
- * @brief host_int_del_allstation
- * @details Setting del station params in message queue
- * @param[in] WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]s
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-s32 host_int_del_allstation(tstrWILC_WFIDrv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN])
+
+s32 host_int_del_allstation(struct host_if_drv *hif_drv,
+ u8 pu8MacAddr[][ETH_ALEN])
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
- tstrHostIFDelAllSta *pstrDelAllStationMsg = &strHostIFmsg.uniHostIFmsgBody.strHostIFDelAllSta;
+ s32 result = 0;
+ struct host_if_msg msg;
+ struct del_all_sta *pstrDelAllStationMsg = &msg.body.del_all_sta_info;
u8 au8Zero_Buff[ETH_ALEN] = {0};
u32 i;
u8 u8AssocNumb = 0;
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
-
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n");
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_ALL_STA;
- strHostIFmsg.drvHandler = hWFIDrv;
+ msg.id = HOST_IF_MSG_DEL_ALL_STA;
+ msg.drv = hif_drv;
- /* Handling situation of deauthenticing all associated stations*/
for (i = 0; i < MAX_NUM_STA; i++) {
if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) {
- memcpy(pstrDelAllStationMsg->au8Sta_DelAllSta[i], pu8MacAddr[i], ETH_ALEN);
- PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", pstrDelAllStationMsg->au8Sta_DelAllSta[i][0], pstrDelAllStationMsg->au8Sta_DelAllSta[i][1], pstrDelAllStationMsg->au8Sta_DelAllSta[i][2], pstrDelAllStationMsg->au8Sta_DelAllSta[i][3], pstrDelAllStationMsg->au8Sta_DelAllSta[i][4],
- pstrDelAllStationMsg->au8Sta_DelAllSta[i][5]);
+ memcpy(pstrDelAllStationMsg->del_all_sta[i], pu8MacAddr[i], ETH_ALEN);
+ PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n",
+ pstrDelAllStationMsg->del_all_sta[i][0],
+ pstrDelAllStationMsg->del_all_sta[i][1],
+ pstrDelAllStationMsg->del_all_sta[i][2],
+ pstrDelAllStationMsg->del_all_sta[i][3],
+ pstrDelAllStationMsg->del_all_sta[i][4],
+ pstrDelAllStationMsg->del_all_sta[i][5]);
u8AssocNumb++;
}
}
if (!u8AssocNumb) {
PRINT_D(CFG80211_DBG, "NO ASSOCIATED STAS\n");
- return s32Error;
+ return result;
}
- pstrDelAllStationMsg->u8Num_AssocSta = u8AssocNumb;
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
-
+ pstrDelAllStationMsg->assoc_sta = u8AssocNumb;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
+ if (result)
+ PRINT_ER("wilc_mq_send fail\n");
- WILC_CATCH(s32Error)
- {
-
- }
- down(&hWaitResponse);
-
- return s32Error;
+ down(&hif_sema_wait_response);
+ return result;
}
-/**
- * @brief host_int_edit_station
- * @details Setting edit station params in message queue
- * @param[in] WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam* pstrStaParams
- * @return Error code.
- * @author
- * @date
- * @version 1.0
- */
-s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams)
+s32 host_int_edit_station(struct host_if_drv *hif_drv,
+ struct add_sta_param *pstrStaParams)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
- tstrWILC_AddStaParam *pstrAddStationMsg = &strHostIFmsg.uniHostIFmsgBody.strAddStaParam;
+ s32 result = 0;
+ struct host_if_msg msg;
+ struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info;
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n");
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
+ msg.id = HOST_IF_MSG_EDIT_STATION;
+ msg.drv = hif_drv;
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_EDIT_STATION;
- strHostIFmsg.drvHandler = hWFIDrv;
-
- memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam));
+ memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param));
if (pstrAddStationMsg->u8NumRates > 0) {
- u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates);
+ u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL);
+
+ if (!rates)
+ return -ENOMEM;
- WILC_NULLCHECK(s32Error, rates);
memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
pstrAddStationMsg->pu8Rates = rates;
}
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
- }
- return s32Error;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc_mq_send fail\n");
+
+ return result;
}
-#endif /*WILC_AP_EXTERNAL_MLME*/
-uint32_t wilc_get_chipid(uint8_t);
-s32 host_int_set_power_mgmt(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32Timeout)
+s32 host_int_set_power_mgmt(struct host_if_drv *hif_drv,
+ bool bIsEnabled,
+ u32 u32Timeout)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
- tstrHostIfPowerMgmtParam *pstrPowerMgmtParam = &strHostIFmsg.uniHostIFmsgBody.strPowerMgmtparam;
+ s32 result = 0;
+ struct host_if_msg msg;
+ struct power_mgmt_param *pstrPowerMgmtParam = &msg.body.pwr_mgmt_info;
PRINT_INFO(HOSTINF_DBG, "\n\n>> Setting PS to %d <<\n\n", bIsEnabled);
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n");
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
-
+ memset(&msg, 0, sizeof(struct host_if_msg));
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_POWER_MGMT;
- strHostIFmsg.drvHandler = hWFIDrv;
+ msg.id = HOST_IF_MSG_POWER_MGMT;
+ msg.drv = hif_drv;
- pstrPowerMgmtParam->bIsEnabled = bIsEnabled;
- pstrPowerMgmtParam->u32Timeout = u32Timeout;
+ pstrPowerMgmtParam->enabled = bIsEnabled;
+ pstrPowerMgmtParam->timeout = u32Timeout;
-
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
- }
- return s32Error;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc_mq_send fail\n");
+ return result;
}
-s32 host_int_setup_multicast_filter(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32count)
+s32 host_int_setup_multicast_filter(struct host_if_drv *hif_drv,
+ bool bIsEnabled,
+ u32 u32count)
{
- s32 s32Error = WILC_SUCCESS;
-
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
- tstrHostIFSetMulti *pstrMulticastFilterParam = &strHostIFmsg.uniHostIFmsgBody.strHostIfSetMulti;
-
+ s32 result = 0;
+ struct host_if_msg msg;
+ struct set_multicast *pstrMulticastFilterParam = &msg.body.multicast_info;
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n");
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
-
+ memset(&msg, 0, sizeof(struct host_if_msg));
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_MULTICAST_FILTER;
- strHostIFmsg.drvHandler = hWFIDrv;
+ msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER;
+ msg.drv = hif_drv;
- pstrMulticastFilterParam->bIsEnabled = bIsEnabled;
- pstrMulticastFilterParam->u32count = u32count;
+ pstrMulticastFilterParam->enabled = bIsEnabled;
+ pstrMulticastFilterParam->cnt = u32count;
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
- }
- return s32Error;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc_mq_send fail\n");
+ return result;
}
-
-
-/*Bug4218: Parsing Join Param*/
-#ifdef WILC_PARSE_SCAN_IN_HOST
-
-/*Bug4218: Parsing Join Param*/
-/**
- * @brief host_int_ParseJoinBssParam
- * @details Parse Needed Join Parameters and save it in a new JoinBssParam entry
- * @param[in] tstrNetworkInfo* ptstrNetworkInfo
- * @return
- * @author zsalah
- * @date
- * @version 1.0**/
static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo)
{
- tstrJoinBssParam *pNewJoinBssParam = NULL;
+ struct join_bss_param *pNewJoinBssParam = NULL;
u8 *pu8IEs;
u16 u16IEsLen;
u16 index = 0;
@@ -7451,388 +4747,259 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo)
pu8IEs = ptstrNetworkInfo->pu8IEs;
u16IEsLen = ptstrNetworkInfo->u16IEsLen;
- pNewJoinBssParam = WILC_MALLOC(sizeof(tstrJoinBssParam));
- if (pNewJoinBssParam != NULL) {
- memset(pNewJoinBssParam, 0, sizeof(tstrJoinBssParam));
+ pNewJoinBssParam = kzalloc(sizeof(struct join_bss_param), GFP_KERNEL);
+ if (pNewJoinBssParam) {
pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod;
pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod;
pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo;
memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6);
- /*for(i=0; i<6;i++)
- * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->au8bssid[i]);*/
memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1);
- pNewJoinBssParam->ssidLen = ptstrNetworkInfo->u8SsidLen;
+ pNewJoinBssParam->ssid_len = ptstrNetworkInfo->u8SsidLen;
memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3);
memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3);
- /*for(i=0; i<pNewJoinBssParam->ssidLen;i++)
- * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->ssid[i]);*/
- /* parse supported rates: */
while (index < u16IEsLen) {
- /* supportedRates IE */
if (pu8IEs[index] == SUPP_RATES_IE) {
- /* PRINT_D(HOSTINF_DBG, "Supported Rates\n"); */
suppRatesNo = pu8IEs[index + 1];
pNewJoinBssParam->supp_rates[0] = suppRatesNo;
- index += 2; /* skipping ID and length bytes; */
+ index += 2;
- for (i = 0; i < suppRatesNo; i++) {
+ for (i = 0; i < suppRatesNo; i++)
pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i];
- /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[i+1]); */
- }
+
index += suppRatesNo;
continue;
- }
- /* Ext SupportedRates IE */
- else if (pu8IEs[index] == EXT_SUPP_RATES_IE) {
- /* PRINT_D(HOSTINF_DBG, "Extended Supported Rates\n"); */
- /* checking if no of ext. supp and supp rates < max limit */
+ } else if (pu8IEs[index] == EXT_SUPP_RATES_IE) {
extSuppRatesNo = pu8IEs[index + 1];
if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo))
pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED;
else
pNewJoinBssParam->supp_rates[0] += extSuppRatesNo;
index += 2;
- /* pNewJoinBssParam.supp_rates[0] contains now old number not the ext. no */
- for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++) {
+ for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++)
pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i];
- /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[suppRatesNo+i+1]); */
- }
+
index += extSuppRatesNo;
continue;
- }
- /* HT Cap. IE */
- else if (pu8IEs[index] == HT_CAPABILITY_IE) {
- /* if IE found set the flag */
+ } else if (pu8IEs[index] == HT_CAPABILITY_IE) {
pNewJoinBssParam->ht_capable = true;
- index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */
- /* PRINT_D(HOSTINF_DBG,"HT_CAPABALE\n"); */
+ index += pu8IEs[index + 1] + 2;
continue;
- } else if ((pu8IEs[index] == WMM_IE) && /* WMM Element ID */
+ } else if ((pu8IEs[index] == WMM_IE) &&
(pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) &&
- (pu8IEs[index + 4] == 0xF2) && /* OUI */
- (pu8IEs[index + 5] == 0x02) && /* OUI Type */
- ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) && /* OUI Sub Type */
+ (pu8IEs[index + 4] == 0xF2) &&
+ (pu8IEs[index + 5] == 0x02) &&
+ ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) &&
(pu8IEs[index + 7] == 0x01)) {
- /* Presence of WMM Info/Param element indicates WMM capability */
pNewJoinBssParam->wmm_cap = true;
- /* Check if Bit 7 is set indicating U-APSD capability */
- if (pu8IEs[index + 8] & (1 << 7))
+ if (pu8IEs[index + 8] & BIT(7))
pNewJoinBssParam->uapsd_cap = true;
index += pu8IEs[index + 1] + 2;
continue;
- }
- #ifdef WILC_P2P
- else if ((pu8IEs[index] == P2P_IE) && /* P2P Element ID */
+ } else if ((pu8IEs[index] == P2P_IE) &&
(pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) &&
- (pu8IEs[index + 4] == 0x9a) && /* OUI */
- (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { /* OUI Type */
+ (pu8IEs[index + 4] == 0x9a) &&
+ (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) {
u16 u16P2P_count;
pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf;
- pNewJoinBssParam->u8NoaEnbaled = 1;
- pNewJoinBssParam->u8Index = pu8IEs[index + 9];
-
- /* Check if Bit 7 is set indicating Opss capability */
- if (pu8IEs[index + 10] & (1 << 7)) {
- pNewJoinBssParam->u8OppEnable = 1;
- pNewJoinBssParam->u8CtWindow = pu8IEs[index + 10];
- } else
- pNewJoinBssParam->u8OppEnable = 0;
- /* HOSTINF_DBG */
+ pNewJoinBssParam->noa_enabled = 1;
+ pNewJoinBssParam->idx = pu8IEs[index + 9];
+
+ if (pu8IEs[index + 10] & BIT(7)) {
+ pNewJoinBssParam->opp_enabled = 1;
+ pNewJoinBssParam->ct_window = pu8IEs[index + 10];
+ } else {
+ pNewJoinBssParam->opp_enabled = 0;
+ }
+
PRINT_D(GENERIC_DBG, "P2P Dump\n");
for (i = 0; i < pu8IEs[index + 7]; i++)
PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]);
- pNewJoinBssParam->u8Count = pu8IEs[index + 11];
+ pNewJoinBssParam->cnt = pu8IEs[index + 11];
u16P2P_count = index + 12;
- memcpy(pNewJoinBssParam->au8Duration, pu8IEs + u16P2P_count, 4);
+ memcpy(pNewJoinBssParam->duration, pu8IEs + u16P2P_count, 4);
u16P2P_count += 4;
- memcpy(pNewJoinBssParam->au8Interval, pu8IEs + u16P2P_count, 4);
+ memcpy(pNewJoinBssParam->interval, pu8IEs + u16P2P_count, 4);
u16P2P_count += 4;
- memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + u16P2P_count, 4);
+ memcpy(pNewJoinBssParam->start_time, pu8IEs + u16P2P_count, 4);
index += pu8IEs[index + 1] + 2;
continue;
- }
- #endif
- else if ((pu8IEs[index] == RSN_IE) ||
+ } else if ((pu8IEs[index] == RSN_IE) ||
((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) &&
(pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) &&
(pu8IEs[index + 5] == 0x01))) {
u16 rsnIndex = index;
- /*PRINT_D(HOSTINF_DBG,"RSN IE Length:%d\n",pu8IEs[rsnIndex+1]);
- * for(i=0; i<pu8IEs[rsnIndex+1]; i++)
- * {
- * PRINT_D(HOSTINF_DBG,"%0x ",pu8IEs[rsnIndex+2+i]);
- * }*/
+
if (pu8IEs[rsnIndex] == RSN_IE) {
pNewJoinBssParam->mode_802_11i = 2;
- /* PRINT_D(HOSTINF_DBG,"\nRSN_IE\n"); */
- } else { /* check if rsn was previously parsed */
+ } else {
if (pNewJoinBssParam->mode_802_11i == 0)
pNewJoinBssParam->mode_802_11i = 1;
- /* PRINT_D(HOSTINF_DBG,"\nWPA_IE\n"); */
rsnIndex += 4;
}
- rsnIndex += 7; /* skipping id, length, version(2B) and first 3 bytes of gcipher */
+
+ rsnIndex += 7;
pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex];
rsnIndex++;
- /* PRINT_D(HOSTINF_DBG,"Group Policy: %0x\n",pNewJoinBssParam->rsn_grp_policy); */
- /* initialize policies with invalid values */
-
- jumpOffset = pu8IEs[rsnIndex] * 4; /* total no.of bytes of pcipher field (count*4) */
-
- /*parsing pairwise cipher*/
-
- /* saving 3 pcipher max. */
+ jumpOffset = pu8IEs[rsnIndex] * 4;
pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex];
- rsnIndex += 2; /* jump 2 bytes of pcipher count */
+ rsnIndex += 2;
- /* PRINT_D(HOSTINF_DBG,"\npcipher:%d\n",pcipherCount); */
- for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) {
- /* each count corresponds to 4 bytes, only last byte is saved */
+ for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++)
pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1];
- /* PRINT_D(HOSTINF_DBG,"PAIR policy = [%0x,%0x]\n",pNewJoinBssParam->rsn_pcip_policy[i],i); */
- }
+
pcipherTotalCount += pcipherCount;
rsnIndex += jumpOffset;
jumpOffset = pu8IEs[rsnIndex] * 4;
- /*parsing AKM suite (auth_policy)*/
- /* saving 3 auth policies max. */
authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex];
- rsnIndex += 2; /* jump 2 bytes of pcipher count */
+ rsnIndex += 2;
- for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++) {
- /* each count corresponds to 4 bytes, only last byte is saved */
+ for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++)
pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1];
- }
+
authTotalCount += authCount;
rsnIndex += jumpOffset;
- /*pasring rsn cap. only if rsn IE*/
+
if (pu8IEs[index] == RSN_IE) {
pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex];
pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1];
rsnIndex += 2;
}
pNewJoinBssParam->rsn_found = true;
- index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */
+ index += pu8IEs[index + 1] + 2;
continue;
} else
- index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */
-
+ index += pu8IEs[index + 1] + 2;
}
-
-
}
return (void *)pNewJoinBssParam;
-
}
void host_int_freeJoinParams(void *pJoinParams)
{
- if ((tstrJoinBssParam *)pJoinParams != NULL)
- kfree((tstrJoinBssParam *)pJoinParams);
+ if ((struct bss_param *)pJoinParams)
+ kfree((struct bss_param *)pJoinParams);
else
PRINT_ER("Unable to FREE null pointer\n");
}
-#endif /*WILC_PARSE_SCAN_IN_HOST*/
-
-/**
- * @brief host_int_addBASession
- * @details Open a block Ack session with the given parameters
- * @param[in] tstrNetworkInfo* ptstrNetworkInfo
- * @return
- * @author anoureldin
- * @date
- * @version 1.0**/
-
-static int host_int_addBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID, short int BufferSize,
- short int SessionTimeout, void *drvHandler)
+s32 host_int_delBASession(struct host_if_drv *hif_drv, char *pBSSID, char TID)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
- tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo;
-
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
-
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
-
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_BA_SESSION;
-
- memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN);
- pBASessionInfo->u8Ted = TID;
- pBASessionInfo->u16BufferSize = BufferSize;
- pBASessionInfo->u16SessionTimeout = SessionTimeout;
- strHostIFmsg.drvHandler = hWFIDrv;
-
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
+ s32 result = 0;
+ struct host_if_msg msg;
+ struct ba_session_info *pBASessionInfo = &msg.body.session_info;
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
}
- return s32Error;
-}
-
-
-s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID)
-{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
- tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo;
-
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
-
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_BA_SESSION;
+ msg.id = HOST_IF_MSG_DEL_BA_SESSION;
memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN);
pBASessionInfo->u8Ted = TID;
- strHostIFmsg.drvHandler = hWFIDrv;
+ msg.drv = hif_drv;
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc_mq_send fail\n");
- }
+ down(&hif_sema_wait_response);
- /*BugID_5222*/
- down(&hWaitResponse);
-
- return s32Error;
+ return result;
}
-s32 host_int_del_All_Rx_BASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID)
+s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv,
+ char *pBSSID,
+ char TID)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
- tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo;
+ s32 result = 0;
+ struct host_if_msg msg;
+ struct ba_session_info *pBASessionInfo = &msg.body.session_info;
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
+ memset(&msg, 0, sizeof(struct host_if_msg));
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS;
+ msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS;
memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN);
pBASessionInfo->u8Ted = TID;
- strHostIFmsg.drvHandler = hWFIDrv;
-
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
+ msg.drv = hif_drv;
- }
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc_mq_send fail\n");
- /*BugID_5222*/
- down(&hWaitResponse);
+ down(&hif_sema_wait_response);
- return s32Error;
+ return result;
}
-/**
- * @brief host_int_setup_ipaddress
- * @details setup IP in firmware
- * @param[in] Handle to wifi driver
- * @return Error code.
- * @author Abdelrahman Sobhy
- * @date
- * @version 1.0*/
-s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx)
+s32 host_int_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
+ s32 result = 0;
+ struct host_if_msg msg;
- /* TODO: Enable This feature on softap firmware */
return 0;
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
-
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
-
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_IPADDRESS;
-
- strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr = u16ipadd;
- strHostIFmsg.drvHandler = hWFIDrv;
- strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx;
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
+ memset(&msg, 0, sizeof(struct host_if_msg));
- }
+ msg.id = HOST_IF_MSG_SET_IPADDRESS;
- return s32Error;
+ msg.body.ip_info.ip_addr = u16ipadd;
+ msg.drv = hif_drv;
+ msg.body.ip_info.idx = idx;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc_mq_send fail\n");
+ return result;
}
-/**
- * @brief host_int_get_ipaddress
- * @details Get IP from firmware
- * @param[in] Handle to wifi driver
- * @return Error code.
- * @author Abdelrahman Sobhy
- * @date
- * @version 1.0*/
-s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx)
+s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
{
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
- tstrHostIFmsg strHostIFmsg;
-
- if (pstrWFIDrv == NULL)
- WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT);
-
- memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
-
- /* prepare the WiphyParams Message */
- strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_IPADDRESS;
+ s32 result = 0;
+ struct host_if_msg msg;
- strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr = u16ipadd;
- strHostIFmsg.drvHandler = hWFIDrv;
- strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx;
+ if (!hif_drv) {
+ PRINT_ER("driver is null\n");
+ return -EFAULT;
+ }
- s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg));
- if (s32Error)
- WILC_ERRORREPORT(s32Error, s32Error);
- WILC_CATCH(s32Error)
- {
+ memset(&msg, 0, sizeof(struct host_if_msg));
- }
+ msg.id = HOST_IF_MSG_GET_IPADDRESS;
- return s32Error;
+ msg.body.ip_info.ip_addr = u16ipadd;
+ msg.drv = hif_drv;
+ msg.body.ip_info.idx = idx;
+ result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+ if (result)
+ PRINT_ER("wilc_mq_send fail\n");
+ return result;
}
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index e66dee9af..b854db5ac 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -11,121 +11,98 @@
#define HOST_INT_H
#include "coreconfigurator.h"
-/*****************************************************************************/
-/* Macros */
-/*****************************************************************************/
-#define FAIL 0x0000
-#define SUCCESS 0x0001
#define IP_ALEN 4
-#define BIT2 ((u32)(1 << 2))
-#define BIT1 ((u32)(1 << 1))
-#define BIT0 ((u32)(1 << 0))
-
+#define IDLE_MODE 0x00
#define AP_MODE 0x01
#define STATION_MODE 0x02
-#define GO_MODE 0x03
+#define GO_MODE 0x03
#define CLIENT_MODE 0x04
-#define MAX_NUM_STA 9
+#define MAX_NUM_STA 9
#define ACTIVE_SCAN_TIME 10
#define PASSIVE_SCAN_TIME 1200
#define MIN_SCAN_TIME 10
#define MAX_SCAN_TIME 1200
#define DEFAULT_SCAN 0
-#define USER_SCAN BIT0
-#define OBSS_PERIODIC_SCAN BIT1
-#define OBSS_ONETIME_SCAN BIT2
+#define USER_SCAN BIT(0)
+#define OBSS_PERIODIC_SCAN BIT(1)
+#define OBSS_ONETIME_SCAN BIT(2)
#define GTK_RX_KEY_BUFF_LEN 24
-#define ADDKEY 0x1
-#define REMOVEKEY 0x2
-#define DEFAULTKEY 0x4
-#define ADDKEY_AP 0x8
-#define MAX_NUM_SCANNED_NETWORKS 100 /* 30 // rachel */
-#define MAX_NUM_SCANNED_NETWORKS_SHADOW 130
-#define MAX_NUM_PROBED_SSID 10 /*One more than the number of scanned ssids*/
-#define CHANNEL_SCAN_TIME 250 /* 250 */
+#define ADDKEY 0x1
+#define REMOVEKEY 0x2
+#define DEFAULTKEY 0x4
+#define ADDKEY_AP 0x8
+#define MAX_NUM_SCANNED_NETWORKS 100
+#define MAX_NUM_SCANNED_NETWORKS_SHADOW 130
+#define MAX_NUM_PROBED_SSID 10
+#define CHANNEL_SCAN_TIME 250
#define TX_MIC_KEY_LEN 8
#define RX_MIC_KEY_LEN 8
-#define PTK_KEY_LEN 16
+#define PTK_KEY_LEN 16
#define TX_MIC_KEY_MSG_LEN 26
#define RX_MIC_KEY_MSG_LEN 48
#define PTK_KEY_MSG_LEN 39
#define PMKSA_KEY_LEN 22
-#define ETH_ALEN 6
-#define PMKID_LEN 16
-#define WILC_MAX_NUM_PMKIDS 16
-#define WILC_SUPP_MCS_SET_SIZE 16
-#define WILC_ADD_STA_LENGTH 40 /* Not including the rates field cause it has variable length*/
+#define ETH_ALEN 6
+#define PMKID_LEN 16
+#define WILC_MAX_NUM_PMKIDS 16
+#define WILC_SUPP_MCS_SET_SIZE 16
+#define WILC_ADD_STA_LENGTH 40
#define SCAN_EVENT_DONE_ABORTED
-/*****************************************************************************/
-/* Data Types */
-/*****************************************************************************/
-/* typedef unsigned char uint8; */
-/* typedef signed char int8; */
-/* typedef unsigned short uint16; */
-/* typedef unsigned long uint32; */
-/* typedef uint32 Bool; */
-
-typedef struct {
- u16 cfg_wid;
- WID_TYPE_T cfg_type;
- s8 *pu8Para;
-} cfg_param_t;
-
-typedef struct _tstrStatistics {
+#define NUM_CONCURRENT_IFC 2
+
+struct rf_info {
u8 u8LinkSpeed;
s8 s8RSSI;
u32 u32TxCount;
u32 u32RxCount;
u32 u32TxFailureCount;
+};
-} tstrStatistics;
-
-
-typedef enum {
- HOST_IF_IDLE = 0,
- HOST_IF_SCANNING = 1,
- HOST_IF_CONNECTING = 2,
- HOST_IF_WAITING_CONN_RESP = 3,
- HOST_IF_CONNECTED = 4,
- HOST_IF_P2P_LISTEN = 5,
- HOST_IF_FORCE_32BIT = 0xFFFFFFFF
-} tenuHostIFstate;
+enum host_if_state {
+ HOST_IF_IDLE = 0,
+ HOST_IF_SCANNING = 1,
+ HOST_IF_CONNECTING = 2,
+ HOST_IF_WAITING_CONN_RESP = 3,
+ HOST_IF_CONNECTED = 4,
+ HOST_IF_P2P_LISTEN = 5,
+ HOST_IF_FORCE_32BIT = 0xFFFFFFFF
+};
-typedef struct _tstrHostIFpmkid {
+struct host_if_pmkid {
u8 bssid[ETH_ALEN];
u8 pmkid[PMKID_LEN];
-} tstrHostIFpmkid;
+};
-typedef struct _tstrHostIFpmkidAttr {
+struct host_if_pmkid_attr {
u8 numpmkid;
- tstrHostIFpmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
-} tstrHostIFpmkidAttr;
-
-typedef enum {
- AUTORATE = 0,
- MBPS_1 = 1,
- MBPS_2 = 2,
- MBPS_5_5 = 5,
- MBPS_11 = 11,
- MBPS_6 = 6,
- MBPS_9 = 9,
- MBPS_12 = 12,
- MBPS_18 = 18,
- MBPS_24 = 24,
- MBPS_36 = 36,
- MBPS_48 = 48,
- MBPS_54 = 54
-} CURRENT_TX_RATE_T;
-
-typedef struct {
- u32 u32SetCfgFlag;
+ struct host_if_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
+};
+
+enum CURRENT_TXRATE {
+ AUTORATE = 0,
+ MBPS_1 = 1,
+ MBPS_2 = 2,
+ MBPS_5_5 = 5,
+ MBPS_11 = 11,
+ MBPS_6 = 6,
+ MBPS_9 = 9,
+ MBPS_12 = 12,
+ MBPS_18 = 18,
+ MBPS_24 = 24,
+ MBPS_36 = 36,
+ MBPS_48 = 48,
+ MBPS_54 = 54
+};
+
+struct cfg_param_val {
+ u32 flag;
u8 ht_enable;
u8 bss_type;
u8 auth_type;
@@ -140,84 +117,79 @@ typedef struct {
u8 txop_prot_disabled;
u16 beacon_interval;
u16 dtim_period;
- SITE_SURVEY_T site_survey_enabled;
+ enum SITESURVEY site_survey_enabled;
u16 site_survey_scan_time;
u8 scan_source;
u16 active_scan_time;
u16 passive_scan_time;
- CURRENT_TX_RATE_T curr_tx_rate;
-
-} tstrCfgParamVal;
-
-typedef enum {
- RETRY_SHORT = 1 << 0,
- RETRY_LONG = 1 << 1,
- FRAG_THRESHOLD = 1 << 2,
- RTS_THRESHOLD = 1 << 3,
- BSS_TYPE = 1 << 4,
- AUTH_TYPE = 1 << 5,
- AUTHEN_TIMEOUT = 1 << 6,
- POWER_MANAGEMENT = 1 << 7,
- PREAMBLE = 1 << 8,
- SHORT_SLOT_ALLOWED = 1 << 9,
- TXOP_PROT_DISABLE = 1 << 10,
- BEACON_INTERVAL = 1 << 11,
- DTIM_PERIOD = 1 << 12,
- SITE_SURVEY = 1 << 13,
- SITE_SURVEY_SCAN_TIME = 1 << 14,
- ACTIVE_SCANTIME = 1 << 15,
- PASSIVE_SCANTIME = 1 << 16,
- CURRENT_TX_RATE = 1 << 17,
- HT_ENABLE = 1 << 18,
-} tenuCfgParam;
-
-typedef struct {
+ enum CURRENT_TXRATE curr_tx_rate;
+
+};
+
+enum cfg_param {
+ RETRY_SHORT = BIT(0),
+ RETRY_LONG = BIT(1),
+ FRAG_THRESHOLD = BIT(2),
+ RTS_THRESHOLD = BIT(3),
+ BSS_TYPE = BIT(4),
+ AUTH_TYPE = BIT(5),
+ AUTHEN_TIMEOUT = BIT(6),
+ POWER_MANAGEMENT = BIT(7),
+ PREAMBLE = BIT(8),
+ SHORT_SLOT_ALLOWED = BIT(9),
+ TXOP_PROT_DISABLE = BIT(10),
+ BEACON_INTERVAL = BIT(11),
+ DTIM_PERIOD = BIT(12),
+ SITE_SURVEY = BIT(13),
+ SITE_SURVEY_SCAN_TIME = BIT(14),
+ ACTIVE_SCANTIME = BIT(15),
+ PASSIVE_SCANTIME = BIT(16),
+ CURRENT_TX_RATE = BIT(17),
+ HT_ENABLE = BIT(18),
+};
+
+struct found_net_info {
u8 au8bssid[6];
s8 s8rssi;
-} tstrFoundNetworkInfo;
+};
-typedef enum {SCAN_EVENT_NETWORK_FOUND = 0,
- SCAN_EVENT_DONE = 1,
- SCAN_EVENT_ABORTED = 2,
- SCAN_EVENT_FORCE_32BIT = 0xFFFFFFFF} tenuScanEvent;
+enum scan_event {
+ SCAN_EVENT_NETWORK_FOUND = 0,
+ SCAN_EVENT_DONE = 1,
+ SCAN_EVENT_ABORTED = 2,
+ SCAN_EVENT_FORCE_32BIT = 0xFFFFFFFF
+};
-typedef enum {
+enum conn_event {
CONN_DISCONN_EVENT_CONN_RESP = 0,
CONN_DISCONN_EVENT_DISCONN_NOTIF = 1,
- CONN_DISCONN_EVENT_FORCE_32BIT = 0xFFFFFFFF
-} tenuConnDisconnEvent;
+ CONN_DISCONN_EVENT_FORCE_32BIT = 0xFFFFFFFF
+};
-typedef enum {
+enum KEY_TYPE {
WEP,
WPARxGtk,
- /* WPATxGtk, */
WPAPtk,
PMKSA,
-} tenuKeyType;
+};
/*Scan callBack function definition*/
-typedef void (*tWILCpfScanResult)(tenuScanEvent, tstrNetworkInfo *, void *, void *);
+typedef void (*wilc_scan_result)(enum scan_event, tstrNetworkInfo *,
+ void *, void *);
/*Connect callBack function definition*/
-typedef void (*tWILCpfConnectResult)(tenuConnDisconnEvent,
+typedef void (*wilc_connect_result)(enum conn_event,
tstrConnectInfo *,
u8,
tstrDisconnectNotifInfo *,
void *);
-#ifdef WILC_P2P
-typedef void (*tWILCpfRemainOnChanExpired)(void *, u32); /*Remain on channel expiration callback function*/
-typedef void (*tWILCpfRemainOnChanReady)(void *); /*Remain on channel callback function*/
-#endif
-
-/* typedef u32 WILC_WFIDrvHandle; */
-typedef struct {
- s32 s32Dummy;
-} *WILC_WFIDrvHandle;
+typedef void (*wilc_remain_on_chan_expired)(void *, u32); /*Remain on channel expiration callback function*/
+typedef void (*wilc_remain_on_chan_ready)(void *); /*Remain on channel callback function*/
/*!
- * @struct tstrRcvdNetworkInfo
+ * @struct rcvd_net_info
* @brief Structure to hold Received Asynchronous Network info
* @details
* @todo
@@ -226,102 +198,91 @@ typedef struct {
* @date 25 March 2012
* @version 1.0
*/
-typedef struct _tstrRcvdNetworkInfo {
- u8 *pu8Buffer;
- u32 u32Length;
-} tstrRcvdNetworkInfo;
+struct rcvd_net_info {
+ u8 *buffer;
+ u32 len;
+};
-/*BugID_4156*/
-typedef struct _tstrHiddenNetworkInfo {
+struct hidden_net_info {
u8 *pu8ssid;
u8 u8ssidlen;
+};
-} tstrHiddenNetworkInfo;
-
-typedef struct _tstrHiddenNetwork {
- /* MAX_SSID_LEN */
- tstrHiddenNetworkInfo *pstrHiddenNetworkInfo;
+struct hidden_network {
+ struct hidden_net_info *pstrHiddenNetworkInfo;
u8 u8ssidnum;
+};
-} tstrHiddenNetwork;
-
-typedef struct {
+struct user_scan_req {
/* Scan user call back function */
- tWILCpfScanResult pfUserScanResult;
+ wilc_scan_result pfUserScanResult;
/* User specific parameter to be delivered through the Scan User Callback function */
void *u32UserScanPvoid;
u32 u32RcvdChCount;
- tstrFoundNetworkInfo astrFoundNetworkInfo[MAX_NUM_SCANNED_NETWORKS];
-} tstrWILC_UsrScanReq;
+ struct found_net_info astrFoundNetworkInfo[MAX_NUM_SCANNED_NETWORKS];
+};
-typedef struct {
+struct user_conn_req {
u8 *pu8bssid;
u8 *pu8ssid;
u8 u8security;
- AUTHTYPE_T tenuAuth_type;
+ enum AUTHTYPE tenuAuth_type;
size_t ssidLen;
u8 *pu8ConnReqIEs;
size_t ConnReqIEsLen;
/* Connect user call back function */
- tWILCpfConnectResult pfUserConnectResult;
+ wilc_connect_result pfUserConnectResult;
bool IsHTCapable;
/* User specific parameter to be delivered through the Connect User Callback function */
void *u32UserConnectPvoid;
-} tstrWILC_UsrConnReq;
+};
-typedef struct {
- u32 u32Address;
-} tstrHostIfSetDrvHandler;
+struct drv_handler {
+ u32 handler;
+};
-typedef struct {
- u32 u32Mode;
-} tstrHostIfSetOperationMode;
+struct op_mode {
+ u32 mode;
+};
-/*BugID_5077*/
-typedef struct {
- u8 u8MacAddress[ETH_ALEN];
-} tstrHostIfSetMacAddress;
+struct set_mac_addr {
+ u8 mac_addr[ETH_ALEN];
+};
-/*BugID_5213*/
-typedef struct {
- u8 *u8MacAddress;
-} tstrHostIfGetMacAddress;
+struct get_mac_addr {
+ u8 *mac_addr;
+};
-/*BugID_5222*/
-typedef struct {
+struct ba_session_info {
u8 au8Bssid[ETH_ALEN];
u8 u8Ted;
u16 u16BufferSize;
u16 u16SessionTimeout;
-} tstrHostIfBASessionInfo;
+};
-#ifdef WILC_P2P
-typedef struct {
+struct remain_ch {
u16 u16Channel;
u32 u32duration;
- tWILCpfRemainOnChanExpired pRemainOnChanExpired;
- tWILCpfRemainOnChanReady pRemainOnChanReady;
+ wilc_remain_on_chan_expired pRemainOnChanExpired;
+ wilc_remain_on_chan_ready pRemainOnChanReady;
void *pVoid;
u32 u32ListenSessionID;
-} tstrHostIfRemainOnChan;
-
-typedef struct {
+};
+struct reg_frame {
bool bReg;
u16 u16FrameType;
u8 u8Regid;
+};
-} tstrHostIfRegisterFrame;
-
-
-#define ACTION 0xD0
-#define PROBE_REQ 0x40
-#define PROBE_RESP 0x50
-#define ACTION_FRM_IDX 0
-#define PROBE_REQ_IDX 1
+#define ACTION 0xD0
+#define PROBE_REQ 0x40
+#define PROBE_RESP 0x50
+#define ACTION_FRM_IDX 0
+#define PROBE_REQ_IDX 1
enum p2p_listen_state {
@@ -330,33 +291,18 @@ enum p2p_listen_state {
P2P_GRP_FORMATION
};
-#endif
-typedef struct {
- /* Scan user structure */
- tstrWILC_UsrScanReq strWILC_UsrScanReq;
-
- /* Connect User structure */
- tstrWILC_UsrConnReq strWILC_UsrConnReq;
-
- #ifdef WILC_P2P
- /*Remain on channel struvture*/
- tstrHostIfRemainOnChan strHostIfRemainOnChan;
- u8 u8RemainOnChan_pendingreq;
+struct host_if_drv {
+ struct user_scan_req usr_scan_req;
+ struct user_conn_req usr_conn_req;
+ struct remain_ch remain_on_ch;
+ u8 remain_on_ch_pending;
u64 u64P2p_MgmtTimeout;
u8 u8P2PConnect;
- #endif
- tenuHostIFstate enuHostIFstate;
-
- /* bool bPendingConnRequest; */
-
- #ifndef CONNECT_DIRECT
- u32 u32SurveyResultsCount;
- wid_site_survey_reslts_s astrSurveyResults[MAX_NUM_SCANNED_NETWORKS];
- #endif
+ enum host_if_state enuHostIFstate;
u8 au8AssociatedBSSID[ETH_ALEN];
- tstrCfgParamVal strCfgValues;
+ struct cfg_param_val strCfgValues;
/* semaphores */
struct semaphore gtOsCfgValuesSem;
struct semaphore hSemTestKeyBlock;
@@ -369,34 +315,12 @@ typedef struct {
/* timer handlers */
struct timer_list hScanTimer;
struct timer_list hConnectTimer;
- #ifdef WILC_P2P
struct timer_list hRemainOnChannel;
- #endif
bool IFC_UP;
-} tstrWILC_WFIDrv;
-
-/*!
- * @enum tenuWILC_StaFlag
- * @brief Used to decode the station flag set and mask in tstrWILC_AddStaParam
- * @details
- * @todo
- * @sa tstrWILC_AddStaParam, enum nl80211_sta_flags
- * @author Enumeraion's creator
- * @date 12 July 2012
- * @version 1.0 Description
- */
-
-typedef enum {
- WILC_STA_FLAG_INVALID = 0,
- WILC_STA_FLAG_AUTHORIZED, /*!< station is authorized (802.1X)*/
- WILC_STA_FLAG_SHORT_PREAMBLE, /*!< station is capable of receiving frames with short barker preamble*/
- WILC_STA_FLAG_WME, /*!< station is WME/QoS capable*/
- WILC_STA_FLAG_MFP, /*!< station uses management frame protection*/
- WILC_STA_FLAG_AUTHENTICATED /*!< station is authenticated*/
-} tenuWILC_StaFlag;
+};
-typedef struct {
+struct add_sta_param {
u8 au8BSSID[ETH_ALEN];
u16 u16AssocID;
u8 u8NumRates;
@@ -410,9 +334,7 @@ typedef struct {
u8 u8ASELCap;
u16 u16FlagsMask; /*<! Determines which of u16FlagsSet were changed>*/
u16 u16FlagsSet; /*<! Decoded according to tenuWILC_StaFlag */
-} tstrWILC_AddStaParam;
-
-/* extern void CfgDisconnected(void* pUserVoid, u16 u16reason, u8 * ie, size_t ie_len); */
+};
/*****************************************************************************/
/* */
@@ -432,7 +354,7 @@ typedef struct {
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress);
+s32 host_int_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress);
/**
* @brief removes WEP key
* @details valid only in BSS STA mode if External Supplicant support is enabled.
@@ -447,7 +369,7 @@ s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index);
+int host_int_remove_wep_key(struct host_if_drv *wfi_drv, u8 index);
/**
* @brief sets WEP deafault key
* @details Sets the index of the WEP encryption key in use,
@@ -460,7 +382,7 @@ s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index);
+int host_int_set_wep_default_key(struct host_if_drv *hif_drv, u8 index);
/**
* @brief sets WEP deafault key
@@ -481,7 +403,8 @@ s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx);
+int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
+ const u8 *key, u8 len, u8 index);
/**
* @brief host_int_add_wep_key_bss_ap
* @details valid only in AP mode if External Supplicant support is enabled.
@@ -496,7 +419,9 @@ s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey,
* @date 28 Feb 2013
* @version 1.0
*/
-s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, AUTHTYPE_T tenuAuth_type);
+int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
+ const u8 *key, u8 len, u8 index, u8 mode,
+ enum AUTHTYPE auth_type);
/**
* @brief adds ptk Key
@@ -514,7 +439,7 @@ s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen,
+s32 host_int_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen,
const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx);
/**
@@ -529,7 +454,7 @@ s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen,
* @date 15 April 2013
* @version 1.0
*/
-s32 host_int_get_inactive_time(tstrWILC_WFIDrv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime);
+s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime);
/**
* @brief adds Rx GTk Key
@@ -547,7 +472,7 @@ s32 host_int_get_inactive_time(tstrWILC_WFIDrv *hWFIDrv, const u8 *mac, u32 *pu3
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen,
+s32 host_int_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen,
u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC,
const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode);
@@ -568,7 +493,7 @@ s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKe
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_add_tx_gtk(tstrWILC_WFIDrv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx);
+s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx);
/**
* @brief caches the pmkid
@@ -591,7 +516,7 @@ s32 host_int_add_tx_gtk(tstrWILC_WFIDrv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8
* @version 1.0
*/
-s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray);
+s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray);
/**
* @brief gets the cached the pmkid info
* @details valid only in BSS STA mode if External Supplicant
@@ -615,7 +540,7 @@ s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, tstrHostIFpmkidAttr *pu8Pm
* @version 1.0
*/
-s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray,
+s32 host_int_get_pmkid_info(struct host_if_drv *hWFIDrv, u8 *pu8PmkidInfoArray,
u32 u32PmkidInfoLen);
/**
@@ -632,7 +557,7 @@ s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray,
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase,
+s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, u8 *pu8PassPhrase,
u8 u8Psklength);
/**
* @brief gets the pass phrase
@@ -648,7 +573,7 @@ s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPh
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv,
+s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv,
u8 *pu8PassPhrase, u8 u8Psklength);
/**
@@ -662,7 +587,7 @@ s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv,
* @date 19 April 2012
* @version 1.0
*/
-s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress);
+s32 host_int_get_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
/**
* @brief sets mac address
@@ -675,7 +600,7 @@ s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress);
* @date 16 July 2012
* @version 1.0
*/
-s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress);
+s32 host_int_set_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
/**
* @brief wait until msg q is empty
@@ -688,42 +613,7 @@ s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress);
* @date 19 march 2014
* @version 1.0
*/
-s32 host_int_wait_msg_queue_idle(void);
-
-/**
- * @brief gets the site survey results
- * @details
- * @param[in,out] handle to the wifi driver,
- * Message containing site survey results in the
- * following formate
- *|---------------------------------------------------|
- | MsgLength | fragNo. | MsgBodyLength | MsgBody |
- ||-----------|-----------|---------------|-----------|
- | 1 | 1 | 1 | 1 |
- | ----------------------------------------- | ----------------
- |
- ||---------------------------------------|
- | Network1 | Netweork2 | ... | Network5 |
- ||---------------------------------------|
- | 44 | 44 | ... | 44 |
- | -------------------------- | ---------------------------------------
- |
- ||---------------------------------------------------------------------|
- | SSID | BSS Type | Channel | Security Status| BSSID | RSSI |Reserved |
- ||------|----------|---------|----------------|-------|------|---------|
- | 33 | 1 | 1 | 1 | 6 | 1 | 1 |
- ||---------------------------------------------------------------------|
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-#ifndef CONNECT_DIRECT
-s32 host_int_get_site_survey_results(tstrWILC_WFIDrv *hWFIDrv,
- u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE],
- u32 u32MaxSiteSrvyFragLen);
-#endif
+int host_int_wait_msg_queue_idle(void);
/**
* @brief sets a start scan request
@@ -741,7 +631,7 @@ s32 host_int_get_site_survey_results(tstrWILC_WFIDrv *hWFIDrv,
* @version 1.0
*/
-s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource);
+s32 host_int_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource);
/**
* @brief gets scan source of the last scan
* @details
@@ -757,7 +647,7 @@ s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource);
+s32 host_int_get_start_scan_req(struct host_if_drv *hWFIDrv, u8 *pu8ScanSource);
/**
* @brief sets a join request
@@ -771,11 +661,11 @@ s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource);
* @version 1.0
*/
-s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid,
+s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid,
const u8 *pu8ssid, size_t ssidLen,
const u8 *pu8IEs, size_t IEsLen,
- tWILCpfConnectResult pfConnectResult, void *pvUserArg,
- u8 u8security, AUTHTYPE_T tenuAuth_type,
+ wilc_connect_result pfConnectResult, void *pvUserArg,
+ u8 u8security, enum AUTHTYPE tenuAuth_type,
u8 u8channel,
void *pJoinParams);
@@ -791,7 +681,7 @@ s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid,
* @version 8.0
*/
-s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv);
+s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv);
/**
@@ -805,7 +695,7 @@ s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode);
+s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);
/**
* @brief disconnects a sta
@@ -818,7 +708,7 @@ s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id);
+s32 host_int_disconnect_station(struct host_if_drv *hWFIDrv, u8 assoc_id);
/**
* @brief gets a Association request info
* @details
@@ -845,7 +735,7 @@ s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id);
* @version 1.0
*/
-s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo,
+s32 host_int_get_assoc_req_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocReqInfo,
u32 u32AssocReqInfoLen);
/**
* @brief gets a Association Response info
@@ -859,7 +749,7 @@ s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo,
* @version 1.0
*/
-s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo,
+s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocRespInfo,
u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen);
/**
* @brief gets a Association Response info
@@ -876,7 +766,7 @@ s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo,
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,
+s32 host_int_get_rx_power_level(struct host_if_drv *hWFIDrv, u8 *pu8RxPowerLevel,
u32 u32RxPowerLevelLen);
/**
@@ -894,7 +784,7 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel,
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum);
+int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel);
/**
* @brief gets the current channel index
@@ -911,7 +801,7 @@ s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo);
+s32 host_int_get_host_chnl_num(struct host_if_drv *hWFIDrv, u8 *pu8ChNo);
/**
* @brief gets the sta rssi
* @details gets the currently maintained RSSI value for the station.
@@ -925,8 +815,8 @@ s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi);
-s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd);
+s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi);
+s32 host_int_get_link_speed(struct host_if_drv *hWFIDrv, s8 *ps8lnkspd);
/**
* @brief scans a set of channels
* @details
@@ -944,11 +834,12 @@ s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource,
+s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
u8 u8ScanType, u8 *pu8ChnlFreqList,
u8 u8ChnlListLen, const u8 *pu8IEs,
- size_t IEsLen, tWILCpfScanResult ScanResult,
- void *pvUserArg, tstrHiddenNetwork *pstrHiddenNetwork);
+ size_t IEsLen, wilc_scan_result ScanResult,
+ void *pvUserArg,
+ struct hidden_network *pstrHiddenNetwork);
/**
* @brief sets configuration wids values
* @details
@@ -960,7 +851,7 @@ s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource,
* @date 8 March 2012
* @version 1.0
*/
-s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, tstrCfgParamVal *pstrCfgParamVal);
+s32 hif_set_cfg(struct host_if_drv *hWFIDrv, struct cfg_param_val *pstrCfgParamVal);
/**
* @brief gets configuration wids values
@@ -974,45 +865,11 @@ s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, tstrCfgParamVal *pstrCfgParamVal);
* @date 8 March 2012
* @version 1.0
*/
-s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value);
+s32 hif_get_cfg(struct host_if_drv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value);
/*****************************************************************************/
/* Notification Functions */
/*****************************************************************************/
/**
- * @brief notifies host with join and leave requests
- * @details This function prepares an Information frame having the
- * information about a joining/leaving station.
- * @param[in,out] handle to the wifi driver,
- * @param[in] 6 byte Sta Adress
- * Join or leave flag:
- * Join = 1,
- * Leave =0
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-void host_int_send_join_leave_info_to_host
- (u16 assocId, u8 *stationAddr, bool joining);
-
-/**
- * @brief notifies host with stations found in scan
- * @details sends the beacon/probe response from scan
- * @param[in,out] handle to the wifi driver,
- * @param[in] Sta Address,
- * Frame length,
- * Rssi of the Station found
- * @return Error code indicating success/failure
- * @note
- * @author zsalah
- * @date 8 March 2012
- * @version 1.0
- */
-void host_int_send_network_info_to_host
- (u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi);
-
-/**
* @brief host interface initialization function
* @details
* @param[in,out] handle to the wifi driver,
@@ -1021,7 +878,7 @@ void host_int_send_network_info_to_host
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv);
+s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
/**
* @brief host interface initialization function
@@ -1032,7 +889,7 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv);
* @date 8 March 2012
* @version 1.0
*/
-s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv);
+s32 host_int_deinit(struct host_if_drv *hWFIDrv);
/*!
@@ -1057,7 +914,7 @@ s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv);
* @version 1.0 Description
*
*/
-s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval,
+s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval,
u32 u32DTIMPeriod,
u32 u32HeadLen, u8 *pu8Head,
u32 u32TailLen, u8 *pu8tail);
@@ -1075,10 +932,11 @@ s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval,
* @date 10 Julys 2012
* @version 1.0 Description
*/
-s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv);
+s32 host_int_del_beacon(struct host_if_drv *hWFIDrv);
/*!
- * @fn s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam strStaParams)
+ * @fn s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv,
+ * struct add_sta_param *pstrStaParams)
* @brief Notifies the firmware with a new associated stations
* @details
* @param[in,out] hWFIDrv handle to the wifi driver
@@ -1090,7 +948,8 @@ s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv);
* @date 12 July 2012
* @version 1.0 Description
*/
-s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams);
+s32 host_int_add_station(struct host_if_drv *hWFIDrv,
+ struct add_sta_param *pstrStaParams);
/*!
* @fn s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, const u8* pu8MacAddr)
@@ -1105,7 +964,7 @@ s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrSta
* @date 09 April 2014
* @version 1.0 Description
*/
-s32 host_int_del_allstation(tstrWILC_WFIDrv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]);
+s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]);
/*!
* @fn s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr)
@@ -1120,10 +979,11 @@ s32 host_int_del_allstation(tstrWILC_WFIDrv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN])
* @date 15 July 2012
* @version 1.0 Description
*/
-s32 host_int_del_station(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8MacAddr);
+s32 host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr);
/*!
- * @fn s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam strStaParams)
+ * @fn s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv,
+ * struct add_sta_param *pstrStaParams)
* @brief Notifies the firmware with new parameters of an already associated station
* @details
* @param[in,out] hWFIDrv handle to the wifi driver
@@ -1135,7 +995,8 @@ s32 host_int_del_station(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8MacAddr);
* @date 15 July 2012
* @version 1.0 Description
*/
-s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams);
+s32 host_int_edit_station(struct host_if_drv *hWFIDrv,
+ struct add_sta_param *pstrStaParams);
/*!
* @fn s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32Timeout)
@@ -1152,7 +1013,7 @@ s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrSt
* @date 24 November 2012
* @version 1.0 Description
*/
-s32 host_int_set_power_mgmt(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32Timeout);
+s32 host_int_set_power_mgmt(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32Timeout);
/* @param[in,out] hWFIDrv handle to the wifi driver
* @param[in] bIsEnabled TRUE if enabled, FALSE otherwise
* @param[in] u8count count of mac address entries in the filter table
@@ -1164,7 +1025,7 @@ s32 host_int_set_power_mgmt(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32Ti
* @date 24 November 2012
* @version 1.0 Description
*/
-s32 host_int_setup_multicast_filter(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32count);
+s32 host_int_setup_multicast_filter(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32count);
/**
* @brief host_int_setup_ipaddress
* @details set IP address on firmware
@@ -1174,7 +1035,7 @@ s32 host_int_setup_multicast_filter(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u
* @date
* @version 1.0
*/
-s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
+s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
/**
@@ -1186,7 +1047,7 @@ s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
* @date
* @version 1.0
*/
-s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID);
+s32 host_int_delBASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);
/**
* @brief host_int_delBASession
@@ -1197,7 +1058,7 @@ s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID);
* @date
* @version 1.0
*/
-s32 host_int_del_All_Rx_BASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID);
+s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);
/**
@@ -1209,9 +1070,8 @@ s32 host_int_del_All_Rx_BASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char T
* @date
* @version 1.0
*/
-s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
+s32 host_int_get_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
-#ifdef WILC_P2P
/**
* @brief host_int_remain_on_channel
* @details
@@ -1221,7 +1081,7 @@ s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
* @date
* @version 1.0
*/
-s32 host_int_remain_on_channel(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, tWILCpfRemainOnChanExpired RemainOnChanExpired, tWILCpfRemainOnChanReady RemainOnChanReady, void *pvUserArg);
+s32 host_int_remain_on_channel(struct host_if_drv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, wilc_remain_on_chan_expired RemainOnChanExpired, wilc_remain_on_chan_ready RemainOnChanReady, void *pvUserArg);
/**
* @brief host_int_ListenStateExpired
@@ -1237,7 +1097,7 @@ s32 host_int_remain_on_channel(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID, u32 u
* @date
* @version 1.0
*/
-s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID);
+s32 host_int_ListenStateExpired(struct host_if_drv *hWFIDrv, u32 u32SessionID);
/**
* @brief host_int_frame_register
@@ -1248,8 +1108,7 @@ s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID);
* @date
* @version 1.0
*/
-s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bReg);
-#endif
+s32 host_int_frame_register(struct host_if_drv *hWFIDrv, u16 u16FrameType, bool bReg);
/**
* @brief host_int_set_wfi_drv_handler
* @details
@@ -1259,22 +1118,13 @@ s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bRe
* @date
* @version 1.0
*/
-s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address);
-s32 host_int_set_operation_mode(tstrWILC_WFIDrv *hWFIDrv, u32 u32mode);
-
-static s32 Handle_ScanDone(tstrWILC_WFIDrv *drvHandler, tenuScanEvent enuEvent);
-
-static int host_int_addBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID, short int BufferSize,
- short int SessionTimeout, void *drvHandler);
+int host_int_set_wfi_drv_handler(struct host_if_drv *address);
+int host_int_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode);
+static s32 Handle_ScanDone(struct host_if_drv *drvHandler, enum scan_event enuEvent);
void host_int_freeJoinParams(void *pJoinParams);
-s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics *pstrStatistics);
+s32 host_int_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics);
-/*****************************************************************************/
-/* */
-/* EOF */
-/* */
-/*****************************************************************************/
#endif
diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index b8d7d0484..450af1b77 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -11,15 +11,10 @@
#include "wilc_wlan_if.h"
#include "wilc_wlan.h"
-#ifdef WILC_FULLY_HOSTING_AP
-#include "wilc_host_ap.h"
-#endif
-#ifdef WILC_AP_EXTERNAL_MLME
struct wilc_wfi_radiotap_hdr {
struct ieee80211_radiotap_header hdr;
u8 rate;
- /* u32 channel; */
} __attribute__((packed));
struct wilc_wfi_radiotap_cb_hdr {
@@ -27,16 +22,11 @@ struct wilc_wfi_radiotap_cb_hdr {
u8 rate;
u8 dump;
u16 tx_flags;
- /* u32 channel; */
} __attribute__((packed));
-extern linux_wlan_t *g_linux_wlan;
-
static struct net_device *wilc_wfi_mon; /* global monitor netdev */
-#if USE_WIRELESS
extern int mac_xmit(struct sk_buff *skb, struct net_device *dev);
-#endif
u8 srcAdd[6];
@@ -59,20 +49,15 @@ u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
#define IS_MGMT_STATUS_SUCCES 0x040
#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
-void WILC_WFI_monitor_rx(uint8_t *buff, uint32_t size)
+void WILC_WFI_monitor_rx(u8 *buff, u32 size)
{
- uint32_t header, pkt_offset;
+ u32 header, pkt_offset;
struct sk_buff *skb = NULL;
struct wilc_wfi_radiotap_hdr *hdr;
struct wilc_wfi_radiotap_cb_hdr *cb_hdr;
PRINT_INFO(HOSTAPD_DBG, "In monitor interface receive function\n");
- /* struct WILC_WFI_priv *priv = netdev_priv(dev); */
-
- /* priv = wiphy_priv(priv->dev->ieee80211_ptr->wiphy); */
-
- /* Bug 4601 */
if (wilc_wfi_mon == NULL)
return;
@@ -129,30 +114,19 @@ void WILC_WFI_monitor_rx(uint8_t *buff, uint32_t size)
return;
}
- /* skb = skb_copy_expand(tx_skb, sizeof(*hdr), 0, GFP_ATOMIC); */
- /* if (skb == NULL) */
- /* return; */
-
memcpy(skb_put(skb, size), buff, size);
hdr = (struct wilc_wfi_radiotap_hdr *) skb_push(skb, sizeof(*hdr));
memset(hdr, 0, sizeof(struct wilc_wfi_radiotap_hdr));
hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */
- /* hdr->hdr.it_pad = 0; */
hdr->hdr.it_len = cpu_to_le16(sizeof(struct wilc_wfi_radiotap_hdr));
PRINT_INFO(HOSTAPD_DBG, "Radiotap len %d\n", hdr->hdr.it_len);
hdr->hdr.it_present = cpu_to_le32
(1 << IEEE80211_RADIOTAP_RATE); /* | */
- /* (1 << IEEE80211_RADIOTAP_CHANNEL)); */
PRINT_INFO(HOSTAPD_DBG, "Presentflags %d\n", hdr->hdr.it_present);
hdr->rate = 5; /* txrate->bitrate / 5; */
}
-/* if(INFO || if(skb->data[9] == 0x00 || skb->data[9] == 0xb0))
- * {
- * for(i=0;i<skb->len;i++)
- * PRINT_INFO(HOSTAPD_DBG,"Mon RxData[%d] = %02x\n",i,skb->data[i]);
- * }*/
skb->dev = wilc_wfi_mon;
@@ -175,9 +149,6 @@ struct tx_complete_mon_data {
static void mgmt_tx_complete(void *priv, int status)
{
- /* struct sk_buff *skb2; */
- /* struct wilc_wfi_radiotap_cb_hdr *cb_hdr; */
-
struct tx_complete_mon_data *pv_data = (struct tx_complete_mon_data *)priv;
u8 *buf = pv_data->buff;
@@ -191,42 +162,11 @@ static void mgmt_tx_complete(void *priv, int status)
}
-/* //(skb->data[9] == 0x00 || skb->data[9] == 0xb0 || skb->data[9] == 0x40 || skb->data[9] == 0xd0 )
- * {
- * skb2 = dev_alloc_skb(pv_data->size+sizeof(struct wilc_wfi_radiotap_cb_hdr));
- *
- * memcpy(skb_put(skb2,pv_data->size),pv_data->buff, pv_data->size);
- *
- * cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *) skb_push(skb2, sizeof(*cb_hdr));
- * memset(cb_hdr, 0, sizeof(struct wilc_wfi_radiotap_cb_hdr));
- *
- * cb_hdr->hdr.it_version = 0;//PKTHDR_RADIOTAP_VERSION;
- *
- * cb_hdr->hdr.it_len = cpu_to_le16(sizeof(struct wilc_wfi_radiotap_cb_hdr));
- *
- * cb_hdr->hdr.it_present = cpu_to_le32(
- * (1 << IEEE80211_RADIOTAP_RATE) |
- * (1 << IEEE80211_RADIOTAP_TX_FLAGS));
- *
- * cb_hdr->rate = 5;//txrate->bitrate / 5;
- * cb_hdr->tx_flags = 0x0004;
- *
- * skb2->dev = wilc_wfi_mon;
- * skb_set_mac_header(skb2, 0);
- * skb2->ip_summed = CHECKSUM_UNNECESSARY;
- * skb2->pkt_type = PACKET_OTHERHOST;
- * skb2->protocol = htons(ETH_P_802_2);
- * memset(skb2->cb, 0, sizeof(skb2->cb));
- *
- * netif_rx(skb2);
- * }*/
/* incase of fully hosting mode, the freeing will be done in response to the cfg packet */
- #ifndef WILC_FULLY_HOSTING_AP
kfree(pv_data->buff);
kfree(pv_data);
- #endif
}
static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)
{
@@ -234,44 +174,29 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)
if (dev == NULL) {
PRINT_D(HOSTAPD_DBG, "ERROR: dev == NULL\n");
- return WILC_FAIL;
+ return -EFAULT;
}
netif_stop_queue(dev);
mgmt_tx = kmalloc(sizeof(struct tx_complete_mon_data), GFP_ATOMIC);
if (mgmt_tx == NULL) {
PRINT_ER("Failed to allocate memory for mgmt_tx structure\n");
- return WILC_FAIL;
+ return -EFAULT;
}
- #ifdef WILC_FULLY_HOSTING_AP
- /* add space for the pointer to tx_complete_mon_data */
- len += sizeof(struct tx_complete_mon_data *);
- #endif
-
mgmt_tx->buff = kmalloc(len, GFP_ATOMIC);
if (mgmt_tx->buff == NULL) {
PRINT_ER("Failed to allocate memory for mgmt_tx buff\n");
- return WILC_FAIL;
+ kfree(mgmt_tx);
+ return -EFAULT;
}
mgmt_tx->size = len;
- #ifndef WILC_FULLY_HOSTING_AP
memcpy(mgmt_tx->buff, buf, len);
- #else
- memcpy(mgmt_tx->buff, buf, len - sizeof(struct tx_complete_mon_data *));
- memcpy((mgmt_tx->buff) + (len - sizeof(struct tx_complete_mon_data *)), &mgmt_tx, sizeof(struct tx_complete_mon_data *));
-
- /* filter data frames to handle it's PS */
- if (filter_monitor_data_frames((mgmt_tx->buff), len) == true) {
- return;
- }
-
- #endif /* WILC_FULLY_HOSTING_AP */
-
- g_linux_wlan->oup.wlan_add_mgmt_to_tx_que(mgmt_tx, mgmt_tx->buff, mgmt_tx->size, mgmt_tx_complete);
+ wilc_wlan_txq_add_mgmt_pkt(mgmt_tx, mgmt_tx->buff, mgmt_tx->size,
+ mgmt_tx_complete);
netif_wake_queue(dev);
return 0;
@@ -295,17 +220,14 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb,
struct sk_buff *skb2;
struct wilc_wfi_radiotap_cb_hdr *cb_hdr;
- /* Bug 4601 */
if (wilc_wfi_mon == NULL)
- return WILC_FAIL;
-
- /* if(skb->data[3] == 0x10 || skb->data[3] == 0xb0) */
+ return -EFAULT;
mon_priv = netdev_priv(wilc_wfi_mon);
if (mon_priv == NULL) {
PRINT_ER("Monitor interface private structure is NULL\n");
- return WILC_FAIL;
+ return -EFAULT;
}
@@ -367,7 +289,6 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb,
PRINT_INFO(HOSTAPD_DBG, "SKB netdevice name = %s\n", skb->dev->name);
PRINT_INFO(HOSTAPD_DBG, "MONITOR real dev name = %s\n", mon_priv->real_ndev->name);
- #if USE_WIRELESS
/* Identify if Ethernet or MAC header (data or mgmt) */
memcpy(srcAdd, &skb->data[10], 6);
memcpy(bssid, &skb->data[16], 6);
@@ -378,9 +299,7 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb,
dev_kfree_skb(skb);
} else
ret = mac_xmit(skb, mon_priv->real_ndev);
- #endif
- /* return NETDEV_TX_OK; */
return ret;
}
@@ -389,117 +308,6 @@ static const struct net_device_ops wilc_wfi_netdev_ops = {
};
-#ifdef WILC_FULLY_HOSTING_AP
-/*
- * @brief WILC_mgm_HOSTAPD_ACK
- * @details report the status of transmitted mgmt frames to HOSTAPD
- * @param[in] priv : pointer to tx_complete_mon_data struct
- * bStatus : status of transmission
- * @author Abd Al-Rahman Diab
- * @date 9 May 2013
- * @version 1.0
- */
-void WILC_mgm_HOSTAPD_ACK(void *priv, bool bStatus)
-{
- struct sk_buff *skb;
- struct wilc_wfi_radiotap_cb_hdr *cb_hdr;
-
- struct tx_complete_mon_data *pv_data = (struct tx_complete_mon_data *)priv;
- u8 *buf = pv_data->buff;
-
- /* len of the original frame without the added pointer at the tail */
- u16 u16len = (pv_data->size) - sizeof(struct tx_complete_mon_data *);
-
-
- /*if(bStatus == 1){
- * if(INFO || buf[0] == 0x10 || buf[0] == 0xb0)
- * PRINT_D(HOSTAPD_DBG,"Packet sent successfully - Size = %d - Address = %p.\n",u16len,pv_data->buff);
- * }else{
- * PRINT_D(HOSTAPD_DBG,"Couldn't send packet - Size = %d - Address = %p.\n",u16len,pv_data->buff);
- * }
- */
-
- /* (skb->data[9] == 0x00 || skb->data[9] == 0xb0 || skb->data[9] == 0x40 || skb->data[9] == 0xd0 ) */
- {
- skb = dev_alloc_skb(u16len + sizeof(struct wilc_wfi_radiotap_cb_hdr));
-
- memcpy(skb_put(skb, u16len), pv_data->buff, u16len);
-
- cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *) skb_push(skb, sizeof(*cb_hdr));
- memset(cb_hdr, 0, sizeof(struct wilc_wfi_radiotap_cb_hdr));
-
- cb_hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */
-
- cb_hdr->hdr.it_len = cpu_to_le16(sizeof(struct wilc_wfi_radiotap_cb_hdr));
-
- cb_hdr->hdr.it_present = cpu_to_le32(
- (1 << IEEE80211_RADIOTAP_RATE) |
- (1 << IEEE80211_RADIOTAP_TX_FLAGS));
-
- cb_hdr->rate = 5; /* txrate->bitrate / 5; */
-
-
- if (bStatus) {
- /* success */
- cb_hdr->tx_flags = IEEE80211_RADIOTAP_F_TX_RTS;
- } else {
- cb_hdr->tx_flags = IEEE80211_RADIOTAP_F_TX_FAIL;
- }
-
- skb->dev = wilc_wfi_mon;
- skb_set_mac_header(skb, 0);
- skb->ip_summed = CHECKSUM_UNNECESSARY;
- skb->pkt_type = PACKET_OTHERHOST;
- skb->protocol = htons(ETH_P_802_2);
- memset(skb->cb, 0, sizeof(skb->cb));
-
- netif_rx(skb);
- }
-
- /* incase of fully hosting mode, the freeing will be done in response to the cfg packet */
- kfree(pv_data->buff);
-
- kfree(pv_data);
-
-}
-#endif /* WILC_FULLY_HOSTING_AP */
-
-/**
- * @brief WILC_WFI_mon_setup
- * @details
- * @param[in]
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 12 JUL 2012
- * @version 1.0
- */
-static void WILC_WFI_mon_setup(struct net_device *dev)
-{
-
- dev->netdev_ops = &wilc_wfi_netdev_ops;
- /* dev->destructor = free_netdev; */
- PRINT_INFO(CORECONFIG_DBG, "In Ethernet setup function\n");
- ether_setup(dev);
- dev->priv_flags |= IFF_NO_QUEUE;
- dev->type = ARPHRD_IEEE80211_RADIOTAP;
- eth_zero_addr(dev->dev_addr);
-
- #ifdef USE_WIRELESS
- {
- /* u8 * mac_add; */
- unsigned char mac_add[] = {0x00, 0x50, 0xc2, 0x5e, 0x10, 0x8f};
- /* priv = wiphy_priv(priv->dev->ieee80211_ptr->wiphy); */
- /* mac_add = (u8*)WILC_MALLOC(ETH_ALEN); */
- /* status = host_int_get_MacAddress(priv->hWILCWFIDrv,mac_add); */
- /* mac_add[ETH_ALEN-1]+=1; */
- memcpy(dev->dev_addr, mac_add, ETH_ALEN);
- }
- #else
- dev->dev_addr[0] = 0x12;
- #endif
-
-}
-
/**
* @brief WILC_WFI_init_mon_interface
* @details
@@ -513,7 +321,7 @@ struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_devi
{
- u32 ret = WILC_SUCCESS;
+ u32 ret = 0;
struct WILC_WFI_mon_priv *priv;
/*If monitor interface is already initialized, return it*/
@@ -571,7 +379,6 @@ int WILC_WFI_deinit_mon_interface(void)
}
PRINT_D(HOSTAPD_DBG, "Unregister netdev\n");
unregister_netdev(wilc_wfi_mon);
- /* free_netdev(wilc_wfi_mon); */
if (rollback_lock) {
rtnl_lock();
@@ -579,7 +386,6 @@ int WILC_WFI_deinit_mon_interface(void)
}
wilc_wfi_mon = NULL;
}
- return WILC_SUCCESS;
+ return 0;
}
-#endif /* WILC_AP_EXTERNAL_MLME */
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 7ba8e9efd..3015ca379 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -2,11 +2,6 @@
#include "linux_wlan_common.h"
#include "wilc_wlan_if.h"
#include "wilc_wlan.h"
-#ifdef USE_WIRELESS
-#include "wilc_wfi_cfgoperations.h"
-#endif
-
-#include "linux_wlan_common.h"
#include <linux/slab.h>
#include <linux/sched.h>
@@ -22,9 +17,7 @@
#include <linux/init.h>
#include <linux/netdevice.h>
-#ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
#include <linux/inetdevice.h>
-#endif
#include <linux/etherdevice.h>
#include <linux/module.h>
#include <linux/kernel.h>
@@ -39,17 +32,6 @@
#include "linux_wlan_spi.h"
#endif
-#ifdef WILC_FULLY_HOSTING_AP
-#include "wilc_host_ap.h"
-#endif
-
-#ifdef STATIC_MACADDRESS /* brandy_0724 [[ */
-#include <linux/vmalloc.h>
-#include <linux/fs.h>
-struct task_struct *wilc_mac_thread;
-unsigned char mac_add[] = {0x00, 0x80, 0xC2, 0x5E, 0xa2, 0xb2};
-#endif /* brandy_0724 ]] */
-
#if defined(CUSTOMER_PLATFORM)
/*
TODO : Write power control functions as customer platform.
@@ -63,16 +45,10 @@ unsigned char mac_add[] = {0x00, 0x80, 0xC2, 0x5E, 0xa2, 0xb2};
#define _linux_wlan_device_removal() {}
#endif
-#ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
extern bool g_obtainingIP;
-#endif
-extern u16 Set_machw_change_vir_if(bool bValue);
extern void resolve_disconnect_aberration(void *drvHandler);
extern u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
-void wilc1000_wlan_deinit(linux_wlan_t *nic);
-#ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
extern struct timer_list hDuringIpTimer;
-#endif
static int linux_wlan_device_power(int on_off)
{
@@ -102,35 +78,11 @@ static int linux_wlan_device_detection(int on_off)
return 0;
}
-#ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr);
static struct notifier_block g_dev_notifier = {
.notifier_call = dev_state_ev_handler
};
-#endif
-
-#define wilc_wlan_deinit(nic) { if (&g_linux_wlan->oup != NULL) \
- if (g_linux_wlan->oup.wlan_cleanup != NULL) \
- g_linux_wlan->oup.wlan_cleanup(); }
-
-#ifndef STA_FIRMWARE
-#define STA_FIRMWARE "/*(DEBLOBBED)*/"
-#endif
-
-#ifndef AP_FIRMWARE
-#define AP_FIRMWARE "/*(DEBLOBBED)*/"
-#endif
-
-#ifndef P2P_CONCURRENCY_FIRMWARE
-#define P2P_CONCURRENCY_FIRMWARE "/*(DEBLOBBED)*/"
-#endif
-
-typedef struct android_wifi_priv_cmd {
- char *buf;
- int used_len;
- int total_len;
-} android_wifi_priv_cmd;
#define IRQ_WAIT 1
#define IRQ_NO_WAIT 0
@@ -141,20 +93,13 @@ typedef struct android_wifi_priv_cmd {
* deinitialized from mdoule_exit
*/
static struct semaphore close_exit_sync;
-unsigned int int_rcvdU;
-unsigned int int_rcvdB;
-unsigned int int_clrd;
-
-static int wlan_deinit_locks(linux_wlan_t *nic);
-static void wlan_deinitialize_threads(linux_wlan_t *nic);
-static void linux_wlan_lock(void *vp);
-void linux_wlan_unlock(void *vp);
-extern void WILC_WFI_monitor_rx(uint8_t *buff, uint32_t size);
-extern void WILC_WFI_p2p_rx(struct net_device *dev, uint8_t *buff, uint32_t size);
-
-static void *internal_alloc(uint32_t size, uint32_t flag);
+
+static int wlan_deinit_locks(struct net_device *dev);
+static void wlan_deinitialize_threads(struct net_device *dev);
+extern void WILC_WFI_monitor_rx(u8 *buff, u32 size);
+extern void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
+
static void linux_wlan_tx_complete(void *priv, int status);
-void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset);
static int mac_init_fn(struct net_device *ndev);
int mac_xmit(struct sk_buff *skb, struct net_device *dev);
int mac_open(struct net_device *ndev);
@@ -167,8 +112,7 @@ static void wilc_set_multicast_list(struct net_device *dev);
* for now - in frmw_to_linux there should be private data to be passed to it
* and this data should be pointer to net device
*/
-linux_wlan_t *g_linux_wlan;
-wilc_wlan_oup_t *gpstrWlanOps;
+struct wilc *g_linux_wlan;
bool bEnablePS = true;
static const struct net_device_ops wilc_netdev_ops = {
@@ -182,65 +126,11 @@ static const struct net_device_ops wilc_netdev_ops = {
};
-#ifdef DEBUG_MODE
-
-extern volatile int timeNo;
-
-#define DEGUG_BUFFER_LENGTH 1000
-volatile int WatchDogdebuggerCounter;
-char DebugBuffer[DEGUG_BUFFER_LENGTH + 20] = {0};
-static char *ps8current = DebugBuffer;
-
-void printk_later(const char *format, ...)
-{
- va_list args;
- va_start(args, format);
- ps8current += vsprintf(ps8current, format, args);
- va_end(args);
- if ((ps8current - DebugBuffer) > DEGUG_BUFFER_LENGTH)
- ps8current = DebugBuffer;
-
-}
-
-void dump_logs(void)
-{
- if (DebugBuffer[0]) {
- DebugBuffer[DEGUG_BUFFER_LENGTH] = 0;
- PRINT_INFO(GENERIC_DBG, "early printed\n");
- PRINT_D(GENERIC_DBG, ps8current + 1);
- ps8current[1] = 0;
- PRINT_INFO(GENERIC_DBG, "latest printed\n");
- PRINT_D(GENERIC_DBG, DebugBuffer);
- DebugBuffer[0] = 0;
- ps8current = DebugBuffer;
- }
-}
-
-void Reset_WatchDogdebugger(void)
-{
- WatchDogdebuggerCounter = 0;
-}
-
-static int DebuggingThreadTask(void *vp)
-{
- while (1) {
- while (!WatchDogdebuggerCounter) {
- PRINT_D(GENERIC_DBG, "Debug Thread Running %d\n", timeNo);
- WatchDogdebuggerCounter = 1;
- msleep(10000);
- }
- dump_logs();
- WatchDogdebuggerCounter = 0;
- }
-}
-#endif
-
-#ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr)
{
struct in_ifaddr *dev_iface = (struct in_ifaddr *)ptr;
- struct WILC_WFI_priv *priv;
- tstrWILC_WFIDrv *pstrWFIDrv;
+ struct wilc_priv *priv;
+ struct host_if_drv *pstrWFIDrv;
struct net_device *dev;
u8 *pIP_Add_buff;
perInterface_wlan_t *nic;
@@ -267,7 +157,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
return NOTIFY_DONE;
}
- pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
nic = netdev_priv(dev);
if (nic == NULL || pstrWFIDrv == NULL) {
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
@@ -334,136 +224,56 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
return NOTIFY_DONE;
}
-#endif
-
-/*
- * Interrupt initialization and handling functions
- */
-
-void linux_wlan_enable_irq(void)
-{
-
-#if (RX_BH_TYPE != RX_BH_THREADED_IRQ)
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
- PRINT_D(INT_DBG, "Enabling IRQ ...\n");
- enable_irq(g_linux_wlan->dev_irq_num);
-#endif
-#endif
-}
-
-void linux_wlan_disable_irq(int wait)
-{
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
- if (wait) {
- PRINT_D(INT_DBG, "Disabling IRQ ...\n");
- disable_irq(g_linux_wlan->dev_irq_num);
- } else {
- PRINT_D(INT_DBG, "Disabling IRQ ...\n");
- disable_irq_nosync(g_linux_wlan->dev_irq_num);
- }
-#endif
-}
#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
static irqreturn_t isr_uh_routine(int irq, void *user_data)
{
- int_rcvdU++;
-#if (RX_BH_TYPE != RX_BH_THREADED_IRQ)
- linux_wlan_disable_irq(IRQ_NO_WAIT);
-#endif
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+ struct net_device *dev = (struct net_device *)user_data;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
PRINT_D(INT_DBG, "Interrupt received UH\n");
/*While mac is closing cacncel the handling of any interrupts received*/
- if (g_linux_wlan->close) {
+ if (wilc->close) {
PRINT_ER("Driver is CLOSING: Can't handle UH interrupt\n");
- #if (RX_BH_TYPE == RX_BH_THREADED_IRQ)
return IRQ_HANDLED;
- #else
- return IRQ_NONE;
- #endif
-
}
-#if (RX_BH_TYPE == RX_BH_WORK_QUEUE)
- schedule_work(&g_linux_wlan->rx_work_queue);
- return IRQ_HANDLED;
-#elif (RX_BH_TYPE == RX_BH_KTHREAD)
- linux_wlan_unlock(&g_linux_wlan->rx_sem);
- return IRQ_HANDLED;
-#elif (RX_BH_TYPE == RX_BH_THREADED_IRQ)
return IRQ_WAKE_THREAD;
-#endif
-
}
#endif
-#if (RX_BH_TYPE == RX_BH_WORK_QUEUE || RX_BH_TYPE == RX_BH_THREADED_IRQ)
-
-#if (RX_BH_TYPE == RX_BH_THREADED_IRQ)
irqreturn_t isr_bh_routine(int irq, void *userdata)
{
- linux_wlan_t *nic;
- nic = (linux_wlan_t *)userdata;
-#else
-static void isr_bh_routine(struct work_struct *work)
-{
perInterface_wlan_t *nic;
- nic = (perInterface_wlan_t *)container_of(work, linux_wlan_t, rx_work_queue);
-#endif
+ struct wilc *wilc;
+
+ nic = netdev_priv(userdata);
+ wilc = nic->wilc;
/*While mac is closing cacncel the handling of any interrupts received*/
- if (g_linux_wlan->close) {
+ if (wilc->close) {
PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n");
- #if (RX_BH_TYPE == RX_BH_THREADED_IRQ)
return IRQ_HANDLED;
- #else
- return;
- #endif
}
- int_rcvdB++;
PRINT_D(INT_DBG, "Interrupt received BH\n");
- if (g_linux_wlan->oup.wlan_handle_rx_isr != 0)
- g_linux_wlan->oup.wlan_handle_rx_isr();
- else
- PRINT_ER("wlan_handle_rx_isr() hasn't been initialized\n");
+ wilc_handle_isr(wilc);
-#if (RX_BH_TYPE == RX_BH_THREADED_IRQ)
return IRQ_HANDLED;
-#endif
-}
-#elif (RX_BH_TYPE == RX_BH_KTHREAD)
-static int isr_bh_routine(void *vp)
-{
- linux_wlan_t *nic;
-
- nic = (linux_wlan_t *)vp;
-
- while (1) {
- linux_wlan_lock(&nic->rx_sem);
- if (g_linux_wlan->close) {
-
- while (!kthread_should_stop())
- schedule();
-
- break;
- }
- int_rcvdB++;
- PRINT_D(INT_DBG, "Interrupt received BH\n");
- if (g_linux_wlan->oup.wlan_handle_rx_isr != 0)
- g_linux_wlan->oup.wlan_handle_rx_isr();
- else
- PRINT_ER("wlan_handle_rx_isr() hasn't been initialized\n");
- }
-
- return 0;
}
-#endif
#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
-static int init_irq(linux_wlan_t *p_nic)
+static int init_irq(struct net_device *dev)
{
int ret = 0;
- linux_wlan_t *nic = p_nic;
+ perInterface_wlan_t *nic;
+ struct wilc *wl;
+
+ nic = netdev_priv(dev);
+ wl = nic->wilc;
/*initialize GPIO and register IRQ num*/
/*GPIO request*/
@@ -475,49 +285,42 @@ static int init_irq(linux_wlan_t *p_nic)
*
* ex) nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
*/
-#elif defined(NM73131_0_BOARD)
- nic->dev_irq_num = IRQ_WILC1000;
-#elif defined(PANDA_BOARD)
- gpio_export(GPIO_NUM, 1);
- nic->dev_irq_num = OMAP_GPIO_IRQ(GPIO_NUM);
- irq_set_irq_type(nic->dev_irq_num, IRQ_TYPE_LEVEL_LOW);
#else
- nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
+ wl->dev_irq_num = gpio_to_irq(GPIO_NUM);
#endif
} else {
ret = -1;
PRINT_ER("could not obtain gpio for WILC_INTR\n");
}
-#if (RX_BH_TYPE == RX_BH_THREADED_IRQ)
- if ((ret != -1) && (request_threaded_irq(nic->dev_irq_num, isr_uh_routine, isr_bh_routine,
+ if ((ret != -1) && (request_threaded_irq(wl->dev_irq_num, isr_uh_routine, isr_bh_routine,
IRQF_TRIGGER_LOW | IRQF_ONESHOT, /*Without IRQF_ONESHOT the uh will remain kicked in and dont gave a chance to bh*/
- "WILC_IRQ", nic)) < 0) {
-
-#else
- /*Request IRQ*/
- if ((ret != -1) && (request_irq(nic->dev_irq_num, isr_uh_routine,
- IRQF_TRIGGER_LOW, "WILC_IRQ", nic) < 0)) {
+ "WILC_IRQ", dev)) < 0) {
-#endif
PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM);
ret = -1;
} else {
PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: %d\n",
- nic->dev_irq_num, GPIO_NUM);
+ wl->dev_irq_num, GPIO_NUM);
}
return ret;
}
#endif
-static void deinit_irq(linux_wlan_t *nic)
+static void deinit_irq(struct net_device *dev)
{
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
+
#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
/* Deintialize IRQ */
- if (&nic->dev_irq_num != 0) {
- free_irq(nic->dev_irq_num, g_linux_wlan);
+ if (&wilc->dev_irq_num != 0) {
+ free_irq(wilc->dev_irq_num, wilc);
gpio_free(GPIO_NUM);
}
@@ -527,83 +330,15 @@ static void deinit_irq(linux_wlan_t *nic)
/*
* OS functions
*/
-static void linux_wlan_msleep(uint32_t msc)
-{
- if (msc <= 4000000) {
- u32 u32Temp = msc * 1000;
- usleep_range(u32Temp, u32Temp);
- } else {
- msleep(msc);
- }
-}
-
-static void linux_wlan_atomic_msleep(uint32_t msc)
-{
- mdelay(msc);
-}
-static void linux_wlan_dbg(uint8_t *buff)
+void linux_wlan_dbg(u8 *buff)
{
PRINT_D(INIT_DBG, "%d\n", *buff);
}
-static void *linux_wlan_malloc_atomic(uint32_t sz)
-{
- char *pntr = NULL;
- pntr = kmalloc(sz, GFP_ATOMIC);
- PRINT_D(MEM_DBG, "Allocating %d bytes at address %p\n", sz, pntr);
- return (void *)pntr;
-
-}
-static void *linux_wlan_malloc(uint32_t sz)
-{
- char *pntr = NULL;
- pntr = kmalloc(sz, GFP_KERNEL);
- PRINT_D(MEM_DBG, "Allocating %d bytes at address %p\n", sz, pntr);
- return (void *)pntr;
-}
-
-void linux_wlan_free(void *vp)
-{
- if (vp != NULL) {
- PRINT_D(MEM_DBG, "Freeing %p\n", vp);
- kfree(vp);
- }
-}
-
-static void *internal_alloc(uint32_t size, uint32_t flag)
-{
- char *pntr = NULL;
- pntr = kmalloc(size, flag);
- PRINT_D(MEM_DBG, "Allocating %d bytes at address %p\n", size, pntr);
- return (void *)pntr;
-}
-
-static void linux_wlan_init_lock(char *lockName, void *plock, int count)
-{
- sema_init((struct semaphore *)plock, count);
- PRINT_D(LOCK_DBG, "Initializing [%s][%p]\n", lockName, plock);
-
-}
-
-static void linux_wlan_deinit_lock(void *plock)
-{
- /* mutex_destroy((struct mutex*)plock); */
-}
-
-static void linux_wlan_lock(void *vp)
-{
- PRINT_D(LOCK_DBG, "Locking %p\n", vp);
- if (vp != NULL) {
- while (down_interruptible((struct semaphore *) vp))
- ;
- } else {
- PRINT_ER("Failed, mutex is NULL\n");
- }
-}
-
-static int linux_wlan_lock_timeout(void *vp, u32 timeout)
+int linux_wlan_lock_timeout(void *vp, u32 timeout)
{
int error = -1;
+
PRINT_D(LOCK_DBG, "Locking %p\n", vp);
if (vp != NULL)
error = down_timeout((struct semaphore *)vp, msecs_to_jiffies(timeout));
@@ -612,113 +347,23 @@ static int linux_wlan_lock_timeout(void *vp, u32 timeout)
return error;
}
-void linux_wlan_unlock(void *vp)
-{
- PRINT_D(LOCK_DBG, "Unlocking %p\n", vp);
- if (vp != NULL)
- up((struct semaphore *)vp);
- else
- PRINT_ER("Failed, mutex is NULL\n");
-}
-
-static void linux_wlan_init_mutex(char *lockName, void *plock, int count)
-{
- mutex_init((struct mutex *)plock);
- PRINT_D(LOCK_DBG, "Initializing mutex [%s][%p]\n", lockName, plock);
-
-}
-
-static void linux_wlan_deinit_mutex(void *plock)
-{
- mutex_destroy((struct mutex *)plock);
-}
-
-static void linux_wlan_lock_mutex(void *vp)
-{
- PRINT_D(LOCK_DBG, "Locking mutex %p\n", vp);
- if (vp != NULL) {
- /*
- * if(mutex_is_locked((struct mutex*)vp))
- * {
- * //PRINT_ER("Mutex already locked - %p \n",vp);
- * }
- */
- mutex_lock((struct mutex *)vp);
-
- } else {
- PRINT_ER("Failed, mutex is NULL\n");
- }
-}
-
-static void linux_wlan_unlock_mutex(void *vp)
-{
- PRINT_D(LOCK_DBG, "Unlocking mutex %p\n", vp);
- if (vp != NULL) {
-
- if (mutex_is_locked((struct mutex *)vp)) {
- mutex_unlock((struct mutex *)vp);
- } else {
- /* PRINT_ER("Mutex already unlocked - %p\n",vp); */
- }
-
- } else {
- PRINT_ER("Failed, mutex is NULL\n");
- }
-}
-
-/*Added by Amr - BugID_4720*/
-static void linux_wlan_init_spin_lock(char *lockName, void *plock, int count)
-{
- spin_lock_init((spinlock_t *)plock);
- PRINT_D(SPIN_DEBUG, "Initializing mutex [%s][%p]\n", lockName, plock);
-
-}
-
-static void linux_wlan_deinit_spin_lock(void *plock)
-{
-
-}
-static void linux_wlan_spin_lock(void *vp, unsigned long *flags)
-{
- unsigned long lflags;
- PRINT_D(SPIN_DEBUG, "Lock spin %p\n", vp);
- if (vp != NULL) {
- spin_lock_irqsave((spinlock_t *)vp, lflags);
- *flags = lflags;
- } else {
- PRINT_ER("Failed, spin lock is NULL\n");
- }
-}
-static void linux_wlan_spin_unlock(void *vp, unsigned long *flags)
-{
- unsigned long lflags = *flags;
- PRINT_D(SPIN_DEBUG, "Unlock spin %p\n", vp);
- if (vp != NULL) {
- spin_unlock_irqrestore((spinlock_t *)vp, lflags);
- *flags = lflags;
- } else {
- PRINT_ER("Failed, spin lock is NULL\n");
- }
-}
-
-static void linux_wlan_mac_indicate(int flag)
+void linux_wlan_mac_indicate(struct wilc *wilc, int flag)
{
/*I have to do it that way becuase there is no mean to encapsulate device pointer
* as a parameter
*/
- linux_wlan_t *pd = g_linux_wlan;
int status;
if (flag == WILC_MAC_INDICATE_STATUS) {
- pd->oup.wlan_cfg_get_value(WID_STATUS, (unsigned char *)&status, 4);
- if (pd->mac_status == WILC_MAC_STATUS_INIT) {
- pd->mac_status = status;
- linux_wlan_unlock(&pd->sync_event);
+ wilc_wlan_cfg_get_val(WID_STATUS, (unsigned char *)&status, 4);
+ if (wilc->mac_status == WILC_MAC_STATUS_INIT) {
+ wilc->mac_status = status;
+ up(&wilc->sync_event);
} else {
- pd->mac_status = status;
+ wilc->mac_status = status;
}
- if (pd->mac_status == WILC_MAC_STATUS_CONNECT) { /* Connect */
+ if (wilc->mac_status == WILC_MAC_STATUS_CONNECT) { /* Connect */
}
} else if (flag == WILC_MAC_INDICATE_SCAN) {
@@ -728,92 +373,65 @@ static void linux_wlan_mac_indicate(int flag)
}
-struct net_device *GetIfHandler(uint8_t *pMacHeader)
+struct net_device *GetIfHandler(struct wilc *wilc, u8 *pMacHeader)
{
- uint8_t *Bssid, *Bssid1;
+ u8 *Bssid, *Bssid1;
int i = 0;
Bssid = pMacHeader + 10;
Bssid1 = pMacHeader + 4;
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
- if (!memcmp(Bssid1, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN) ||
- !memcmp(Bssid, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN)) {
- return g_linux_wlan->strInterfaceInfo[i].wilc_netdev;
- }
- }
+ for (i = 0; i < wilc->vif_num; i++)
+ if (!memcmp(Bssid1, wilc->vif[i].bssid, ETH_ALEN) ||
+ !memcmp(Bssid, wilc->vif[i].bssid, ETH_ALEN))
+ return wilc->vif[i].ndev;
+
PRINT_INFO(INIT_DBG, "Invalide handle\n");
for (i = 0; i < 25; i++)
PRINT_D(INIT_DBG, "%02x ", pMacHeader[i]);
Bssid = pMacHeader + 18;
Bssid1 = pMacHeader + 12;
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
- if (!memcmp(Bssid1, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN) ||
- !memcmp(Bssid, g_linux_wlan->strInterfaceInfo[i].aBSSID, ETH_ALEN)) {
- PRINT_D(INIT_DBG, "Ctx [%p]\n", g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
- return g_linux_wlan->strInterfaceInfo[i].wilc_netdev;
- }
- }
+ for (i = 0; i < wilc->vif_num; i++)
+ if (!memcmp(Bssid1, wilc->vif[i].bssid, ETH_ALEN) ||
+ !memcmp(Bssid, wilc->vif[i].bssid, ETH_ALEN))
+ return wilc->vif[i].ndev;
+
PRINT_INFO(INIT_DBG, "\n");
return NULL;
}
-int linux_wlan_set_bssid(struct net_device *wilc_netdev, uint8_t *pBSSID)
+int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID)
{
int i = 0;
int ret = -1;
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
- PRINT_D(INIT_DBG, "set bssid on[%p]\n", wilc_netdev);
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
- if (g_linux_wlan->strInterfaceInfo[i].wilc_netdev == wilc_netdev) {
- PRINT_D(INIT_DBG, "set bssid [%x][%x][%x]\n", pBSSID[0], pBSSID[1], pBSSID[2]);
- memcpy(g_linux_wlan->strInterfaceInfo[i].aBSSID, pBSSID, 6);
+ nic = netdev_priv(wilc_netdev);
+ wilc = nic->wilc;
+
+ for (i = 0; i < wilc->vif_num; i++)
+ if (wilc->vif[i].ndev == wilc_netdev) {
+ memcpy(wilc->vif[i].bssid, pBSSID, 6);
ret = 0;
break;
}
- }
+
return ret;
}
-/*BugID_5213*/
/*Function to get number of connected interfaces*/
int linux_wlan_get_num_conn_ifcs(void)
{
- uint8_t i = 0;
- uint8_t null_bssid[6] = {0};
- uint8_t ret_val = 0;
+ u8 i = 0;
+ u8 null_bssid[6] = {0};
+ u8 ret_val = 0;
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
- if (memcmp(g_linux_wlan->strInterfaceInfo[i].aBSSID, null_bssid, 6))
+ for (i = 0; i < g_linux_wlan->vif_num; i++)
+ if (memcmp(g_linux_wlan->vif[i].bssid, null_bssid, 6))
ret_val++;
- }
- return ret_val;
-}
-
-static int linux_wlan_rxq_task(void *vp)
-{
-
- /* inform wilc1000_wlan_init that RXQ task is started. */
- linux_wlan_unlock(&g_linux_wlan->rxq_thread_started);
- while (1) {
- linux_wlan_lock(&g_linux_wlan->rxq_event);
- /* wait_for_completion(&g_linux_wlan->rxq_event); */
-
- if (g_linux_wlan->close) {
- /*Unlock the mutex in the mac_close function to indicate the exiting of the RX thread */
- linux_wlan_unlock(&g_linux_wlan->rxq_thread_started);
- while (!kthread_should_stop())
- schedule();
-
- PRINT_D(RX_DBG, " RX thread stopped\n");
- break;
- }
- PRINT_D(RX_DBG, "Calling wlan_handle_rx_que()\n");
-
- g_linux_wlan->oup.wlan_handle_rx_que();
- }
- return 0;
+ return ret_val;
}
#define USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS
@@ -821,7 +439,9 @@ static int linux_wlan_rxq_task(void *vp)
static int linux_wlan_txq_task(void *vp)
{
int ret, txq_count;
-
+ perInterface_wlan_t *nic;
+ struct wilc *wl;
+ struct net_device *dev = vp;
#if defined USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS
#define TX_BACKOFF_WEIGHT_INCR_STEP (1)
#define TX_BACKOFF_WEIGHT_DECR_STEP (1)
@@ -831,18 +451,21 @@ static int linux_wlan_txq_task(void *vp)
int backoff_weight = TX_BACKOFF_WEIGHT_MIN;
#endif
+ nic = netdev_priv(dev);
+ wl = nic->wilc;
+
/* inform wilc1000_wlan_init that TXQ task is started. */
- linux_wlan_unlock(&g_linux_wlan->txq_thread_started);
+ up(&wl->txq_thread_started);
while (1) {
PRINT_D(TX_DBG, "txq_task Taking a nap :)\n");
- linux_wlan_lock(&g_linux_wlan->txq_event);
+ down(&wl->txq_event);
/* wait_for_completion(&pd->txq_event); */
PRINT_D(TX_DBG, "txq_task Who waked me up :$\n");
- if (g_linux_wlan->close) {
+ if (wl->close) {
/*Unlock the mutex in the mac_close function to indicate the exiting of the TX thread */
- linux_wlan_unlock(&g_linux_wlan->txq_thread_started);
+ up(&wl->txq_thread_started);
while (!kthread_should_stop())
schedule();
@@ -852,17 +475,17 @@ static int linux_wlan_txq_task(void *vp)
}
PRINT_D(TX_DBG, "txq_task handle the sending packet and let me go to sleep.\n");
#if !defined USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS
- g_linux_wlan->oup.wlan_handle_tx_que();
+ ret = wilc_wlan_handle_txq(dev, &txq_count);
#else
do {
- ret = g_linux_wlan->oup.wlan_handle_tx_que(&txq_count);
+ ret = wilc_wlan_handle_txq(dev, &txq_count);
if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD /* && netif_queue_stopped(pd->wilc_netdev)*/) {
PRINT_D(TX_DBG, "Waking up queue\n");
/* netif_wake_queue(pd->wilc_netdev); */
- if (netif_queue_stopped(g_linux_wlan->strInterfaceInfo[0].wilc_netdev))
- netif_wake_queue(g_linux_wlan->strInterfaceInfo[0].wilc_netdev);
- if (netif_queue_stopped(g_linux_wlan->strInterfaceInfo[1].wilc_netdev))
- netif_wake_queue(g_linux_wlan->strInterfaceInfo[1].wilc_netdev);
+ if (netif_queue_stopped(wl->vif[0].ndev))
+ netif_wake_queue(wl->vif[0].ndev);
+ if (netif_queue_stopped(wl->vif[1].ndev))
+ netif_wake_queue(wl->vif[1].ndev);
}
if (ret == WILC_TX_ERR_NO_BUF) { /* failed to allocate buffers in chip. */
@@ -884,13 +507,13 @@ static int linux_wlan_txq_task(void *vp)
}
}
/*TODO: drop packets after a certain time/number of retry count. */
- } while (ret == WILC_TX_ERR_NO_BUF && !g_linux_wlan->close); /* retry sending packets if no more buffers in chip. */
+ } while (ret == WILC_TX_ERR_NO_BUF && !wl->close); /* retry sending packets if no more buffers in chip. */
#endif
}
return 0;
}
-static void linux_wlan_rx_complete(void)
+void linux_wlan_rx_complete(void)
{
PRINT_D(RX_DBG, "RX completed\n");
}
@@ -908,7 +531,6 @@ int linux_wlan_get_firmware(perInterface_wlan_t *p_nic)
else if (nic->iftype == STATION_MODE)
firmware = STA_FIRMWARE;
- /*BugID_5137*/
else {
PRINT_D(INIT_DBG, "Get P2P_CONCURRENCY_FIRMWARE\n");
firmware = P2P_CONCURRENCY_FIRMWARE;
@@ -940,7 +562,7 @@ int linux_wlan_get_firmware(perInterface_wlan_t *p_nic)
goto _fail_;
}
#endif
- g_linux_wlan->wilc_firmware = wilc_firmware; /* Bug 4703 */
+ g_linux_wlan->firmware = wilc_firmware;
_fail_:
@@ -948,17 +570,13 @@ _fail_:
}
-#ifdef COMPLEMENT_BOOT
-int repeat_power_cycle(perInterface_wlan_t *nic);
-#endif
-
static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
{
int ret = 0;
/* start firmware */
PRINT_D(INIT_DBG, "Starting Firmware ...\n");
- ret = g_linux_wlan->oup.wlan_start();
+ ret = wilc_wlan_start();
if (ret < 0) {
PRINT_ER("Failed to start Firmware\n");
goto _fail_;
@@ -968,18 +586,6 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n");
ret = linux_wlan_lock_timeout(&g_linux_wlan->sync_event, 5000);
if (ret) {
-#ifdef COMPLEMENT_BOOT
- static int timeout = 5;
-
- if (timeout--) {
- PRINT_D(INIT_DBG, "repeat power cycle[%d]", timeout);
- ret = repeat_power_cycle(nic);
- } else {
- timeout = 5;
- ret = -1;
- goto _fail_;
- }
-#endif
PRINT_D(INIT_DBG, "Firmware start timed out");
goto _fail_;
}
@@ -992,12 +598,12 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
_fail_:
return ret;
}
-static int linux_wlan_firmware_download(linux_wlan_t *p_nic)
+static int linux_wlan_firmware_download(struct wilc *p_nic)
{
int ret = 0;
- if (g_linux_wlan->wilc_firmware == NULL) {
+ if (!g_linux_wlan->firmware) {
PRINT_ER("Firmware buffer is NULL\n");
ret = -ENOBUFS;
goto _FAIL_;
@@ -1006,15 +612,15 @@ static int linux_wlan_firmware_download(linux_wlan_t *p_nic)
* do the firmware download
**/
PRINT_D(INIT_DBG, "Downloading Firmware ...\n");
- ret = g_linux_wlan->oup.wlan_firmware_download(g_linux_wlan->wilc_firmware->data, g_linux_wlan->wilc_firmware->size);
+ ret = wilc_wlan_firmware_download(g_linux_wlan->firmware->data,
+ g_linux_wlan->firmware->size);
if (ret < 0)
goto _FAIL_;
/* Freeing FW buffer */
PRINT_D(INIT_DBG, "Freeing FW buffer ...\n");
PRINT_D(INIT_DBG, "Releasing firmware\n");
- release_firmware(g_linux_wlan->wilc_firmware);
- g_linux_wlan->wilc_firmware = NULL;
+ release_firmware(g_linux_wlan->firmware);
PRINT_D(INIT_DBG, "Download Succeeded\n");
@@ -1023,90 +629,74 @@ _FAIL_:
}
/* startup configuration - could be changed later using iconfig*/
-static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_nic)
+static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_nic)
{
unsigned char c_val[64];
- #ifndef STATIC_MACADDRESS
unsigned char mac_add[] = {0x00, 0x80, 0xC2, 0x5E, 0xa2, 0xff};
- #endif
- /*BugID_5077*/
- struct WILC_WFI_priv *priv;
- tstrWILC_WFIDrv *pstrWFIDrv;
+ struct wilc_priv *priv;
+ struct host_if_drv *pstrWFIDrv;
PRINT_D(TX_DBG, "Start configuring Firmware\n");
- #ifndef STATIC_MACADDRESS
get_random_bytes(&mac_add[5], 1);
get_random_bytes(&mac_add[4], 1);
- #endif
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
- pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
PRINT_D(INIT_DBG, "Host = %p\n", pstrWFIDrv);
PRINT_D(INIT_DBG, "MAC address is : %02x-%02x-%02x-%02x-%02x-%02x\n", mac_add[0], mac_add[1], mac_add[2], mac_add[3], mac_add[4], mac_add[5]);
wilc_get_chipid(0);
- if (g_linux_wlan->oup.wlan_cfg_set == NULL) {
- PRINT_D(INIT_DBG, "Null p[ointer\n");
- goto _fail_;
- }
-
- *(int *)c_val = (u32)pstrWFIDrv;
+ *(int *)c_val = 1;
- if (!g_linux_wlan->oup.wlan_cfg_set(1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
+ if (!wilc_wlan_cfg_set(1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
goto _fail_;
/*to tell fw that we are going to use PC test - WILC specific*/
c_val[0] = 0;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = INFRASTRUCTURE;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_BSS_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_BSS_TYPE, c_val, 1, 0, 0))
goto _fail_;
- /* c_val[0] = RATE_AUTO; / * bug 4275: Enable autorate and limit it to 24Mbps * / */
+ /* c_val[0] = RATE_AUTO; */
c_val[0] = RATE_AUTO;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = G_MIXED_11B_2_MODE;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = 1;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = G_SHORT_PREAMBLE;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_PREAMBLE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_PREAMBLE, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = AUTO_PROT;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
goto _fail_;
-#ifdef SWITCH_LOG_TERMINAL
- c_val[0] = AUTO_PROT;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_LOGTerminal_Switch, c_val, 1, 0, 0))
- goto _fail_;
-#endif
-
c_val[0] = ACTIVE_SCAN;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_SCAN_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_SCAN_TYPE, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = SITE_SURVEY_OFF;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_SITE_SURVEY, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_SITE_SURVEY, c_val, 1, 0, 0))
goto _fail_;
*((int *)c_val) = 0xffff; /* Never use RTS-CTS */
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
goto _fail_;
*((int *)c_val) = 2346;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
goto _fail_;
/* SSID */
@@ -1116,30 +706,24 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n
/* ( In BSS Station Set SSID to "" (null string) */
/* to enable Broadcast SSID suppport ) */
/* -------------------------------------------------------------- */
-#ifndef USE_WIRELESS
- strcpy(c_val, "nwifi");
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_SSID, c_val, (strlen(c_val) + 1), 0, 0))
- goto _fail_;
-#endif
-
c_val[0] = 0;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_BCAST_SSID, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_BCAST_SSID, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = 1;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_QOS_ENABLE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_QOS_ENABLE, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = NO_POWERSAVE;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = NO_ENCRYPT; /* NO_ENCRYPT, 0x79 */
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = OPEN_SYSTEM;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_AUTH_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_AUTH_TYPE, c_val, 1, 0, 0))
goto _fail_;
/* WEP/802 11I Configuration */
@@ -1151,7 +735,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n
/* ------------------------------------------------------------------ */
strcpy(c_val, "123456790abcdef1234567890");
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_WEP_KEY_VALUE, c_val, (strlen(c_val) + 1), 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_WEP_KEY_VALUE, c_val, (strlen(c_val) + 1), 0, 0))
goto _fail_;
/* WEP/802 11I Configuration */
@@ -1161,7 +745,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n
/* and less than 64 bytes */
/* ------------------------------------------------------------------ */
strcpy(c_val, "12345678");
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11I_PSK, c_val, (strlen(c_val)), 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_11I_PSK, c_val, (strlen(c_val)), 0, 0))
goto _fail_;
/* IEEE802.1X Key Configuration */
@@ -1171,7 +755,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n
/* and less than 65 bytes */
/* ------------------------------------------------------------------ */
strcpy(c_val, "password");
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_1X_KEY, c_val, (strlen(c_val) + 1), 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_1X_KEY, c_val, (strlen(c_val) + 1), 0, 0))
goto _fail_;
/* IEEE802.1X Server Address Configuration */
@@ -1183,31 +767,31 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n
c_val[1] = 168;
c_val[2] = 1;
c_val[3] = 112;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_1X_SERV_ADDR, c_val, 4, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_1X_SERV_ADDR, c_val, 4, 0, 0))
goto _fail_;
c_val[0] = 3;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_LISTEN_INTERVAL, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_LISTEN_INTERVAL, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = 3;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_DTIM_PERIOD, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_DTIM_PERIOD, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = NORMAL_ACK;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_ACK_POLICY, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_ACK_POLICY, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = 0;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_USER_CONTROL_ON_TX_POWER, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_USER_CONTROL_ON_TX_POWER, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = 48;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_TX_POWER_LEVEL_11A, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_TX_POWER_LEVEL_11A, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = 28;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0, 0))
goto _fail_;
/* Beacon Interval */
@@ -1217,11 +801,11 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n
/* -------------------------------------------------------------------- */
*((int *)c_val) = 100;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_BEACON_INTERVAL, c_val, 2, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_BEACON_INTERVAL, c_val, 2, 0, 0))
goto _fail_;
c_val[0] = REKEY_DISABLE;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_REKEY_POLICY, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_REKEY_POLICY, c_val, 1, 0, 0))
goto _fail_;
/* Rekey Time (s) (Used only when the Rekey policy is 2 or 4) */
@@ -1230,7 +814,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n
/* Values to set : 32-bit value */
/* -------------------------------------------------------------------- */
*((int *)c_val) = 84600;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_REKEY_PERIOD, c_val, 4, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_REKEY_PERIOD, c_val, 4, 0, 0))
goto _fail_;
/* Rekey Packet Count (in 1000s; used when Rekey Policy is 3) */
@@ -1239,59 +823,59 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n
/* Values to set : 32-bit Value */
/* -------------------------------------------------------------------- */
*((int *)c_val) = 500;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_REKEY_PACKET_COUNT, c_val, 4, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_REKEY_PACKET_COUNT, c_val, 4, 0, 0))
goto _fail_;
c_val[0] = 1;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_SHORT_SLOT_ALLOWED, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_SHORT_SLOT_ALLOWED, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = G_SELF_CTS_PROT;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = 1; /* Enable N */
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11N_ENABLE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_11N_ENABLE, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = HT_MIXED_MODE;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11N_OPERATING_MODE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_11N_OPERATING_MODE, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = 1; /* TXOP Prot disable in N mode: No RTS-CTS on TX A-MPDUs to save air-time. */
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0, 0))
goto _fail_;
memcpy(c_val, mac_add, 6);
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_MAC_ADDR, c_val, 6, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_MAC_ADDR, c_val, 6, 0, 0))
goto _fail_;
/**
* AP only
**/
c_val[0] = DETECT_PROTECT_REPORT;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = RTS_CTS_NONHT_PROT;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = 0;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11N_RIFS_PROT_ENABLE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_11N_RIFS_PROT_ENABLE, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = MIMO_MODE;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11N_SMPS_MODE, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_11N_SMPS_MODE, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = 7;
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0, 0))
+ if (!wilc_wlan_cfg_set(0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0, 0))
goto _fail_;
c_val[0] = 1; /* Enable N with immediate block ack. */
- if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1, 1, (u32)pstrWFIDrv))
+ if (!wilc_wlan_cfg_set(0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1, 1, 1))
goto _fail_;
return 0;
@@ -1301,17 +885,21 @@ _fail_:
}
/**************************/
-void wilc1000_wlan_deinit(linux_wlan_t *nic)
+void wilc1000_wlan_deinit(struct net_device *dev)
{
+ perInterface_wlan_t *nic;
+ struct wilc *wl;
- if (g_linux_wlan->wilc1000_initialized) {
+ nic = netdev_priv(dev);
+ wl = nic->wilc;
- printk("Deinitializing wilc1000 ...\n");
+ if (!wl) {
+ netdev_err(dev, "wl is NULL\n");
+ return;
+ }
- if (nic == NULL) {
- PRINT_ER("nic is NULL\n");
- return;
- }
+ if (wl->initialized) {
+ netdev_info(dev, "Deinitializing wilc1000...\n");
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
/* johnny : remove */
@@ -1321,64 +909,40 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic)
#endif
PRINT_D(INIT_DBG, "Disabling IRQ\n");
- #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- linux_wlan_disable_irq(IRQ_WAIT);
- #else
- #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
-
- #else
- linux_wlan_lock_mutex((void *)&g_linux_wlan->hif_cs);
+#ifdef WILC_SDIO
+ mutex_lock(&wl->hif_cs);
disable_sdio_interrupt();
- linux_wlan_unlock_mutex((void *)&g_linux_wlan->hif_cs);
- #endif
- #endif
-
- /* not sure if the following unlocks are needed or not*/
- if (&g_linux_wlan->rxq_event != NULL)
- linux_wlan_unlock(&g_linux_wlan->rxq_event);
-
- if (&g_linux_wlan->txq_event != NULL)
- linux_wlan_unlock(&g_linux_wlan->txq_event);
-
- #if (RX_BH_TYPE == RX_BH_WORK_QUEUE)
- /*Removing the work struct from the linux kernel workqueue*/
- if (&g_linux_wlan->rx_work_queue != NULL)
- flush_work(&g_linux_wlan->rx_work_queue);
-
- #elif (RX_BH_TYPE == RX_BH_KTHREAD)
- /* if(&nic->rx_sem != NULL) */
- /* linux_wlan_unlock(&nic->rx_sem); */
- #endif
+ mutex_unlock(&wl->hif_cs);
+#endif
+ if (&wl->txq_event != NULL)
+ up(&wl->txq_event);
PRINT_D(INIT_DBG, "Deinitializing Threads\n");
- wlan_deinitialize_threads(nic);
+ wlan_deinitialize_threads(dev);
PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
- deinit_irq(g_linux_wlan);
+ deinit_irq(dev);
- if (&g_linux_wlan->oup != NULL) {
- if (g_linux_wlan->oup.wlan_stop != NULL)
- g_linux_wlan->oup.wlan_stop();
- }
+ wilc_wlan_stop();
PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
- wilc_wlan_deinit(nic);
+ wilc_wlan_cleanup(dev);
#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
- linux_wlan_lock_mutex((void *)&g_linux_wlan->hif_cs);
+ mutex_lock(&wl->hif_cs);
disable_sdio_interrupt();
- linux_wlan_unlock_mutex((void *)&g_linux_wlan->hif_cs);
+ mutex_unlock(&wl->hif_cs);
#endif
#endif
/*De-Initialize locks*/
PRINT_D(INIT_DBG, "Deinitializing Locks\n");
- wlan_deinit_locks(g_linux_wlan);
+ wlan_deinit_locks(dev);
/* announce that wilc1000 is not initialized */
- g_linux_wlan->wilc1000_initialized = 0;
+ wl->initialized = false;
PRINT_D(INIT_DBG, "wilc1000 deinitialization Done\n");
@@ -1387,120 +951,56 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic)
}
}
-int wlan_init_locks(linux_wlan_t *p_nic)
+int wlan_init_locks(struct net_device *dev)
{
+ perInterface_wlan_t *nic;
+ struct wilc *wl;
- PRINT_D(INIT_DBG, "Initializing Locks ...\n");
-
- /*initialize mutexes*/
- linux_wlan_init_mutex("hif_lock/hif_cs", &g_linux_wlan->hif_cs, 1);
- linux_wlan_init_mutex("rxq_lock/rxq_cs", &g_linux_wlan->rxq_cs, 1);
- linux_wlan_init_mutex("txq_lock/txq_cs", &g_linux_wlan->txq_cs, 1);
+ nic = netdev_priv(dev);
+ wl = nic->wilc;
- /*Added by Amr - BugID_4720*/
- linux_wlan_init_spin_lock("txq_spin_lock/txq_cs", &g_linux_wlan->txq_spinlock, 1);
+ PRINT_D(INIT_DBG, "Initializing Locks ...\n");
- /*Added by Amr - BugID_4720*/
- linux_wlan_init_lock("txq_add_to_head_lock/txq_cs", &g_linux_wlan->txq_add_to_head_cs, 1);
+ mutex_init(&wl->hif_cs);
+ mutex_init(&wl->rxq_cs);
- linux_wlan_init_lock("txq_wait/txq_event", &g_linux_wlan->txq_event, 0);
- linux_wlan_init_lock("rxq_wait/rxq_event", &g_linux_wlan->rxq_event, 0);
+ spin_lock_init(&wl->txq_spinlock);
+ sema_init(&wl->txq_add_to_head_cs, 1);
- linux_wlan_init_lock("cfg_wait/cfg_event", &g_linux_wlan->cfg_event, 0);
- linux_wlan_init_lock("sync_event", &g_linux_wlan->sync_event, 0);
+ sema_init(&wl->txq_event, 0);
- linux_wlan_init_lock("rxq_lock/rxq_started", &g_linux_wlan->rxq_thread_started, 0);
- linux_wlan_init_lock("rxq_lock/txq_started", &g_linux_wlan->txq_thread_started, 0);
+ sema_init(&wl->cfg_event, 0);
+ sema_init(&wl->sync_event, 0);
- #if (RX_BH_TYPE == RX_BH_KTHREAD)
- linux_wlan_init_lock("BH_SEM", &g_linux_wlan->rx_sem, 0);
- #endif
+ sema_init(&wl->txq_thread_started, 0);
return 0;
}
-static int wlan_deinit_locks(linux_wlan_t *nic)
+static int wlan_deinit_locks(struct net_device *dev)
{
- PRINT_D(INIT_DBG, "De-Initializing Locks\n");
-
- if (&g_linux_wlan->hif_cs != NULL)
- linux_wlan_deinit_mutex(&g_linux_wlan->hif_cs);
-
- if (&g_linux_wlan->rxq_cs != NULL)
- linux_wlan_deinit_mutex(&g_linux_wlan->rxq_cs);
-
- if (&g_linux_wlan->txq_cs != NULL)
- linux_wlan_deinit_mutex(&g_linux_wlan->txq_cs);
-
- /*Added by Amr - BugID_4720*/
- if (&g_linux_wlan->txq_spinlock != NULL)
- linux_wlan_deinit_spin_lock(&g_linux_wlan->txq_spinlock);
-
- if (&g_linux_wlan->rxq_event != NULL)
- linux_wlan_deinit_lock(&g_linux_wlan->rxq_event);
-
- if (&g_linux_wlan->txq_event != NULL)
- linux_wlan_deinit_lock(&g_linux_wlan->txq_event);
-
- /*Added by Amr - BugID_4720*/
- if (&g_linux_wlan->txq_add_to_head_cs != NULL)
- linux_wlan_deinit_lock(&g_linux_wlan->txq_add_to_head_cs);
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
- if (&g_linux_wlan->rxq_thread_started != NULL)
- linux_wlan_deinit_lock(&g_linux_wlan->rxq_thread_started);
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
- if (&g_linux_wlan->txq_thread_started != NULL)
- linux_wlan_deinit_lock(&g_linux_wlan->txq_thread_started);
+ PRINT_D(INIT_DBG, "De-Initializing Locks\n");
- if (&g_linux_wlan->cfg_event != NULL)
- linux_wlan_deinit_lock(&g_linux_wlan->cfg_event);
+ if (&wilc->hif_cs != NULL)
+ mutex_destroy(&wilc->hif_cs);
- if (&g_linux_wlan->sync_event != NULL)
- linux_wlan_deinit_lock(&g_linux_wlan->sync_event);
+ if (&wilc->rxq_cs != NULL)
+ mutex_destroy(&wilc->rxq_cs);
return 0;
}
-void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic)
+void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
{
PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");
- nwi->os_context.hif_critical_section = (void *)&g_linux_wlan->hif_cs;
nwi->os_context.os_private = (void *)nic;
- nwi->os_context.tx_buffer_size = LINUX_TX_SIZE;
- nwi->os_context.txq_critical_section = (void *)&g_linux_wlan->txq_cs;
-
- /*Added by Amr - BugID_4720*/
- nwi->os_context.txq_add_to_head_critical_section = (void *)&g_linux_wlan->txq_add_to_head_cs;
-
- /*Added by Amr - BugID_4720*/
- nwi->os_context.txq_spin_lock = (void *)&g_linux_wlan->txq_spinlock;
-
- nwi->os_context.txq_wait_event = (void *)&g_linux_wlan->txq_event;
-
-#if defined(MEMORY_STATIC)
- nwi->os_context.rx_buffer_size = LINUX_RX_SIZE;
-#endif
- nwi->os_context.rxq_critical_section = (void *)&g_linux_wlan->rxq_cs;
- nwi->os_context.rxq_wait_event = (void *)&g_linux_wlan->rxq_event;
- nwi->os_context.cfg_wait_event = (void *)&g_linux_wlan->cfg_event;
-
- nwi->os_func.os_sleep = linux_wlan_msleep;
- nwi->os_func.os_atomic_sleep = linux_wlan_atomic_msleep;
- nwi->os_func.os_debug = linux_wlan_dbg;
- nwi->os_func.os_malloc = linux_wlan_malloc;
- nwi->os_func.os_malloc_atomic = linux_wlan_malloc_atomic;
- nwi->os_func.os_free = linux_wlan_free;
- nwi->os_func.os_lock = linux_wlan_lock;
- nwi->os_func.os_unlock = linux_wlan_unlock;
- nwi->os_func.os_wait = linux_wlan_lock_timeout;
- nwi->os_func.os_signal = linux_wlan_unlock;
- nwi->os_func.os_enter_cs = linux_wlan_lock_mutex;
- nwi->os_func.os_leave_cs = linux_wlan_unlock_mutex;
-
- /*Added by Amr - BugID_4720*/
- nwi->os_func.os_spin_lock = linux_wlan_spin_lock;
- nwi->os_func.os_spin_unlock = linux_wlan_spin_unlock;
#ifdef WILC_SDIO
nwi->io_func.io_type = HIF_SDIO;
@@ -1519,331 +1019,95 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic)
nwi->io_func.u.spi.spi_trx = linux_spi_write_read;
nwi->io_func.u.spi.spi_max_speed = linux_spi_set_max_speed;
#endif
-
- /*for now - to be revised*/
- #ifdef WILC_FULLY_HOSTING_AP
- /* incase of Fully hosted AP, all non cfg pkts are processed here*/
- nwi->net_func.rx_indicate = WILC_Process_rx_frame;
- #else
- nwi->net_func.rx_indicate = frmw_to_linux;
- #endif
- nwi->net_func.rx_complete = linux_wlan_rx_complete;
- nwi->indicate_func.mac_indicate = linux_wlan_mac_indicate;
}
-int wlan_initialize_threads(perInterface_wlan_t *nic)
+int wlan_initialize_threads(struct net_device *dev)
{
-
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
int ret = 0;
- PRINT_D(INIT_DBG, "Initializing Threads ...\n");
-
-#if (RX_BH_TYPE == RX_BH_WORK_QUEUE)
- /*Initialize rx work queue task*/
- INIT_WORK(&g_linux_wlan->rx_work_queue, isr_bh_routine);
-#elif (RX_BH_TYPE == RX_BH_KTHREAD)
- PRINT_D(INIT_DBG, "Creating kthread for Rxq BH\n");
- g_linux_wlan->rx_bh_thread = kthread_run(isr_bh_routine, (void *)g_linux_wlan, "K_RXQ_BH");
- if (g_linux_wlan->rx_bh_thread == 0) {
- PRINT_ER("couldn't create RX BH thread\n");
- ret = -ENOBUFS;
- goto _fail_;
- }
-#endif
-
-#ifndef TCP_ENHANCEMENTS
- /* create rx task */
- PRINT_D(INIT_DBG, "Creating kthread for reception\n");
- g_linux_wlan->rxq_thread = kthread_run(linux_wlan_rxq_task, (void *)g_linux_wlan, "K_RXQ_TASK");
- if (g_linux_wlan->rxq_thread == 0) {
- PRINT_ER("couldn't create RXQ thread\n");
- ret = -ENOBUFS;
- goto _fail_1;
- }
- /* wait for RXQ task to start. */
- linux_wlan_lock(&g_linux_wlan->rxq_thread_started);
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
-#endif
+ PRINT_D(INIT_DBG, "Initializing Threads ...\n");
/* create tx task */
PRINT_D(INIT_DBG, "Creating kthread for transmission\n");
- g_linux_wlan->txq_thread = kthread_run(linux_wlan_txq_task, (void *)g_linux_wlan, "K_TXQ_TASK");
- if (g_linux_wlan->txq_thread == 0) {
- PRINT_ER("couldn't create TXQ thread\n");
- ret = -ENOBUFS;
- goto _fail_2;
- }
-#ifdef DEBUG_MODE
- PRINT_D(INIT_DBG, "Creating kthread for Debugging\n");
- g_linux_wlan->txq_thread = kthread_run(DebuggingThreadTask, (void *)g_linux_wlan, "DebugThread");
- if (g_linux_wlan->txq_thread == 0) {
+ wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev,
+ "K_TXQ_TASK");
+ if (!wilc->txq_thread) {
PRINT_ER("couldn't create TXQ thread\n");
ret = -ENOBUFS;
goto _fail_2;
}
-#endif
/* wait for TXQ task to start. */
- linux_wlan_lock(&g_linux_wlan->txq_thread_started);
+ down(&wilc->txq_thread_started);
return 0;
_fail_2:
/*De-Initialize 2nd thread*/
- g_linux_wlan->close = 1;
- linux_wlan_unlock(&g_linux_wlan->rxq_event);
- kthread_stop(g_linux_wlan->rxq_thread);
-
-#ifndef TCP_ENHANCEMENTS
-_fail_1:
-#endif
- #if (RX_BH_TYPE == RX_BH_KTHREAD)
- /*De-Initialize 1st thread*/
- g_linux_wlan->close = 1;
- linux_wlan_unlock(&g_linux_wlan->rx_sem);
- kthread_stop(g_linux_wlan->rx_bh_thread);
-_fail_:
- #endif
- g_linux_wlan->close = 0;
+ wilc->close = 0;
return ret;
}
-static void wlan_deinitialize_threads(linux_wlan_t *nic)
-{
-
- g_linux_wlan->close = 1;
- PRINT_D(INIT_DBG, "Deinitializing Threads\n");
- if (&g_linux_wlan->rxq_event != NULL)
- linux_wlan_unlock(&g_linux_wlan->rxq_event);
-
- if (g_linux_wlan->rxq_thread != NULL) {
- kthread_stop(g_linux_wlan->rxq_thread);
- g_linux_wlan->rxq_thread = NULL;
- }
-
- if (&g_linux_wlan->txq_event != NULL)
- linux_wlan_unlock(&g_linux_wlan->txq_event);
-
- if (g_linux_wlan->txq_thread != NULL) {
- kthread_stop(g_linux_wlan->txq_thread);
- g_linux_wlan->txq_thread = NULL;
- }
-
- #if (RX_BH_TYPE == RX_BH_KTHREAD)
- if (&g_linux_wlan->rx_sem != NULL)
- linux_wlan_unlock(&g_linux_wlan->rx_sem);
-
- if (g_linux_wlan->rx_bh_thread != NULL) {
- kthread_stop(g_linux_wlan->rx_bh_thread);
- g_linux_wlan->rx_bh_thread = NULL;
- }
- #endif
-}
-
-#ifdef STATIC_MACADDRESS
-const char *path_string[] = {
- "/etc/wlan",
- "/data/wlan",
-};
-
-static int linux_wlan_read_mac_addr(void *vp)
+static void wlan_deinitialize_threads(struct net_device *dev)
{
- int ret = 0;
- struct file *fp = (struct file *)-ENOENT;
- mm_segment_t old_fs;
- loff_t pos = 0;
- int index;
- int array_size = ARRAY_SIZE(path_string);
-
- /* change to KERNEL_DS address limit */
- old_fs = get_fs();
- set_fs(KERNEL_DS);
-
- for (index = 0; index < array_size; index++) {
- fp = filp_open(path_string[index], O_WRONLY, 0640);
- if (!fp) {
- ret = -1;
- goto exit;
- }
-
- /*No such file or directory */
- if (IS_ERR(fp) || !fp->f_op) {
- get_random_bytes(&mac_add[3], 3);
- /* open file to write */
- fp = filp_open(path_string[index], O_WRONLY | O_CREAT, 0640);
-
- if (!fp || IS_ERR(fp)) {
- ret = -1;
- continue;
- } else {
- /* write buf to file */
- fp->f_op->write(fp, mac_add, 6, &pos);
- break;
- }
- } else {
- /* read file to buf */
- fp->f_op->read(fp, mac_add, 6, &pos);
- break;
- }
- }
-
- if (index == array_size)
- PRINT_ER("random MAC\n");
-
-exit:
- if (fp && !IS_ERR(fp))
- filp_close(fp, NULL);
-
- set_fs(old_fs);
-
- return ret;
-}
-#endif
-
-#ifdef COMPLEMENT_BOOT
-
-extern volatile int probe;
-extern uint8_t core_11b_ready(void);
-
-#define READY_CHECK_THRESHOLD 30
-extern void wilc_wlan_global_reset(void);
-uint8_t wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, wilc_wlan_oup_t *nwo, linux_wlan_t *nic)
-{
- uint8_t trials = 0;
- while ((core_11b_ready() && (READY_CHECK_THRESHOLD > (trials++)))) {
- PRINT_D(INIT_DBG, "11b core not ready yet: %u\n", trials);
- wilc_wlan_deinit(nic);
- wilc_wlan_global_reset();
- sdio_unregister_driver(&wilc_bus);
-
- linux_wlan_device_detection(0);
-
- mdelay(100);
-
- linux_wlan_device_detection(1);
-
- sdio_register_driver(&wilc_bus);
-
- while (!probe)
- msleep(100);
- probe = 0;
- g_linux_wlan->wilc_sdio_func = local_sdio_func;
- linux_to_wlan(nwi, nic);
- wilc_wlan_init(nwi, nwo);
- }
-
- if (READY_CHECK_THRESHOLD <= trials)
- return 1;
- else
- return 0;
-
-}
-
-int repeat_power_cycle(perInterface_wlan_t *nic)
-{
- int ret = 0;
- wilc_wlan_inp_t nwi;
- wilc_wlan_oup_t nwo;
- sdio_unregister_driver(&wilc_bus);
-
- linux_wlan_device_detection(0);
- linux_wlan_device_power(0);
- msleep(100);
- linux_wlan_device_power(1);
- msleep(80);
- linux_wlan_device_detection(1);
- msleep(20);
-
- sdio_register_driver(&wilc_bus);
+ perInterface_wlan_t *nic;
+ struct wilc *wl;
- /* msleep(1000); */
- while (!probe)
- msleep(100);
- probe = 0;
- g_linux_wlan->wilc_sdio_func = local_sdio_func;
- linux_to_wlan(&nwi, g_linux_wlan);
- ret = wilc_wlan_init(&nwi, &nwo);
+ nic = netdev_priv(dev);
+ wl = nic->wilc;
- g_linux_wlan->mac_status = WILC_MAC_STATUS_INIT;
- #if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
- enable_sdio_interrupt();
- #endif
+ wl->close = 1;
+ PRINT_D(INIT_DBG, "Deinitializing Threads\n");
- if (linux_wlan_get_firmware(nic)) {
- PRINT_ER("Can't get firmware\n");
- ret = -1;
- goto __fail__;
- }
+ if (&wl->txq_event != NULL)
+ up(&wl->txq_event);
- /*Download firmware*/
- ret = linux_wlan_firmware_download(g_linux_wlan);
- if (ret < 0) {
- PRINT_ER("Failed to download firmware\n");
- goto __fail__;
+ if (wl->txq_thread != NULL) {
+ kthread_stop(wl->txq_thread);
+ wl->txq_thread = NULL;
}
- /* Start firmware*/
- ret = linux_wlan_start_firmware(nic);
- if (ret < 0)
- PRINT_ER("Failed to start firmware\n");
-__fail__:
- return ret;
}
-#endif
int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
{
wilc_wlan_inp_t nwi;
- wilc_wlan_oup_t nwo;
perInterface_wlan_t *nic = p_nic;
int ret = 0;
+ struct wilc *wl = nic->wilc;
- if (!g_linux_wlan->wilc1000_initialized) {
- g_linux_wlan->mac_status = WILC_MAC_STATUS_INIT;
- g_linux_wlan->close = 0;
- g_linux_wlan->wilc1000_initialized = 0;
+ if (!wl->initialized) {
+ wl->mac_status = WILC_MAC_STATUS_INIT;
+ wl->close = 0;
- wlan_init_locks(g_linux_wlan);
+ wlan_init_locks(dev);
-#ifdef STATIC_MACADDRESS
- wilc_mac_thread = kthread_run(linux_wlan_read_mac_addr, NULL, "wilc_mac_thread");
- if (wilc_mac_thread < 0)
- PRINT_ER("couldn't create Mac addr thread\n");
-#endif
+ linux_to_wlan(&nwi, wl);
- linux_to_wlan(&nwi, g_linux_wlan);
-
- ret = wilc_wlan_init(&nwi, &nwo);
+ ret = wilc_wlan_init(&nwi);
if (ret < 0) {
PRINT_ER("Initializing WILC_Wlan FAILED\n");
ret = -EIO;
goto _fail_locks_;
}
- memcpy(&g_linux_wlan->oup, &nwo, sizeof(wilc_wlan_oup_t));
-
- /*Save the oup structre into global pointer*/
- gpstrWlanOps = &g_linux_wlan->oup;
-
- ret = wlan_initialize_threads(nic);
- if (ret < 0) {
- PRINT_ER("Initializing Threads FAILED\n");
- ret = -EIO;
- goto _fail_wilc_wlan_;
- }
-#if (defined WILC_SDIO) && (defined COMPLEMENT_BOOT)
- if (wilc1000_prepare_11b_core(&nwi, &nwo, g_linux_wlan)) {
- PRINT_ER("11b Core is not ready\n");
+#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
+ if (init_irq(dev)) {
+ PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
- goto _fail_threads_;
+ goto _fail_locks_;
}
#endif
-#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- if (init_irq(g_linux_wlan)) {
- PRINT_ER("couldn't initialize IRQ\n");
+ ret = wlan_initialize_threads(dev);
+ if (ret < 0) {
+ PRINT_ER("Initializing Threads FAILED\n");
ret = -EIO;
- goto _fail_threads_;
+ goto _fail_wilc_wlan_;
}
-#endif
#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
if (enable_sdio_interrupt()) {
@@ -1860,7 +1124,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
}
/*Download firmware*/
- ret = linux_wlan_firmware_download(g_linux_wlan);
+ ret = linux_wlan_firmware_download(wl);
if (ret < 0) {
PRINT_ER("Failed to download firmware\n");
ret = -EIO;
@@ -1877,17 +1141,18 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
wilc_bus_set_max_speed();
- if (g_linux_wlan->oup.wlan_cfg_get(1, WID_FIRMWARE_VERSION, 1, 0)) {
+ if (wilc_wlan_cfg_get(1, WID_FIRMWARE_VERSION, 1, 0)) {
int size;
char Firmware_ver[20];
- size = g_linux_wlan->oup.wlan_cfg_get_value(
+
+ size = wilc_wlan_cfg_get_val(
WID_FIRMWARE_VERSION,
Firmware_ver, sizeof(Firmware_ver));
Firmware_ver[size] = '\0';
PRINT_D(INIT_DBG, "***** Firmware Ver = %s *******\n", Firmware_ver);
}
/* Initialize firmware with default configuration */
- ret = linux_wlan_init_test_config(dev, g_linux_wlan);
+ ret = linux_wlan_init_test_config(dev, wl);
if (ret < 0) {
PRINT_ER("Failed to configure firmware\n");
@@ -1895,14 +1160,11 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
goto _fail_fw_start_;
}
- g_linux_wlan->wilc1000_initialized = 1;
+ wl->initialized = true;
return 0; /*success*/
_fail_fw_start_:
- if (&g_linux_wlan->oup != NULL) {
- if (g_linux_wlan->oup.wlan_stop != NULL)
- g_linux_wlan->oup.wlan_stop();
- }
+ wilc_wlan_stop();
_fail_irq_enable_:
#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
@@ -1910,15 +1172,14 @@ _fail_irq_enable_:
_fail_irq_init_:
#endif
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- deinit_irq(g_linux_wlan);
+ deinit_irq(dev);
#endif
-_fail_threads_:
- wlan_deinitialize_threads(g_linux_wlan);
+ wlan_deinitialize_threads(dev);
_fail_wilc_wlan_:
- wilc_wlan_deinit(g_linux_wlan);
+ wilc_wlan_cleanup(dev);
_fail_locks_:
- wlan_deinit_locks(g_linux_wlan);
+ wlan_deinit_locks(dev);
PRINT_ER("WLAN Iinitialization FAILED\n");
} else {
PRINT_D(INIT_DBG, "wilc1000 already initialized\n");
@@ -1930,7 +1191,6 @@ _fail_locks_:
* - this function will be called automatically by OS when module inserted.
*/
-#if !defined(NM73131_0_BOARD)
int mac_init_fn(struct net_device *ndev)
{
@@ -1940,79 +1200,65 @@ int mac_init_fn(struct net_device *ndev)
return 0;
}
-#else
-int mac_init_fn(struct net_device *ndev)
-{
-
- unsigned char mac_add[] = {0x00, 0x50, 0xc2, 0x5e, 0x10, 0x00};
- /* TODO: get MAC address whenever the source is EPROM - hardcoded and copy it to ndev*/
- memcpy(ndev->dev_addr, mac_add, 6);
-
- if (!is_valid_ether_addr(ndev->dev_addr)) {
- PRINT_ER("Error: Wrong MAC address\n");
- return -EINVAL;
- }
-
- return 0;
-}
-#endif
-
-void WILC_WFI_frame_register(struct wiphy *wiphy, struct net_device *dev,
- u16 frame_type, bool reg);
/* This fn is called, when this device is setup using ifconfig */
-#if !defined(NM73131_0_BOARD)
int mac_open(struct net_device *ndev)
{
perInterface_wlan_t *nic;
- /*BugID_5213*/
/*No need for setting mac address here anymore,*/
/*Just set it in init_test_config()*/
unsigned char mac_add[ETH_ALEN] = {0};
int ret = 0;
int i = 0;
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
+ struct wilc *wl;
+
+ nic = netdev_priv(ndev);
+ wl = nic->wilc;
+#ifdef WILC_SPI
+ if (!wl|| !wl->wilc_spidev) {
+ netdev_err(ndev, "wilc1000: SPI device not ready\n");
+ return -ENODEV;
+ }
+#endif
nic = netdev_priv(ndev);
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);
- #ifdef USE_WIRELESS
- ret = WILC_WFI_InitHostInt(ndev);
+ ret = wilc_init_host_int(ndev);
if (ret < 0) {
PRINT_ER("Failed to initialize host interface\n");
return ret;
}
- #endif
/*initialize platform*/
PRINT_D(INIT_DBG, "*** re-init ***\n");
ret = wilc1000_wlan_init(ndev, nic);
if (ret < 0) {
PRINT_ER("Failed to initialize wilc1000\n");
- WILC_WFI_DeInitHostInt(ndev);
+ wilc_deinit_host_int(ndev);
return ret;
}
- Set_machw_change_vir_if(false);
+ Set_machw_change_vir_if(ndev, false);
host_int_get_MacAddress(priv->hWILCWFIDrv, mac_add);
- PRINT_D(INIT_DBG, "Mac address: %x:%x:%x:%x:%x:%x\n", mac_add[0], mac_add[1], mac_add[2],
- mac_add[3], mac_add[4], mac_add[5]);
+ PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);
/* loop through the NUM of supported devices and set the MAC address */
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
- if (ndev == g_linux_wlan->strInterfaceInfo[i].wilc_netdev) {
- memcpy(g_linux_wlan->strInterfaceInfo[i].aSrcAddress, mac_add, ETH_ALEN);
- g_linux_wlan->strInterfaceInfo[i].drvHandler = priv->hWILCWFIDrv;
+ for (i = 0; i < wl->vif_num; i++) {
+ if (ndev == wl->vif[i].ndev) {
+ memcpy(wl->vif[i].src_addr, mac_add, ETH_ALEN);
+ wl->vif[i].hif_drv = priv->hWILCWFIDrv;
break;
}
}
/* TODO: get MAC address whenever the source is EPROM - hardcoded and copy it to ndev*/
- memcpy(ndev->dev_addr, g_linux_wlan->strInterfaceInfo[i].aSrcAddress, ETH_ALEN);
+ memcpy(ndev->dev_addr, wl->vif[i].src_addr, ETH_ALEN);
if (!is_valid_ether_addr(ndev->dev_addr)) {
PRINT_ER("Error: Wrong MAC address\n");
@@ -2020,39 +1266,20 @@ int mac_open(struct net_device *ndev)
goto _err_;
}
- WILC_WFI_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev,
- nic->g_struct_frame_reg[0].frame_type, nic->g_struct_frame_reg[0].reg);
- WILC_WFI_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev,
- nic->g_struct_frame_reg[1].frame_type, nic->g_struct_frame_reg[1].reg);
+ wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev->ieee80211_ptr,
+ nic->g_struct_frame_reg[0].frame_type, nic->g_struct_frame_reg[0].reg);
+ wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev->ieee80211_ptr,
+ nic->g_struct_frame_reg[1].frame_type, nic->g_struct_frame_reg[1].reg);
netif_wake_queue(ndev);
- g_linux_wlan->open_ifcs++;
+ wl->open_ifcs++;
nic->mac_opened = 1;
return 0;
_err_:
- WILC_WFI_DeInitHostInt(ndev);
- wilc1000_wlan_deinit(g_linux_wlan);
+ wilc_deinit_host_int(ndev);
+ wilc1000_wlan_deinit(ndev);
return ret;
}
-#else
-int mac_open(struct net_device *ndev)
-{
-
- linux_wlan_t *nic;
- nic = netdev_priv(ndev);
-
- /*initialize platform*/
- if (wilc1000_wlan_init(nic)) {
- PRINT_ER("Failed to initialize platform\n");
- return 1;
- }
- /* Start the network interface queue for this device */
- PRINT_D(INIT_DBG, "Starting netifQ\n");
- netif_start_queue(ndev);
-/* linux_wlan_lock(&close_exit_sync); */
- return 0;
-}
-#endif
struct net_device_stats *mac_stats(struct net_device *dev)
{
@@ -2066,11 +1293,12 @@ static void wilc_set_multicast_list(struct net_device *dev)
{
struct netdev_hw_addr *ha;
- struct WILC_WFI_priv *priv;
- tstrWILC_WFIDrv *pstrWFIDrv;
+ struct wilc_priv *priv;
+ struct host_if_drv *pstrWFIDrv;
int i = 0;
+
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
- pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
if (!dev)
return;
@@ -2120,13 +1348,14 @@ static void linux_wlan_tx_complete(void *priv, int status)
{
struct tx_complete_data *pv_data = (struct tx_complete_data *)priv;
+
if (status == 1)
PRINT_D(TX_DBG, "Packet sent successfully - Size = %d - Address = %p - SKB = %p\n", pv_data->size, pv_data->buff, pv_data->skb);
else
PRINT_D(TX_DBG, "Couldn't send packet - Size = %d - Address = %p - SKB = %p\n", pv_data->size, pv_data->buff, pv_data->skb);
/* Free the SK Buffer, its work is done */
dev_kfree_skb(pv_data->skb);
- linux_wlan_free(pv_data);
+ kfree(pv_data);
}
int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
@@ -2137,9 +1366,11 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
char *pu8UdpBuffer;
struct iphdr *ih;
struct ethhdr *eth_h;
+ struct wilc *wilc;
+
nic = netdev_priv(ndev);
+ wilc = nic->wilc;
- PRINT_D(INT_DBG, "\n========\n IntUH: %d - IntBH: %d - IntCld: %d\n========\n", int_rcvdU, int_rcvdB, int_clrd);
PRINT_D(TX_DBG, "Sending packet just received from TCP/IP\n");
/* Stop the network interface queue */
@@ -2148,7 +1379,7 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
return 0;
}
- tx_data = (struct tx_complete_data *)internal_alloc(sizeof(struct tx_complete_data), GFP_ATOMIC);
+ tx_data = kmalloc(sizeof(struct tx_complete_data), GFP_ATOMIC);
if (tx_data == NULL) {
PRINT_ER("Failed to allocate memory for tx_data structure\n");
dev_kfree_skb(skb);
@@ -2181,19 +1412,14 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
nic->netstats.tx_packets++;
nic->netstats.tx_bytes += tx_data->size;
- tx_data->pBssid = g_linux_wlan->strInterfaceInfo[nic->u8IfIdx].aBSSID;
- #ifndef WILC_FULLY_HOSTING_AP
- QueueCount = g_linux_wlan->oup.wlan_add_to_tx_que((void *)tx_data,
- tx_data->buff,
- tx_data->size,
- linux_wlan_tx_complete);
- #else
- QueueCount = WILC_Xmit_data((void *)tx_data, HOST_TO_WLAN);
- #endif /* WILC_FULLY_HOSTING_AP */
+ tx_data->pBssid = wilc->vif[nic->u8IfIdx].bssid;
+ QueueCount = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
+ tx_data->buff, tx_data->size,
+ linux_wlan_tx_complete);
if (QueueCount > FLOW_CONTROL_UPPER_THRESHOLD) {
- netif_stop_queue(g_linux_wlan->strInterfaceInfo[0].wilc_netdev);
- netif_stop_queue(g_linux_wlan->strInterfaceInfo[1].wilc_netdev);
+ netif_stop_queue(wilc->vif[0].ndev);
+ netif_stop_queue(wilc->vif[1].ndev);
}
return 0;
@@ -2201,9 +1427,10 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
int mac_close(struct net_device *ndev)
{
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
perInterface_wlan_t *nic;
- tstrWILC_WFIDrv *pstrWFIDrv;
+ struct host_if_drv *pstrWFIDrv;
+ struct wilc *wl;
nic = netdev_priv(ndev);
@@ -2213,18 +1440,19 @@ int mac_close(struct net_device *ndev)
}
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
+ wl = nic->wilc;
if (priv == NULL) {
PRINT_ER("priv = NULL\n");
return 0;
}
- pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
PRINT_D(GENERIC_DBG, "Mac close\n");
- if (g_linux_wlan == NULL) {
- PRINT_ER("g_linux_wlan = NULL\n");
+ if (!wl) {
+ PRINT_ER("wl = NULL\n");
return 0;
}
@@ -2233,8 +1461,8 @@ int mac_close(struct net_device *ndev)
return 0;
}
- if ((g_linux_wlan->open_ifcs) > 0) {
- g_linux_wlan->open_ifcs--;
+ if ((wl->open_ifcs) > 0) {
+ wl->open_ifcs--;
} else {
PRINT_ER("ERROR: MAC close called while number of opened interfaces is zero\n");
return 0;
@@ -2244,23 +1472,17 @@ int mac_close(struct net_device *ndev)
/* Stop the network interface queue */
netif_stop_queue(nic->wilc_netdev);
- #ifdef USE_WIRELESS
- WILC_WFI_DeInitHostInt(nic->wilc_netdev);
- #endif
+ wilc_deinit_host_int(nic->wilc_netdev);
}
- if (g_linux_wlan->open_ifcs == 0) {
+ if (wl->open_ifcs == 0) {
PRINT_D(GENERIC_DBG, "Deinitializing wilc1000\n");
- g_linux_wlan->close = 1;
- wilc1000_wlan_deinit(g_linux_wlan);
- #ifdef USE_WIRELESS
- #ifdef WILC_AP_EXTERNAL_MLME
+ wl->close = 1;
+ wilc1000_wlan_deinit(ndev);
WILC_WFI_deinit_mon_interface();
- #endif
- #endif
}
- linux_wlan_unlock(&close_exit_sync);
+ up(&close_exit_sync);
nic->mac_opened = 0;
return 0;
@@ -2273,18 +1495,17 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
s8 rssi;
u32 size = 0, length = 0;
perInterface_wlan_t *nic;
- struct WILC_WFI_priv *priv;
- s32 s32Error = WILC_SUCCESS;
+ struct wilc_priv *priv;
+ s32 s32Error = 0;
+ struct wilc *wilc;
/* struct iwreq *wrq = (struct iwreq *) req; // tony moved to case SIOCSIWPRIV */
- #ifdef USE_WIRELESS
nic = netdev_priv(ndev);
+ wilc = nic->wilc;
- if (!g_linux_wlan->wilc1000_initialized)
+ if (!wilc->initialized)
return 0;
- #endif
-
switch (cmd) {
/* ]] 2013-06-24 */
@@ -2297,19 +1518,14 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
if (size && wrq->u.data.pointer) {
buff = memdup_user(wrq->u.data.pointer, wrq->u.data.length);
- if (IS_ERR(buff)) {
- s32Error = PTR_ERR(buff);
- goto done;
- }
+ if (IS_ERR(buff))
+ return PTR_ERR(buff);
if (strncasecmp(buff, "RSSI", length) == 0) {
-
- #ifdef USE_WIRELESS
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
s32Error = host_int_get_rssi(priv->hWILCWFIDrv, &(rssi));
if (s32Error)
PRINT_ER("Failed to send get rssi param's message queue ");
- #endif
PRINT_INFO(GENERIC_DBG, "RSSI :%d\n", rssi);
/*Rounding up the rssi negative value*/
@@ -2342,21 +1558,17 @@ done:
return s32Error;
}
-void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset)
+void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset)
{
unsigned int frame_len = 0;
int stats;
unsigned char *buff_to_send = NULL;
struct sk_buff *skb;
-#ifndef TCP_ENHANCEMENTS
- char *pu8UdpBuffer;
- struct iphdr *ih;
-#endif
struct net_device *wilc_netdev;
perInterface_wlan_t *nic;
- wilc_netdev = GetIfHandler(buff);
+ wilc_netdev = GetIfHandler(wilc, buff);
if (wilc_netdev == NULL)
return;
@@ -2375,10 +1587,8 @@ void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset)
return;
}
- skb_reserve(skb, (unsigned int)skb->data & 0x3);
-
- if (g_linux_wlan == NULL || wilc_netdev == NULL)
- PRINT_ER("wilc_netdev in g_linux_wlan is NULL");
+ if (wilc == NULL || wilc_netdev == NULL)
+ PRINT_ER("wilc_netdev in wilc is NULL");
skb->dev = wilc_netdev;
if (skb->dev == NULL)
@@ -2399,24 +1609,7 @@ void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset)
/* nic = netdev_priv(wilc_netdev); */
-#ifdef USE_WIRELESS
- /* if(nic->monitor_flag)
- * {
- * WILC_WFI_monitor_rx(nic->wilc_netdev,skb);
- * return;
- * }*/
-#endif
skb->protocol = eth_type_trans(skb, wilc_netdev);
- #ifndef TCP_ENHANCEMENTS
- /*get source and dest ip addresses*/
- ih = (struct iphdr *)(skb->data + sizeof(struct ethhdr));
-
- pu8UdpBuffer = (char *)ih + sizeof(struct iphdr);
- if (buff_to_send[35] == 67 && buff_to_send[37] == 68)
- PRINT_D(RX_DBG, "DHCP Message received\n");
- if (buff_to_send[12] == 0x88 && buff_to_send[13] == 0x8e)
- PRINT_D(GENERIC_DBG, "eapol received\n");
- #endif
/* Send the packet to the stack by giving it to the bridge */
nic->netstats.rx_packets++;
nic->netstats.rx_bytes += frame_len;
@@ -2424,56 +1617,86 @@ void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset)
stats = netif_rx(skb);
PRINT_D(RX_DBG, "netif_rx ret value is: %d\n", stats);
}
- #ifndef TCP_ENHANCEMENTS
- else
- PRINT_ER("Discard sending packet with len = %d\n", size);
- #endif
}
-void WILC_WFI_mgmt_rx(uint8_t *buff, uint32_t size)
+void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size)
{
int i = 0;
perInterface_wlan_t *nic;
- /*BugID_5450*/
/*Pass the frame on the monitor interface, if any.*/
/*Otherwise, pass it on p2p0 netdev, if registered on it*/
- for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) {
- nic = netdev_priv(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
+ for (i = 0; i < wilc->vif_num; i++) {
+ nic = netdev_priv(wilc->vif[i].ndev);
if (nic->monitor_flag) {
WILC_WFI_monitor_rx(buff, size);
return;
}
}
- #ifdef WILC_P2P
- nic = netdev_priv(g_linux_wlan->strInterfaceInfo[1].wilc_netdev); /* p2p0 */
+ nic = netdev_priv(wilc->vif[1].ndev); /* p2p0 */
if ((buff[0] == nic->g_struct_frame_reg[0].frame_type && nic->g_struct_frame_reg[0].reg) ||
(buff[0] == nic->g_struct_frame_reg[1].frame_type && nic->g_struct_frame_reg[1].reg))
- WILC_WFI_p2p_rx(g_linux_wlan->strInterfaceInfo[1].wilc_netdev, buff, size);
- #endif
+ WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size);
}
-int wilc_netdev_init(void)
+void wl_wlan_cleanup(void)
{
+ int i = 0;
+ perInterface_wlan_t *nic[NUM_CONCURRENT_IFC];
+ if (g_linux_wlan &&
+ (g_linux_wlan->vif[0].ndev || g_linux_wlan->vif[1].ndev)) {
+ unregister_inetaddr_notifier(&g_dev_notifier);
+
+ for (i = 0; i < NUM_CONCURRENT_IFC; i++)
+ nic[i] = netdev_priv(g_linux_wlan->vif[i].ndev);
+ }
+
+ if (g_linux_wlan && g_linux_wlan->firmware)
+ release_firmware(g_linux_wlan->firmware);
+
+ if (g_linux_wlan &&
+ (g_linux_wlan->vif[0].ndev || g_linux_wlan->vif[1].ndev)) {
+ linux_wlan_lock_timeout(&close_exit_sync, 12 * 1000);
+
+ for (i = 0; i < NUM_CONCURRENT_IFC; i++)
+ if (g_linux_wlan->vif[i].ndev)
+ if (nic[i]->mac_opened)
+ mac_close(g_linux_wlan->vif[i].ndev);
+
+ for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
+ unregister_netdev(g_linux_wlan->vif[i].ndev);
+ wilc_free_wiphy(g_linux_wlan->vif[i].ndev);
+ free_netdev(g_linux_wlan->vif[i].ndev);
+ }
+ }
+
+ kfree(g_linux_wlan);
+
+#if defined(WILC_DEBUGFS)
+ wilc_debugfs_remove();
+#endif
+ linux_wlan_device_detection(0);
+ linux_wlan_device_power(0);
+}
+
+int wilc_netdev_init(struct wilc **wilc)
+{
int i;
perInterface_wlan_t *nic;
struct net_device *ndev;
- linux_wlan_init_lock("close_exit_sync", &close_exit_sync, 0);
+ sema_init(&close_exit_sync, 0);
/*create the common structure*/
- g_linux_wlan = WILC_MALLOC(sizeof(linux_wlan_t));
- memset(g_linux_wlan, 0, sizeof(linux_wlan_t));
-
- /*Reset interrupt count debug*/
- int_rcvdU = 0;
- int_rcvdB = 0;
- int_clrd = 0;
- #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
+ g_linux_wlan = kzalloc(sizeof(*g_linux_wlan), GFP_KERNEL);
+ if (!g_linux_wlan)
+ return -ENOMEM;
+
+ *wilc = g_linux_wlan;
+
register_inetaddr_notifier(&g_dev_notifier);
- #endif
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
/*allocate first ethernet device with perinterface_wlan_t as its private data*/
@@ -2498,17 +1721,17 @@ int wilc_netdev_init(void)
} else
strcpy(ndev->name, "p2p%d");
- nic->u8IfIdx = g_linux_wlan->u8NoIfcs;
+ nic->u8IfIdx = g_linux_wlan->vif_num;
nic->wilc_netdev = ndev;
- g_linux_wlan->strInterfaceInfo[g_linux_wlan->u8NoIfcs].wilc_netdev = ndev;
- g_linux_wlan->u8NoIfcs++;
+ nic->wilc = *wilc;
+ g_linux_wlan->vif[g_linux_wlan->vif_num].ndev = ndev;
+ g_linux_wlan->vif_num++;
ndev->netdev_ops = &wilc_netdev_ops;
- #ifdef USE_WIRELESS
{
struct wireless_dev *wdev;
/*Register WiFi*/
- wdev = WILC_WFI_WiphyRegister(ndev);
+ wdev = wilc_create_wiphy(ndev);
#ifdef WILC_SDIO
/* set netdev, tony */
@@ -2530,7 +1753,6 @@ int wilc_netdev_init(void)
nic->netstats.tx_bytes = 0;
}
- #endif
if (register_netdev(ndev)) {
PRINT_ER("Device couldn't be registered - %s\n", ndev->name);
@@ -2558,6 +1780,10 @@ int wilc_netdev_init(void)
/*The 1st function called after module inserted*/
static int __init init_wilc_driver(void)
{
+#ifdef WILC_SPI
+ struct wilc *wilc;
+#endif
+
#if defined(WILC_DEBUGFS)
if (wilc_debugfs_init() < 0) {
PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc driver\n");
@@ -2584,7 +1810,7 @@ static int __init init_wilc_driver(void)
}
#else
PRINT_D(INIT_DBG, "Initializing netdev\n");
- if (wilc_netdev_init())
+ if (wilc_netdev_init(&wilc))
PRINT_ER("Couldn't initialize netdev\n");
return 0;
#endif
@@ -2593,84 +1819,13 @@ late_initcall(init_wilc_driver);
static void __exit exit_wilc_driver(void)
{
- int i = 0;
- perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
- #define CLOSE_TIMEOUT (12 * 1000)
-
- if ((g_linux_wlan != NULL) && (((g_linux_wlan->strInterfaceInfo[0].wilc_netdev) != NULL)
- || ((g_linux_wlan->strInterfaceInfo[1].wilc_netdev) != NULL))) {
- #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
- unregister_inetaddr_notifier(&g_dev_notifier);
- #endif
-
- for (i = 0; i < NUM_CONCURRENT_IFC; i++)
- nic[i] = netdev_priv(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
- }
-
- if ((g_linux_wlan != NULL) && g_linux_wlan->wilc_firmware != NULL) {
- release_firmware(g_linux_wlan->wilc_firmware);
- g_linux_wlan->wilc_firmware = NULL;
- }
-
- if ((g_linux_wlan != NULL) && (((g_linux_wlan->strInterfaceInfo[0].wilc_netdev) != NULL)
- || ((g_linux_wlan->strInterfaceInfo[1].wilc_netdev) != NULL))) {
- PRINT_D(INIT_DBG, "Waiting for mac_close ....\n");
-
- if (linux_wlan_lock_timeout(&close_exit_sync, CLOSE_TIMEOUT) < 0)
- PRINT_D(INIT_DBG, "Closed TimedOUT\n");
- else
- PRINT_D(INIT_DBG, "mac_closed\n");
-
- for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
- /* close all opened interfaces */
- if (g_linux_wlan->strInterfaceInfo[i].wilc_netdev != NULL) {
- if (nic[i]->mac_opened)
- mac_close(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
- }
- }
- for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
- PRINT_D(INIT_DBG, "Unregistering netdev %p\n", g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
- unregister_netdev(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
- #ifdef USE_WIRELESS
- PRINT_D(INIT_DBG, "Freeing Wiphy...\n");
- WILC_WFI_WiphyFree(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
- #endif
- PRINT_D(INIT_DBG, "Freeing netdev...\n");
- free_netdev(g_linux_wlan->strInterfaceInfo[i].wilc_netdev);
- }
- }
-
-#ifdef USE_WIRELESS
-#ifdef WILC_AP_EXTERNAL_MLME
- /* Bug 4600 : WILC_WFI_deinit_mon_interface was already called at mac_close */
- /* WILC_WFI_deinit_mon_interface(); */
-#endif
-#endif
-
- /* if(g_linux_wlan->open_ifcs==0) */
- {
- #ifndef WILC_SDIO
- PRINT_D(INIT_DBG, "SPI unregsiter...\n");
- spi_unregister_driver(&wilc_bus);
- #else
- PRINT_D(INIT_DBG, "SDIO unregsiter...\n");
- sdio_unregister_driver(&wilc_bus);
- #endif
-
- linux_wlan_deinit_lock(&close_exit_sync);
- if (g_linux_wlan != NULL) {
- kfree(g_linux_wlan);
- g_linux_wlan = NULL;
- }
- printk("Module_exit Done.\n");
-
-#if defined(WILC_DEBUGFS)
- wilc_debugfs_remove();
+#ifndef WILC_SDIO
+ PRINT_D(INIT_DBG, "SPI unregister...\n");
+ spi_unregister_driver(&wilc_bus);
+#else
+ PRINT_D(INIT_DBG, "SDIO unregister...\n");
+ sdio_unregister_driver(&wilc_bus);
#endif
-
- linux_wlan_device_detection(0);
- linux_wlan_device_power(0);
- }
}
module_exit(exit_wilc_driver);
diff --git a/drivers/staging/wilc1000/linux_wlan_common.h b/drivers/staging/wilc1000/linux_wlan_common.h
index e6ebf3e89..2b76e41eb 100644
--- a/drivers/staging/wilc1000/linux_wlan_common.h
+++ b/drivers/staging/wilc1000/linux_wlan_common.h
@@ -12,7 +12,6 @@ enum debug_region {
RX_debug,
Lock_debug,
Tcp_enhance,
- /*Added by amr - BugID_4720*/
Spin_debug,
Init_debug,
@@ -45,10 +44,10 @@ void wilc_debugfs_remove(void);
extern atomic_t REGION;
extern atomic_t DEBUG_LEVEL;
-#define DEBUG (1 << 0)
-#define INFO (1 << 1)
-#define WRN (1 << 2)
-#define ERR (1 << 3)
+#define DEBUG BIT(0)
+#define INFO BIT(1)
+#define WRN BIT(2)
+#define ERR BIT(3)
#define PRINT_D(region, ...) \
do { \
@@ -135,12 +134,7 @@ extern atomic_t DEBUG_LEVEL;
#define WILC_MULTICAST_TABLE_SIZE 8
-#if defined (NM73131_0_BOARD)
-
-#define MODALIAS "wilc_spi"
-#define GPIO_NUM IRQ_WILC1000_GPIO
-
-#elif defined (BEAGLE_BOARD)
+#if defined (BEAGLE_BOARD)
#define SPI_CHANNEL 4
#if SPI_CHANNEL == 4
@@ -150,9 +144,6 @@ extern atomic_t DEBUG_LEVEL;
#define MODALIAS "wilc_spi3"
#define GPIO_NUM 133
#endif
-#elif defined(PANDA_BOARD)
- #define MODALIAS "WILC_SPI"
- #define GPIO_NUM 139
#elif defined(PLAT_WMS8304) /* rachel */
#define MODALIAS "wilc_spi"
#define GPIO_NUM 139
@@ -176,7 +167,4 @@ extern atomic_t DEBUG_LEVEL;
#define MODALIAS "WILC_SPI"
#define GPIO_NUM 0x44
#endif
-
-
-void linux_wlan_enable_irq(void);
#endif
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 37f31f455..4aff953a8 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -8,15 +8,9 @@
-#if defined (NM73131_0_BOARD)
-#define SDIO_MODALIAS "wilc_sdio"
-#else
#define SDIO_MODALIAS "wilc1000_sdio"
-#endif
-#if defined (NM73131_0_BOARD)
- #define MAX_SPEED 50000000
-#elif defined(CUSTOMER_PLATFORM)
+#if defined(CUSTOMER_PLATFORM)
/* TODO : User have to stable bus clock as user's environment. */
#ifdef MAX_BUS_SPEED
#define MAX_SPEED MAX_BUS_SPEED
@@ -27,11 +21,12 @@
#define MAX_SPEED (6 * 1000000) /* Max 50M */
#endif
+struct wilc_sdio {
+ struct sdio_func *func;
+ struct wilc *wilc;
+};
struct sdio_func *local_sdio_func;
-extern linux_wlan_t *g_linux_wlan;
-extern int wilc_netdev_init(void);
-extern void wilc_handle_isr(void);
static unsigned int sdio_default_speed;
@@ -40,14 +35,19 @@ static unsigned int sdio_default_speed;
static const struct sdio_device_id wilc_sdio_ids[] = {
{ SDIO_DEVICE(SDIO_VENDOR_ID_WILC, SDIO_DEVICE_ID_WILC) },
+ { },
};
static void wilc_sdio_interrupt(struct sdio_func *func)
{
+ struct wilc_sdio *wl_sdio;
+
+ wl_sdio = sdio_get_drvdata(func);
+
#ifndef WILC_SDIO_IRQ_GPIO
sdio_release_host(func);
- wilc_handle_isr();
+ wilc_handle_isr(wl_sdio->wilc);
sdio_claim_host(func);
#endif
}
@@ -116,25 +116,26 @@ int linux_sdio_cmd53(sdio_cmd53_t *cmd)
return 1;
}
-volatile int probe; /* COMPLEMENT_BOOT */
static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
{
+ struct wilc_sdio *wl_sdio;
+ struct wilc *wilc;
+
PRINT_D(INIT_DBG, "probe function\n");
+ wl_sdio = kzalloc(sizeof(struct wilc_sdio), GFP_KERNEL);
+ if (!wl_sdio)
+ return -ENOMEM;
-#ifdef COMPLEMENT_BOOT
- if (local_sdio_func != NULL) {
- local_sdio_func = func;
- probe = 1;
- PRINT_D(INIT_DBG, "local_sdio_func isn't NULL\n");
- return 0;
- }
-#endif
PRINT_D(INIT_DBG, "Initializing netdev\n");
local_sdio_func = func;
- if (wilc_netdev_init()) {
+ if (wilc_netdev_init(&wilc)) {
PRINT_ER("Couldn't initialize netdev\n");
+ kfree(wl_sdio);
return -1;
}
+ wl_sdio->func = func;
+ wl_sdio->wilc = wilc;
+ sdio_set_drvdata(func, wl_sdio);
printk("Driver Initializing success\n");
return 0;
@@ -142,10 +143,11 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id
static void linux_sdio_remove(struct sdio_func *func)
{
- /**
- * TODO
- **/
+ struct wilc_sdio *wl_sdio;
+ wl_sdio = sdio_get_drvdata(func);
+ wl_wlan_cleanup();
+ kfree(wl_sdio);
}
struct sdio_driver wilc_bus = {
@@ -194,6 +196,7 @@ void disable_sdio_interrupt(void)
static int linux_sdio_set_speed(int speed)
{
struct mmc_ios ios;
+
sdio_claim_host(local_sdio_func);
memcpy((void *)&ios, (void *)&local_sdio_func->card->host->ios, sizeof(struct mmc_ios));
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index 236669cfc..039d06192 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -5,11 +5,12 @@
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/cdev.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <linux/device.h>
#include <linux/spi/spi.h>
#include "linux_wlan_common.h"
+#include "linux_wlan_spi.h"
#define USE_SPI_DMA 0 /* johnny add */
@@ -38,7 +39,7 @@
#define MAX_SPEED 6000000
#endif /* WILC_ASIC_A0 */
-static uint32_t SPEED = MIN_SPEED;
+static u32 SPEED = MIN_SPEED;
struct spi_device *wilc_spi_dev;
void linux_spi_deinit(void *vp);
@@ -113,57 +114,20 @@ int linux_spi_init(void *vp)
#define TXRX_PHASE_SIZE (4096)
#endif
-#if defined (NM73131_0_BOARD)
+#if defined(TXRX_PHASE_SIZE)
-int linux_spi_write(uint8_t *b, uint32_t len)
+int linux_spi_write(u8 *b, u32 len)
{
-
int ret;
if (len > 0 && b != NULL) {
- struct spi_message msg;
- PRINT_D(BUS_DBG, "Request writing %d bytes\n", len);
- struct spi_transfer tr = {
- .tx_buf = b,
- .len = len,
- .speed_hz = SPEED,
- .delay_usecs = 0,
- };
-
- spi_message_init(&msg);
- spi_message_add_tail(&tr, &msg);
- ret = spi_sync(wilc_spi_dev, &msg);
- if (ret < 0) {
- PRINT_ER("SPI transaction failed\n");
- }
-
- } else {
- PRINT_ER("can't write data with the following length: %d\n", len);
- PRINT_ER("FAILED due to NULL buffer or ZERO length check the following length: %d\n", len);
- ret = -1;
- }
-
- /* change return value to match WILC interface */
- (ret < 0) ? (ret = 0) : (ret = 1);
-
-
- return ret;
-}
-
-#elif defined(TXRX_PHASE_SIZE)
-
-int linux_spi_write(uint8_t *b, uint32_t len)
-{
- int ret;
- if (len > 0 && b != NULL) {
int i = 0;
int blk = len / TXRX_PHASE_SIZE;
int remainder = len % TXRX_PHASE_SIZE;
char *r_buffer = kzalloc(TXRX_PHASE_SIZE, GFP_KERNEL);
- if (!r_buffer) {
- PRINT_ER("Failed to allocate memory for r_buffer\n");
- }
+ if (!r_buffer)
+ return -ENOMEM;
if (blk) {
while (i < blk) {
@@ -229,7 +193,7 @@ int linux_spi_write(uint8_t *b, uint32_t len)
}
#else
-int linux_spi_write(uint8_t *b, uint32_t len)
+int linux_spi_write(u8 *b, u32 len)
{
int ret;
@@ -243,9 +207,9 @@ int linux_spi_write(uint8_t *b, uint32_t len)
.delay_usecs = 0,
};
char *r_buffer = kzalloc(len, GFP_KERNEL);
- if (!r_buffer) {
- PRINT_ER("Failed to allocate memory for r_buffer\n");
- }
+ if (!r_buffer)
+ return -ENOMEM;
+
tr.rx_buf = r_buffer;
PRINT_D(BUS_DBG, "Request writing %d bytes\n", len);
@@ -278,42 +242,9 @@ int linux_spi_write(uint8_t *b, uint32_t len)
#endif
-#if defined (NM73131_0_BOARD)
+#if defined(TXRX_PHASE_SIZE)
-int linux_spi_read(unsigned char *rb, unsigned long rlen)
-{
-
- int ret;
-
- if (rlen > 0) {
- struct spi_message msg;
- struct spi_transfer tr = {
- .rx_buf = rb,
- .len = rlen,
- .speed_hz = SPEED,
- .delay_usecs = 0,
-
- };
-
- spi_message_init(&msg);
- spi_message_add_tail(&tr, &msg);
- ret = spi_sync(wilc_spi_dev, &msg);
- if (ret < 0) {
- PRINT_ER("SPI transaction failed\n");
- }
- } else {
- PRINT_ER("can't read data with the following length: %ld\n", rlen);
- ret = -1;
- }
- /* change return value to match WILC interface */
- (ret < 0) ? (ret = 0) : (ret = 1);
-
- return ret;
-}
-
-#elif defined(TXRX_PHASE_SIZE)
-
-int linux_spi_read(unsigned char *rb, unsigned long rlen)
+int linux_spi_read(u8 *rb, u32 rlen)
{
int ret;
@@ -324,9 +255,8 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
int remainder = rlen % TXRX_PHASE_SIZE;
char *t_buffer = kzalloc(TXRX_PHASE_SIZE, GFP_KERNEL);
- if (!t_buffer) {
- PRINT_ER("Failed to allocate memory for t_buffer\n");
- }
+ if (!t_buffer)
+ return -ENOMEM;
if (blk) {
while (i < blk) {
@@ -378,7 +308,7 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
kfree(t_buffer);
} else {
- PRINT_ER("can't read data with the following length: %ld\n", rlen);
+ PRINT_ER("can't read data with the following length: %u\n", rlen);
ret = -1;
}
/* change return value to match WILC interface */
@@ -388,7 +318,7 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
}
#else
-int linux_spi_read(unsigned char *rb, unsigned long rlen)
+int linux_spi_read(u8 *rb, u32 rlen)
{
int ret;
@@ -403,9 +333,9 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
};
char *t_buffer = kzalloc(rlen, GFP_KERNEL);
- if (!t_buffer) {
- PRINT_ER("Failed to allocate memory for t_buffer\n");
- }
+ if (!t_buffer)
+ return -ENOMEM;
+
tr.tx_buf = t_buffer;
memset(&msg, 0, sizeof(msg));
@@ -422,7 +352,7 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
}
kfree(t_buffer);
} else {
- PRINT_ER("can't read data with the following length: %ld\n", rlen);
+ PRINT_ER("can't read data with the following length: %u\n", rlen);
ret = -1;
}
/* change return value to match WILC interface */
@@ -433,7 +363,7 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
#endif
-int linux_spi_write_read(unsigned char *wb, unsigned char *rb, unsigned int rlen)
+int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
{
int ret;
@@ -461,7 +391,7 @@ int linux_spi_write_read(unsigned char *wb, unsigned char *rb, unsigned int rlen
PRINT_ER("SPI transaction failed\n");
}
} else {
- PRINT_ER("can't read data with the following length: %d\n", rlen);
+ PRINT_ER("can't read data with the following length: %u\n", rlen);
ret = -1;
}
/* change return value to match WILC interface */
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h
index 0ecad477d..735678529 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ b/drivers/staging/wilc1000/linux_wlan_spi.h
@@ -7,8 +7,8 @@ extern struct spi_driver wilc_bus;
int linux_spi_init(void *vp);
void linux_spi_deinit(void *vp);
-int linux_spi_write(uint8_t *b, uint32_t len);
-int linux_spi_read(uint8_t *rb, uint32_t rlen);
-int linux_spi_write_read(unsigned char *wb, unsigned char *rb, unsigned int rlen);
+int linux_spi_write(u8 *b, u32 len);
+int linux_spi_read(u8 *rb, u32 rlen);
+int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen);
int linux_spi_set_max_speed(void);
#endif
diff --git a/drivers/staging/wilc1000/wilc_errorsupport.h b/drivers/staging/wilc1000/wilc_errorsupport.h
deleted file mode 100644
index b9517dc7f..000000000
--- a/drivers/staging/wilc1000/wilc_errorsupport.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef __WILC_ERRORSUPPORT_H__
-#define __WILC_ERRORSUPPORT_H__
-
-/*!
- * @file wilc_errorsupport.h
- * @brief Error reporting and handling support
- * @author syounan
- * @sa wilc_oswrapper.h top level OS wrapper file
- * @date 10 Aug 2010
- * @version 1.0
- */
-
-#include "linux_wlan_common.h"
-
-/* Psitive Numbers to indicate sucess with special status */
-#define WILC_ALREADY_EXSIT (+100) /** The requested object already exists */
-
-/* Generic success will return 0 */
-#define WILC_SUCCESS 0 /** Generic success */
-
-/* Negative numbers to indicate failures */
-#define WILC_FAIL -100 /** Generic Fail */
-#define WILC_BUSY -101 /** Busy with another operation*/
-#define WILC_INVALID_ARGUMENT -102 /** A given argument is invalid*/
-#define WILC_INVALID_STATE -103 /** An API request would violate the Driver state machine (i.e. to start PID while not camped)*/
-#define WILC_BUFFER_OVERFLOW -104 /** In copy operations if the copied data is larger than the allocated buffer*/
-#define WILC_NULL_PTR -105 /** null pointer is passed or used */
-#define WILC_EMPTY -107
-#define WILC_FULL -108
-#define WILC_TIMEOUT -109
-#define WILC_CANCELED -110 /** The required operation have been canceled by the user*/
-#define WILC_INVALID_FILE -112 /** The Loaded file is corruped or having an invalid format */
-#define WILC_NOT_FOUND -113 /** Cant find the file to load */
-#define WILC_NO_MEM -114
-#define WILC_UNSUPPORTED_VERSION -115
-#define WILC_FILE_EOF -116
-
-
-/* Error type */
-typedef s32 WILC_ErrNo;
-
-#define WILC_IS_ERR(__status__) (__status__ < WILC_SUCCESS)
-
-#define WILC_ERRORCHECK(__status__) do { \
- if (WILC_IS_ERR(__status__)) { \
- PRINT_ER("PRINT_ER(%d)\n", __status__); \
- goto ERRORHANDLER; \
- } \
-} while (0)
-
-#define WILC_ERRORREPORT(__status__, __err__) do { \
- PRINT_ER("PRINT_ER(%d)\n", __err__); \
- __status__ = __err__; \
- goto ERRORHANDLER; \
-} while (0)
-
-#define WILC_NULLCHECK(__status__, __ptr__) do { \
- if (__ptr__ == NULL) { \
- WILC_ERRORREPORT(__status__, WILC_NULL_PTR); \
- } \
-} while (0)
-
-#define WILC_CATCH(__status__) \
-ERRORHANDLER: \
- if (WILC_IS_ERR(__status__)) \
-
-#endif
diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c b/drivers/staging/wilc1000/wilc_exported_buf.c
deleted file mode 100644
index c3f6a0a1c..000000000
--- a/drivers/staging/wilc1000/wilc_exported_buf.c
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-
-#define LINUX_RX_SIZE (96 * 1024)
-#define LINUX_TX_SIZE (64 * 1024)
-#define WILC1000_FW_SIZE (4 * 1024)
-
-#define MALLOC_WILC_BUFFER(name, size) \
- exported_ ## name = kmalloc(size, GFP_KERNEL); \
- if (!exported_ ## name) { \
- printk("fail to alloc: %s memory\n", exported_ ## name); \
- return -ENOBUFS; \
- }
-
-#define FREE_WILC_BUFFER(name) \
- kfree(exported_ ## name);
-
-/*
- * Add necessary buffer pointers
- */
-void *exported_g_tx_buf;
-void *exported_g_rx_buf;
-void *exported_g_fw_buf;
-
-void *get_tx_buffer(void)
-{
- return exported_g_tx_buf;
-}
-EXPORT_SYMBOL(get_tx_buffer);
-
-void *get_rx_buffer(void)
-{
- return exported_g_rx_buf;
-}
-EXPORT_SYMBOL(get_rx_buffer);
-
-void *get_fw_buffer(void)
-{
- return exported_g_fw_buf;
-}
-EXPORT_SYMBOL(get_fw_buffer);
-
-static int __init wilc_module_init(void)
-{
- printk("wilc_module_init\n");
- /*
- * alloc necessary memory
- */
- MALLOC_WILC_BUFFER(g_tx_buf, LINUX_TX_SIZE)
- MALLOC_WILC_BUFFER(g_rx_buf, LINUX_RX_SIZE)
- MALLOC_WILC_BUFFER(g_fw_buf, WILC1000_FW_SIZE)
-
- return 0;
-}
-
-static void __exit wilc_module_deinit(void)
-{
- printk("wilc_module_deinit\n");
- FREE_WILC_BUFFER(g_tx_buf)
- FREE_WILC_BUFFER(g_rx_buf)
- FREE_WILC_BUFFER(g_fw_buf)
-}
-
-MODULE_LICENSE("Dual BSD/GPL");
-MODULE_AUTHOR("Tony Cho");
-MODULE_DESCRIPTION("WILC1xxx Memory Manager");
-pure_initcall(wilc_module_init);
-module_exit(wilc_module_deinit);
diff --git a/drivers/staging/wilc1000/wilc_memory.c b/drivers/staging/wilc1000/wilc_memory.c
deleted file mode 100644
index e90a95705..000000000
--- a/drivers/staging/wilc1000/wilc_memory.c
+++ /dev/null
@@ -1,16 +0,0 @@
-
-#include "wilc_memory.h"
-
-/*!
- * @author syounan
- * @date 18 Aug 2010
- * @version 1.0
- */
-void *WILC_MemoryAlloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs,
- char *pcFileName, u32 u32LineNo)
-{
- if (u32Size > 0)
- return kmalloc(u32Size, GFP_ATOMIC);
- else
- return NULL;
-}
diff --git a/drivers/staging/wilc1000/wilc_memory.h b/drivers/staging/wilc1000/wilc_memory.h
deleted file mode 100644
index f19cec11a..000000000
--- a/drivers/staging/wilc1000/wilc_memory.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef __WILC_MEMORY_H__
-#define __WILC_MEMORY_H__
-
-/*!
- * @file wilc_memory.h
- * @brief Memory OS wrapper functionality
- * @author syounan
- * @sa wilc_oswrapper.h top level OS wrapper file
- * @date 16 Aug 2010
- * @version 1.0
- */
-
-#include <linux/types.h>
-#include <linux/slab.h>
-
-/*!
- * @struct tstrWILC_MemoryAttrs
- * @brief Memory API options
- * @author syounan
- * @date 16 Aug 2010
- * @version 1.0
- */
-typedef struct {
-} tstrWILC_MemoryAttrs;
-
-/*!
- * @brief Allocates a given size of bytes
- * @param[in] u32Size size of memory in bytes to be allocated
- * @param[in] strAttrs Optional attributes, NULL for default
- * if not NULL, pAllocationPool should point to the pool to use for
- * this allocation. if NULL memory will be allocated directly from
- * the system
- * @param[in] pcFileName file name of the calling code for debugging
- * @param[in] u32LineNo line number of the calling code for debugging
- * @return The new allocated block, NULL if allocation fails
- * @note It is recommended to use of of the wrapper macros instead of
- * calling this function directly
- * @sa sttrWILC_MemoryAttrs
- * @sa WILC_MALLOC
- * @sa WILC_MALLOC_EX
- * @author syounan
- * @date 16 Aug 2010
- * @version 1.0
- */
-void *WILC_MemoryAlloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs,
- char *pcFileName, u32 u32LineNo);
-
-/*!
- * @brief standrad malloc wrapper with custom attributes
- */
- #define WILC_MALLOC_EX(__size__, __attrs__) \
- (WILC_MemoryAlloc( \
- (__size__), __attrs__, NULL, 0))
-
-
-/*!
- * @brief standrad malloc wrapper with default attributes
- */
-#define WILC_MALLOC(__size__) \
- WILC_MALLOC_EX(__size__, NULL)
-
-
-
-
-
-#endif
diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c b/drivers/staging/wilc1000/wilc_msgqueue.c
index 70e4fa6a0..0eff121b8 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -1,6 +1,9 @@
#include "wilc_msgqueue.h"
#include <linux/spinlock.h>
+#include "linux_wlan_common.h"
+#include <linux/errno.h>
+#include <linux/slab.h>
/*!
* @author syounan
@@ -8,14 +11,14 @@
* @note copied from FLO glue implementatuion
* @version 1.0
*/
-WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle)
+int wilc_mq_create(WILC_MsgQueueHandle *pHandle)
{
spin_lock_init(&pHandle->strCriticalSection);
sema_init(&pHandle->hSem, 0);
pHandle->pstrMessageList = NULL;
pHandle->u32ReceiversCount = 0;
pHandle->bExiting = false;
- return WILC_SUCCESS;
+ return 0;
}
/*!
@@ -24,24 +27,24 @@ WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle)
* @note copied from FLO glue implementatuion
* @version 1.0
*/
-WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle)
+int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle)
{
-
pHandle->bExiting = true;
/* Release any waiting receiver thread. */
while (pHandle->u32ReceiversCount > 0) {
- up(&(pHandle->hSem));
+ up(&pHandle->hSem);
pHandle->u32ReceiversCount--;
}
- while (pHandle->pstrMessageList != NULL) {
+ while (pHandle->pstrMessageList) {
Message *pstrMessge = pHandle->pstrMessageList->pstrNext;
+
kfree(pHandle->pstrMessageList);
pHandle->pstrMessageList = pstrMessge;
}
- return WILC_SUCCESS;
+ return 0;
}
/*!
@@ -50,41 +53,47 @@ WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle)
* @note copied from FLO glue implementatuion
* @version 1.0
*/
-WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
+int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
const void *pvSendBuffer, u32 u32SendBufferSize)
{
- WILC_ErrNo s32RetStatus = WILC_SUCCESS;
unsigned long flags;
Message *pstrMessage = NULL;
- if ((pHandle == NULL) || (u32SendBufferSize == 0) || (pvSendBuffer == NULL)) {
- WILC_ERRORREPORT(s32RetStatus, WILC_INVALID_ARGUMENT);
+ if ((!pHandle) || (u32SendBufferSize == 0) || (!pvSendBuffer)) {
+ PRINT_ER("pHandle or pvSendBuffer is null\n");
+ return -EFAULT;
}
- if (pHandle->bExiting == true) {
- WILC_ERRORREPORT(s32RetStatus, WILC_FAIL);
+ if (pHandle->bExiting) {
+ PRINT_ER("pHandle fail\n");
+ return -EFAULT;
}
- spin_lock_irqsave(&pHandle->strCriticalSection, flags);
-
/* construct a new message */
pstrMessage = kmalloc(sizeof(Message), GFP_ATOMIC);
- WILC_NULLCHECK(s32RetStatus, pstrMessage);
+ if (!pstrMessage)
+ return -ENOMEM;
+
pstrMessage->u32Length = u32SendBufferSize;
pstrMessage->pstrNext = NULL;
- pstrMessage->pvBuffer = WILC_MALLOC(u32SendBufferSize);
- WILC_NULLCHECK(s32RetStatus, pstrMessage->pvBuffer);
- memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize);
+ pstrMessage->pvBuffer = kmemdup(pvSendBuffer, u32SendBufferSize,
+ GFP_ATOMIC);
+ if (!pstrMessage->pvBuffer) {
+ kfree(pstrMessage);
+ return -ENOMEM;
+ }
+ spin_lock_irqsave(&pHandle->strCriticalSection, flags);
/* add it to the message queue */
- if (pHandle->pstrMessageList == NULL) {
+ if (!pHandle->pstrMessageList) {
pHandle->pstrMessageList = pstrMessage;
} else {
Message *pstrTailMsg = pHandle->pstrMessageList;
- while (pstrTailMsg->pstrNext != NULL) {
+
+ while (pstrTailMsg->pstrNext)
pstrTailMsg = pstrTailMsg->pstrNext;
- }
+
pstrTailMsg->pstrNext = pstrMessage;
}
@@ -92,95 +101,78 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
up(&pHandle->hSem);
- WILC_CATCH(s32RetStatus)
- {
- /* error occured, free any allocations */
- if (pstrMessage != NULL) {
- if (pstrMessage->pvBuffer != NULL) {
- kfree(pstrMessage->pvBuffer);
- }
- kfree(pstrMessage);
- }
- }
-
- return s32RetStatus;
+ return 0;
}
-
-
/*!
* @author syounan
* @date 1 Sep 2010
* @note copied from FLO glue implementatuion
* @version 1.0
*/
-WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
+int wilc_mq_recv(WILC_MsgQueueHandle *pHandle,
void *pvRecvBuffer, u32 u32RecvBufferSize,
u32 *pu32ReceivedLength)
{
-
Message *pstrMessage;
- WILC_ErrNo s32RetStatus = WILC_SUCCESS;
+ int result = 0;
unsigned long flags;
- if ((pHandle == NULL) || (u32RecvBufferSize == 0)
- || (pvRecvBuffer == NULL) || (pu32ReceivedLength == NULL)) {
- WILC_ERRORREPORT(s32RetStatus, WILC_INVALID_ARGUMENT);
+
+ if ((!pHandle) || (u32RecvBufferSize == 0)
+ || (!pvRecvBuffer) || (!pu32ReceivedLength)) {
+ PRINT_ER("pHandle or pvRecvBuffer is null\n");
+ return -EINVAL;
}
- if (pHandle->bExiting == true) {
- WILC_ERRORREPORT(s32RetStatus, WILC_FAIL);
+ if (pHandle->bExiting) {
+ PRINT_ER("pHandle fail\n");
+ return -EFAULT;
}
spin_lock_irqsave(&pHandle->strCriticalSection, flags);
pHandle->u32ReceiversCount++;
spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
- down(&(pHandle->hSem));
+ down(&pHandle->hSem);
- if (s32RetStatus == WILC_TIMEOUT) {
- /* timed out, just exit without consumeing the message */
- spin_lock_irqsave(&pHandle->strCriticalSection, flags);
- pHandle->u32ReceiversCount--;
- spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
- } else {
- /* other non-timeout scenarios */
- WILC_ERRORCHECK(s32RetStatus);
-
- if (pHandle->bExiting) {
- WILC_ERRORREPORT(s32RetStatus, WILC_FAIL);
- }
-
- spin_lock_irqsave(&pHandle->strCriticalSection, flags);
-
- pstrMessage = pHandle->pstrMessageList;
- if (pstrMessage == NULL) {
- spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
- WILC_ERRORREPORT(s32RetStatus, WILC_FAIL);
- }
- /* check buffer size */
- if (u32RecvBufferSize < pstrMessage->u32Length) {
- spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
- up(&pHandle->hSem);
- WILC_ERRORREPORT(s32RetStatus, WILC_BUFFER_OVERFLOW);
- }
-
- /* consume the message */
- pHandle->u32ReceiversCount--;
- memcpy(pvRecvBuffer, pstrMessage->pvBuffer, pstrMessage->u32Length);
- *pu32ReceivedLength = pstrMessage->u32Length;
+ /* other non-timeout scenarios */
+ if (result) {
+ PRINT_ER("Non-timeout\n");
+ return result;
+ }
- pHandle->pstrMessageList = pstrMessage->pstrNext;
+ if (pHandle->bExiting) {
+ PRINT_ER("pHandle fail\n");
+ return -EFAULT;
+ }
- kfree(pstrMessage->pvBuffer);
- kfree(pstrMessage);
+ spin_lock_irqsave(&pHandle->strCriticalSection, flags);
+ pstrMessage = pHandle->pstrMessageList;
+ if (!pstrMessage) {
spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
-
+ PRINT_ER("pstrMessage is null\n");
+ return -EFAULT;
}
-
- WILC_CATCH(s32RetStatus)
- {
+ /* check buffer size */
+ if (u32RecvBufferSize < pstrMessage->u32Length) {
+ spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
+ up(&pHandle->hSem);
+ PRINT_ER("u32RecvBufferSize overflow\n");
+ return -EOVERFLOW;
}
- return s32RetStatus;
+ /* consume the message */
+ pHandle->u32ReceiversCount--;
+ memcpy(pvRecvBuffer, pstrMessage->pvBuffer, pstrMessage->u32Length);
+ *pu32ReceivedLength = pstrMessage->u32Length;
+
+ pHandle->pstrMessageList = pstrMessage->pstrNext;
+
+ kfree(pstrMessage->pvBuffer);
+ kfree(pstrMessage);
+
+ spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
+
+ return result;
}
diff --git a/drivers/staging/wilc1000/wilc_msgqueue.h b/drivers/staging/wilc1000/wilc_msgqueue.h
index ef1d2fa20..d231c334e 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.h
+++ b/drivers/staging/wilc1000/wilc_msgqueue.h
@@ -10,9 +10,22 @@
* @version 1.0
*/
-#include "wilc_platform.h"
-#include "wilc_errorsupport.h"
-#include "wilc_memory.h"
+#include <linux/semaphore.h>
+
+/* Message Queue type is a structure */
+typedef struct __Message_struct {
+ void *pvBuffer;
+ u32 u32Length;
+ struct __Message_struct *pstrNext;
+} Message;
+
+typedef struct __MessageQueue_struct {
+ struct semaphore hSem;
+ spinlock_t strCriticalSection;
+ bool bExiting;
+ u32 u32ReceiversCount;
+ Message *pstrMessageList;
+} WILC_MsgQueueHandle;
/*!
* @brief Creates a new Message queue
@@ -27,7 +40,7 @@
* @date 30 Aug 2010
* @version 1.0
*/
-WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle);
+int wilc_mq_create(WILC_MsgQueueHandle *pHandle);
/*!
* @brief Sends a message
@@ -44,7 +57,7 @@ WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle);
* @date 30 Aug 2010
* @version 1.0
*/
-WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
+int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
const void *pvSendBuffer, u32 u32SendBufferSize);
/*!
@@ -63,7 +76,7 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
* @date 30 Aug 2010
* @version 1.0
*/
-WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
+int wilc_mq_recv(WILC_MsgQueueHandle *pHandle,
void *pvRecvBuffer, u32 u32RecvBufferSize,
u32 *pu32ReceivedLength);
@@ -76,6 +89,6 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
* @date 30 Aug 2010
* @version 1.0
*/
-WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle);
+int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle);
#endif
diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h
deleted file mode 100644
index cb483253e..000000000
--- a/drivers/staging/wilc1000/wilc_oswrapper.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __WILC_OSWRAPPER_H__
-#define __WILC_OSWRAPPER_H__
-
-/*!
- * @file wilc_oswrapper.h
- * @brief Top level OS Wrapper, include this file and it will include all
- * other files as necessary
- * @author syounan
- * @date 10 Aug 2010
- * @version 1.0
- */
-
-/* OS Wrapper interface version */
-#define WILC_OSW_INTERFACE_VER 2
-
-/* Os Configuration File */
-#include "wilc_platform.h"
-
-/* Error reporting and handling support */
-#include "wilc_errorsupport.h"
-
-/* Memory support */
-#include "wilc_memory.h"
-
-
-/* Message Queue */
-#include "wilc_msgqueue.h"
-
-#endif
diff --git a/drivers/staging/wilc1000/wilc_platform.h b/drivers/staging/wilc1000/wilc_platform.h
deleted file mode 100644
index 1e56973f2..000000000
--- a/drivers/staging/wilc1000/wilc_platform.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef __WILC_platform_H__
-#define __WILC_platform_H__
-
-#include <linux/kthread.h>
-#include <linux/semaphore.h>
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/kernel.h>
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/stat.h>
-#include <linux/time.h>
-#include <linux/version.h>
-#include "linux/string.h"
-/******************************************************************
- * OS specific types
- *******************************************************************/
-
-/* Message Queue type is a structure */
-typedef struct __Message_struct {
- void *pvBuffer;
- u32 u32Length;
- struct __Message_struct *pstrNext;
-} Message;
-
-typedef struct __MessageQueue_struct {
- struct semaphore hSem;
- spinlock_t strCriticalSection;
- bool bExiting;
- u32 u32ReceiversCount;
- Message *pstrMessageList;
-} WILC_MsgQueueHandle;
-
-
-
-/*Time represented in 64 bit format*/
-typedef time_t WILC_Time;
-
-
-/*******************************************************************
- * others
- ********************************************************************/
-
-/* Generic printf function */
-#define __WILC_FILE__ __FILE__
-#define __WILC_FUNCTION__ __func__
-#define __WILC_LINE__ __LINE__
-#endif
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 5a18148a5..300c571e4 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -7,6 +7,7 @@
/* */
/* //////////////////////////////////////////////////////////////////////////// */
+#include <linux/string.h>
#include "wilc_wlan_if.h"
#include "wilc_wlan.h"
@@ -14,8 +15,7 @@
typedef struct {
void *os_context;
- wilc_wlan_os_func_t os_func;
- uint32_t block_size;
+ u32 block_size;
int (*sdio_cmd52)(sdio_cmd52_t *);
int (*sdio_cmd53)(sdio_cmd53_t *);
int (*sdio_set_max_speed)(void);
@@ -29,10 +29,9 @@ typedef struct {
static wilc_sdio_t g_sdio;
#ifdef WILC_SDIO_IRQ_GPIO
-static int sdio_write_reg(uint32_t addr, uint32_t data);
-static int sdio_read_reg(uint32_t addr, uint32_t *data);
+static int sdio_write_reg(u32 addr, u32 data);
+static int sdio_read_reg(u32 addr, u32 *data);
#endif
-extern unsigned int int_clrd;
/********************************************
*
@@ -40,7 +39,7 @@ extern unsigned int int_clrd;
*
********************************************/
-static int sdio_set_func0_csa_address(uint32_t adr)
+static int sdio_set_func0_csa_address(u32 adr)
{
sdio_cmd52_t cmd;
@@ -51,21 +50,21 @@ static int sdio_set_func0_csa_address(uint32_t adr)
cmd.function = 0;
cmd.raw = 0;
cmd.address = 0x10c;
- cmd.data = (uint8_t)adr;
+ cmd.data = (u8)adr;
if (!g_sdio.sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10c data...\n");
goto _fail_;
}
cmd.address = 0x10d;
- cmd.data = (uint8_t)(adr >> 8);
+ cmd.data = (u8)(adr >> 8);
if (!g_sdio.sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10d data...\n");
goto _fail_;
}
cmd.address = 0x10e;
- cmd.data = (uint8_t)(adr >> 16);
+ cmd.data = (u8)(adr >> 16);
if (!g_sdio.sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10e data...\n");
goto _fail_;
@@ -76,29 +75,7 @@ _fail_:
return 0;
}
-static int sdio_set_func0_csa_address_byte0(uint32_t adr)
-{
- sdio_cmd52_t cmd;
-
- /**
- * Review: BIG ENDIAN
- **/
- cmd.read_write = 1;
- cmd.function = 0;
- cmd.raw = 0;
- cmd.address = 0x10c;
- cmd.data = (uint8_t)adr;
- if (!g_sdio.sdio_cmd52(&cmd)) {
- g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10c data...\n");
- goto _fail_;
- }
-
- return 1;
-_fail_:
- return 0;
-}
-
-static int sdio_set_func0_block_size(uint32_t block_size)
+static int sdio_set_func0_block_size(u32 block_size)
{
sdio_cmd52_t cmd;
@@ -106,14 +83,14 @@ static int sdio_set_func0_block_size(uint32_t block_size)
cmd.function = 0;
cmd.raw = 0;
cmd.address = 0x10;
- cmd.data = (uint8_t)block_size;
+ cmd.data = (u8)block_size;
if (!g_sdio.sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10 data...\n");
goto _fail_;
}
cmd.address = 0x11;
- cmd.data = (uint8_t)(block_size >> 8);
+ cmd.data = (u8)(block_size >> 8);
if (!g_sdio.sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x11 data...\n");
goto _fail_;
@@ -130,7 +107,7 @@ _fail_:
*
********************************************/
-static int sdio_set_func1_block_size(uint32_t block_size)
+static int sdio_set_func1_block_size(u32 block_size)
{
sdio_cmd52_t cmd;
@@ -138,13 +115,13 @@ static int sdio_set_func1_block_size(uint32_t block_size)
cmd.function = 0;
cmd.raw = 0;
cmd.address = 0x110;
- cmd.data = (uint8_t)block_size;
+ cmd.data = (u8)block_size;
if (!g_sdio.sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x110 data...\n");
goto _fail_;
}
cmd.address = 0x111;
- cmd.data = (uint8_t)(block_size >> 8);
+ cmd.data = (u8)(block_size >> 8);
if (!g_sdio.sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x111 data...\n");
goto _fail_;
@@ -158,7 +135,7 @@ _fail_:
static int sdio_clear_int(void)
{
#ifndef WILC_SDIO_IRQ_GPIO
- /* uint32_t sts; */
+ /* u32 sts; */
sdio_cmd52_t cmd;
cmd.read_write = 0;
@@ -167,11 +144,10 @@ static int sdio_clear_int(void)
cmd.address = 0x4;
cmd.data = 0;
g_sdio.sdio_cmd52(&cmd);
- int_clrd++;
return cmd.data;
#else
- uint32_t reg;
+ u32 reg;
if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, &reg)) {
g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0);
@@ -179,15 +155,14 @@ static int sdio_clear_int(void)
}
reg &= ~0x1;
sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
- int_clrd++;
return 1;
#endif
}
-uint32_t sdio_xfer_cnt(void)
+u32 sdio_xfer_cnt(void)
{
- uint32_t cnt = 0;
+ u32 cnt = 0;
sdio_cmd52_t cmd;
cmd.read_write = 0;
@@ -246,7 +221,7 @@ _fail_:
return 0;
}
-static int sdio_write_reg(uint32_t addr, uint32_t data)
+static int sdio_write_reg(u32 addr, u32 data)
{
#ifdef BIG_ENDIAN
data = BYTE_SWAP(data);
@@ -279,7 +254,7 @@ static int sdio_write_reg(uint32_t addr, uint32_t data)
cmd.block_mode = 0;
cmd.increment = 1;
cmd.count = 4;
- cmd.buffer = (uint8_t *)&data;
+ cmd.buffer = (u8 *)&data;
cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */
if (!g_sdio.sdio_cmd53(&cmd)) {
@@ -295,9 +270,9 @@ _fail_:
return 0;
}
-static int sdio_write(uint32_t addr, uint8_t *buf, uint32_t size)
+static int sdio_write(u32 addr, u8 *buf, u32 size)
{
- uint32_t block_size = g_sdio.block_size;
+ u32 block_size = g_sdio.block_size;
sdio_cmd53_t cmd;
int nblk, nleft;
@@ -379,7 +354,7 @@ _fail_:
return 0;
}
-static int sdio_read_reg(uint32_t addr, uint32_t *data)
+static int sdio_read_reg(u32 addr, u32 *data)
{
if ((addr >= 0xf0) && (addr <= 0xff)) {
sdio_cmd52_t cmd;
@@ -405,7 +380,7 @@ static int sdio_read_reg(uint32_t addr, uint32_t *data)
cmd.block_mode = 0;
cmd.increment = 1;
cmd.count = 4;
- cmd.buffer = (uint8_t *)data;
+ cmd.buffer = (u8 *)data;
cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */
@@ -426,9 +401,9 @@ _fail_:
return 0;
}
-static int sdio_read(uint32_t addr, uint8_t *buf, uint32_t size)
+static int sdio_read(u32 addr, u8 *buf, u32 size)
{
- uint32_t block_size = g_sdio.block_size;
+ u32 block_size = g_sdio.block_size;
sdio_cmd53_t cmd;
int nblk, nleft;
@@ -523,7 +498,7 @@ static int sdio_deinit(void *pv)
static int sdio_sync(void)
{
- uint32_t reg;
+ u32 reg;
/**
* Disable power sequencer
@@ -533,7 +508,7 @@ static int sdio_sync(void)
return 0;
}
- reg &= ~(1 << 8);
+ reg &= ~BIT(8);
if (!sdio_write_reg(WILC_MISC, reg)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write misc reg...\n");
return 0;
@@ -541,7 +516,7 @@ static int sdio_sync(void)
#ifdef WILC_SDIO_IRQ_GPIO
{
- uint32_t reg;
+ u32 reg;
int ret;
/**
@@ -552,7 +527,7 @@ static int sdio_sync(void)
g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0);
return 0;
}
- reg |= (1 << 8);
+ reg |= BIT(8);
ret = sdio_write_reg(WILC_PIN_MUX_0, reg);
if (!ret) {
g_sdio.dPrint(N_ERR, "[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0);
@@ -567,7 +542,7 @@ static int sdio_sync(void)
g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE);
return 0;
}
- reg |= (1 << 16);
+ reg |= BIT(16);
ret = sdio_write_reg(WILC_INTR_ENABLE, reg);
if (!ret) {
g_sdio.dPrint(N_ERR, "[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE);
@@ -583,13 +558,12 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
{
sdio_cmd52_t cmd;
int loop;
- uint32_t chipid;
+ u32 chipid;
memset(&g_sdio, 0, sizeof(wilc_sdio_t));
g_sdio.dPrint = func;
g_sdio.os_context = inp->os_context.os_private;
- memcpy((void *)&g_sdio.os_func, (void *)&inp->os_func, sizeof(wilc_wlan_os_func_t));
if (inp->io_func.io_init) {
if (!inp->io_func.io_init(g_sdio.os_context)) {
@@ -715,10 +689,10 @@ static void sdio_set_default_speed(void)
g_sdio.sdio_set_default_speed();
}
-static int sdio_read_size(uint32_t *size)
+static int sdio_read_size(u32 *size)
{
- uint32_t tmp;
+ u32 tmp;
sdio_cmd52_t cmd;
/**
@@ -744,10 +718,10 @@ static int sdio_read_size(uint32_t *size)
return 1;
}
-static int sdio_read_int(uint32_t *int_status)
+static int sdio_read_int(u32 *int_status)
{
- uint32_t tmp;
+ u32 tmp;
sdio_cmd52_t cmd;
sdio_read_size(&tmp);
@@ -756,24 +730,22 @@ static int sdio_read_int(uint32_t *int_status)
* Read IRQ flags
**/
#ifndef WILC_SDIO_IRQ_GPIO
- /* cmd.read_write = 0; */
cmd.function = 1;
- /* cmd.raw = 0; */
cmd.address = 0x04;
cmd.data = 0;
g_sdio.sdio_cmd52(&cmd);
- if (cmd.data & (1 << 0))
+ if (cmd.data & BIT(0))
tmp |= INT_0;
- if (cmd.data & (1 << 2))
+ if (cmd.data & BIT(2))
tmp |= INT_1;
- if (cmd.data & (1 << 3))
+ if (cmd.data & BIT(3))
tmp |= INT_2;
- if (cmd.data & (1 << 4))
+ if (cmd.data & BIT(4))
tmp |= INT_3;
- if (cmd.data & (1 << 5))
+ if (cmd.data & BIT(5))
tmp |= INT_4;
- if (cmd.data & (1 << 6))
+ if (cmd.data & BIT(6))
tmp |= INT_5;
{
int i;
@@ -787,7 +759,7 @@ static int sdio_read_int(uint32_t *int_status)
}
#else
{
- uint32_t irq_flags;
+ u32 irq_flags;
cmd.read_write = 0;
cmd.function = 0;
@@ -806,18 +778,18 @@ static int sdio_read_int(uint32_t *int_status)
return 1;
}
-static int sdio_clear_int_ext(uint32_t val)
+static int sdio_clear_int_ext(u32 val)
{
int ret;
if (g_sdio.has_thrpt_enh3) {
- uint32_t reg;
+ u32 reg;
#ifdef WILC_SDIO_IRQ_GPIO
{
- uint32_t flags;
+ u32 flags;
- flags = val & ((1 << MAX_NUN_INT_THRPT_ENH2) - 1);
+ flags = val & (BIT(MAX_NUN_INT_THRPT_ENH2) - 1);
reg = flags;
}
#else
@@ -825,13 +797,13 @@ static int sdio_clear_int_ext(uint32_t val)
#endif
/* select VMM table 0 */
if ((val & SEL_VMM_TBL0) == SEL_VMM_TBL0)
- reg |= (1 << 5);
+ reg |= BIT(5);
/* select VMM table 1 */
if ((val & SEL_VMM_TBL1) == SEL_VMM_TBL1)
- reg |= (1 << 6);
+ reg |= BIT(6);
/* enable VMM */
if ((val & EN_VMM) == EN_VMM)
- reg |= (1 << 7);
+ reg |= BIT(7);
if (reg) {
sdio_cmd52_t cmd;
@@ -853,9 +825,9 @@ static int sdio_clear_int_ext(uint32_t val)
{
/* see below. has_thrpt_enh2 uses register 0xf8 to clear interrupts. */
/* Cannot clear multiple interrupts. Must clear each interrupt individually */
- uint32_t flags;
+ u32 flags;
- flags = val & ((1 << MAX_NUM_INT) - 1);
+ flags = val & (BIT(MAX_NUM_INT) - 1);
if (flags) {
int i;
@@ -868,7 +840,7 @@ static int sdio_clear_int_ext(uint32_t val)
cmd.function = 0;
cmd.raw = 0;
cmd.address = 0xf8;
- cmd.data = (1 << i);
+ cmd.data = BIT(i);
ret = g_sdio.sdio_cmd52(&cmd);
if (!ret) {
@@ -893,18 +865,18 @@ static int sdio_clear_int_ext(uint32_t val)
#endif /* WILC_SDIO_IRQ_GPIO */
{
- uint32_t vmm_ctl;
+ u32 vmm_ctl;
vmm_ctl = 0;
/* select VMM table 0 */
if ((val & SEL_VMM_TBL0) == SEL_VMM_TBL0)
- vmm_ctl |= (1 << 0);
+ vmm_ctl |= BIT(0);
/* select VMM table 1 */
if ((val & SEL_VMM_TBL1) == SEL_VMM_TBL1)
- vmm_ctl |= (1 << 1);
+ vmm_ctl |= BIT(1);
/* enable VMM */
if ((val & EN_VMM) == EN_VMM)
- vmm_ctl |= (1 << 2);
+ vmm_ctl |= BIT(2);
if (vmm_ctl) {
sdio_cmd52_t cmd;
@@ -930,7 +902,7 @@ _fail_:
static int sdio_sync_ext(int nint /* how mant interrupts to enable. */)
{
- uint32_t reg;
+ u32 reg;
if (nint > MAX_NUM_INT) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Too many interupts (%d)...\n", nint);
@@ -951,7 +923,7 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */)
return 0;
}
- reg &= ~(1 << 8);
+ reg &= ~BIT(8);
if (!sdio_write_reg(WILC_MISC, reg)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write misc reg...\n");
return 0;
@@ -959,7 +931,7 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */)
#ifdef WILC_SDIO_IRQ_GPIO
{
- uint32_t reg;
+ u32 reg;
int ret, i;
/**
@@ -970,7 +942,7 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */)
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0);
return 0;
}
- reg |= (1 << 8);
+ reg |= BIT(8);
ret = sdio_write_reg(WILC_PIN_MUX_0, reg);
if (!ret) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0);
@@ -987,7 +959,7 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */)
}
for (i = 0; (i < 5) && (nint > 0); i++, nint--)
- reg |= (1 << (27 + i));
+ reg |= BIT((27 + i));
ret = sdio_write_reg(WILC_INTR_ENABLE, reg);
if (!ret) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE);
@@ -1001,7 +973,7 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */)
}
for (i = 0; (i < 3) && (nint > 0); i++, nint--)
- reg |= (1 << i);
+ reg |= BIT(i);
ret = sdio_read_reg(WILC_INTR2_ENABLE, &reg);
if (!ret) {
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 1bf7d314a..599508bea 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -7,20 +7,15 @@
/* */
/* //////////////////////////////////////////////////////////////////////////// */
+#include <linux/string.h>
#include "wilc_wlan_if.h"
#include "wilc_wlan.h"
-extern unsigned int int_clrd;
-
-/*
- * #include <linux/kernel.h>
- * #include <linux/string.h>
- */
typedef struct {
void *os_context;
- int (*spi_tx)(uint8_t *, uint32_t);
- int (*spi_rx)(uint8_t *, uint32_t);
- int (*spi_trx)(uint8_t *, uint8_t *, uint32_t);
+ int (*spi_tx)(u8 *, u32);
+ int (*spi_rx)(u8 *, u32);
+ int (*spi_trx)(u8 *, u8 *, u32);
int (*spi_max_speed)(void);
wilc_debug_func dPrint;
int crc_off;
@@ -30,8 +25,8 @@ typedef struct {
static wilc_spi_t g_spi;
-static int spi_read(uint32_t, uint8_t *, uint32_t);
-static int spi_write(uint32_t, uint8_t *, uint32_t);
+static int spi_read(u32, u8 *, u32);
+static int spi_write(u32, u8 *, u32);
/********************************************
*
@@ -39,7 +34,7 @@ static int spi_write(uint32_t, uint8_t *, uint32_t);
*
********************************************/
-static const uint8_t crc7_syndrome_table[256] = {
+static const u8 crc7_syndrome_table[256] = {
0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f,
0x48, 0x41, 0x5a, 0x53, 0x6c, 0x65, 0x7e, 0x77,
0x19, 0x10, 0x0b, 0x02, 0x3d, 0x34, 0x2f, 0x26,
@@ -74,12 +69,12 @@ static const uint8_t crc7_syndrome_table[256] = {
0x46, 0x4f, 0x54, 0x5d, 0x62, 0x6b, 0x70, 0x79
};
-static uint8_t crc7_byte(uint8_t crc, uint8_t data)
+static u8 crc7_byte(u8 crc, u8 data)
{
return crc7_syndrome_table[(crc << 1) ^ data];
}
-static uint8_t crc7(uint8_t crc, const uint8_t *buffer, uint32_t len)
+static u8 crc7(u8 crc, const u8 *buffer, u32 len)
{
while (len--)
crc = crc7_byte(crc, *buffer++);
@@ -116,26 +111,26 @@ static uint8_t crc7(uint8_t crc, const uint8_t *buffer, uint32_t len)
#define DATA_PKT_SZ_8K (8 * 1024)
#define DATA_PKT_SZ DATA_PKT_SZ_8K
-static int spi_cmd(uint8_t cmd, uint32_t adr, uint32_t data, uint32_t sz, uint8_t clockless)
+static int spi_cmd(u8 cmd, u32 adr, u32 data, u32 sz, u8 clockless)
{
- uint8_t bc[9];
+ u8 bc[9];
int len = 5;
int result = N_OK;
bc[0] = cmd;
switch (cmd) {
case CMD_SINGLE_READ: /* single word (4 bytes) read */
- bc[1] = (uint8_t)(adr >> 16);
- bc[2] = (uint8_t)(adr >> 8);
- bc[3] = (uint8_t)adr;
+ bc[1] = (u8)(adr >> 16);
+ bc[2] = (u8)(adr >> 8);
+ bc[3] = (u8)adr;
len = 5;
break;
case CMD_INTERNAL_READ: /* internal register read */
- bc[1] = (uint8_t)(adr >> 8);
+ bc[1] = (u8)(adr >> 8);
if (clockless)
- bc[1] |= (1 << 7);
- bc[2] = (uint8_t)adr;
+ bc[1] |= BIT(7);
+ bc[2] = (u8)adr;
bc[3] = 0x00;
len = 5;
break;
@@ -163,45 +158,45 @@ static int spi_cmd(uint8_t cmd, uint32_t adr, uint32_t data, uint32_t sz, uint8_
case CMD_DMA_WRITE: /* dma write */
case CMD_DMA_READ: /* dma read */
- bc[1] = (uint8_t)(adr >> 16);
- bc[2] = (uint8_t)(adr >> 8);
- bc[3] = (uint8_t)adr;
- bc[4] = (uint8_t)(sz >> 8);
- bc[5] = (uint8_t)(sz);
+ bc[1] = (u8)(adr >> 16);
+ bc[2] = (u8)(adr >> 8);
+ bc[3] = (u8)adr;
+ bc[4] = (u8)(sz >> 8);
+ bc[5] = (u8)(sz);
len = 7;
break;
case CMD_DMA_EXT_WRITE: /* dma extended write */
case CMD_DMA_EXT_READ: /* dma extended read */
- bc[1] = (uint8_t)(adr >> 16);
- bc[2] = (uint8_t)(adr >> 8);
- bc[3] = (uint8_t)adr;
- bc[4] = (uint8_t)(sz >> 16);
- bc[5] = (uint8_t)(sz >> 8);
- bc[6] = (uint8_t)(sz);
+ bc[1] = (u8)(adr >> 16);
+ bc[2] = (u8)(adr >> 8);
+ bc[3] = (u8)adr;
+ bc[4] = (u8)(sz >> 16);
+ bc[5] = (u8)(sz >> 8);
+ bc[6] = (u8)(sz);
len = 8;
break;
case CMD_INTERNAL_WRITE: /* internal register write */
- bc[1] = (uint8_t)(adr >> 8);
+ bc[1] = (u8)(adr >> 8);
if (clockless)
- bc[1] |= (1 << 7);
- bc[2] = (uint8_t)(adr);
- bc[3] = (uint8_t)(data >> 24);
- bc[4] = (uint8_t)(data >> 16);
- bc[5] = (uint8_t)(data >> 8);
- bc[6] = (uint8_t)(data);
+ bc[1] |= BIT(7);
+ bc[2] = (u8)(adr);
+ bc[3] = (u8)(data >> 24);
+ bc[4] = (u8)(data >> 16);
+ bc[5] = (u8)(data >> 8);
+ bc[6] = (u8)(data);
len = 8;
break;
case CMD_SINGLE_WRITE: /* single word write */
- bc[1] = (uint8_t)(adr >> 16);
- bc[2] = (uint8_t)(adr >> 8);
- bc[3] = (uint8_t)(adr);
- bc[4] = (uint8_t)(data >> 24);
- bc[5] = (uint8_t)(data >> 16);
- bc[6] = (uint8_t)(data >> 8);
- bc[7] = (uint8_t)(data);
+ bc[1] = (u8)(adr >> 16);
+ bc[2] = (u8)(adr >> 8);
+ bc[3] = (u8)(adr);
+ bc[4] = (u8)(data >> 24);
+ bc[5] = (u8)(data >> 16);
+ bc[6] = (u8)(data >> 8);
+ bc[7] = (u8)(data);
len = 9;
break;
@@ -212,7 +207,7 @@ static int spi_cmd(uint8_t cmd, uint32_t adr, uint32_t data, uint32_t sz, uint8_
if (result) {
if (!g_spi.crc_off)
- bc[len - 1] = (crc7(0x7f, (const uint8_t *)&bc[0], len - 1)) << 1;
+ bc[len - 1] = (crc7(0x7f, (const u8 *)&bc[0], len - 1)) << 1;
else
len -= 1;
@@ -225,9 +220,9 @@ static int spi_cmd(uint8_t cmd, uint32_t adr, uint32_t data, uint32_t sz, uint8_
return result;
}
-static int spi_cmd_rsp(uint8_t cmd)
+static int spi_cmd_rsp(u8 cmd)
{
- uint8_t rsp;
+ u8 rsp;
int result = N_OK;
/**
@@ -273,29 +268,29 @@ _fail_:
return result;
}
-static int spi_cmd_complete(uint8_t cmd, uint32_t adr, uint8_t *b, uint32_t sz, uint8_t clockless)
+static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless)
{
- uint8_t wb[32], rb[32];
- uint8_t wix, rix;
- uint32_t len2;
- uint8_t rsp;
+ u8 wb[32], rb[32];
+ u8 wix, rix;
+ u32 len2;
+ u8 rsp;
int len = 0;
int result = N_OK;
wb[0] = cmd;
switch (cmd) {
case CMD_SINGLE_READ: /* single word (4 bytes) read */
- wb[1] = (uint8_t)(adr >> 16);
- wb[2] = (uint8_t)(adr >> 8);
- wb[3] = (uint8_t)adr;
+ wb[1] = (u8)(adr >> 16);
+ wb[2] = (u8)(adr >> 8);
+ wb[3] = (u8)adr;
len = 5;
break;
case CMD_INTERNAL_READ: /* internal register read */
- wb[1] = (uint8_t)(adr >> 8);
+ wb[1] = (u8)(adr >> 8);
if (clockless == 1)
- wb[1] |= (1 << 7);
- wb[2] = (uint8_t)adr;
+ wb[1] |= BIT(7);
+ wb[2] = (u8)adr;
wb[3] = 0x00;
len = 5;
break;
@@ -323,30 +318,30 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, uint8_t *b, uint32_t sz,
case CMD_DMA_WRITE: /* dma write */
case CMD_DMA_READ: /* dma read */
- wb[1] = (uint8_t)(adr >> 16);
- wb[2] = (uint8_t)(adr >> 8);
- wb[3] = (uint8_t)adr;
- wb[4] = (uint8_t)(sz >> 8);
- wb[5] = (uint8_t)(sz);
+ wb[1] = (u8)(adr >> 16);
+ wb[2] = (u8)(adr >> 8);
+ wb[3] = (u8)adr;
+ wb[4] = (u8)(sz >> 8);
+ wb[5] = (u8)(sz);
len = 7;
break;
case CMD_DMA_EXT_WRITE: /* dma extended write */
case CMD_DMA_EXT_READ: /* dma extended read */
- wb[1] = (uint8_t)(adr >> 16);
- wb[2] = (uint8_t)(adr >> 8);
- wb[3] = (uint8_t)adr;
- wb[4] = (uint8_t)(sz >> 16);
- wb[5] = (uint8_t)(sz >> 8);
- wb[6] = (uint8_t)(sz);
+ wb[1] = (u8)(adr >> 16);
+ wb[2] = (u8)(adr >> 8);
+ wb[3] = (u8)adr;
+ wb[4] = (u8)(sz >> 16);
+ wb[5] = (u8)(sz >> 8);
+ wb[6] = (u8)(sz);
len = 8;
break;
case CMD_INTERNAL_WRITE: /* internal register write */
- wb[1] = (uint8_t)(adr >> 8);
+ wb[1] = (u8)(adr >> 8);
if (clockless == 1)
- wb[1] |= (1 << 7);
- wb[2] = (uint8_t)(adr);
+ wb[1] |= BIT(7);
+ wb[2] = (u8)(adr);
wb[3] = b[3];
wb[4] = b[2];
wb[5] = b[1];
@@ -355,9 +350,9 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, uint8_t *b, uint32_t sz,
break;
case CMD_SINGLE_WRITE: /* single word write */
- wb[1] = (uint8_t)(adr >> 16);
- wb[2] = (uint8_t)(adr >> 8);
- wb[3] = (uint8_t)(adr);
+ wb[1] = (u8)(adr >> 16);
+ wb[2] = (u8)(adr >> 8);
+ wb[3] = (u8)(adr);
wb[4] = b[3];
wb[5] = b[2];
wb[6] = b[1];
@@ -375,7 +370,7 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, uint8_t *b, uint32_t sz,
}
if (!g_spi.crc_off)
- wb[len - 1] = (crc7(0x7f, (const uint8_t *)&wb[0], len - 1)) << 1;
+ wb[len - 1] = (crc7(0x7f, (const u8 *)&wb[0], len - 1)) << 1;
else
len -= 1;
@@ -402,9 +397,9 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, uint8_t *b, uint32_t sz,
}
#undef NUM_DUMMY_BYTES
- if (len2 > (sizeof(wb) / sizeof(wb[0]))) {
+ if (len2 > ARRAY_SIZE(wb)) {
PRINT_ER("[wilc spi]: spi buffer size too small (%d) (%zu)\n",
- len2, (sizeof(wb) / sizeof(wb[0])));
+ len2, ARRAY_SIZE(wb));
result = N_FAIL;
return result;
}
@@ -455,8 +450,8 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, uint8_t *b, uint32_t sz,
if ((cmd == CMD_INTERNAL_READ) || (cmd == CMD_SINGLE_READ)
|| (cmd == CMD_DMA_READ) || (cmd == CMD_DMA_EXT_READ)) {
int retry;
- /* uint16_t crc1, crc2; */
- uint8_t crc[2];
+ /* u16 crc1, crc2; */
+ u8 crc[2];
/**
* Data Respnose header
**/
@@ -612,12 +607,12 @@ _error_:
return result;
}
-static int spi_data_read(uint8_t *b, uint32_t sz)
+static int spi_data_read(u8 *b, u32 sz)
{
int retry, ix, nbytes;
int result = N_OK;
- uint8_t crc[2];
- uint8_t rsp;
+ u8 crc[2];
+ u8 rsp;
/**
* Data
@@ -680,12 +675,12 @@ static int spi_data_read(uint8_t *b, uint32_t sz)
return result;
}
-static int spi_data_write(uint8_t *b, uint32_t sz)
+static int spi_data_write(u8 *b, u32 sz)
{
int ix, nbytes;
int result = 1;
- uint8_t cmd, order, crc[2] = {0};
- /* uint8_t rsp; */
+ u8 cmd, order, crc[2] = {0};
+ /* u8 rsp; */
/**
* Data
@@ -757,71 +752,30 @@ static int spi_data_write(uint8_t *b, uint32_t sz)
*
********************************************/
-static int spi_internal_write(uint32_t adr, uint32_t dat)
+static int spi_internal_write(u32 adr, u32 dat)
{
int result;
-#if defined USE_OLD_SPI_SW
- /**
- * Command
- **/
- result = spi_cmd(CMD_INTERNAL_WRITE, adr, dat, 4, 0);
- if (result != N_OK) {
- PRINT_ER("[wilc spi]: Failed internal write cmd...\n");
- return 0;
- }
-
- result = spi_cmd_rsp(CMD_INTERNAL_WRITE, 0);
- if (result != N_OK) {
- PRINT_ER("[wilc spi]: Failed internal write cmd response...\n");
- }
-#else
-
#ifdef BIG_ENDIAN
dat = BYTE_SWAP(dat);
#endif
- result = spi_cmd_complete(CMD_INTERNAL_WRITE, adr, (uint8_t *)&dat, 4, 0);
+ result = spi_cmd_complete(CMD_INTERNAL_WRITE, adr, (u8 *)&dat, 4, 0);
if (result != N_OK) {
PRINT_ER("[wilc spi]: Failed internal write cmd...\n");
}
-#endif
return result;
}
-static int spi_internal_read(uint32_t adr, uint32_t *data)
+static int spi_internal_read(u32 adr, u32 *data)
{
int result;
-#if defined USE_OLD_SPI_SW
- result = spi_cmd(CMD_INTERNAL_READ, adr, 0, 4, 0);
- if (result != N_OK) {
- PRINT_ER("[wilc spi]: Failed internal read cmd...\n");
- return 0;
- }
-
- result = spi_cmd_rsp(CMD_INTERNAL_READ, 0);
- if (result != N_OK) {
- PRINT_ER("[wilc spi]: Failed internal read cmd response...\n");
- return 0;
- }
-
- /**
- * Data
- **/
- result = spi_data_read((uint8_t *)data, 4);
- if (result != N_OK) {
- PRINT_ER("[wilc spi]: Failed internal read data...\n");
- return 0;
- }
-#else
- result = spi_cmd_complete(CMD_INTERNAL_READ, adr, (uint8_t *)data, 4, 0);
+ result = spi_cmd_complete(CMD_INTERNAL_READ, adr, (u8 *)data, 4, 0);
if (result != N_OK) {
PRINT_ER("[wilc spi]: Failed internal read cmd...\n");
return 0;
}
-#endif
-
#ifdef BIG_ENDIAN
*data = BYTE_SWAP(*data);
@@ -836,30 +790,12 @@ static int spi_internal_read(uint32_t adr, uint32_t *data)
*
********************************************/
-static int spi_write_reg(uint32_t addr, uint32_t data)
+static int spi_write_reg(u32 addr, u32 data)
{
int result = N_OK;
- uint8_t cmd = CMD_SINGLE_WRITE;
- uint8_t clockless = 0;
-
-
-#if defined USE_OLD_SPI_SW
- {
- result = spi_cmd(cmd, addr, data, 4, 0);
- if (result != N_OK) {
- PRINT_ER("[wilc spi]: Failed cmd, write reg (%08x)...\n", addr);
- return 0;
- }
+ u8 cmd = CMD_SINGLE_WRITE;
+ u8 clockless = 0;
- result = spi_cmd_rsp(cmd, 0);
- if (result != N_OK) {
- PRINT_ER("[wilc spi]: Failed cmd response, write reg (%08x)...\n", addr);
- return 0;
- }
-
- return 1;
- }
-#else
#ifdef BIG_ENDIAN
data = BYTE_SWAP(data);
#endif
@@ -869,20 +805,18 @@ static int spi_write_reg(uint32_t addr, uint32_t data)
clockless = 1;
}
- result = spi_cmd_complete(cmd, addr, (uint8_t *)&data, 4, clockless);
+ result = spi_cmd_complete(cmd, addr, (u8 *)&data, 4, clockless);
if (result != N_OK) {
PRINT_ER("[wilc spi]: Failed cmd, write reg (%08x)...\n", addr);
}
return result;
-#endif
-
}
-static int spi_write(uint32_t addr, uint8_t *buf, uint32_t size)
+static int spi_write(u32 addr, u8 *buf, u32 size)
{
int result;
- uint8_t cmd = CMD_DMA_EXT_WRITE;
+ u8 cmd = CMD_DMA_EXT_WRITE;
/**
* has to be greated than 4
@@ -890,28 +824,11 @@ static int spi_write(uint32_t addr, uint8_t *buf, uint32_t size)
if (size <= 4)
return 0;
-#if defined USE_OLD_SPI_SW
- /**
- * Command
- **/
- result = spi_cmd(cmd, addr, 0, size, 0);
- if (result != N_OK) {
- PRINT_ER("[wilc spi]: Failed cmd, write block (%08x)...\n", addr);
- return 0;
- }
-
- result = spi_cmd_rsp(cmd, 0);
- if (result != N_OK) {
- PRINT_ER("[wilc spi ]: Failed cmd response, write block (%08x)...\n", addr);
- return 0;
- }
-#else
result = spi_cmd_complete(cmd, addr, NULL, size, 0);
if (result != N_OK) {
PRINT_ER("[wilc spi]: Failed cmd, write block (%08x)...\n", addr);
return 0;
}
-#endif
/**
* Data
@@ -924,30 +841,12 @@ static int spi_write(uint32_t addr, uint8_t *buf, uint32_t size)
return 1;
}
-static int spi_read_reg(uint32_t addr, uint32_t *data)
+static int spi_read_reg(u32 addr, u32 *data)
{
int result = N_OK;
- uint8_t cmd = CMD_SINGLE_READ;
- uint8_t clockless = 0;
-
-#if defined USE_OLD_SPI_SW
- result = spi_cmd(cmd, addr, 0, 4, 0);
- if (result != N_OK) {
- PRINT_ER("[wilc spi]: Failed cmd, read reg (%08x)...\n", addr);
- return 0;
- }
- result = spi_cmd_rsp(cmd, 0);
- if (result != N_OK) {
- PRINT_ER("[wilc spi]: Failed cmd response, read reg (%08x)...\n", addr);
- return 0;
- }
+ u8 cmd = CMD_SINGLE_READ;
+ u8 clockless = 0;
- result = spi_data_read((uint8_t *)data, 4);
- if (result != N_OK) {
- PRINT_ER("[wilc spi]: Failed data read...\n");
- return 0;
- }
-#else
if (addr < 0x30) {
/* PRINT_ER("***** read addr %d\n\n", addr); */
/* Clockless register*/
@@ -955,13 +854,11 @@ static int spi_read_reg(uint32_t addr, uint32_t *data)
clockless = 1;
}
- result = spi_cmd_complete(cmd, addr, (uint8_t *)data, 4, clockless);
+ result = spi_cmd_complete(cmd, addr, (u8 *)data, 4, clockless);
if (result != N_OK) {
PRINT_ER("[wilc spi]: Failed cmd, read reg (%08x)...\n", addr);
return 0;
}
-#endif
-
#ifdef BIG_ENDIAN
*data = BYTE_SWAP(*data);
@@ -970,46 +867,19 @@ static int spi_read_reg(uint32_t addr, uint32_t *data)
return 1;
}
-static int spi_read(uint32_t addr, uint8_t *buf, uint32_t size)
+static int spi_read(u32 addr, u8 *buf, u32 size)
{
- uint8_t cmd = CMD_DMA_EXT_READ;
+ u8 cmd = CMD_DMA_EXT_READ;
int result;
if (size <= 4)
return 0;
-#if defined USE_OLD_SPI_SW
- /**
- * Command
- **/
- result = spi_cmd(cmd, addr, 0, size, 0);
- if (result != N_OK) {
- PRINT_ER("[wilc spi]: Failed cmd, read block (%08x)...\n", addr);
- return 0;
- }
-
- result = spi_cmd_rsp(cmd, 0);
- if (result != N_OK) {
- PRINT_ER("[wilc spi]: Failed cmd response, read block (%08x)...\n", addr);
- return 0;
- }
-
- /**
- * Data
- **/
- result = spi_data_read(buf, size);
- if (result != N_OK) {
- PRINT_ER("[wilc spi]: Failed block data read...\n");
- return 0;
- }
-#else
result = spi_cmd_complete(cmd, addr, buf, size, 0);
if (result != N_OK) {
PRINT_ER("[wilc spi]: Failed cmd, read block (%08x)...\n", addr);
return 0;
}
-#endif
-
return 1;
}
@@ -1022,14 +892,14 @@ static int spi_read(uint32_t addr, uint8_t *buf, uint32_t size)
static int spi_clear_int(void)
{
- uint32_t reg;
+ u32 reg;
+
if (!spi_read_reg(WILC_HOST_RX_CTRL_0, &reg)) {
PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0);
return 0;
}
reg &= ~0x1;
spi_write_reg(WILC_HOST_RX_CTRL_0, reg);
- int_clrd++;
return 1;
}
@@ -1043,7 +913,7 @@ static int spi_deinit(void *pv)
static int spi_sync(void)
{
- uint32_t reg;
+ u32 reg;
int ret;
/**
@@ -1054,7 +924,7 @@ static int spi_sync(void)
PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0);
return 0;
}
- reg |= (1 << 8);
+ reg |= BIT(8);
ret = spi_write_reg(WILC_PIN_MUX_0, reg);
if (!ret) {
PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0);
@@ -1069,7 +939,7 @@ static int spi_sync(void)
PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE);
return 0;
}
- reg |= (1 << 16);
+ reg |= BIT(16);
ret = spi_write_reg(WILC_INTR_ENABLE, reg);
if (!ret) {
PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE);
@@ -1081,8 +951,8 @@ static int spi_sync(void)
static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
{
- uint32_t reg;
- uint32_t chipid;
+ u32 reg;
+ u32 chipid;
static int isinit;
@@ -1167,15 +1037,16 @@ static void spi_default_bus_speed(void)
{
}
-static int spi_read_size(uint32_t *size)
+static int spi_read_size(u32 *size)
{
int ret;
+
if (g_spi.has_thrpt_enh) {
ret = spi_internal_read(0xe840 - WILC_SPI_REG_BASE, size);
*size = *size & IRQ_DMA_WD_CNT_MASK;
} else {
- uint32_t tmp;
- uint32_t byte_cnt;
+ u32 tmp;
+ u32 byte_cnt;
ret = spi_read_reg(WILC_VMM_TO_HOST_SIZE, &byte_cnt);
if (!ret) {
@@ -1194,14 +1065,15 @@ _fail_:
-static int spi_read_int(uint32_t *int_status)
+static int spi_read_int(u32 *int_status)
{
int ret;
+
if (g_spi.has_thrpt_enh) {
ret = spi_internal_read(0xe840 - WILC_SPI_REG_BASE, int_status);
} else {
- uint32_t tmp;
- uint32_t byte_cnt;
+ u32 tmp;
+ u32 byte_cnt;
ret = spi_read_reg(WILC_VMM_TO_HOST_SIZE, &byte_cnt);
if (!ret) {
@@ -1215,7 +1087,7 @@ static int spi_read_int(uint32_t *int_status)
j = 0;
do {
- uint32_t irq_flags;
+ u32 irq_flags;
happended = 0;
@@ -1228,7 +1100,7 @@ static int spi_read_int(uint32_t *int_status)
}
{
- uint32_t unkmown_mask;
+ u32 unkmown_mask;
unkmown_mask = ~((1ul << g_spi.nint) - 1);
@@ -1249,15 +1121,16 @@ _fail_:
return ret;
}
-static int spi_clear_int_ext(uint32_t val)
+static int spi_clear_int_ext(u32 val)
{
int ret;
if (g_spi.has_thrpt_enh) {
ret = spi_internal_write(0xe844 - WILC_SPI_REG_BASE, val);
} else {
- uint32_t flags;
- flags = val & ((1 << MAX_NUM_INT) - 1);
+ u32 flags;
+
+ flags = val & (BIT(MAX_NUM_INT) - 1);
if (flags) {
int i;
@@ -1282,15 +1155,15 @@ static int spi_clear_int_ext(uint32_t val)
}
{
- uint32_t tbl_ctl;
+ u32 tbl_ctl;
tbl_ctl = 0;
/* select VMM table 0 */
if ((val & SEL_VMM_TBL0) == SEL_VMM_TBL0)
- tbl_ctl |= (1 << 0);
+ tbl_ctl |= BIT(0);
/* select VMM table 1 */
if ((val & SEL_VMM_TBL1) == SEL_VMM_TBL1)
- tbl_ctl |= (1 << 1);
+ tbl_ctl |= BIT(1);
ret = spi_write_reg(WILC_VMM_TBL_CTL, tbl_ctl);
if (!ret) {
@@ -1316,7 +1189,7 @@ _fail_:
static int spi_sync_ext(int nint /* how mant interrupts to enable. */)
{
- uint32_t reg;
+ u32 reg;
int ret, i;
if (nint > MAX_NUM_INT) {
@@ -1334,7 +1207,7 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */)
PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0);
return 0;
}
- reg |= (1 << 8);
+ reg |= BIT(8);
ret = spi_write_reg(WILC_PIN_MUX_0, reg);
if (!ret) {
PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0);
@@ -1351,7 +1224,7 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */)
}
for (i = 0; (i < 5) && (nint > 0); i++, nint--) {
- reg |= (1 << (27 + i));
+ reg |= (BIT((27 + i)));
}
ret = spi_write_reg(WILC_INTR_ENABLE, reg);
if (!ret) {
@@ -1366,7 +1239,7 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */)
}
for (i = 0; (i < 3) && (nint > 0); i++, nint--) {
- reg |= (1 << i);
+ reg |= BIT(i);
}
ret = spi_read_reg(WILC_INTR2_ENABLE, &reg);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index a6edc973f..3e9501727 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -11,11 +11,10 @@
*/
#include "wilc_wfi_cfgoperations.h"
-#include "wilc_wlan.c"
#ifdef WILC_SDIO
-#include "linux_wlan_sdio.h" /* tony : for set_wiphy_dev() */
+#include "linux_wlan_sdio.h"
#endif
-
+#include <linux/errno.h>
#define IS_MANAGMEMENT 0x100
#define IS_MANAGMEMENT_CALLBACK 0x080
@@ -23,27 +22,19 @@
#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
extern int linux_wlan_get_firmware(perInterface_wlan_t *p_nic);
-extern void linux_wlan_unlock(void *vp);
-extern u16 Set_machw_change_vir_if(bool bValue);
extern int mac_open(struct net_device *ndev);
extern int mac_close(struct net_device *ndev);
tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
u32 u32LastScannedNtwrksCountShadow;
-#ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
struct timer_list hDuringIpTimer;
-#endif
struct timer_list hAgingTimer;
static u8 op_ifcs;
extern u8 u8ConnectedSSID[6];
-/*BugID_5137*/
u8 g_wilc_initialized = 1;
-extern linux_wlan_t *g_linux_wlan;
-#ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
extern bool g_obtainingIP;
-#endif
#define CHAN2G(_channel, _freq, _flags) { \
.band = IEEE80211_BAND_2GHZ, \
@@ -95,7 +86,6 @@ static struct ieee80211_rate WILC_WFI_rates[] = {
RATETAB_ENT(540, 12, 0),
};
-#ifdef WILC_P2P
struct p2p_mgmt_data {
int size;
u8 *buff;
@@ -104,15 +94,13 @@ struct p2p_mgmt_data {
/*Global variable used to state the current connected STA channel*/
u8 u8WLANChannel = INVALID_CHANNEL;
-/*BugID_5442*/
-u8 u8CurrChannel;
+u8 curr_channel;
u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09};
u8 u8P2Plocalrandom = 0x01;
u8 u8P2Precvrandom = 0x00;
u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
bool bWilc_ie;
-#endif
static struct ieee80211_supported_band WILC_WFI_band_2ghz = {
.channels = WILC_WFI_2ghz_channels,
@@ -122,7 +110,6 @@ static struct ieee80211_supported_band WILC_WFI_band_2ghz = {
};
-/*BugID_5137*/
struct add_key_params {
u8 key_idx;
bool pairwise;
@@ -133,7 +120,6 @@ struct wilc_wfi_key g_key_gtk_params;
struct add_key_params g_add_ptk_key_params;
struct wilc_wfi_key g_key_ptk_params;
struct wilc_wfi_wep_key g_key_wep_params;
-u8 g_flushing_in_progress;
bool g_ptk_keys_saved;
bool g_gtk_keys_saved;
bool g_wep_keys_saved;
@@ -144,6 +130,7 @@ bool g_wep_keys_saved;
void clear_shadow_scan(void *pUserVoid)
{
int i;
+
if (op_ifcs == 0) {
del_timer_sync(&hAgingTimer);
PRINT_INFO(CORECONFIG_DBG, "destroy aging timer\n");
@@ -162,11 +149,11 @@ void clear_shadow_scan(void *pUserVoid)
}
-uint32_t get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo)
+u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo)
{
- uint8_t i;
+ u8 i;
int rssi_v = 0;
- uint8_t num_rssi = (pstrNetworkInfo->strRssi.u8Full) ? NUM_RSSI : (pstrNetworkInfo->strRssi.u8Index);
+ u8 num_rssi = (pstrNetworkInfo->strRssi.u8Full) ? NUM_RSSI : (pstrNetworkInfo->strRssi.u8Index);
for (i = 0; i < num_rssi; i++)
rssi_v += pstrNetworkInfo->strRssi.as8RSSI[i];
@@ -175,19 +162,20 @@ uint32_t get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo)
return rssi_v;
}
-void refresh_scan(void *pUserVoid, uint8_t all, bool bDirectScan)
+void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan)
{
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
struct wiphy *wiphy;
struct cfg80211_bss *bss = NULL;
int i;
int rssi = 0;
- priv = (struct WILC_WFI_priv *)pUserVoid;
+ priv = (struct wilc_priv *)pUserVoid;
wiphy = priv->dev->ieee80211_ptr->wiphy;
for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) {
tstrNetworkInfo *pstrNetworkInfo;
+
pstrNetworkInfo = &(astrLastScannedNtwrksShadow[i]);
@@ -217,6 +205,7 @@ void refresh_scan(void *pUserVoid, uint8_t all, bool bDirectScan)
void reset_shadow_found(void *pUserVoid)
{
int i;
+
for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) {
astrLastScannedNtwrksShadow[i].u8Found = 0;
@@ -226,6 +215,7 @@ void reset_shadow_found(void *pUserVoid)
void update_scan_time(void *pUserVoid)
{
int i;
+
for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) {
astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan = jiffies;
}
@@ -241,10 +231,8 @@ static void remove_network_from_shadow(unsigned long arg)
if (time_after(now, astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan + (unsigned long)(SCAN_RESULT_EXPIRE))) {
PRINT_D(CFG80211_DBG, "Network expired in ScanShadow: %s\n", astrLastScannedNtwrksShadow[i].au8ssid);
- if (astrLastScannedNtwrksShadow[i].pu8IEs != NULL) {
- kfree(astrLastScannedNtwrksShadow[i].pu8IEs);
- astrLastScannedNtwrksShadow[i].pu8IEs = NULL;
- }
+ kfree(astrLastScannedNtwrksShadow[i].pu8IEs);
+ astrLastScannedNtwrksShadow[i].pu8IEs = NULL;
host_int_freeJoinParams(astrLastScannedNtwrksShadow[i].pJoinParams);
@@ -264,17 +252,15 @@ static void remove_network_from_shadow(unsigned long arg)
}
}
-#ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
static void clear_duringIP(unsigned long arg)
{
PRINT_D(GENERIC_DBG, "GO:IP Obtained , enable scan\n");
g_obtainingIP = false;
}
-#endif
-int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
+int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
{
- int8_t state = -1;
+ int state = -1;
int i;
if (u32LastScannedNtwrksCountShadow == 0) {
@@ -297,9 +283,9 @@ int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams)
{
- int8_t ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid);
- uint32_t ap_index = 0;
- uint8_t rssi_index = 0;
+ int ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid);
+ u32 ap_index = 0;
+ u8 rssi_index = 0;
if (u32LastScannedNtwrksCountShadow >= MAX_NUM_SCANNED_NETWORKS_SHADOW) {
PRINT_D(CFG80211_DBG, "Shadow network reached its maximum limit\n");
@@ -339,7 +325,7 @@ void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, vo
if (ap_found != -1)
kfree(astrLastScannedNtwrksShadow[ap_index].pu8IEs);
astrLastScannedNtwrksShadow[ap_index].pu8IEs =
- WILC_MALLOC(pstrNetworkInfo->u16IEsLen); /* will be deallocated by the WILC_WFI_CfgScan() function */
+ kmalloc(pstrNetworkInfo->u16IEsLen, GFP_KERNEL); /* will be deallocated by the WILC_WFI_CfgScan() function */
memcpy(astrLastScannedNtwrksShadow[ap_index].pu8IEs,
pstrNetworkInfo->pu8IEs, pstrNetworkInfo->u16IEsLen);
@@ -366,40 +352,44 @@ void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, vo
* @date
* @version 1.0
*/
-static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams)
+static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams)
{
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
struct wiphy *wiphy;
s32 s32Freq;
struct ieee80211_channel *channel;
- s32 s32Error = WILC_SUCCESS;
struct cfg80211_bss *bss = NULL;
- priv = (struct WILC_WFI_priv *)pUserVoid;
- if (priv->bCfgScanning == true) {
+ priv = (struct wilc_priv *)pUserVoid;
+ if (priv->bCfgScanning) {
if (enuScanEvent == SCAN_EVENT_NETWORK_FOUND) {
wiphy = priv->dev->ieee80211_ptr->wiphy;
- WILC_NULLCHECK(s32Error, wiphy);
+
+ if (!wiphy)
+ return;
+
if (wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC
&&
((((s32)pstrNetworkInfo->s8rssi) * 100) < 0
||
(((s32)pstrNetworkInfo->s8rssi) * 100) > 100)
) {
- WILC_ERRORREPORT(s32Error, WILC_FAIL);
+ PRINT_ER("wiphy signal type fial\n");
+ return;
}
if (pstrNetworkInfo != NULL) {
s32Freq = ieee80211_channel_to_frequency((s32)pstrNetworkInfo->u8channel, IEEE80211_BAND_2GHZ);
channel = ieee80211_get_channel(wiphy, s32Freq);
- WILC_NULLCHECK(s32Error, channel);
+ if (!channel)
+ return;
PRINT_INFO(CFG80211_DBG, "Network Info:: CHANNEL Frequency: %d, RSSI: %d, CapabilityInfo: %d,"
"BeaconPeriod: %d\n", channel->center_freq, (((s32)pstrNetworkInfo->s8rssi) * 100),
pstrNetworkInfo->u16CapInfo, pstrNetworkInfo->u16BeaconPeriod);
- if (pstrNetworkInfo->bNewNetwork == true) {
+ if (pstrNetworkInfo->bNewNetwork) {
if (priv->u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { /* TODO: mostafa: to be replaced by */
/* max_scan_ssids */
PRINT_D(CFG80211_DBG, "Network %s found\n", pstrNetworkInfo->au8ssid);
@@ -479,11 +469,6 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo
up(&(priv->hSemScanReq));
}
}
-
-
- WILC_CATCH(s32Error)
- {
- }
}
@@ -496,10 +481,10 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo
* @date 01 MAR 2012
* @version 1.0
*/
-int WILC_WFI_Set_PMKSA(u8 *bssid, struct WILC_WFI_priv *priv)
+int WILC_WFI_Set_PMKSA(u8 *bssid, struct wilc_priv *priv)
{
u32 i;
- s32 s32Error = WILC_SUCCESS;
+ s32 s32Error = 0;
for (i = 0; i < priv->pmkid_list.numpmkid; i++) {
@@ -511,7 +496,7 @@ int WILC_WFI_Set_PMKSA(u8 *bssid, struct WILC_WFI_priv *priv)
/*If bssid is found, set the values*/
s32Error = host_int_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list);
- if (s32Error != WILC_SUCCESS)
+ if (s32Error != 0)
PRINT_ER("Error in pmkid\n");
break;
@@ -522,7 +507,7 @@ int WILC_WFI_Set_PMKSA(u8 *bssid, struct WILC_WFI_priv *priv)
}
-int linux_wlan_set_bssid(struct net_device *wilc_netdev, uint8_t *pBSSID);
+int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);
/**
@@ -541,29 +526,30 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, uint8_t *pBSSID);
*/
int connecting;
-static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent,
+static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
tstrConnectInfo *pstrConnectInfo,
u8 u8MacStatus,
tstrDisconnectNotifInfo *pstrDisconnectNotifInfo,
void *pUserVoid)
{
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
struct net_device *dev;
- #ifdef WILC_P2P
- tstrWILC_WFIDrv *pstrWFIDrv;
- #endif
+ struct host_if_drv *pstrWFIDrv;
u8 NullBssid[ETH_ALEN] = {0};
+ struct wilc *wl;
+ perInterface_wlan_t *nic;
+
connecting = 0;
- priv = (struct WILC_WFI_priv *)pUserVoid;
+ priv = (struct wilc_priv *)pUserVoid;
dev = priv->dev;
- #ifdef WILC_P2P
- pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv;
- #endif
+ nic = netdev_priv(dev);
+ wl = nic->wilc;
+ pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
if (enuConnDisconnEvent == CONN_DISCONN_EVENT_CONN_RESP) {
/*Initialization*/
- u16 u16ConnectStatus = WLAN_STATUS_SUCCESS;
+ u16 u16ConnectStatus;
u16ConnectStatus = pstrConnectInfo->u16ConnectStatus;
@@ -575,14 +561,11 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent,
* = SUCCESSFUL_STATUSCODE, while mac status is MAC_DISCONNECTED (which means something wrong happened) */
u16ConnectStatus = WLAN_STATUS_UNSPECIFIED_FAILURE;
linux_wlan_set_bssid(priv->dev, NullBssid);
- memset(u8ConnectedSSID, 0, ETH_ALEN);
+ eth_zero_addr(u8ConnectedSSID);
- /*BugID_5457*/
/*Invalidate u8WLANChannel value on wlan0 disconnect*/
- #ifdef WILC_P2P
if (!pstrWFIDrv->u8P2PConnect)
u8WLANChannel = INVALID_CHANNEL;
- #endif
PRINT_ER("Unspecified failure: Connection status %d : MAC status = %d\n", u16ConnectStatus, u8MacStatus);
}
@@ -595,9 +578,6 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent,
pstrConnectInfo->au8bssid[1], pstrConnectInfo->au8bssid[2], pstrConnectInfo->au8bssid[3], pstrConnectInfo->au8bssid[4], pstrConnectInfo->au8bssid[5]);
memcpy(priv->au8AssociatedBss, pstrConnectInfo->au8bssid, ETH_ALEN);
- /* BugID_4209: if this network has expired in the scan results in the above nl80211 layer, refresh them here by calling
- * cfg80211_inform_bss() with the last Scan results before calling cfg80211_connect_result() to avoid
- * Linux kernel warning generated at the nl80211 layer */
for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) {
if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid,
@@ -614,7 +594,6 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent,
}
if (bNeedScanRefresh) {
- /*BugID_5418*/
/*Also, refrsh DIRECT- results if */
refresh_scan(priv, 1, true);
@@ -633,34 +612,27 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent,
u16ConnectStatus, GFP_KERNEL); /* TODO: mostafa: u16ConnectStatus to */
/* be replaced by pstrConnectInfo->u16ConnectStatus */
} else if (enuConnDisconnEvent == CONN_DISCONN_EVENT_DISCONN_NOTIF) {
- #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
g_obtainingIP = false;
- #endif
PRINT_ER("Received MAC_DISCONNECTED from firmware with reason %d on dev [%p]\n",
pstrDisconnectNotifInfo->u16reason, priv->dev);
u8P2Plocalrandom = 0x01;
u8P2Precvrandom = 0x00;
bWilc_ie = false;
- memset(priv->au8AssociatedBss, 0, ETH_ALEN);
+ eth_zero_addr(priv->au8AssociatedBss);
linux_wlan_set_bssid(priv->dev, NullBssid);
- memset(u8ConnectedSSID, 0, ETH_ALEN);
+ eth_zero_addr(u8ConnectedSSID);
- /*BugID_5457*/
/*Invalidate u8WLANChannel value on wlan0 disconnect*/
- #ifdef WILC_P2P
if (!pstrWFIDrv->u8P2PConnect)
u8WLANChannel = INVALID_CHANNEL;
- #endif
- /*BugID_5315*/
/*Incase "P2P CLIENT Connected" send deauthentication reason by 3 to force the WPA_SUPPLICANT to directly change
* virtual interface to station*/
- if ((pstrWFIDrv->IFC_UP) && (dev == g_linux_wlan->strInterfaceInfo[1].wilc_netdev)) {
+ if ((pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) {
pstrDisconnectNotifInfo->u16reason = 3;
}
- /*BugID_5315*/
/*Incase "P2P CLIENT during connection(not connected)" send deauthentication reason by 1 to force the WPA_SUPPLICANT
* to scan again and retry the connection*/
- else if ((!pstrWFIDrv->IFC_UP) && (dev == g_linux_wlan->strInterfaceInfo[1].wilc_netdev)) {
+ else if ((!pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) {
pstrDisconnectNotifInfo->u16reason = 1;
}
cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, pstrDisconnectNotifInfo->ie,
@@ -673,7 +645,7 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent,
/**
- * @brief WILC_WFI_CfgSetChannel
+ * @brief set_channel
* @details Set channel for a given wireless interface. Some devices
* may support multi-channel operation (by channel hopping) so cfg80211
* doesn't verify much. Note, however, that the passed netdev may be
@@ -685,29 +657,29 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent,
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_CfgSetChannel(struct wiphy *wiphy,
- struct cfg80211_chan_def *chandef)
+static int set_channel(struct wiphy *wiphy,
+ struct cfg80211_chan_def *chandef)
{
-
u32 channelnum = 0;
- struct WILC_WFI_priv *priv;
- s32 s32Error = WILC_SUCCESS;
+ struct wilc_priv *priv;
+ int result = 0;
+
priv = wiphy_priv(wiphy);
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);
- u8CurrChannel = channelnum;
- s32Error = host_int_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum);
+ curr_channel = channelnum;
+ result = host_int_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum);
- if (s32Error != WILC_SUCCESS)
+ if (result != 0)
PRINT_ER("Error in setting channel %d\n", channelnum);
- return s32Error;
+ return result;
}
/**
- * @brief WILC_WFI_CfgScan
+ * @brief scan
* @details Request to do a scan. If returning zero, the scan request is given
* the driver, and will be valid until passed to cfg80211_scan_done().
* For scan results, call cfg80211_inform_bss(); you can call this outside
@@ -719,17 +691,13 @@ static int WILC_WFI_CfgSetChannel(struct wiphy *wiphy,
* @version 1.0
*/
-/*
- * kernel version 3.8.8 supported
- * tony, sswd, WILC-KR, 2013-10-29
- */
-static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
+static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
{
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
u32 i;
- s32 s32Error = WILC_SUCCESS;
+ s32 s32Error = 0;
u8 au8ScanChanList[MAX_NUM_SCANNED_NETWORKS];
- tstrHiddenNetwork strHiddenNetwork;
+ struct hidden_network strHiddenNetwork;
priv = wiphy_priv(wiphy);
@@ -758,15 +726,14 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct cfg80211_scan_request *r
if (request->n_ssids >= 1) {
- strHiddenNetwork.pstrHiddenNetworkInfo = WILC_MALLOC(request->n_ssids * sizeof(tstrHiddenNetwork));
+ strHiddenNetwork.pstrHiddenNetworkInfo = kmalloc(request->n_ssids * sizeof(struct hidden_network), GFP_KERNEL);
strHiddenNetwork.u8ssidnum = request->n_ssids;
- /*BugID_4156*/
for (i = 0; i < request->n_ssids; i++) {
if (request->ssids[i].ssid != NULL && request->ssids[i].ssid_len != 0) {
- strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid = WILC_MALLOC(request->ssids[i].ssid_len);
+ 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;
} else {
@@ -792,7 +759,7 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct cfg80211_scan_request *r
" channels\n");
}
- if (s32Error != WILC_SUCCESS) {
+ if (s32Error != 0) {
s32Error = -EBUSY;
PRINT_WRN(CFG80211_DBG, "Device is busy: Error(%d)\n", s32Error);
}
@@ -801,7 +768,7 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct cfg80211_scan_request *r
}
/**
- * @brief WILC_WFI_CfgConnect
+ * @brief connect
* @details Connect to the ESS with the specified parameters. When connected,
* call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
* If the connection fails for some reason, call cfg80211_connect_result()
@@ -812,36 +779,34 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct cfg80211_scan_request *r
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev,
- struct cfg80211_connect_params *sme)
+static int connect(struct wiphy *wiphy, struct net_device *dev,
+ struct cfg80211_connect_params *sme)
{
- s32 s32Error = WILC_SUCCESS;
+ s32 s32Error = 0;
u32 i;
u8 u8security = NO_ENCRYPT;
- AUTHTYPE_T tenuAuth_type = ANY;
+ enum AUTHTYPE tenuAuth_type = ANY;
char *pcgroup_encrypt_val = NULL;
char *pccipher_group = NULL;
char *pcwpa_version = NULL;
- struct WILC_WFI_priv *priv;
- tstrWILC_WFIDrv *pstrWFIDrv;
+ struct wilc_priv *priv;
+ struct host_if_drv *pstrWFIDrv;
tstrNetworkInfo *pstrNetworkInfo = NULL;
connecting = 1;
priv = wiphy_priv(wiphy);
- pstrWFIDrv = (tstrWILC_WFIDrv *)(priv->hWILCWFIDrv);
+ pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv);
host_int_set_wfi_drv_handler(priv->hWILCWFIDrv);
PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv);
- #ifdef WILC_P2P
if (!(strncmp(sme->ssid, "DIRECT-", 7))) {
PRINT_D(CFG80211_DBG, "Connected to Direct network,OBSS disabled\n");
pstrWFIDrv->u8P2PConnect = 1;
} else
pstrWFIDrv->u8P2PConnect = 0;
- #endif
PRINT_INFO(CFG80211_DBG, "Required SSID = %s\n , AuthType = %d\n", sme->ssid, sme->auth_type);
for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) {
@@ -920,14 +885,13 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev,
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);
- /*BugID_5137*/
g_key_wep_params.key_len = sme->key_len;
- g_key_wep_params.key = WILC_MALLOC(sme->key_len);
+ g_key_wep_params.key = kmalloc(sme->key_len, GFP_KERNEL);
memcpy(g_key_wep_params.key, sme->key, sme->key_len);
g_key_wep_params.key_idx = sme->key_idx;
g_wep_keys_saved = true;
- host_int_set_WEPDefaultKeyID(priv->hWILCWFIDrv, sme->key_idx);
+ host_int_set_wep_default_key(priv->hWILCWFIDrv, sme->key_idx);
host_int_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
} else if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104) {
u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
@@ -938,14 +902,13 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev,
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);
- /*BugID_5137*/
g_key_wep_params.key_len = sme->key_len;
- g_key_wep_params.key = WILC_MALLOC(sme->key_len);
+ g_key_wep_params.key = kmalloc(sme->key_len, GFP_KERNEL);
memcpy(g_key_wep_params.key, sme->key, sme->key_len);
g_key_wep_params.key_idx = sme->key_idx;
g_wep_keys_saved = true;
- host_int_set_WEPDefaultKeyID(priv->hWILCWFIDrv, sme->key_idx);
+ host_int_set_wep_default_key(priv->hWILCWFIDrv, sme->key_idx);
host_int_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP) {
@@ -1032,8 +995,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev,
PRINT_INFO(CFG80211_DBG, "Group encryption value = %s\n Cipher Group = %s\n WPA version = %s\n",
pcgroup_encrypt_val, pccipher_group, pcwpa_version);
- /*BugID_5442*/
- u8CurrChannel = pstrNetworkInfo->u8channel;
+ curr_channel = pstrNetworkInfo->u8channel;
if (!pstrWFIDrv->u8P2PConnect) {
u8WLANChannel = pstrNetworkInfo->u8channel;
@@ -1046,7 +1008,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev,
CfgConnectResult, (void *)priv, u8security,
tenuAuth_type, pstrNetworkInfo->u8channel,
pstrNetworkInfo->pJoinParams);
- if (s32Error != WILC_SUCCESS) {
+ if (s32Error != 0) {
PRINT_ER("host_int_set_join_req(): Error(%d)\n", s32Error);
s32Error = -ENOENT;
goto done;
@@ -1059,7 +1021,7 @@ done:
/**
- * @brief WILC_WFI_disconnect
+ * @brief disconnect
* @details Disconnect from the BSS/ESS.
* @param[in]
* @return int : Return 0 on Success
@@ -1067,24 +1029,20 @@ done:
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_code)
+static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_code)
{
- s32 s32Error = WILC_SUCCESS;
- struct WILC_WFI_priv *priv;
- #ifdef WILC_P2P
- tstrWILC_WFIDrv *pstrWFIDrv;
- #endif
- uint8_t NullBssid[ETH_ALEN] = {0};
+ s32 s32Error = 0;
+ struct wilc_priv *priv;
+ struct host_if_drv *pstrWFIDrv;
+ u8 NullBssid[ETH_ALEN] = {0};
+
connecting = 0;
priv = wiphy_priv(wiphy);
- /*BugID_5457*/
/*Invalidate u8WLANChannel value on wlan0 disconnect*/
- #ifdef WILC_P2P
- pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
if (!pstrWFIDrv->u8P2PConnect)
u8WLANChannel = INVALID_CHANNEL;
- #endif
linux_wlan_set_bssid(priv->dev, NullBssid);
PRINT_D(CFG80211_DBG, "Disconnecting with reason code(%d)\n", reason_code);
@@ -1092,12 +1050,10 @@ static int WILC_WFI_disconnect(struct wiphy *wiphy, struct net_device *dev, u16
u8P2Plocalrandom = 0x01;
u8P2Precvrandom = 0x00;
bWilc_ie = false;
- #ifdef WILC_P2P
pstrWFIDrv->u64P2p_MgmtTimeout = 0;
- #endif
s32Error = host_int_disconnect(priv->hWILCWFIDrv, reason_code);
- if (s32Error != WILC_SUCCESS) {
+ if (s32Error != 0) {
PRINT_ER("Error in disconnecting: Error(%d)\n", s32Error);
s32Error = -EINVAL;
}
@@ -1106,7 +1062,7 @@ static int WILC_WFI_disconnect(struct wiphy *wiphy, struct net_device *dev, u16
}
/**
- * @brief WILC_WFI_add_key
+ * @brief add_key
* @details Add a key with the given parameters. @mac_addr will be %NULL
* when adding a group key.
* @param[in] key : key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key, 8-byte Rx Mic Key
@@ -1115,28 +1071,29 @@ static int WILC_WFI_disconnect(struct wiphy *wiphy, struct net_device *dev, u16
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
- bool pairwise,
- const u8 *mac_addr, struct key_params *params)
+static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
+ bool pairwise,
+ const u8 *mac_addr, struct key_params *params)
{
- s32 s32Error = WILC_SUCCESS, KeyLen = params->key_len;
+ s32 s32Error = 0, KeyLen = params->key_len;
u32 i;
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
const u8 *pu8RxMic = NULL;
const u8 *pu8TxMic = NULL;
u8 u8mode = NO_ENCRYPT;
- #ifdef WILC_AP_EXTERNAL_MLME
u8 u8gmode = NO_ENCRYPT;
u8 u8pmode = NO_ENCRYPT;
- AUTHTYPE_T tenuAuth_type = ANY;
- #endif
+ enum AUTHTYPE tenuAuth_type = ANY;
+ struct wilc *wl;
+ perInterface_wlan_t *nic;
priv = wiphy_priv(wiphy);
+ nic = netdev_priv(netdev);
+ wl = nic->wilc;
PRINT_D(CFG80211_DBG, "Adding key with cipher suite = %x\n", params->cipher);
- /*BugID_5137*/
PRINT_D(CFG80211_DBG, "%p %p %d\n", wiphy, netdev, key_index);
PRINT_D(CFG80211_DBG, "key %x %x %x\n", params->key[0],
@@ -1147,7 +1104,6 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
switch (params->cipher) {
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
- #ifdef WILC_AP_EXTERNAL_MLME
if (priv->wdev->iftype == NL80211_IFTYPE_AP) {
priv->WILC_WFI_wep_default = key_index;
@@ -1170,7 +1126,6 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
host_int_add_wep_key_bss_ap(priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type);
break;
}
- #endif
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;
@@ -1189,17 +1144,16 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
case WLAN_CIPHER_SUITE_TKIP:
case WLAN_CIPHER_SUITE_CCMP:
- #ifdef WILC_AP_EXTERNAL_MLME
if (priv->wdev->iftype == NL80211_IFTYPE_AP || priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
if (priv->wilc_gtk[key_index] == NULL) {
- priv->wilc_gtk[key_index] = WILC_MALLOC(sizeof(struct wilc_wfi_key));
+ priv->wilc_gtk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
priv->wilc_gtk[key_index]->key = NULL;
priv->wilc_gtk[key_index]->seq = NULL;
}
if (priv->wilc_ptk[key_index] == NULL) {
- priv->wilc_ptk[key_index] = WILC_MALLOC(sizeof(struct wilc_wfi_key));
+ priv->wilc_ptk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
priv->wilc_ptk[key_index]->key = NULL;
priv->wilc_ptk[key_index]->seq = NULL;
}
@@ -1221,18 +1175,16 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
KeyLen = params->key_len - 16;
}
/* if there has been previous allocation for the same index through its key, free that memory and allocate again*/
- if (priv->wilc_gtk[key_index]->key)
- kfree(priv->wilc_gtk[key_index]->key);
+ kfree(priv->wilc_gtk[key_index]->key);
- priv->wilc_gtk[key_index]->key = WILC_MALLOC(params->key_len);
+ priv->wilc_gtk[key_index]->key = kmalloc(params->key_len, GFP_KERNEL);
memcpy(priv->wilc_gtk[key_index]->key, params->key, params->key_len);
/* if there has been previous allocation for the same index through its seq, free that memory and allocate again*/
- if (priv->wilc_gtk[key_index]->seq)
- kfree(priv->wilc_gtk[key_index]->seq);
+ kfree(priv->wilc_gtk[key_index]->seq);
if ((params->seq_len) > 0) {
- priv->wilc_gtk[key_index]->seq = WILC_MALLOC(params->seq_len);
+ priv->wilc_gtk[key_index]->seq = kmalloc(params->seq_len, GFP_KERNEL);
memcpy(priv->wilc_gtk[key_index]->seq, params->seq, params->seq_len);
}
@@ -1267,16 +1219,14 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
KeyLen = params->key_len - 16;
}
- if (priv->wilc_ptk[key_index]->key)
- kfree(priv->wilc_ptk[key_index]->key);
+ kfree(priv->wilc_ptk[key_index]->key);
- priv->wilc_ptk[key_index]->key = WILC_MALLOC(params->key_len);
+ priv->wilc_ptk[key_index]->key = kmalloc(params->key_len, GFP_KERNEL);
- if (priv->wilc_ptk[key_index]->seq)
- kfree(priv->wilc_ptk[key_index]->seq);
+ kfree(priv->wilc_ptk[key_index]->seq);
if ((params->seq_len) > 0)
- priv->wilc_ptk[key_index]->seq = WILC_MALLOC(params->seq_len);
+ priv->wilc_ptk[key_index]->seq = kmalloc(params->seq_len, GFP_KERNEL);
if (INFO) {
for (i = 0; i < params->key_len; i++)
@@ -1300,7 +1250,6 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
}
break;
}
- #endif
{
u8mode = 0;
@@ -1312,23 +1261,22 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
KeyLen = params->key_len - 16;
}
- /*BugID_5137*/
/*save keys only on interface 0 (wifi interface)*/
- if (!g_gtk_keys_saved && netdev == g_linux_wlan->strInterfaceInfo[0].wilc_netdev) {
+ if (!g_gtk_keys_saved && netdev == wl->vif[0].ndev) {
g_add_gtk_key_params.key_idx = key_index;
g_add_gtk_key_params.pairwise = pairwise;
if (!mac_addr) {
g_add_gtk_key_params.mac_addr = NULL;
} else {
- g_add_gtk_key_params.mac_addr = WILC_MALLOC(ETH_ALEN);
+ g_add_gtk_key_params.mac_addr = kmalloc(ETH_ALEN, GFP_KERNEL);
memcpy(g_add_gtk_key_params.mac_addr, mac_addr, ETH_ALEN);
}
g_key_gtk_params.key_len = params->key_len;
g_key_gtk_params.seq_len = params->seq_len;
- g_key_gtk_params.key = WILC_MALLOC(params->key_len);
+ g_key_gtk_params.key = kmalloc(params->key_len, GFP_KERNEL);
memcpy(g_key_gtk_params.key, params->key, params->key_len);
if (params->seq_len > 0) {
- g_key_gtk_params.seq = WILC_MALLOC(params->seq_len);
+ g_key_gtk_params.seq = kmalloc(params->seq_len, GFP_KERNEL);
memcpy(g_key_gtk_params.seq, params->seq, params->seq_len);
}
g_key_gtk_params.cipher = params->cipher;
@@ -1349,23 +1297,22 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
KeyLen = params->key_len - 16;
}
- /*BugID_5137*/
/*save keys only on interface 0 (wifi interface)*/
- if (!g_ptk_keys_saved && netdev == g_linux_wlan->strInterfaceInfo[0].wilc_netdev) {
+ if (!g_ptk_keys_saved && netdev == wl->vif[0].ndev) {
g_add_ptk_key_params.key_idx = key_index;
g_add_ptk_key_params.pairwise = pairwise;
if (!mac_addr) {
g_add_ptk_key_params.mac_addr = NULL;
} else {
- g_add_ptk_key_params.mac_addr = WILC_MALLOC(ETH_ALEN);
+ g_add_ptk_key_params.mac_addr = kmalloc(ETH_ALEN, GFP_KERNEL);
memcpy(g_add_ptk_key_params.mac_addr, mac_addr, ETH_ALEN);
}
g_key_ptk_params.key_len = params->key_len;
g_key_ptk_params.seq_len = params->seq_len;
- g_key_ptk_params.key = WILC_MALLOC(params->key_len);
+ g_key_ptk_params.key = kmalloc(params->key_len, GFP_KERNEL);
memcpy(g_key_ptk_params.key, params->key, params->key_len);
if (params->seq_len > 0) {
- g_key_ptk_params.seq = WILC_MALLOC(params->seq_len);
+ g_key_ptk_params.seq = kmalloc(params->seq_len, GFP_KERNEL);
memcpy(g_key_ptk_params.seq, params->seq, params->seq_len);
}
g_key_ptk_params.cipher = params->cipher;
@@ -1397,7 +1344,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
}
/**
- * @brief WILC_WFI_del_key
+ * @brief del_key
* @details Remove a key given the @mac_addr (%NULL for a group key)
* and @key_index, return -ENOENT if the key doesn't exist.
* @param[in]
@@ -1406,44 +1353,37 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev,
- u8 key_index,
- bool pairwise,
- const u8 *mac_addr)
+static int del_key(struct wiphy *wiphy, struct net_device *netdev,
+ u8 key_index,
+ bool pairwise,
+ const u8 *mac_addr)
{
- struct WILC_WFI_priv *priv;
- s32 s32Error = WILC_SUCCESS;
+ struct wilc_priv *priv;
+ struct wilc *wl;
+ perInterface_wlan_t *nic;
priv = wiphy_priv(wiphy);
+ nic = netdev_priv(netdev);
+ wl = nic->wilc;
- /*BugID_5137*/
/*delete saved keys, if any*/
- if (netdev == g_linux_wlan->strInterfaceInfo[0].wilc_netdev) {
+ if (netdev == wl->vif[0].ndev) {
g_ptk_keys_saved = false;
g_gtk_keys_saved = false;
g_wep_keys_saved = false;
/*Delete saved WEP keys params, if any*/
- if (g_key_wep_params.key != NULL) {
- kfree(g_key_wep_params.key);
- g_key_wep_params.key = NULL;
- }
+ kfree(g_key_wep_params.key);
+ g_key_wep_params.key = NULL;
/*freeing memory allocated by "wilc_gtk" and "wilc_ptk" in "WILC_WIFI_ADD_KEY"*/
- #ifdef WILC_AP_EXTERNAL_MLME
if ((priv->wilc_gtk[key_index]) != NULL) {
- if (priv->wilc_gtk[key_index]->key != NULL) {
-
- kfree(priv->wilc_gtk[key_index]->key);
- priv->wilc_gtk[key_index]->key = NULL;
- }
- if (priv->wilc_gtk[key_index]->seq) {
-
- kfree(priv->wilc_gtk[key_index]->seq);
- priv->wilc_gtk[key_index]->seq = NULL;
- }
+ kfree(priv->wilc_gtk[key_index]->key);
+ priv->wilc_gtk[key_index]->key = NULL;
+ kfree(priv->wilc_gtk[key_index]->seq);
+ priv->wilc_gtk[key_index]->seq = NULL;
kfree(priv->wilc_gtk[key_index]);
priv->wilc_gtk[key_index] = NULL;
@@ -1452,42 +1392,27 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev,
if ((priv->wilc_ptk[key_index]) != NULL) {
- if (priv->wilc_ptk[key_index]->key) {
-
- kfree(priv->wilc_ptk[key_index]->key);
- priv->wilc_ptk[key_index]->key = NULL;
- }
- if (priv->wilc_ptk[key_index]->seq) {
-
- kfree(priv->wilc_ptk[key_index]->seq);
- priv->wilc_ptk[key_index]->seq = NULL;
- }
+ kfree(priv->wilc_ptk[key_index]->key);
+ priv->wilc_ptk[key_index]->key = NULL;
+ kfree(priv->wilc_ptk[key_index]->seq);
+ priv->wilc_ptk[key_index]->seq = NULL;
kfree(priv->wilc_ptk[key_index]);
priv->wilc_ptk[key_index] = NULL;
}
- #endif
/*Delete saved PTK and GTK keys params, if any*/
- if (g_key_ptk_params.key != NULL) {
- kfree(g_key_ptk_params.key);
- g_key_ptk_params.key = NULL;
- }
- if (g_key_ptk_params.seq != NULL) {
- kfree(g_key_ptk_params.seq);
- g_key_ptk_params.seq = NULL;
- }
+ kfree(g_key_ptk_params.key);
+ g_key_ptk_params.key = NULL;
+ kfree(g_key_ptk_params.seq);
+ g_key_ptk_params.seq = NULL;
- if (g_key_gtk_params.key != NULL) {
- kfree(g_key_gtk_params.key);
- g_key_gtk_params.key = NULL;
- }
- if (g_key_gtk_params.seq != NULL) {
- kfree(g_key_gtk_params.seq);
- g_key_gtk_params.seq = NULL;
- }
+ kfree(g_key_gtk_params.key);
+ g_key_gtk_params.key = NULL;
+ kfree(g_key_gtk_params.seq);
+ g_key_gtk_params.seq = NULL;
/*Reset WILC_CHANGING_VIR_IF register to allow adding futrue keys to CE H/W*/
- Set_machw_change_vir_if(false);
+ Set_machw_change_vir_if(netdev, false);
}
if (key_index >= 0 && key_index <= 3) {
@@ -1501,11 +1426,11 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev,
host_int_remove_key(priv->hWILCWFIDrv, mac_addr);
}
- return s32Error;
+ return 0;
}
/**
- * @brief WILC_WFI_get_key
+ * @brief get_key
* @details Get information about the key with the given parameters.
* @mac_addr will be %NULL when requesting information for a group
* key. All pointers given to the @callback function need not be valid
@@ -1517,21 +1442,18 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev,
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
- bool pairwise,
- const u8 *mac_addr, void *cookie, void (*callback)(void *cookie, struct key_params *))
+static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
+ bool pairwise,
+ const u8 *mac_addr, void *cookie, void (*callback)(void *cookie, struct key_params *))
{
-
- s32 s32Error = WILC_SUCCESS;
-
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
struct key_params key_params;
u32 i;
+
priv = wiphy_priv(wiphy);
- if (!pairwise)
- {
+ if (!pairwise) {
PRINT_D(CFG80211_DBG, "Getting group key idx: %x\n", key_index);
key_params.key = priv->wilc_gtk[key_index]->key;
@@ -1555,11 +1477,11 @@ static int WILC_WFI_get_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
callback(cookie, &key_params);
- return s32Error; /* priv->wilc_gtk->key_len ?0 : -ENOENT; */
+ return 0; /* priv->wilc_gtk->key_len ?0 : -ENOENT; */
}
/**
- * @brief WILC_WFI_set_default_key
+ * @brief set_default_key
* @details Set the default management frame key on an interface
* @param[in]
* @return int : Return 0 on Success.
@@ -1567,11 +1489,10 @@ static int WILC_WFI_get_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
- bool unicast, bool multicast)
+static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
+ bool unicast, bool multicast)
{
- s32 s32Error = WILC_SUCCESS;
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
priv = wiphy_priv(wiphy);
@@ -1580,39 +1501,14 @@ static int WILC_WFI_set_default_key(struct wiphy *wiphy, struct net_device *netd
if (key_index != priv->WILC_WFI_wep_default) {
- host_int_set_WEPDefaultKeyID(priv->hWILCWFIDrv, key_index);
+ host_int_set_wep_default_key(priv->hWILCWFIDrv, key_index);
}
- return s32Error;
-}
-
-/**
- * @brief WILC_WFI_dump_survey
- * @details Get site survey information
- * @param[in]
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
-static int WILC_WFI_dump_survey(struct wiphy *wiphy, struct net_device *netdev,
- int idx, struct survey_info *info)
-{
- s32 s32Error = WILC_SUCCESS;
-
-
- if (idx != 0) {
- s32Error = -ENOENT;
- PRINT_ER("Error Idx value doesn't equal zero: Error(%d)\n", s32Error);
-
- }
-
- return s32Error;
+ return 0;
}
-
/**
- * @brief WILC_WFI_get_station
+ * @brief get_station
* @details Get station information for the station identified by @mac
* @param[in] NONE
* @return int : Return 0 on Success.
@@ -1621,21 +1517,17 @@ static int WILC_WFI_dump_survey(struct wiphy *wiphy, struct net_device *netdev,
* @version 1.0
*/
-static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev,
- const u8 *mac, struct station_info *sinfo)
+static int get_station(struct wiphy *wiphy, struct net_device *dev,
+ const u8 *mac, struct station_info *sinfo)
{
- s32 s32Error = WILC_SUCCESS;
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
perInterface_wlan_t *nic;
- #ifdef WILC_AP_EXTERNAL_MLME
u32 i = 0;
u32 associatedsta = 0;
u32 inactive_time = 0;
- #endif
priv = wiphy_priv(wiphy);
nic = netdev_priv(dev);
- #ifdef WILC_AP_EXTERNAL_MLME
if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) {
PRINT_D(HOSTAPD_DBG, "Getting station parameters\n");
@@ -1651,10 +1543,8 @@ static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev,
}
if (associatedsta == -1) {
- s32Error = -ENOENT;
- PRINT_ER("Station required is not associated : Error(%d)\n", s32Error);
-
- return s32Error;
+ PRINT_ER("Station required is not associated\n");
+ return -ENOENT;
}
sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME);
@@ -1664,17 +1554,12 @@ static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(CFG80211_DBG, "Inactive time %d\n", sinfo->inactive_time);
}
- #endif
if (nic->iftype == STATION_MODE) {
- tstrStatistics strStatistics;
+ struct rf_info strStatistics;
+
host_int_get_statistics(priv->hWILCWFIDrv, &strStatistics);
- /*
- * tony: 2013-11-13
- * tx_failed introduced more than
- * kernel version 3.0.0
- */
sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) |
BIT(NL80211_STA_INFO_RX_PACKETS) |
BIT(NL80211_STA_INFO_TX_PACKETS) |
@@ -1687,22 +1572,20 @@ static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev,
sinfo->tx_failed = strStatistics.u32TxFailureCount;
sinfo->txrate.legacy = strStatistics.u8LinkSpeed * 10;
-#ifdef TCP_ENHANCEMENTS
if ((strStatistics.u8LinkSpeed > TCP_ACK_FILTER_LINK_SPEED_THRESH) && (strStatistics.u8LinkSpeed != DEFAULT_LINK_SPEED))
Enable_TCP_ACK_Filter(true);
else if (strStatistics.u8LinkSpeed != DEFAULT_LINK_SPEED)
Enable_TCP_ACK_Filter(false);
-#endif
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 s32Error;
+ return 0;
}
/**
- * @brief WILC_WFI_change_bss
+ * @brief change_bss
* @details Modify parameters for a given BSS.
* @param[in]
* -use_cts_prot: Whether to use CTS protection
@@ -1722,79 +1605,15 @@ static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev,
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_change_bss(struct wiphy *wiphy, struct net_device *dev,
- struct bss_parameters *params)
+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;
}
/**
- * @brief WILC_WFI_auth
- * @details Request to authenticate with the specified peer
- * @param[in]
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
-static int WILC_WFI_auth(struct wiphy *wiphy, struct net_device *dev,
- struct cfg80211_auth_request *req)
-{
- PRINT_D(CFG80211_DBG, "In Authentication Function\n");
- return 0;
-}
-
-/**
- * @brief WILC_WFI_assoc
- * @details Request to (re)associate with the specified peer
- * @param[in]
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
-static int WILC_WFI_assoc(struct wiphy *wiphy, struct net_device *dev,
- struct cfg80211_assoc_request *req)
-{
- PRINT_D(CFG80211_DBG, "In Association Function\n");
- return 0;
-}
-
-/**
- * @brief WILC_WFI_deauth
- * @details Request to deauthenticate from the specified peer
- * @param[in]
- * @return int : Return 0 on Success.
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
-static int WILC_WFI_deauth(struct wiphy *wiphy, struct net_device *dev,
- struct cfg80211_deauth_request *req, void *cookie)
-{
- PRINT_D(CFG80211_DBG, "In De-authentication Function\n");
- return 0;
-}
-
-/**
- * @brief WILC_WFI_disassoc
- * @details Request to disassociate from the specified peer
- * @param[in]
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
-static int WILC_WFI_disassoc(struct wiphy *wiphy, struct net_device *dev,
- struct cfg80211_disassoc_request *req, void *cookie)
-{
- PRINT_D(CFG80211_DBG, "In Disassociation Function\n");
- return 0;
-}
-
-/**
- * @brief WILC_WFI_set_wiphy_params
+ * @brief set_wiphy_params
* @details Notify that wiphy parameters have changed;
* @param[in] Changed bitfield (see &enum wiphy_params_flags) describes which values
* have changed.
@@ -1803,33 +1622,33 @@ static int WILC_WFI_disassoc(struct wiphy *wiphy, struct net_device *dev,
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_set_wiphy_params(struct wiphy *wiphy, u32 changed)
+static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
{
- s32 s32Error = WILC_SUCCESS;
- tstrCfgParamVal pstrCfgParamVal;
- struct WILC_WFI_priv *priv;
+ s32 s32Error = 0;
+ struct cfg_param_val pstrCfgParamVal;
+ struct wilc_priv *priv;
priv = wiphy_priv(wiphy);
- pstrCfgParamVal.u32SetCfgFlag = 0;
+ 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.u32SetCfgFlag |= 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.u32SetCfgFlag |= 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.u32SetCfgFlag |= FRAG_THRESHOLD;
+ pstrCfgParamVal.flag |= FRAG_THRESHOLD;
pstrCfgParamVal.frag_threshold = priv->dev->ieee80211_ptr->wiphy->frag_threshold;
}
@@ -1837,7 +1656,7 @@ static int WILC_WFI_set_wiphy_params(struct wiphy *wiphy, u32 changed)
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.u32SetCfgFlag |= RTS_THRESHOLD;
+ pstrCfgParamVal.flag |= RTS_THRESHOLD;
pstrCfgParamVal.rts_threshold = priv->dev->ieee80211_ptr->wiphy->rts_threshold;
}
@@ -1852,27 +1671,7 @@ static int WILC_WFI_set_wiphy_params(struct wiphy *wiphy, u32 changed)
}
/**
- * @brief WILC_WFI_set_bitrate_mask
- * @details set the bitrate mask configuration
- * @param[in]
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
-static int WILC_WFI_set_bitrate_mask(struct wiphy *wiphy,
- struct net_device *dev, const u8 *peer,
- const struct cfg80211_bitrate_mask *mask)
-{
- s32 s32Error = WILC_SUCCESS;
-
- PRINT_D(CFG80211_DBG, "Setting Bitrate mask function\n");
- return s32Error;
-
-}
-
-/**
- * @brief WILC_WFI_set_pmksa
+ * @brief set_pmksa
* @details Cache a PMKID for a BSSID. This is mostly useful for fullmac
* devices running firmwares capable of generating the (re) association
* RSN IE. It allows for faster roaming between WPA2 BSSIDs.
@@ -1882,14 +1681,14 @@ static int WILC_WFI_set_bitrate_mask(struct wiphy *wiphy,
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
- struct cfg80211_pmksa *pmksa)
+static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
+ struct cfg80211_pmksa *pmksa)
{
u32 i;
- s32 s32Error = WILC_SUCCESS;
+ s32 s32Error = 0;
u8 flag = 0;
- struct WILC_WFI_priv *priv = wiphy_priv(wiphy);
+ struct wilc_priv *priv = wiphy_priv(wiphy);
PRINT_D(CFG80211_DBG, "Setting PMKSA\n");
@@ -1924,7 +1723,7 @@ static int WILC_WFI_set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
}
/**
- * @brief WILC_WFI_del_pmksa
+ * @brief del_pmksa
* @details Delete a cached PMKID.
* @param[in]
* @return int : Return 0 on Success
@@ -1932,15 +1731,14 @@ static int WILC_WFI_set_pmksa(struct wiphy *wiphy, struct net_device *netdev,
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
- struct cfg80211_pmksa *pmksa)
+static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
+ struct cfg80211_pmksa *pmksa)
{
u32 i;
- u8 flag = 0;
- s32 s32Error = WILC_SUCCESS;
+ s32 s32Error = 0;
- struct WILC_WFI_priv *priv = wiphy_priv(wiphy);
+ struct wilc_priv *priv = wiphy_priv(wiphy);
PRINT_D(CFG80211_DBG, "Deleting PMKSA keys\n");
@@ -1949,8 +1747,7 @@ static int WILC_WFI_del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
ETH_ALEN)) {
/*If bssid is found, reset the values*/
PRINT_D(CFG80211_DBG, "Reseting PMKID values\n");
- memset(&priv->pmkid_list.pmkidlist[i], 0, sizeof(tstrHostIFpmkid));
- flag = PMKID_FOUND;
+ memset(&priv->pmkid_list.pmkidlist[i], 0, sizeof(struct host_if_pmkid));
break;
}
}
@@ -1973,7 +1770,7 @@ static int WILC_WFI_del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
}
/**
- * @brief WILC_WFI_flush_pmksa
+ * @brief flush_pmksa
* @details Flush all cached PMKIDs.
* @param[in]
* @return int : Return 0 on Success
@@ -1981,19 +1778,18 @@ static int WILC_WFI_del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
+static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
{
- struct WILC_WFI_priv *priv = wiphy_priv(wiphy);
+ struct wilc_priv *priv = wiphy_priv(wiphy);
PRINT_D(CFG80211_DBG, "Flushing PMKID key values\n");
/*Get cashed Pmkids and set all with zeros*/
- memset(&priv->pmkid_list, 0, sizeof(tstrHostIFpmkidAttr));
+ memset(&priv->pmkid_list, 0, sizeof(struct host_if_pmkid_attr));
return 0;
}
-#ifdef WILC_P2P
/**
* @brief WILC_WFI_CfgParseRxAction
@@ -2014,51 +1810,13 @@ void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
u32 index = 0;
u32 i = 0, j = 0;
- /*BugID_5460*/
- #ifdef USE_SUPPLICANT_GO_INTENT
- u8 intent;
- u8 tie_breaker;
- bool is_wilc_go = true;
- #endif
u8 op_channel_attr_index = 0;
u8 channel_list_attr_index = 0;
while (index < len) {
if (buf[index] == GO_INTENT_ATTR_ID) {
- #ifdef USE_SUPPLICANT_GO_INTENT
- /*BugID_5460*/
- /*Case 1: If we are going to be p2p client, no need to modify channels attributes*/
- /*In negotiation frames, go intent attr value determines who will be GO*/
- intent = GET_GO_INTENT(buf[index + 3]);
- tie_breaker = GET_TIE_BREAKER(buf[index + 3]);
- if (intent > SUPPLICANT_GO_INTENT
- || (intent == SUPPLICANT_GO_INTENT && tie_breaker == 1)) {
- PRINT_D(GENERIC_DBG, "WILC will be client (intent %d tie breaker %d)\n", intent, tie_breaker);
- is_wilc_go = false;
- } else {
- PRINT_D(GENERIC_DBG, "WILC will be GO (intent %d tie breaker %d)\n", intent, tie_breaker);
- is_wilc_go = true;
- }
-
- #else /* USE_SUPPLICANT_GO_INTENT */
- #ifdef FORCE_P2P_CLIENT
- buf[index + 3] = (buf[index + 3] & 0x01) | (0x0f << 1);
- #else
buf[index + 3] = (buf[index + 3] & 0x01) | (0x00 << 1);
- #endif
- #endif /* USE_SUPPLICANT_GO_INTENT */
- }
-
- #ifdef USE_SUPPLICANT_GO_INTENT
- /*Case 2: If group bssid attribute is present, no need to modify channels attributes*/
- /*In invitation req and rsp, group bssid attr presence determines who will be GO*/
- if (buf[index] == GROUP_BSSID_ATTR_ID) {
- PRINT_D(GENERIC_DBG, "Group BSSID: %2x:%2x:%2x\n", buf[index + 3]
- , buf[index + 4]
- , buf[index + 5]);
- is_wilc_go = false;
}
- #endif /* USE_SUPPLICANT_GO_INTENT */
if (buf[index] == CHANLIST_ATTR_ID)
channel_list_attr_index = index;
@@ -2066,13 +1824,8 @@ void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
op_channel_attr_index = index;
index += buf[index + 1] + 3; /* ID,Length byte */
}
+ if (u8WLANChannel != INVALID_CHANNEL) {
- #ifdef USE_SUPPLICANT_GO_INTENT
- if (u8WLANChannel != INVALID_CHANNEL && is_wilc_go)
- #else
- if (u8WLANChannel != INVALID_CHANNEL)
- #endif
- {
/*Modify channel list attribute*/
if (channel_list_attr_index) {
PRINT_D(GENERIC_DBG, "Modify channel list attribute\n");
@@ -2111,39 +1864,13 @@ void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype)
u8 op_channel_attr_index = 0;
u8 channel_list_attr_index = 0;
- #ifdef USE_SUPPLICANT_GO_INTENT
- bool is_wilc_go = false;
-
- /*BugID_5460*/
- /*Case 1: If we are already p2p client, no need to modify channels attributes*/
- /*This to handle the case of inviting a p2p peer to join an existing group which we are a member in*/
- if (iftype == CLIENT_MODE)
- return;
- #endif
while (index < len) {
- #ifdef USE_SUPPLICANT_GO_INTENT
- /*Case 2: If group bssid attribute is present, no need to modify channels attributes*/
- /*In invitation req and rsp, group bssid attr presence determines who will be GO*/
- /*Note: If we are already p2p client, group bssid attr may also be present (handled in Case 1)*/
- if (buf[index] == GROUP_BSSID_ATTR_ID) {
- PRINT_D(GENERIC_DBG, "Group BSSID: %2x:%2x:%2x\n", buf[index + 3]
- , buf[index + 4]
- , buf[index + 5]);
- is_wilc_go = true;
- }
-
- #else /* USE_SUPPLICANT_GO_INTENT */
if (buf[index] == GO_INTENT_ATTR_ID) {
- #ifdef FORCE_P2P_CLIENT
- buf[index + 3] = (buf[index + 3] & 0x01) | (0x00 << 1);
- #else
buf[index + 3] = (buf[index + 3] & 0x01) | (0x0f << 1);
- #endif
break;
}
- #endif
if (buf[index] == CHANLIST_ATTR_ID)
channel_list_attr_index = index;
@@ -2151,14 +1878,8 @@ void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype)
op_channel_attr_index = index;
index += buf[index + 1] + 3; /* ID,Length byte */
}
+ if (u8WLANChannel != INVALID_CHANNEL && bOperChan) {
- #ifdef USE_SUPPLICANT_GO_INTENT
- /*No need to check bOperChan since only transmitted invitation frames are parsed*/
- if (u8WLANChannel != INVALID_CHANNEL && is_wilc_go)
- #else
- if (u8WLANChannel != INVALID_CHANNEL && bOperChan)
- #endif
- {
/*Modify channel list attribute*/
if (channel_list_attr_index) {
PRINT_D(GENERIC_DBG, "Modify channel list attribute\n");
@@ -2190,16 +1911,17 @@ void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype)
* @version 1.0
*/
-void WILC_WFI_p2p_rx (struct net_device *dev, uint8_t *buff, uint32_t size)
+void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)
{
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
u32 header, pkt_offset;
- tstrWILC_WFIDrv *pstrWFIDrv;
+ struct host_if_drv *pstrWFIDrv;
u32 i = 0;
s32 s32Freq;
+
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
- pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
/* Get WILC header */
memcpy(&header, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET);
@@ -2229,14 +1951,13 @@ void WILC_WFI_p2p_rx (struct net_device *dev, uint8_t *buff, uint32_t size)
PRINT_D(GENERIC_DBG, "Rx Frame Type:%x\n", buff[FRAME_TYPE_ID]);
- /*BugID_5442*/
/*Upper layer is informed that the frame is received on this freq*/
- s32Freq = ieee80211_channel_to_frequency(u8CurrChannel, IEEE80211_BAND_2GHZ);
+ 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 == true && time_after_eq(jiffies, (unsigned long)pstrWFIDrv->u64P2p_MgmtTimeout)) {
+ if (priv->bCfgScanning && time_after_eq(jiffies, (unsigned long)pstrWFIDrv->u64P2p_MgmtTimeout)) {
PRINT_D(GENERIC_DBG, "Receiving action frames from wrong channels\n");
return;
}
@@ -2332,8 +2053,9 @@ static void WILC_WFI_mgmt_tx_complete(void *priv, int status)
static void WILC_WFI_RemainOnChannelReady(void *pUserVoid)
{
- struct WILC_WFI_priv *priv;
- priv = (struct WILC_WFI_priv *)pUserVoid;
+ struct wilc_priv *priv;
+
+ priv = (struct wilc_priv *)pUserVoid;
PRINT_D(HOSTINF_DBG, "Remain on channel ready\n");
@@ -2358,10 +2080,10 @@ static void WILC_WFI_RemainOnChannelReady(void *pUserVoid)
static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, u32 u32SessionID)
{
- struct WILC_WFI_priv *priv;
- priv = (struct WILC_WFI_priv *)pUserVoid;
+ struct wilc_priv *priv;
+
+ priv = (struct wilc_priv *)pUserVoid;
- /*BugID_5477*/
if (u32SessionID == priv->strRemainOnChanParams.u32ListenSessionID) {
PRINT_D(GENERIC_DBG, "Remain on channel expired\n");
@@ -2380,7 +2102,7 @@ static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, u32 u32SessionID)
/**
- * @brief WILC_WFI_remain_on_channel
+ * @brief remain_on_channel
* @details Request the driver to remain awake on the specified
* channel for the specified duration to complete an off-channel
* operation (e.g., public action frame exchange). When the driver is
@@ -2392,27 +2114,25 @@ static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, u32 u32SessionID)
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_remain_on_channel(struct wiphy *wiphy,
- struct wireless_dev *wdev,
- struct ieee80211_channel *chan,
- unsigned int duration, u64 *cookie)
+static int remain_on_channel(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ struct ieee80211_channel *chan,
+ unsigned int duration, u64 *cookie)
{
- s32 s32Error = WILC_SUCCESS;
- struct WILC_WFI_priv *priv;
+ s32 s32Error = 0;
+ struct wilc_priv *priv;
+
priv = wiphy_priv(wiphy);
PRINT_D(GENERIC_DBG, "Remaining on channel %d\n", chan->hw_value);
- /*BugID_4800: if in AP mode, return.*/
- /*This check is to handle the situation when user*/
- /*requests "create group" during a running scan*/
if (wdev->iftype == NL80211_IFTYPE_AP) {
PRINT_D(GENERIC_DBG, "Required remain-on-channel while in AP mode");
return s32Error;
}
- u8CurrChannel = chan->hw_value;
+ curr_channel = chan->hw_value;
/*Setting params needed by WILC_WFI_RemainOnChannelExpired()*/
priv->strRemainOnChanParams.pstrListenChan = chan;
@@ -2432,7 +2152,7 @@ static int WILC_WFI_remain_on_channel(struct wiphy *wiphy,
}
/**
- * @brief WILC_WFI_cancel_remain_on_channel
+ * @brief cancel_remain_on_channel
* @details Cancel an on-going remain-on-channel operation.
* This allows the operation to be terminated prior to timeout based on
* the duration value.
@@ -2444,12 +2164,13 @@ static int WILC_WFI_remain_on_channel(struct wiphy *wiphy,
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_cancel_remain_on_channel(struct wiphy *wiphy,
- struct wireless_dev *wdev,
- u64 cookie)
+static int cancel_remain_on_channel(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ u64 cookie)
{
- s32 s32Error = WILC_SUCCESS;
- struct WILC_WFI_priv *priv;
+ s32 s32Error = 0;
+ struct wilc_priv *priv;
+
priv = wiphy_priv(wiphy);
PRINT_D(CFG80211_DBG, "Cancel remain on channel\n");
@@ -2458,20 +2179,6 @@ static int WILC_WFI_cancel_remain_on_channel(struct wiphy *wiphy,
return s32Error;
}
/**
- * @brief WILC_WFI_add_wilcvendorspec
- * @details Adding WILC information elemet to allow two WILC devices to
- * identify each other and connect
- * @param[in] u8 * buf
- * @return void
- * @author mdaftedar
- * @date 01 JAN 2014
- * @version 1.0
- */
-void WILC_WFI_add_wilcvendorspec(u8 *buff)
-{
- memcpy(buff, u8P2P_vendorspec, sizeof(u8P2P_vendorspec));
-}
-/**
* @brief WILC_WFI_mgmt_tx_frame
* @details
*
@@ -2481,12 +2188,11 @@ void WILC_WFI_add_wilcvendorspec(u8 *buff)
* @date 01 JUL 2012
* @version
*/
-extern linux_wlan_t *g_linux_wlan;
extern bool bEnablePS;
-int WILC_WFI_mgmt_tx(struct wiphy *wiphy,
- struct wireless_dev *wdev,
- struct cfg80211_mgmt_tx_params *params,
- u64 *cookie)
+static int mgmt_tx(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ struct cfg80211_mgmt_tx_params *params,
+ u64 *cookie)
{
struct ieee80211_channel *chan = params->chan;
unsigned int wait = params->wait;
@@ -2494,16 +2200,15 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy,
size_t len = params->len;
const struct ieee80211_mgmt *mgmt;
struct p2p_mgmt_data *mgmt_tx;
- struct WILC_WFI_priv *priv;
- s32 s32Error = WILC_SUCCESS;
- tstrWILC_WFIDrv *pstrWFIDrv;
+ struct wilc_priv *priv;
+ struct host_if_drv *pstrWFIDrv;
u32 i;
perInterface_wlan_t *nic;
u32 buf_len = len + sizeof(u8P2P_vendorspec) + sizeof(u8P2Plocalrandom);
nic = netdev_priv(wdev->netdev);
priv = wiphy_priv(wiphy);
- pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
*cookie = (unsigned long)buf;
priv->u64tx_cookie = *cookie;
@@ -2512,15 +2217,16 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy,
if (ieee80211_is_mgmt(mgmt->frame_control)) {
/*mgmt frame allocation*/
- mgmt_tx = WILC_MALLOC(sizeof(struct p2p_mgmt_data));
+ mgmt_tx = kmalloc(sizeof(struct p2p_mgmt_data), GFP_KERNEL);
if (mgmt_tx == NULL) {
PRINT_ER("Failed to allocate memory for mgmt_tx structure\n");
- return WILC_FAIL;
+ return -EFAULT;
}
- mgmt_tx->buff = WILC_MALLOC(buf_len);
+ mgmt_tx->buff = kmalloc(buf_len, GFP_KERNEL);
if (mgmt_tx->buff == NULL) {
PRINT_ER("Failed to allocate memory for mgmt_tx buff\n");
- return WILC_FAIL;
+ kfree(mgmt_tx);
+ return -EFAULT;
}
memcpy(mgmt_tx->buff, buf, len);
mgmt_tx->size = len;
@@ -2531,14 +2237,12 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy,
PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value);
host_int_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
/*Save the current channel after we tune to it*/
- u8CurrChannel = 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);
- /*BugID_4847*/
if (buf[ACTION_CAT_ID] == PUB_ACTION_ATTR_ID) {
- /*BugID_4847*/
/*Only set the channel, if not a negotiation confirmation frame
* (If Negotiation confirmation frame, force it
* to be transmitted on the same negotiation channel)*/
@@ -2548,7 +2252,7 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy,
PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value);
host_int_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
/*Save the current channel after we tune to it*/
- u8CurrChannel = chan->hw_value;
+ curr_channel = chan->hw_value;
}
switch (buf[ACTION_SUBTYPE_ID]) {
case GAS_INTIAL_REQ:
@@ -2588,19 +2292,20 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy,
if (buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP)
WILC_WFI_CfgParseTxAction(&mgmt_tx->buff[i + 6], len - (i + 6), true, nic->iftype);
- /*BugID_5460*/
/*If using supplicant go intent, no need at all*/
/*to parse transmitted negotiation frames*/
- #ifndef USE_SUPPLICANT_GO_INTENT
else
WILC_WFI_CfgParseTxAction(&mgmt_tx->buff[i + 6], len - (i + 6), false, nic->iftype);
- #endif
break;
}
}
if (buf[P2P_PUB_ACTION_SUBTYPE] != P2P_INV_REQ && buf[P2P_PUB_ACTION_SUBTYPE] != P2P_INV_RSP) {
- WILC_WFI_add_wilcvendorspec(&mgmt_tx->buff[len]);
+ /*
+ * Adding WILC information element to allow two WILC devices to
+ * identify each other and connect
+ */
+ memcpy(&mgmt_tx->buff[len], u8P2P_vendorspec, sizeof(u8P2P_vendorspec));
mgmt_tx->buff[len + sizeof(u8P2P_vendorspec)] = u8P2Plocalrandom;
mgmt_tx->size = buf_len;
}
@@ -2631,29 +2336,30 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy,
}
- g_linux_wlan->oup.wlan_add_mgmt_to_tx_que(mgmt_tx, mgmt_tx->buff, mgmt_tx->size, WILC_WFI_mgmt_tx_complete);
+ wilc_wlan_txq_add_mgmt_pkt(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 s32Error;
+ return 0;
}
-int WILC_WFI_mgmt_tx_cancel_wait(struct wiphy *wiphy,
- struct wireless_dev *wdev,
- u64 cookie)
+static int mgmt_tx_cancel_wait(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ u64 cookie)
{
- struct WILC_WFI_priv *priv;
- tstrWILC_WFIDrv *pstrWFIDrv;
+ struct wilc_priv *priv;
+ struct host_if_drv *pstrWFIDrv;
+
priv = wiphy_priv(wiphy);
- pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv;
+ pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
PRINT_D(GENERIC_DBG, "Tx Cancel wait :%lu\n", jiffies);
pstrWFIDrv->u64P2p_MgmtTimeout = jiffies;
- if (priv->bInP2PlistenState == false) {
- /* Bug 5504: This is just to avoid connection failure when getting stuck when the supplicant
- * considers the driver falsely that it is in Listen state */
+ if (!priv->bInP2PlistenState) {
cfg80211_remain_on_channel_expired(priv->wdev,
priv->strRemainOnChanParams.u64ListenCookie,
priv->strRemainOnChanParams.pstrListenChan,
@@ -2664,7 +2370,7 @@ int WILC_WFI_mgmt_tx_cancel_wait(struct wiphy *wiphy,
}
/**
- * @brief WILC_WFI_frame_register
+ * @brief wilc_mgmt_frame_register
* @details Notify driver that a management frame type was
* registered. Note that this callback may not sleep, and cannot run
* concurrently with itself.
@@ -2674,21 +2380,18 @@ int WILC_WFI_mgmt_tx_cancel_wait(struct wiphy *wiphy,
* @date 01 JUL 2012
* @version
*/
-void WILC_WFI_frame_register(struct wiphy *wiphy,
- struct wireless_dev *wdev,
- u16 frame_type, bool reg)
+void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
+ u16 frame_type, bool reg)
{
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
perInterface_wlan_t *nic;
-
+ struct wilc *wl;
priv = wiphy_priv(wiphy);
nic = netdev_priv(priv->wdev->netdev);
+ wl = nic->wilc;
-
-
- /*BugID_5137*/
if (!frame_type)
return;
@@ -2715,7 +2418,7 @@ void WILC_WFI_frame_register(struct wiphy *wiphy,
}
/*If mac is closed, then return*/
- if (!g_linux_wlan->wilc1000_initialized) {
+ if (!wl->initialized) {
PRINT_D(GENERIC_DBG, "Return since mac is closed\n");
return;
}
@@ -2723,10 +2426,9 @@ void WILC_WFI_frame_register(struct wiphy *wiphy,
}
-#endif /*WILC_P2P*/
/**
- * @brief WILC_WFI_set_cqm_rssi_config
+ * @brief set_cqm_rssi_config
* @details Configure connection quality monitor RSSI threshold.
* @param[in] struct wiphy *wiphy:
* @param[in] struct net_device *dev:
@@ -2737,15 +2439,15 @@ void WILC_WFI_frame_register(struct wiphy *wiphy,
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_set_cqm_rssi_config(struct wiphy *wiphy,
- struct net_device *dev, s32 rssi_thold, u32 rssi_hyst)
+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;
}
/**
- * @brief WILC_WFI_dump_station
+ * @brief dump_station
* @details Configure connection quality monitor RSSI threshold.
* @param[in] struct wiphy *wiphy:
* @param[in] struct net_device *dev
@@ -2757,10 +2459,11 @@ static int WILC_WFI_set_cqm_rssi_config(struct wiphy *wiphy,
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_dump_station(struct wiphy *wiphy, struct net_device *dev,
- int idx, u8 *mac, struct station_info *sinfo)
+static int dump_station(struct wiphy *wiphy, struct net_device *dev,
+ int idx, u8 *mac, struct station_info *sinfo)
{
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
+
PRINT_D(CFG80211_DBG, "Dumping station information\n");
if (idx != 0)
@@ -2778,18 +2481,19 @@ static int WILC_WFI_dump_station(struct wiphy *wiphy, struct net_device *dev,
/**
- * @brief WILC_WFI_set_power_mgmt
+ * @brief set_power_mgmt
* @details
* @param[in]
* @return int : Return 0 on Success.
* @author mdaftedar
* @date 01 JUL 2012
- * @version 1.0WILC_WFI_set_cqmWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_config_rssi_config
+ * @version 1.0
*/
-int WILC_WFI_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
- bool enabled, int timeout)
+static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
+ bool enabled, int timeout)
{
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
+
PRINT_D(CFG80211_DBG, " Power save Enabled= %d , TimeOut = %d\n", enabled, timeout);
if (wiphy == NULL)
@@ -2805,12 +2509,12 @@ int WILC_WFI_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
host_int_set_power_mgmt(priv->hWILCWFIDrv, enabled, timeout);
- return WILC_SUCCESS;
+ return 0;
}
-#ifdef WILC_AP_EXTERNAL_MLME
+
/**
- * @brief WILC_WFI_change_virt_intf
+ * @brief change_virtual_intf
* @details Change type/configuration of virtual interface,
* keep the struct wireless_dev's iftype updated.
* @param[in] NONE
@@ -2819,23 +2523,21 @@ int WILC_WFI_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
* @date 01 MAR 2012
* @version 1.0
*/
-void wilc1000_wlan_deinit(linux_wlan_t *nic);
int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
-static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev,
- enum nl80211_iftype type, u32 *flags, struct vif_params *params)
+static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
+ enum nl80211_iftype type, u32 *flags, struct vif_params *params)
{
- s32 s32Error = WILC_SUCCESS;
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
perInterface_wlan_t *nic;
u8 interface_type;
u16 TID = 0;
- #ifdef WILC_P2P
u8 i;
- #endif
+ struct wilc *wl;
nic = netdev_priv(dev);
priv = wiphy_priv(wiphy);
+ wl = nic->wilc;
PRINT_D(HOSTAPD_DBG, "In Change virtual interface function\n");
PRINT_D(HOSTAPD_DBG, "Wireless interface name =%s\n", dev->name);
@@ -2844,15 +2546,12 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
bWilc_ie = false;
- #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
g_obtainingIP = false;
del_timer(&hDuringIpTimer);
PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n");
- #endif
- /*BugID_5137*/
/*Set WILC_CHANGING_VIR_IF register to disallow adding futrue keys to CE H/W*/
if (g_ptk_keys_saved && g_gtk_keys_saved) {
- Set_machw_change_vir_if(true);
+ Set_machw_change_vir_if(dev, true);
}
switch (type) {
@@ -2870,35 +2569,34 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
/*Remove the enteries of the previously connected clients*/
memset(priv->assoc_stainfo.au8Sta_AssociatedBss, 0, MAX_NUM_STA * ETH_ALEN);
- #ifdef WILC_P2P
interface_type = nic->iftype;
nic->iftype = STATION_MODE;
- if (g_linux_wlan->wilc1000_initialized) {
- host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->strInterfaceInfo[0].aBSSID, TID);
+ if (wl->initialized) {
+ host_int_del_All_Rx_BASession(priv->hWILCWFIDrv,
+ wl->vif[0].bssid, TID);
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
- /*BugID_5213*/
/*Eliminate host interface blocking state*/
- linux_wlan_unlock((void *)&g_linux_wlan->cfg_event);
+ up(&wl->cfg_event);
- wilc1000_wlan_deinit(g_linux_wlan);
+ wilc1000_wlan_deinit(dev);
wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1;
nic->iftype = interface_type;
/*Setting interface 1 drv handler and mac address in newly downloaded FW*/
- host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler);
- host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler,
- g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
+ host_int_set_wfi_drv_handler(wl->vif[0].hif_drv);
+ host_int_set_MacAddress(wl->vif[0].hif_drv,
+ wl->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
- host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ host_int_set_wep_default_key(wl->vif[0].hif_drv,
g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
@@ -2916,24 +2614,22 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
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]);
- WILC_WFI_add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
- 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));
-
- WILC_WFI_add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
- 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));
+ 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));
}
- /*BugID_4847: registered frames in firmware are now*/
- /*lost due to mac close. So re-register those frames*/
- if (g_linux_wlan->wilc1000_initialized) {
+ if (wl->initialized) {
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
@@ -2946,7 +2642,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
bEnablePS = true;
host_int_set_power_mgmt(priv->hWILCWFIDrv, 1, 0);
}
- #endif
break;
case NL80211_IFTYPE_P2P_CLIENT:
@@ -2955,36 +2650,35 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
connecting = 0;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_P2P_CLIENT\n");
- host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->strInterfaceInfo[0].aBSSID, TID);
+ host_int_del_All_Rx_BASession(priv->hWILCWFIDrv,
+ wl->vif[0].bssid, TID);
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
nic->monitor_flag = 0;
- #ifdef WILC_P2P
-
PRINT_D(HOSTAPD_DBG, "Downloading P2P_CONCURRENCY_FIRMWARE\n");
nic->iftype = CLIENT_MODE;
- if (g_linux_wlan->wilc1000_initialized) {
+ if (wl->initialized) {
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
- wilc1000_wlan_deinit(g_linux_wlan);
+ wilc1000_wlan_deinit(dev);
wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1;
- host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler);
- host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler,
- g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
+ host_int_set_wfi_drv_handler(wl->vif[0].hif_drv);
+ host_int_set_MacAddress(wl->vif[0].hif_drv,
+ wl->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
- host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ host_int_set_wep_default_key(wl->vif[0].hif_drv,
g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
@@ -3002,28 +2696,26 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
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]);
- WILC_WFI_add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
- 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));
-
- WILC_WFI_add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
- 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));
+ 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, to refresh the scan results to the wpa_supplicant. Set MachHw to false to enable further key installments*/
refresh_scan(priv, 1, true);
- Set_machw_change_vir_if(false);
+ Set_machw_change_vir_if(dev, false);
- /*BugID_4847: registered frames in firmware are now lost
- * due to mac close. So re-register those frames */
- if (g_linux_wlan->wilc1000_initialized) {
+ if (wl->initialized) {
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
@@ -3033,7 +2725,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
}
}
}
- #endif
break;
case NL80211_IFTYPE_AP:
@@ -3046,16 +2737,12 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n");
linux_wlan_get_firmware(nic);
- #ifdef WILC_P2P
/*If wilc is running, then close-open to actually get new firmware running (serves P2P)*/
- if (g_linux_wlan->wilc1000_initialized) {
+ if (wl->initialized) {
nic->iftype = AP_MODE;
- g_linux_wlan->wilc1000_initialized = 1;
mac_close(dev);
mac_open(dev);
- /*BugID_4847: registered frames in firmware are now lost
- * due to mac close. So re-register those frames */
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
@@ -3064,23 +2751,20 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
nic->g_struct_frame_reg[i].reg);
}
}
- #endif
break;
case NL80211_IFTYPE_P2P_GO:
PRINT_D(GENERIC_DBG, "start duringIP timer\n");
- #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
g_obtainingIP = true;
mod_timer(&hDuringIpTimer, jiffies + msecs_to_jiffies(duringIP_TIME));
- #endif
host_int_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
- /*BugID_5222*/
/*Delete block ack has to be the latest config packet*/
/*sent before downloading new FW. This is because it blocks on*/
/*hWaitResponse semaphore, which allows previous config*/
/*packets to actually take action on old FW*/
- host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, g_linux_wlan->strInterfaceInfo[0].aBSSID, TID);
+ host_int_del_All_Rx_BASession(priv->hWILCWFIDrv,
+ wl->vif[0].bssid, TID);
bEnablePS = false;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n");
dev->ieee80211_ptr->iftype = type;
@@ -3088,31 +2772,29 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv);
- #ifdef WILC_P2P
PRINT_D(HOSTAPD_DBG, "Downloading P2P_CONCURRENCY_FIRMWARE\n");
- #if 1
nic->iftype = GO_MODE;
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
- wilc1000_wlan_deinit(g_linux_wlan);
+ wilc1000_wlan_deinit(dev);
wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1;
/*Setting interface 1 drv handler and mac address in newly downloaded FW*/
- host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler);
- host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler,
- g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
+ host_int_set_wfi_drv_handler(wl->vif[0].hif_drv);
+ host_int_set_MacAddress(wl->vif[0].hif_drv,
+ wl->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, AP_MODE);
/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
- host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ host_int_set_wep_default_key(wl->vif[0].hif_drv,
g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler,
+ host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
@@ -3132,27 +2814,22 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
g_key_gtk_params.key[1],
g_key_gtk_params.key[2],
g_key_gtk_params.cipher);
- #if 1
- WILC_WFI_add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
- 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));
-
- WILC_WFI_add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
- g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
- 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));
- #endif
+ 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));
}
- #endif
- /*BugID_4847: registered frames in firmware are now*/
- /*lost due to mac close. So re-register those frames*/
- if (g_linux_wlan->wilc1000_initialized) {
+ if (wl->initialized) {
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
@@ -3161,17 +2838,14 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
nic->g_struct_frame_reg[i].reg);
}
}
- #endif
break;
default:
PRINT_ER("Unknown interface type= %d\n", type);
- s32Error = -EINVAL;
- return s32Error;
- break;
+ return -EINVAL;
}
- return s32Error;
+ return 0;
}
/* (austin.2013-07-23)
@@ -3189,7 +2863,7 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
*/
/**
- * @brief WILC_WFI_start_ap
+ * @brief start_ap
* @details Add a beacon with given parameters, @head, @interval
* and @dtim_period will be valid, @tail is optional.
* @param[in] wiphy
@@ -3200,45 +2874,41 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
* @date 23 JUL 2013
* @version 1.0
*/
-static int WILC_WFI_start_ap(struct wiphy *wiphy, struct net_device *dev,
- struct cfg80211_ap_settings *settings)
+static int start_ap(struct wiphy *wiphy, struct net_device *dev,
+ struct cfg80211_ap_settings *settings)
{
struct cfg80211_beacon_data *beacon = &(settings->beacon);
- struct WILC_WFI_priv *priv;
- s32 s32Error = WILC_SUCCESS;
+ struct wilc_priv *priv;
+ s32 s32Error = 0;
+ struct wilc *wl;
+ perInterface_wlan_t *nic;
priv = wiphy_priv(wiphy);
+ nic = netdev_priv(dev);
+ wl = nic->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);
- s32Error = WILC_WFI_CfgSetChannel(wiphy, &settings->chandef);
+ s32Error = set_channel(wiphy, &settings->chandef);
- if (s32Error != WILC_SUCCESS)
+ if (s32Error != 0)
PRINT_ER("Error in setting channel\n");
- linux_wlan_set_bssid(dev, g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
+ linux_wlan_set_bssid(dev, wl->vif[0].src_addr);
- #ifndef WILC_FULLY_HOSTING_AP
s32Error = host_int_add_beacon(priv->hWILCWFIDrv,
settings->beacon_interval,
settings->dtim_period,
beacon->head_len, (u8 *)beacon->head,
beacon->tail_len, (u8 *)beacon->tail);
- #else
- s32Error = host_add_beacon(priv->hWILCWFIDrv,
- settings->beacon_interval,
- settings->dtim_period,
- beacon->head_len, (u8 *)beacon->head,
- beacon->tail_len, (u8 *)beacon->tail);
- #endif
return s32Error;
}
/**
- * @brief WILC_WFI_change_beacon
+ * @brief change_beacon
* @details Add a beacon with given parameters, @head, @interval
* and @dtim_period will be valid, @tail is optional.
* @param[in] wiphy
@@ -3249,35 +2919,27 @@ static int WILC_WFI_start_ap(struct wiphy *wiphy, struct net_device *dev,
* @date 23 JUL 2013
* @version 1.0
*/
-static int WILC_WFI_change_beacon(struct wiphy *wiphy, struct net_device *dev,
- struct cfg80211_beacon_data *beacon)
+static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
+ struct cfg80211_beacon_data *beacon)
{
- struct WILC_WFI_priv *priv;
- s32 s32Error = WILC_SUCCESS;
+ struct wilc_priv *priv;
+ s32 s32Error = 0;
priv = wiphy_priv(wiphy);
PRINT_D(HOSTAPD_DBG, "Setting beacon\n");
-#ifndef WILC_FULLY_HOSTING_AP
s32Error = host_int_add_beacon(priv->hWILCWFIDrv,
0,
0,
beacon->head_len, (u8 *)beacon->head,
beacon->tail_len, (u8 *)beacon->tail);
-#else
- s32Error = host_add_beacon(priv->hWILCWFIDrv,
- 0,
- 0,
- beacon->head_len, (u8 *)beacon->head,
- beacon->tail_len, (u8 *)beacon->tail);
-#endif
return s32Error;
}
/**
- * @brief WILC_WFI_stop_ap
+ * @brief stop_ap
* @details Remove beacon configuration and stop sending the beacon.
* @param[in]
* @return int : Return 0 on Success.
@@ -3285,38 +2947,31 @@ static int WILC_WFI_change_beacon(struct wiphy *wiphy, struct net_device *dev,
* @date 23 JUL 2013
* @version 1.0
*/
-static int WILC_WFI_stop_ap(struct wiphy *wiphy, struct net_device *dev)
+static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
{
- s32 s32Error = WILC_SUCCESS;
- struct WILC_WFI_priv *priv;
+ s32 s32Error = 0;
+ struct wilc_priv *priv;
u8 NullBssid[ETH_ALEN] = {0};
-
- WILC_NULLCHECK(s32Error, wiphy);
+ if (!wiphy)
+ return -EFAULT;
priv = wiphy_priv(wiphy);
PRINT_D(HOSTAPD_DBG, "Deleting beacon\n");
- /*BugID_5188*/
linux_wlan_set_bssid(dev, NullBssid);
- #ifndef WILC_FULLY_HOSTING_AP
s32Error = host_int_del_beacon(priv->hWILCWFIDrv);
- #else
- s32Error = host_del_beacon(priv->hWILCWFIDrv);
- #endif
- WILC_ERRORCHECK(s32Error);
+ if (s32Error)
+ PRINT_ER("Host delete beacon fail\n");
- WILC_CATCH(s32Error)
- {
- }
return s32Error;
}
/**
- * @brief WILC_WFI_add_station
+ * @brief add_station
* @details Add a new station.
* @param[in]
* @return int : Return 0 on Success.
@@ -3324,23 +2979,21 @@ static int WILC_WFI_stop_ap(struct wiphy *wiphy, struct net_device *dev)
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev,
- const u8 *mac, struct station_parameters *params)
+static int add_station(struct wiphy *wiphy, struct net_device *dev,
+ const u8 *mac, struct station_parameters *params)
{
- s32 s32Error = WILC_SUCCESS;
- struct WILC_WFI_priv *priv;
- tstrWILC_AddStaParam strStaParams = { {0} };
+ s32 s32Error = 0;
+ struct wilc_priv *priv;
+ struct add_sta_param strStaParams = { {0} };
perInterface_wlan_t *nic;
-
- WILC_NULLCHECK(s32Error, wiphy);
+ if (!wiphy)
+ return -EFAULT;
priv = wiphy_priv(wiphy);
nic = netdev_priv(dev);
if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) {
- #ifndef WILC_FULLY_HOSTING_AP
-
memcpy(strStaParams.au8BSSID, mac, ETH_ALEN);
memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN);
strStaParams.u16AssocID = params->aid;
@@ -3379,29 +3032,15 @@ static int WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.u16FlagsSet);
s32Error = host_int_add_station(priv->hWILCWFIDrv, &strStaParams);
- WILC_ERRORCHECK(s32Error);
-
- #else
- PRINT_D(CFG80211_DBG, "Adding station parameters %d\n", params->aid);
- memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN);
-
- 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]);
-
- WILC_AP_AddSta(mac, params);
- WILC_ERRORCHECK(s32Error);
- #endif /* WILC_FULLY_HOSTING_AP */
-
+ if (s32Error)
+ PRINT_ER("Host add station fail\n");
}
- WILC_CATCH(s32Error)
- {
- }
return s32Error;
}
/**
- * @brief WILC_WFI_del_station
+ * @brief del_station
* @details Remove a station; @mac may be NULL to remove all stations.
* @param[in]
* @return int : Return 0 on Success.
@@ -3409,14 +3048,16 @@ static int WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev,
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_del_station(struct wiphy *wiphy, struct net_device *dev,
- struct station_del_parameters *params)
+static int del_station(struct wiphy *wiphy, struct net_device *dev,
+ struct station_del_parameters *params)
{
const u8 *mac = params->mac;
- s32 s32Error = WILC_SUCCESS;
- struct WILC_WFI_priv *priv;
+ s32 s32Error = 0;
+ struct wilc_priv *priv;
perInterface_wlan_t *nic;
- WILC_NULLCHECK(s32Error, wiphy);
+
+ if (!wiphy)
+ return -EFAULT;
priv = wiphy_priv(wiphy);
nic = netdev_priv(dev);
@@ -3432,22 +3073,16 @@ static int WILC_WFI_del_station(struct wiphy *wiphy, struct net_device *dev,
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]);
}
- #ifndef WILC_FULLY_HOSTING_AP
s32Error = host_int_del_station(priv->hWILCWFIDrv, mac);
- #else
- WILC_AP_RemoveSta(mac);
- #endif /* WILC_FULLY_HOSTING_AP */
- WILC_ERRORCHECK(s32Error);
- }
- WILC_CATCH(s32Error)
- {
+ if (s32Error)
+ PRINT_ER("Host delete station fail\n");
}
return s32Error;
}
/**
- * @brief WILC_WFI_change_station
+ * @brief change_station
* @details Modify a given station.
* @param[in]
* @return int : Return 0 on Success.
@@ -3455,25 +3090,24 @@ static int WILC_WFI_del_station(struct wiphy *wiphy, struct net_device *dev,
* @date 01 MAR 2012
* @version 1.0
*/
-static int WILC_WFI_change_station(struct wiphy *wiphy, struct net_device *dev,
- const u8 *mac, struct station_parameters *params)
+static int change_station(struct wiphy *wiphy, struct net_device *dev,
+ const u8 *mac, struct station_parameters *params)
{
- s32 s32Error = WILC_SUCCESS;
- struct WILC_WFI_priv *priv;
- tstrWILC_AddStaParam strStaParams = { {0} };
+ s32 s32Error = 0;
+ struct wilc_priv *priv;
+ struct add_sta_param strStaParams = { {0} };
perInterface_wlan_t *nic;
PRINT_D(HOSTAPD_DBG, "Change station paramters\n");
- WILC_NULLCHECK(s32Error, wiphy);
+ if (!wiphy)
+ return -EFAULT;
priv = wiphy_priv(wiphy);
nic = netdev_priv(dev);
if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) {
- #ifndef WILC_FULLY_HOSTING_AP
-
memcpy(strStaParams.au8BSSID, mac, ETH_ALEN);
strStaParams.u16AssocID = params->aid;
strStaParams.u8NumRates = params->supported_rates_len;
@@ -3510,23 +3144,15 @@ static int WILC_WFI_change_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.u16FlagsSet);
s32Error = host_int_edit_station(priv->hWILCWFIDrv, &strStaParams);
- WILC_ERRORCHECK(s32Error);
-
- #else
- WILC_AP_EditSta(mac, params);
- WILC_ERRORCHECK(s32Error);
- #endif /* WILC_FULLY_HOSTING_AP */
-
- }
- WILC_CATCH(s32Error)
- {
+ if (s32Error)
+ PRINT_ER("Host edit station fail\n");
}
return s32Error;
}
/**
- * @brief WILC_WFI_add_virt_intf
+ * @brief add_virtual_intf
* @details
* @param[in]
* @return int : Return 0 on Success.
@@ -3534,14 +3160,17 @@ static int WILC_WFI_change_station(struct wiphy *wiphy, struct net_device *dev,
* @date 01 JUL 2012
* @version 1.0
*/
-struct wireless_dev *WILC_WFI_add_virt_intf(struct wiphy *wiphy, const char *name,
- unsigned char name_assign_type,
- enum nl80211_iftype type, u32 *flags,
- struct vif_params *params)
+static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy,
+ const char *name,
+ unsigned char name_assign_type,
+ enum nl80211_iftype type,
+ u32 *flags,
+ struct vif_params *params)
{
perInterface_wlan_t *nic;
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
struct net_device *new_ifc = NULL;
+
priv = wiphy_priv(wiphy);
@@ -3566,7 +3195,7 @@ struct wireless_dev *WILC_WFI_add_virt_intf(struct wiphy *wiphy, const char *nam
}
/**
- * @brief WILC_WFI_del_virt_intf
+ * @brief del_virtual_intf
* @details
* @param[in]
* @return int : Return 0 on Success.
@@ -3574,56 +3203,47 @@ struct wireless_dev *WILC_WFI_add_virt_intf(struct wiphy *wiphy, const char *nam
* @date 01 JUL 2012
* @version 1.0
*/
-int WILC_WFI_del_virt_intf(struct wiphy *wiphy, struct wireless_dev *wdev) /* tony for v3.8 support */
+static int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
{
PRINT_D(HOSTAPD_DBG, "Deleting virtual interface\n");
- return WILC_SUCCESS;
+ return 0;
}
-
-
-#endif /*WILC_AP_EXTERNAL_MLME*/
-static struct cfg80211_ops WILC_WFI_cfg80211_ops = {
-
- .set_monitor_channel = WILC_WFI_CfgSetChannel,
- .scan = WILC_WFI_CfgScan,
- .connect = WILC_WFI_CfgConnect,
- .disconnect = WILC_WFI_disconnect,
- .add_key = WILC_WFI_add_key,
- .del_key = WILC_WFI_del_key,
- .get_key = WILC_WFI_get_key,
- .set_default_key = WILC_WFI_set_default_key,
- #ifdef WILC_AP_EXTERNAL_MLME
- .add_virtual_intf = WILC_WFI_add_virt_intf,
- .del_virtual_intf = WILC_WFI_del_virt_intf,
- .change_virtual_intf = WILC_WFI_change_virt_intf,
-
- .start_ap = WILC_WFI_start_ap,
- .change_beacon = WILC_WFI_change_beacon,
- .stop_ap = WILC_WFI_stop_ap,
- .add_station = WILC_WFI_add_station,
- .del_station = WILC_WFI_del_station,
- .change_station = WILC_WFI_change_station,
- #endif /* WILC_AP_EXTERNAL_MLME*/
- #ifndef WILC_FULLY_HOSTING_AP
- .get_station = WILC_WFI_get_station,
- #endif
- .dump_station = WILC_WFI_dump_station,
- .change_bss = WILC_WFI_change_bss,
- .set_wiphy_params = WILC_WFI_set_wiphy_params,
-
- .set_pmksa = WILC_WFI_set_pmksa,
- .del_pmksa = WILC_WFI_del_pmksa,
- .flush_pmksa = WILC_WFI_flush_pmksa,
-#ifdef WILC_P2P
- .remain_on_channel = WILC_WFI_remain_on_channel,
- .cancel_remain_on_channel = WILC_WFI_cancel_remain_on_channel,
- .mgmt_tx_cancel_wait = WILC_WFI_mgmt_tx_cancel_wait,
- .mgmt_tx = WILC_WFI_mgmt_tx,
- .mgmt_frame_register = WILC_WFI_frame_register,
- .set_power_mgmt = WILC_WFI_set_power_mgmt,
- .set_cqm_rssi_config = WILC_WFI_set_cqm_rssi_config,
-#endif
+static struct cfg80211_ops wilc_cfg80211_ops = {
+
+ .set_monitor_channel = set_channel,
+ .scan = scan,
+ .connect = connect,
+ .disconnect = disconnect,
+ .add_key = add_key,
+ .del_key = del_key,
+ .get_key = get_key,
+ .set_default_key = set_default_key,
+ .add_virtual_intf = add_virtual_intf,
+ .del_virtual_intf = del_virtual_intf,
+ .change_virtual_intf = change_virtual_intf,
+
+ .start_ap = start_ap,
+ .change_beacon = change_beacon,
+ .stop_ap = stop_ap,
+ .add_station = add_station,
+ .del_station = del_station,
+ .change_station = change_station,
+ .get_station = get_station,
+ .dump_station = dump_station,
+ .change_bss = change_bss,
+ .set_wiphy_params = set_wiphy_params,
+
+ .set_pmksa = set_pmksa,
+ .del_pmksa = del_pmksa,
+ .flush_pmksa = flush_pmksa,
+ .remain_on_channel = remain_on_channel,
+ .cancel_remain_on_channel = cancel_remain_on_channel,
+ .mgmt_tx_cancel_wait = mgmt_tx_cancel_wait,
+ .mgmt_tx = mgmt_tx,
+ .mgmt_frame_register = wilc_mgmt_frame_register,
+ .set_power_mgmt = set_power_mgmt,
+ .set_cqm_rssi_config = set_cqm_rssi_config,
};
@@ -3638,15 +3258,14 @@ static struct cfg80211_ops WILC_WFI_cfg80211_ops = {
* @return int : Return 0 on Success.
* @author mdaftedar
* @date 01 MAR 2012
- * @version 1.0WILC_WFI_set_cqmWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_config_rssi_config
+ * @version 1.0
*/
int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)
{
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
priv = wiphy_priv(wiphy);
-#if 1
switch (changed) {
case WILC_WFI_RX_PKT:
@@ -3669,7 +3288,6 @@ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)
default:
break;
}
-#endif
return 0;
}
@@ -3698,21 +3316,19 @@ struct wireless_dev *WILC_WFI_CfgAlloc(void)
}
/*Creating a new wiphy, linking wireless structure with the wiphy structure*/
- wdev->wiphy = wiphy_new(&WILC_WFI_cfg80211_ops, sizeof(struct WILC_WFI_priv));
+ wdev->wiphy = wiphy_new(&wilc_cfg80211_ops, sizeof(struct wilc_priv));
if (!wdev->wiphy) {
PRINT_ER("Cannot allocate wiphy\n");
goto _fail_mem_;
}
- #ifdef WILC_AP_EXTERNAL_MLME
/* enable 802.11n HT */
WILC_WFI_band_2ghz.ht_cap.ht_supported = 1;
WILC_WFI_band_2ghz.ht_cap.cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT);
WILC_WFI_band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff;
WILC_WFI_band_2ghz.ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_8K;
WILC_WFI_band_2ghz.ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE;
- #endif
/*wiphy bands*/
wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &WILC_WFI_band_2ghz;
@@ -3726,7 +3342,7 @@ _fail_:
}
/**
- * @brief WILC_WFI_WiphyRegister
+ * @brief wilc_create_wiphy
* @details Registering of the wiphy structure and interface modes
* @param[in] NONE
* @return NONE
@@ -3734,11 +3350,11 @@ _fail_:
* @date 01 MAR 2012
* @version 1.0
*/
-struct wireless_dev *WILC_WFI_WiphyRegister(struct net_device *net)
+struct wireless_dev *wilc_create_wiphy(struct net_device *net)
{
- struct WILC_WFI_priv *priv;
+ struct wilc_priv *priv;
struct wireless_dev *wdev;
- s32 s32Error = WILC_SUCCESS;
+ s32 s32Error = 0;
PRINT_D(CFG80211_DBG, "Registering wifi device\n");
@@ -3773,15 +3389,11 @@ struct wireless_dev *WILC_WFI_WiphyRegister(struct net_device *net)
/*Setting default managment types: for register action frame: */
wdev->wiphy->mgmt_stypes = wilc_wfi_cfg80211_mgmt_types;
-#ifdef WILC_P2P
wdev->wiphy->max_remain_on_channel_duration = 500;
/*Setting the wiphy interfcae mode and type before registering the wiphy*/
wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP) | BIT(NL80211_IFTYPE_MONITOR) | BIT(NL80211_IFTYPE_P2P_GO) |
BIT(NL80211_IFTYPE_P2P_CLIENT);
wdev->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
-#else
- wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP) | BIT(NL80211_IFTYPE_MONITOR);
-#endif
wdev->iftype = NL80211_IFTYPE_STATION;
@@ -3791,7 +3403,7 @@ struct wireless_dev *WILC_WFI_WiphyRegister(struct net_device *net)
wdev->wiphy->interface_modes, wdev->iftype);
#ifdef WILC_SDIO
- set_wiphy_dev(wdev->wiphy, &local_sdio_func->dev); /* tony */
+ set_wiphy_dev(wdev->wiphy, &local_sdio_func->dev);
#endif
/*Register wiphy structure*/
@@ -3817,20 +3429,18 @@ struct wireless_dev *WILC_WFI_WiphyRegister(struct net_device *net)
* @date 01 MAR 2012
* @version 1.0
*/
-int WILC_WFI_InitHostInt(struct net_device *net)
+int wilc_init_host_int(struct net_device *net)
{
- s32 s32Error = WILC_SUCCESS;
+ int s32Error = 0;
- struct WILC_WFI_priv *priv;
+ 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);
- #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
setup_timer(&hDuringIpTimer, clear_duringIP, 0);
- #endif
}
op_ifcs++;
if (s32Error < 0) {
@@ -3843,10 +3453,10 @@ int WILC_WFI_InitHostInt(struct net_device *net)
priv->bInP2PlistenState = false;
sema_init(&(priv->hSemScanReq), 1);
- s32Error = host_int_init(&priv->hWILCWFIDrv);
- if (s32Error) {
+ s32Error = host_int_init(net, &priv->hWILCWFIDrv);
+ if (s32Error)
PRINT_ER("Error while initializing hostinterface\n");
- }
+
return s32Error;
}
@@ -3859,11 +3469,12 @@ int WILC_WFI_InitHostInt(struct net_device *net)
* @date 01 MAR 2012
* @version 1.0
*/
-int WILC_WFI_DeInitHostInt(struct net_device *net)
+int wilc_deinit_host_int(struct net_device *net)
{
- s32 s32Error = WILC_SUCCESS;
+ int s32Error = 0;
+
+ struct wilc_priv *priv;
- struct WILC_WFI_priv *priv;
priv = wdev_priv(net->ieee80211_ptr);
priv->gbAutoRateAdjusted = false;
@@ -3876,16 +3487,14 @@ int WILC_WFI_DeInitHostInt(struct net_device *net)
/* Clear the Shadow scan */
clear_shadow_scan(priv);
- #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP
if (op_ifcs == 0) {
PRINT_D(CORECONFIG_DBG, "destroy during ip\n");
del_timer_sync(&hDuringIpTimer);
}
- #endif
- if (s32Error) {
+ if (s32Error)
PRINT_ER("Error while deintializing host interface\n");
- }
+
return s32Error;
}
@@ -3899,22 +3508,21 @@ int WILC_WFI_DeInitHostInt(struct net_device *net)
* @date 01 MAR 2012
* @version 1.0
*/
-void WILC_WFI_WiphyFree(struct net_device *net)
+void wilc_free_wiphy(struct net_device *net)
{
-
PRINT_D(CFG80211_DBG, "Unregistering wiphy\n");
- if (net == NULL) {
+ if (!net) {
PRINT_D(INIT_DBG, "net_device is NULL\n");
return;
}
- if (net->ieee80211_ptr == NULL) {
+ if (!net->ieee80211_ptr) {
PRINT_D(INIT_DBG, "ieee80211_ptr is NULL\n");
return;
}
- if (net->ieee80211_ptr->wiphy == NULL) {
+ if (!net->ieee80211_ptr->wiphy) {
PRINT_D(INIT_DBG, "wiphy is NULL\n");
return;
}
@@ -3924,5 +3532,4 @@ void WILC_WFI_WiphyFree(struct net_device *net)
PRINT_D(INIT_DBG, "Freeing wiphy\n");
wiphy_free(net->ieee80211_ptr->wiphy);
kfree(net->ieee80211_ptr);
-
}
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 97b663b7f..39cd8e1b5 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -10,63 +10,44 @@
#define NM_WFI_CFGOPERATIONS
#include "wilc_wfi_netdevice.h"
-#ifdef WILC_FULLY_HOSTING_AP
-#include "wilc_host_ap.h"
-#endif
-
-
/* The following macros describe the bitfield map used by the firmware to determine its 11i mode */
-#define NO_ENCRYPT 0
-#define ENCRYPT_ENABLED (1 << 0)
-#define WEP (1 << 1)
-#define WEP_EXTENDED (1 << 2)
-#define WPA (1 << 3)
-#define WPA2 (1 << 4)
-#define AES (1 << 5)
-#define TKIP (1 << 6)
-
-#ifdef WILC_P2P
-/* #define USE_SUPPLICANT_GO_INTENT */
+#define NO_ENCRYPT 0
+#define ENCRYPT_ENABLED BIT(0)
+#define WEP BIT(1)
+#define WEP_EXTENDED BIT(2)
+#define WPA BIT(3)
+#define WPA2 BIT(4)
+#define AES BIT(5)
+#define TKIP BIT(6)
/*Public action frame index IDs*/
-#define FRAME_TYPE_ID 0
-#define ACTION_CAT_ID 24
-#define ACTION_SUBTYPE_ID 25
-#define P2P_PUB_ACTION_SUBTYPE 30
+#define FRAME_TYPE_ID 0
+#define ACTION_CAT_ID 24
+#define ACTION_SUBTYPE_ID 25
+#define P2P_PUB_ACTION_SUBTYPE 30
/*Public action frame Attribute IDs*/
-#define ACTION_FRAME 0xd0
-#define GO_INTENT_ATTR_ID 0x04
-#define CHANLIST_ATTR_ID 0x0b
-#define OPERCHAN_ATTR_ID 0x11
-#ifdef USE_SUPPLICANT_GO_INTENT
-#define GROUP_BSSID_ATTR_ID 0x07
-#endif
-#define PUB_ACTION_ATTR_ID 0x04
-#define P2PELEM_ATTR_ID 0xdd
+#define ACTION_FRAME 0xd0
+#define GO_INTENT_ATTR_ID 0x04
+#define CHANLIST_ATTR_ID 0x0b
+#define OPERCHAN_ATTR_ID 0x11
+#define PUB_ACTION_ATTR_ID 0x04
+#define P2PELEM_ATTR_ID 0xdd
/*Public action subtype values*/
-#define GO_NEG_REQ 0x00
-#define GO_NEG_RSP 0x01
-#define GO_NEG_CONF 0x02
-#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 GO_NEG_REQ 0x00
+#define GO_NEG_RSP 0x01
+#define GO_NEG_CONF 0x02
+#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 INVALID_CHANNEL 0
-#ifdef USE_SUPPLICANT_GO_INTENT
-#define SUPPLICANT_GO_INTENT 6
-#define GET_GO_INTENT(a) (((a) >> 1) & 0x0f)
-#define GET_TIE_BREAKER(a) (((a)) & 0x01)
-#else
-/* #define FORCE_P2P_CLIENT */
-#endif
-#endif
+#define INVALID_CHANNEL 0
#define nl80211_SCAN_RESULT_EXPIRE (3 * HZ)
-#define SCAN_RESULT_EXPIRE (40 * HZ)
+#define SCAN_RESULT_EXPIRE (40 * HZ)
static const u32 cipher_suites[] = {
WLAN_CIPHER_SUITE_WEP40,
@@ -99,7 +80,6 @@ static const struct ieee80211_txrx_stypes
BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
BIT(IEEE80211_STYPE_DISASSOC >> 4) |
BIT(IEEE80211_STYPE_AUTH >> 4) |
BIT(IEEE80211_STYPE_DEAUTH >> 4)
@@ -111,19 +91,19 @@ static const struct ieee80211_txrx_stypes
#define WILC_WFI_DWELL_ACTIVE 40
struct wireless_dev *WILC_WFI_CfgAlloc(void);
-struct wireless_dev *WILC_WFI_WiphyRegister(struct net_device *net);
-void WILC_WFI_WiphyFree(struct net_device *net);
+struct wireless_dev *wilc_create_wiphy(struct net_device *net);
+void wilc_free_wiphy(struct net_device *net);
int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed);
-int WILC_WFI_DeInitHostInt(struct net_device *net);
-int WILC_WFI_InitHostInt(struct net_device *net);
-void WILC_WFI_monitor_rx(uint8_t *buff, uint32_t size);
+int wilc_deinit_host_int(struct net_device *net);
+int wilc_init_host_int(struct net_device *net);
+void WILC_WFI_monitor_rx(u8 *buff, u32 size);
int WILC_WFI_deinit_mon_interface(void);
struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_device *real_dev);
+void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
+ u16 frame_type, bool reg);
-#ifdef TCP_ENHANCEMENTS
-#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
-#define DEFAULT_LINK_SPEED 72
+#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
+#define DEFAULT_LINK_SPEED 72
void Enable_TCP_ACK_Filter(bool value);
-#endif
#endif
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 77f320d12..0bfe7626a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -8,12 +8,10 @@
#ifndef WILC_WFI_NETDEVICE
#define WILC_WFI_NETDEVICE
-/* These are the flags in the statusword */
#define WILC_WFI_RX_INTR 0x0001
#define WILC_WFI_TX_INTR 0x0002
-/* Default timeout period */
-#define WILC_WFI_TIMEOUT 5 /* In jiffies */
+#define WILC_WFI_TIMEOUT 5
#define WILC_MAX_NUM_PMKIDS 16
#define PMKID_LEN 16
#define PMKID_FOUND 1
@@ -24,16 +22,16 @@
#include <linux/moduleparam.h>
#include <linux/sched.h>
#include <linux/kernel.h>
-#include <linux/slab.h> /* kmalloc() */
-#include <linux/errno.h> /* error codes */
-#include <linux/types.h> /* size_t */
-#include <linux/interrupt.h> /* mark_bh */
+#include <linux/slab.h>
+#include <linux/errno.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
#include <linux/time.h>
#include <linux/in.h>
-#include <linux/netdevice.h> /* struct device, and other headers */
-#include <linux/etherdevice.h> /* eth_type_trans */
-#include <linux/ip.h> /* struct iphdr */
-#include <linux/tcp.h> /* struct tcphdr */
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/ip.h>
+#include <linux/tcp.h>
#include <linux/skbuff.h>
#include <linux/ieee80211.h>
#include <net/cfg80211.h>
@@ -45,15 +43,14 @@
#include <asm/checksum.h>
#include "host_interface.h"
#include "wilc_wlan.h"
-#include <linux/wireless.h> /* tony, 2013-06-12 */
+#include <linux/wireless.h>
#define FLOW_CONTROL_LOWER_THRESHOLD 128
#define FLOW_CONTROL_UPPER_THRESHOLD 256
-/*iftype*/
enum stats_flags {
- WILC_WFI_RX_PKT = 1 << 0,
- WILC_WFI_TX_PKT = 1 << 1,
+ WILC_WFI_RX_PKT = BIT(0),
+ WILC_WFI_TX_PKT = BIT(1),
};
struct WILC_WFI_stats {
@@ -71,22 +68,7 @@ struct WILC_WFI_stats {
* packets in and out, so there is place for a packet
*/
-#define RX_BH_KTHREAD 0
-#define RX_BH_WORK_QUEUE 1
-#define RX_BH_THREADED_IRQ 2
#define num_reg_frame 2
-/*
- * If you use RX_BH_WORK_QUEUE on LPC3131: You may lose the first interrupt on
- * LPC3131 which is important to get the MAC start status when you are blocked
- * inside linux_wlan_firmware_download() which blocks mac_open().
- */
-#if defined(NM73131_0_BOARD)
- #define RX_BH_TYPE RX_BH_KTHREAD
-#elif defined(PANDA_BOARD)
- #define RX_BH_TYPE RX_BH_THREADED_IRQ
-#else
- #define RX_BH_TYPE RX_BH_KTHREAD
-#endif
struct wilc_wfi_key {
u8 *key;
@@ -106,7 +88,6 @@ struct sta_info {
u8 au8Sta_AssociatedBss[MAX_NUM_STA][ETH_ALEN];
};
-#ifdef WILC_P2P
/*Parameters needed for host interface for remaining on channel*/
struct wilc_wfi_p2pListenParams {
struct ieee80211_channel *pstrListenChan;
@@ -116,16 +97,12 @@ struct wilc_wfi_p2pListenParams {
u32 u32ListenSessionID;
};
-#endif /*WILC_P2P*/
-
-struct WILC_WFI_priv {
+struct wilc_priv {
struct wireless_dev *wdev;
struct cfg80211_scan_request *pstrScanReq;
- #ifdef WILC_P2P
struct wilc_wfi_p2pListenParams strRemainOnChanParams;
u64 u64tx_cookie;
- #endif
bool bCfgScanning;
u32 u32RcvdChCount;
@@ -144,9 +121,8 @@ struct WILC_WFI_priv {
spinlock_t lock;
struct net_device *dev;
struct napi_struct napi;
- tstrWILC_WFIDrv *hWILCWFIDrv;
- WILC_WFIDrvHandle hWILCWFIDrv_2;
- tstrHostIFpmkidAttr pmkid_list;
+ struct host_if_drv *hWILCWFIDrv;
+ struct host_if_pmkid_attr pmkid_list;
struct WILC_WFI_stats netstats;
u8 WILC_WFI_wep_default;
u8 WILC_WFI_wep_key[4][WLAN_KEY_LEN_WEP104];
@@ -172,85 +148,74 @@ typedef struct {
} struct_frame_reg;
-#define NUM_CONCURRENT_IFC 2
-typedef struct {
- uint8_t aSrcAddress[ETH_ALEN];
- uint8_t aBSSID[ETH_ALEN];
- tstrWILC_WFIDrv *drvHandler;
- struct net_device *wilc_netdev;
-} tstrInterfaceInfo;
-typedef struct {
+struct wilc_vif {
+ u8 src_addr[ETH_ALEN];
+ u8 bssid[ETH_ALEN];
+ struct host_if_drv *hif_drv;
+ struct net_device *ndev;
+};
+
+struct wilc {
int mac_status;
- int wilc1000_initialized;
+ bool initialized;
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
unsigned short dev_irq_num;
#endif
- wilc_wlan_oup_t oup;
int close;
- uint8_t u8NoIfcs;
- tstrInterfaceInfo strInterfaceInfo[NUM_CONCURRENT_IFC];
- uint8_t open_ifcs;
- struct mutex txq_cs;
+ u8 vif_num;
+ struct wilc_vif vif[NUM_CONCURRENT_IFC];
+ u8 open_ifcs;
- /*Added by Amr - BugID_4720*/
- struct mutex txq_add_to_head_cs;
+ struct semaphore txq_add_to_head_cs;
spinlock_t txq_spinlock;
struct mutex rxq_cs;
struct mutex hif_cs;
- /* struct mutex txq_event; */
- struct semaphore rxq_event;
struct semaphore cfg_event;
struct semaphore sync_event;
-
struct semaphore txq_event;
- /* struct completion txq_event; */
-#if (RX_BH_TYPE == RX_BH_WORK_QUEUE)
- struct work_struct rx_work_queue;
-#elif (RX_BH_TYPE == RX_BH_KTHREAD)
- struct task_struct *rx_bh_thread;
- struct semaphore rx_sem;
-#endif
- struct semaphore rxq_thread_started;
struct semaphore txq_thread_started;
- struct task_struct *rxq_thread;
struct task_struct *txq_thread;
unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
- /* unsigned char eth_dst_address[6]; */
- const struct firmware *wilc_firmware; /* Bug 4703 */
+ const struct firmware *firmware;
- struct net_device *real_ndev;
#ifdef WILC_SDIO
- int already_claim;
struct sdio_func *wilc_sdio_func;
#else
struct spi_device *wilc_spidev;
#endif
-
-} linux_wlan_t;
+};
typedef struct {
- uint8_t u8IfIdx;
+ u8 u8IfIdx;
u8 iftype;
int monitor_flag;
int mac_opened;
- #ifdef WILC_P2P
struct_frame_reg g_struct_frame_reg[num_reg_frame];
- #endif
struct net_device *wilc_netdev;
struct net_device_stats netstats;
-
+ struct wilc *wilc;
} perInterface_wlan_t;
struct WILC_WFI_mon_priv {
struct net_device *real_ndev;
};
+extern struct wilc *g_linux_wlan;
extern struct net_device *WILC_WFI_devs[];
-
+void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
+void linux_wlan_mac_indicate(struct wilc *wilc, int flag);
+void linux_wlan_rx_complete(void);
+void linux_wlan_dbg(u8 *buff);
+int linux_wlan_lock_timeout(void *vp, u32 timeout);
+void wl_wlan_cleanup(void);
+int wilc_netdev_init(struct wilc **wilc);
+void wilc1000_wlan_deinit(struct net_device *dev);
+void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
+u16 Set_machw_change_vir_if(struct net_device *dev, bool bValue);
#endif
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 7c53a2bd0..c02665747 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -8,8 +8,8 @@
/* //////////////////////////////////////////////////////////////////////////// */
#include "wilc_wlan_if.h"
-#include "wilc_wlan.h"
-#define INLINE static __inline
+#include "wilc_wfi_netdevice.h"
+#include "wilc_wlan_cfg.h"
/********************************************
*
@@ -18,13 +18,7 @@
********************************************/
extern wilc_hif_func_t hif_sdio;
extern wilc_hif_func_t hif_spi;
-extern wilc_cfg_func_t mac_cfg;
-#if defined(PLAT_RK3026_TCHIP)
-extern u8 g_wilc_initialized; /* AMR : 0422 RK3026 Crash issue */
-#endif
-extern void WILC_WFI_mgmt_rx(uint8_t *buff, uint32_t size);
-uint32_t wilc_get_chipid(uint8_t update);
-u16 Set_machw_change_vir_if(bool bValue);
+u32 wilc_get_chipid(u8 update);
@@ -34,66 +28,51 @@ typedef struct {
/**
* input interface functions
**/
- wilc_wlan_os_func_t os_func;
wilc_wlan_io_func_t io_func;
- wilc_wlan_net_func_t net_func;
- wilc_wlan_indicate_func_t indicate_func;
/**
* host interface functions
**/
wilc_hif_func_t hif_func;
- void *hif_lock;
/**
* configuration interface functions
**/
- wilc_cfg_func_t cif_func;
int cfg_frame_in_use;
wilc_cfg_frame_t cfg_frame;
- uint32_t cfg_frame_offset;
+ u32 cfg_frame_offset;
int cfg_seq_no;
- void *cfg_wait;
/**
* RX buffer
**/
#ifdef MEMORY_STATIC
- uint32_t rx_buffer_size;
- uint8_t *rx_buffer;
- uint32_t rx_buffer_offset;
+ u8 *rx_buffer;
+ u32 rx_buffer_offset;
#endif
/**
* TX buffer
**/
- uint32_t tx_buffer_size;
- uint8_t *tx_buffer;
- uint32_t tx_buffer_offset;
+ u8 *tx_buffer;
+ u32 tx_buffer_offset;
/**
* TX queue
**/
- void *txq_lock;
- /*Added by Amr - BugID_4720*/
- void *txq_add_to_head_lock;
- void *txq_spinlock;
unsigned long txq_spinlock_flags;
struct txq_entry_t *txq_head;
struct txq_entry_t *txq_tail;
int txq_entries;
- void *txq_wait;
int txq_exit;
/**
* RX queue
**/
- void *rxq_lock;
struct rxq_entry_t *rxq_head;
struct rxq_entry_t *rxq_tail;
int rxq_entries;
- void *rxq_wait;
int rxq_exit;
@@ -101,17 +80,17 @@ typedef struct {
static wilc_wlan_dev_t g_wlan;
-INLINE void chip_allow_sleep(void);
-INLINE void chip_wakeup(void);
+static inline void chip_allow_sleep(void);
+static inline void chip_wakeup(void);
/********************************************
*
* Debug
*
********************************************/
-static uint32_t dbgflag = N_INIT | N_ERR | N_INTR | N_TXQ | N_RXQ;
+static u32 dbgflag = N_INIT | N_ERR | N_INTR | N_TXQ | N_RXQ;
-static void wilc_debug(uint32_t flag, char *fmt, ...)
+static void wilc_debug(u32 flag, char *fmt, ...)
{
char buf[256];
va_list args;
@@ -121,21 +100,19 @@ static void wilc_debug(uint32_t flag, char *fmt, ...)
vsprintf(buf, fmt, args);
va_end(args);
- if (g_wlan.os_func.os_debug)
- g_wlan.os_func.os_debug(buf);
+ linux_wlan_dbg(buf);
}
}
static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP;
-/*BugID_5213*/
-/*acquire_bus() and release_bus() are made INLINE functions*/
+/*acquire_bus() and release_bus() are made static inline functions*/
/*as a temporary workaround to fix a problem of receiving*/
/*unknown interrupt from FW*/
-INLINE void acquire_bus(BUS_ACQUIRE_T acquire)
+static inline void acquire_bus(BUS_ACQUIRE_T acquire)
{
- g_wlan.os_func.os_enter_cs(g_wlan.hif_lock);
+ mutex_lock(&g_linux_wlan->hif_cs);
#ifndef WILC_OPTIMIZE_SLEEP_INT
if (genuChipPSstate != CHIP_WAKEDUP)
#endif
@@ -145,13 +122,13 @@ INLINE void acquire_bus(BUS_ACQUIRE_T acquire)
}
}
-INLINE void release_bus(BUS_RELEASE_T release)
+static inline void release_bus(BUS_RELEASE_T release)
{
#ifdef WILC_OPTIMIZE_SLEEP_INT
if (release == RELEASE_ALLOW_SLEEP)
chip_allow_sleep();
#endif
- g_wlan.os_func.os_leave_cs(g_wlan.hif_lock);
+ mutex_unlock(&g_linux_wlan->hif_cs);
}
/********************************************
*
@@ -162,8 +139,7 @@ INLINE void release_bus(BUS_RELEASE_T release)
static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
- /* unsigned long flags; */
+ wilc_wlan_dev_t *p = &g_wlan;
if (tqe == p->txq_head) {
p->txq_head = tqe->next;
@@ -186,34 +162,33 @@ static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
static struct txq_entry_t *wilc_wlan_txq_remove_from_head(void)
{
struct txq_entry_t *tqe;
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;
- p->os_func.os_spin_lock(p->txq_spinlock, &flags);
+
+ spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
if (p->txq_head) {
tqe = p->txq_head;
p->txq_head = tqe->next;
- if (p->txq_head) {
+ if (p->txq_head)
p->txq_head->prev = NULL;
- }
+
p->txq_entries -= 1;
- /*Added by Amr - BugID_4720*/
} else {
tqe = NULL;
}
- p->os_func.os_spin_unlock(p->txq_spinlock, &flags);
+ spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
return tqe;
}
static void wilc_wlan_txq_add_to_tail(struct txq_entry_t *tqe)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;
- /*Added by Amr - BugID_4720*/
- p->os_func.os_spin_lock(p->txq_spinlock, &flags);
+ spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
if (p->txq_head == NULL) {
tqe->next = NULL;
@@ -229,28 +204,25 @@ static void wilc_wlan_txq_add_to_tail(struct txq_entry_t *tqe)
p->txq_entries += 1;
PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries);
- /*Added by Amr - BugID_4720*/
- p->os_func.os_spin_unlock(p->txq_spinlock, &flags);
+ spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
/**
* wake up TX queue
**/
PRINT_D(TX_DBG, "Wake the txq_handling\n");
- p->os_func.os_signal(p->txq_wait);
-
-
+ up(&g_linux_wlan->txq_event);
}
static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;
- /*Added by Amr - BugID_4720*/
- if (p->os_func.os_wait(p->txq_add_to_head_lock, CFG_PKTS_TIMEOUT))
+ if (linux_wlan_lock_timeout(&g_linux_wlan->txq_add_to_head_cs,
+ CFG_PKTS_TIMEOUT))
return -1;
- p->os_func.os_spin_lock(p->txq_spinlock, &flags);
+ spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
if (p->txq_head == NULL) {
tqe->next = NULL;
@@ -266,37 +238,35 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)
p->txq_entries += 1;
PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries);
- /*Added by Amr - BugID_4720*/
- p->os_func.os_spin_unlock(p->txq_spinlock, &flags);
- p->os_func.os_signal(p->txq_add_to_head_lock);
+ spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
+ up(&g_linux_wlan->txq_add_to_head_cs);
/**
* wake up TX queue
**/
- p->os_func.os_signal(p->txq_wait);
+ up(&g_linux_wlan->txq_event);
PRINT_D(TX_DBG, "Wake up the txq_handler\n");
- /*Added by Amr - BugID_4720*/
return 0;
}
-uint32_t Statisitcs_totalAcks = 0, Statisitcs_DroppedAcks = 0;
+u32 Statisitcs_totalAcks = 0, Statisitcs_DroppedAcks = 0;
#ifdef TCP_ACK_FILTER
struct Ack_session_info;
struct Ack_session_info {
- uint32_t Ack_seq_num;
- uint32_t Bigger_Ack_num;
- uint16_t src_port;
- uint16_t dst_port;
- uint16_t status;
+ u32 Ack_seq_num;
+ u32 Bigger_Ack_num;
+ u16 src_port;
+ u16 dst_port;
+ u16 status;
};
typedef struct {
- uint32_t ack_num;
- uint32_t Session_index;
+ u32 ack_num;
+ u32 Session_index;
struct txq_entry_t *txqe;
} Pending_Acks_info_t /*Ack_info_t*/;
@@ -306,9 +276,6 @@ typedef struct {
struct Ack_session_info *Free_head;
struct Ack_session_info *Alloc_head;
-#define TCP_FIN_MASK (1 << 0)
-#define TCP_SYN_MASK (1 << 1)
-#define TCP_Ack_MASK (1 << 4)
#define NOT_TCP_ACK (-1)
#define MAX_TCP_SESSION 25
@@ -316,19 +283,19 @@ struct Ack_session_info *Alloc_head;
struct Ack_session_info Acks_keep_track_info[2 * MAX_TCP_SESSION];
Pending_Acks_info_t Pending_Acks_info[MAX_PENDING_ACKS];
-uint32_t PendingAcks_arrBase;
-uint32_t Opened_TCP_session;
-uint32_t Pending_Acks;
+u32 PendingAcks_arrBase;
+u32 Opened_TCP_session;
+u32 Pending_Acks;
-static __inline int Init_TCP_tracking(void)
+static inline int Init_TCP_tracking(void)
{
return 0;
}
-static __inline int add_TCP_track_session(uint32_t src_prt, uint32_t dst_prt, uint32_t seq)
+static inline int add_TCP_track_session(u32 src_prt, u32 dst_prt, u32 seq)
{
Acks_keep_track_info[Opened_TCP_session].Ack_seq_num = seq;
Acks_keep_track_info[Opened_TCP_session].Bigger_Ack_num = 0;
@@ -340,16 +307,15 @@ static __inline int add_TCP_track_session(uint32_t src_prt, uint32_t dst_prt, ui
return 0;
}
-static __inline int Update_TCP_track_session(uint32_t index, uint32_t Ack)
+static inline int Update_TCP_track_session(u32 index, u32 Ack)
{
- if (Ack > Acks_keep_track_info[index].Bigger_Ack_num) {
+ if (Ack > Acks_keep_track_info[index].Bigger_Ack_num)
Acks_keep_track_info[index].Bigger_Ack_num = Ack;
- }
return 0;
}
-static __inline int add_TCP_Pending_Ack(uint32_t Ack, uint32_t Session_index, struct txq_entry_t *txqe)
+static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_entry_t *txqe)
{
Statisitcs_totalAcks++;
if (Pending_Acks < MAX_PENDING_ACKS) {
@@ -364,49 +330,58 @@ static __inline int add_TCP_Pending_Ack(uint32_t Ack, uint32_t Session_index, st
}
return 0;
}
-static __inline int remove_TCP_related(void)
+static inline int remove_TCP_related(void)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;
- p->os_func.os_spin_lock(p->txq_spinlock, &flags);
- p->os_func.os_spin_unlock(p->txq_spinlock, &flags);
+ spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+
+ spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
return 0;
}
-static __inline int tcp_process(struct txq_entry_t *tqe)
+static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
{
int ret;
- uint8_t *eth_hdr_ptr;
- uint8_t *buffer = tqe->buffer;
+ u8 *eth_hdr_ptr;
+ u8 *buffer = tqe->buffer;
unsigned short h_proto;
int i;
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;
- p->os_func.os_spin_lock(p->txq_spinlock, &flags);
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
+
+ spin_lock_irqsave(&wilc->txq_spinlock, flags);
eth_hdr_ptr = &buffer[0];
h_proto = ntohs(*((unsigned short *)&eth_hdr_ptr[12]));
if (h_proto == 0x0800) { /* IP */
- uint8_t *ip_hdr_ptr;
- uint8_t protocol;
+ u8 *ip_hdr_ptr;
+ u8 protocol;
ip_hdr_ptr = &buffer[ETHERNET_HDR_LEN];
protocol = ip_hdr_ptr[9];
if (protocol == 0x06) {
- uint8_t *tcp_hdr_ptr;
- uint32_t IHL, Total_Length, Data_offset;
+ u8 *tcp_hdr_ptr;
+ u32 IHL, Total_Length, Data_offset;
+
tcp_hdr_ptr = &ip_hdr_ptr[IP_HDR_LEN];
IHL = (ip_hdr_ptr[0] & 0xf) << 2;
- Total_Length = (((uint32_t)ip_hdr_ptr[2]) << 8) + ((uint32_t)ip_hdr_ptr[3]);
- Data_offset = (((uint32_t)tcp_hdr_ptr[12] & 0xf0) >> 2);
+ Total_Length = (((u32)ip_hdr_ptr[2]) << 8) + ((u32)ip_hdr_ptr[3]);
+ Data_offset = (((u32)tcp_hdr_ptr[12] & 0xf0) >> 2);
if (Total_Length == (IHL + Data_offset)) { /*we want to recognize the clear Acks(packet only carry Ack infos not with data) so data size must be equal zero*/
- uint32_t seq_no, Ack_no;
- seq_no = (((uint32_t)tcp_hdr_ptr[4]) << 24) + (((uint32_t)tcp_hdr_ptr[5]) << 16) + (((uint32_t)tcp_hdr_ptr[6]) << 8) + ((uint32_t)tcp_hdr_ptr[7]);
+ u32 seq_no, Ack_no;
+
+ seq_no = (((u32)tcp_hdr_ptr[4]) << 24) + (((u32)tcp_hdr_ptr[5]) << 16) + (((u32)tcp_hdr_ptr[6]) << 8) + ((u32)tcp_hdr_ptr[7]);
- Ack_no = (((uint32_t)tcp_hdr_ptr[8]) << 24) + (((uint32_t)tcp_hdr_ptr[9]) << 16) + (((uint32_t)tcp_hdr_ptr[10]) << 8) + ((uint32_t)tcp_hdr_ptr[11]);
+ Ack_no = (((u32)tcp_hdr_ptr[8]) << 24) + (((u32)tcp_hdr_ptr[9]) << 16) + (((u32)tcp_hdr_ptr[10]) << 8) + ((u32)tcp_hdr_ptr[11]);
for (i = 0; i < Opened_TCP_session; i++) {
@@ -415,9 +390,9 @@ static __inline int tcp_process(struct txq_entry_t *tqe)
break;
}
}
- if (i == Opened_TCP_session) {
+ if (i == Opened_TCP_session)
add_TCP_track_session(0, 0, seq_no);
- }
+
add_TCP_Pending_Ack(Ack_no, i, tqe);
@@ -429,22 +404,27 @@ static __inline int tcp_process(struct txq_entry_t *tqe)
} else {
ret = 0;
}
- p->os_func.os_spin_unlock(p->txq_spinlock, &flags);
+ spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
return ret;
}
-static int wilc_wlan_txq_filter_dup_tcp_ack(void)
+static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
{
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+ u32 i = 0;
+ u32 Dropped = 0;
+ wilc_wlan_dev_t *p = &g_wlan;
- uint32_t i = 0;
- uint32_t Dropped = 0;
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
- p->os_func.os_spin_lock(p->txq_spinlock, &p->txq_spinlock_flags);
+ spin_lock_irqsave(&wilc->txq_spinlock, p->txq_spinlock_flags);
for (i = PendingAcks_arrBase; i < (PendingAcks_arrBase + Pending_Acks); i++) {
if (Pending_Acks_info[i].ack_num < Acks_keep_track_info[Pending_Acks_info[i].Session_index].Bigger_Ack_num) {
struct txq_entry_t *tqe;
+
PRINT_D(TCP_ENH, "DROP ACK: %u\n", Pending_Acks_info[i].ack_num);
tqe = Pending_Acks_info[i].txqe;
if (tqe) {
@@ -453,7 +433,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
tqe->status = 1; /* mark the packet send */
if (tqe->tx_complete_func)
tqe->tx_complete_func(tqe->priv, tqe->status);
- p->os_func.os_free(tqe);
+ kfree(tqe);
Dropped++;
}
}
@@ -467,11 +447,11 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
PendingAcks_arrBase = 0;
- p->os_func.os_spin_unlock(p->txq_spinlock, &p->txq_spinlock_flags);
+ spin_unlock_irqrestore(&wilc->txq_spinlock, p->txq_spinlock_flags);
while (Dropped > 0) {
/*consume the semaphore count of the removed packet*/
- p->os_func.os_wait(p->txq_wait, 1);
+ linux_wlan_lock_timeout(&wilc->txq_event, 1);
Dropped--;
}
@@ -479,7 +459,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
}
#endif
-#ifdef TCP_ENHANCEMENTS
bool EnableTCPAckFilter = false;
void Enable_TCP_ACK_Filter(bool value)
@@ -491,21 +470,20 @@ bool is_TCP_ACK_Filter_Enabled(void)
{
return EnableTCPAckFilter;
}
-#endif
-static int wilc_wlan_txq_add_cfg_pkt(uint8_t *buffer, uint32_t buffer_size)
+static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
struct txq_entry_t *tqe;
PRINT_D(TX_DBG, "Adding config packet ...\n");
if (p->quit) {
PRINT_D(TX_DBG, "Return due to clear function\n");
- p->os_func.os_signal(p->cfg_wait);
+ up(&g_linux_wlan->cfg_event);
return 0;
}
- tqe = (struct txq_entry_t *)p->os_func.os_malloc_atomic(sizeof(struct txq_entry_t));
+ tqe = kmalloc(sizeof(struct txq_entry_t), GFP_ATOMIC);
if (tqe == NULL) {
PRINT_ER("Failed to allocate memory\n");
return 0;
@@ -524,21 +502,21 @@ static int wilc_wlan_txq_add_cfg_pkt(uint8_t *buffer, uint32_t buffer_size)
**/
PRINT_D(TX_DBG, "Adding the config packet at the Queue tail\n");
- /*Edited by Amr - BugID_4720*/
if (wilc_wlan_txq_add_to_head(tqe))
return 0;
return 1;
}
-static int wilc_wlan_txq_add_net_pkt(void *priv, uint8_t *buffer, uint32_t buffer_size, wilc_tx_complete_func_t func)
+int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
+ u32 buffer_size, wilc_tx_complete_func_t func)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
struct txq_entry_t *tqe;
if (p->quit)
return 0;
- tqe = (struct txq_entry_t *)p->os_func.os_malloc_atomic(sizeof(struct txq_entry_t));
+ tqe = kmalloc(sizeof(struct txq_entry_t), GFP_ATOMIC);
if (tqe == NULL)
return 0;
@@ -551,27 +529,24 @@ static int wilc_wlan_txq_add_net_pkt(void *priv, uint8_t *buffer, uint32_t buffe
PRINT_D(TX_DBG, "Adding mgmt packet at the Queue tail\n");
#ifdef TCP_ACK_FILTER
tqe->tcp_PendingAck_index = NOT_TCP_ACK;
-#ifdef TCP_ENHANCEMENTS
if (is_TCP_ACK_Filter_Enabled())
-#endif
- tcp_process(tqe);
+ tcp_process(dev, tqe);
#endif
wilc_wlan_txq_add_to_tail(tqe);
/*return number of itemes in the queue*/
return p->txq_entries;
}
-/*Bug3959: transmitting mgmt frames received from host*/
-#if defined(WILC_AP_EXTERNAL_MLME) || defined(WILC_P2P)
-int wilc_wlan_txq_add_mgmt_pkt(void *priv, uint8_t *buffer, uint32_t buffer_size, wilc_tx_complete_func_t func)
+
+int wilc_wlan_txq_add_mgmt_pkt(void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
struct txq_entry_t *tqe;
if (p->quit)
return 0;
- tqe = (struct txq_entry_t *)p->os_func.os_malloc_atomic(sizeof(struct txq_entry_t));
+ tqe = kmalloc(sizeof(struct txq_entry_t), GFP_KERNEL);
if (tqe == NULL)
return 0;
@@ -588,72 +563,43 @@ int wilc_wlan_txq_add_mgmt_pkt(void *priv, uint8_t *buffer, uint32_t buffer_size
return 1;
}
-#ifdef WILC_FULLY_HOSTING_AP
-int wilc_FH_wlan_txq_add_net_pkt(void *priv, uint8_t *buffer, uint32_t buffer_size, wilc_tx_complete_func_t func)
-{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
- struct txq_entry_t *tqe;
-
- if (p->quit)
- return 0;
-
- tqe = (struct txq_entry_t *)p->os_func.os_malloc_atomic(sizeof(struct txq_entry_t));
-
- if (tqe == NULL)
- return 0;
- tqe->type = WILC_FH_DATA_PKT;
- tqe->buffer = buffer;
- tqe->buffer_size = buffer_size;
- tqe->tx_complete_func = func;
- tqe->priv = priv;
- PRINT_D(TX_DBG, "Adding mgmt packet at the Queue tail\n");
- wilc_wlan_txq_add_to_tail(tqe);
- /*return number of itemes in the queue*/
- return p->txq_entries;
-}
-#endif /* WILC_FULLY_HOSTING_AP*/
-#endif /*WILC_AP_EXTERNAL_MLME*/
static struct txq_entry_t *wilc_wlan_txq_get_first(void)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
struct txq_entry_t *tqe;
unsigned long flags;
- /*Added by Amr - BugID_4720*/
- p->os_func.os_spin_lock(p->txq_spinlock, &flags);
+ spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
tqe = p->txq_head;
- /*Added by Amr - BugID_4720*/
- p->os_func.os_spin_unlock(p->txq_spinlock, &flags);
+ spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
return tqe;
}
-static struct txq_entry_t *wilc_wlan_txq_get_next(struct txq_entry_t *tqe)
+static struct txq_entry_t *wilc_wlan_txq_get_next(struct wilc *wilc,
+ struct txq_entry_t *tqe)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
unsigned long flags;
- /*Added by Amr - BugID_4720*/
- p->os_func.os_spin_lock(p->txq_spinlock, &flags);
+ spin_lock_irqsave(&wilc->txq_spinlock, flags);
tqe = tqe->next;
- /*Added by Amr - BugID_4720*/
- p->os_func.os_spin_unlock(p->txq_spinlock, &flags);
+ spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
return tqe;
}
-static int wilc_wlan_rxq_add(struct rxq_entry_t *rqe)
+static int wilc_wlan_rxq_add(struct wilc *wilc, struct rxq_entry_t *rqe)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
if (p->quit)
return 0;
- p->os_func.os_enter_cs(p->rxq_lock);
+ mutex_lock(&wilc->rxq_cs);
if (p->rxq_head == NULL) {
PRINT_D(RX_DBG, "Add to Queue head\n");
rqe->next = NULL;
@@ -667,24 +613,24 @@ static int wilc_wlan_rxq_add(struct rxq_entry_t *rqe)
}
p->rxq_entries += 1;
PRINT_D(RX_DBG, "Number of queue entries: %d\n", p->rxq_entries);
- p->os_func.os_leave_cs(p->rxq_lock);
+ mutex_unlock(&wilc->rxq_cs);
return p->rxq_entries;
}
-static struct rxq_entry_t *wilc_wlan_rxq_remove(void)
+static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
PRINT_D(RX_DBG, "Getting rxQ element\n");
if (p->rxq_head) {
struct rxq_entry_t *rqe;
- p->os_func.os_enter_cs(p->rxq_lock);
+ mutex_lock(&wilc->rxq_cs);
rqe = p->rxq_head;
p->rxq_head = p->rxq_head->next;
p->rxq_entries -= 1;
PRINT_D(RX_DBG, "RXQ entries decreased\n");
- p->os_func.os_leave_cs(p->rxq_lock);
+ mutex_unlock(&wilc->rxq_cs);
return rqe;
}
PRINT_D(RX_DBG, "Nothing to get from Q\n");
@@ -702,38 +648,38 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(void)
#ifdef WILC_OPTIMIZE_SLEEP_INT
-INLINE void chip_allow_sleep(void)
+static inline void chip_allow_sleep(void)
{
- uint32_t reg = 0;
+ u32 reg = 0;
/* Clear bit 1 */
g_wlan.hif_func.hif_read_reg(0xf0, &reg);
- g_wlan.hif_func.hif_write_reg(0xf0, reg & ~(1 << 0));
+ g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0));
}
-INLINE void chip_wakeup(void)
+static inline void chip_wakeup(void)
{
- uint32_t reg, clk_status_reg, trials = 0;
- uint32_t sleep_time;
+ u32 reg, clk_status_reg, trials = 0;
+ u32 sleep_time;
if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) {
do {
g_wlan.hif_func.hif_read_reg(1, &reg);
/* Set bit 1 */
- g_wlan.hif_func.hif_write_reg(1, reg | (1 << 1));
+ g_wlan.hif_func.hif_write_reg(1, reg | BIT(1));
/* Clear bit 1*/
- g_wlan.hif_func.hif_write_reg(1, reg & ~(1 << 1));
+ g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1));
do {
/* Wait for the chip to stabilize*/
usleep_range(2 * 1000, 2 * 1000);
/* Make sure chip is awake. This is an extra step that can be removed */
/* later to avoid the bus access overhead */
- if ((wilc_get_chipid(true) == 0)) {
+ if ((wilc_get_chipid(true) == 0))
wilc_debug(N_ERR, "Couldn't read chip id. Wake up failed\n");
- }
+
} while ((wilc_get_chipid(true) == 0) && ((++trials % 3) == 0));
} while (wilc_get_chipid(true) == 0);
@@ -741,7 +687,7 @@ INLINE void chip_wakeup(void)
g_wlan.hif_func.hif_read_reg(0xf0, &reg);
do {
/* Set bit 1 */
- g_wlan.hif_func.hif_write_reg(0xf0, reg | (1 << 0));
+ g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0));
/* Check the clock status */
g_wlan.hif_func.hif_read_reg(0xf1, &clk_status_reg);
@@ -757,14 +703,15 @@ INLINE void chip_wakeup(void)
/* later to avoid the bus access overhead */
g_wlan.hif_func.hif_read_reg(0xf1, &clk_status_reg);
- if ((clk_status_reg & 0x1) == 0) {
+ if ((clk_status_reg & 0x1) == 0)
wilc_debug(N_ERR, "clocks still OFF. Wake up failed\n");
- }
+
}
/* in case of failure, Reset the wakeup bit to introduce a new edge on the next loop */
if ((clk_status_reg & 0x1) == 0) {
/* Reset bit 0 */
- g_wlan.hif_func.hif_write_reg(0xf0, reg & (~(1 << 0)));
+ g_wlan.hif_func.hif_write_reg(0xf0, reg &
+ (~BIT(0)));
}
} while ((clk_status_reg & 0x1) == 0);
}
@@ -772,44 +719,46 @@ INLINE void chip_wakeup(void)
if (genuChipPSstate == CHIP_SLEEPING_MANUAL) {
g_wlan.hif_func.hif_read_reg(0x1C0C, &reg);
- reg &= ~(1 << 0);
+ reg &= ~BIT(0);
g_wlan.hif_func.hif_write_reg(0x1C0C, reg);
if (wilc_get_chipid(false) >= 0x1002b0) {
/* Enable PALDO back right after wakeup */
- uint32_t val32;
+ u32 val32;
+
g_wlan.hif_func.hif_read_reg(0x1e1c, &val32);
- val32 |= (1 << 6);
+ val32 |= BIT(6);
g_wlan.hif_func.hif_write_reg(0x1e1c, val32);
g_wlan.hif_func.hif_read_reg(0x1e9c, &val32);
- val32 |= (1 << 6);
+ val32 |= BIT(6);
g_wlan.hif_func.hif_write_reg(0x1e9c, val32);
}
}
genuChipPSstate = CHIP_WAKEDUP;
}
#else
-INLINE void chip_wakeup(void)
+static inline void chip_wakeup(void)
{
- uint32_t reg, trials = 0;
+ u32 reg, trials = 0;
+
do {
if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) {
g_wlan.hif_func.hif_read_reg(1, &reg);
/* Make sure bit 1 is 0 before we start. */
- g_wlan.hif_func.hif_write_reg(1, reg & ~(1 << 1));
+ g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1));
/* Set bit 1 */
- g_wlan.hif_func.hif_write_reg(1, reg | (1 << 1));
+ g_wlan.hif_func.hif_write_reg(1, reg | BIT(1));
/* Clear bit 1*/
- g_wlan.hif_func.hif_write_reg(1, reg & ~(1 << 1));
+ g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1));
} else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO) {
/* Make sure bit 0 is 0 before we start. */
g_wlan.hif_func.hif_read_reg(0xf0, &reg);
- g_wlan.hif_func.hif_write_reg(0xf0, reg & ~(1 << 0));
+ g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0));
/* Set bit 1 */
- g_wlan.hif_func.hif_write_reg(0xf0, reg | (1 << 0));
+ g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0));
/* Clear bit 1 */
- g_wlan.hif_func.hif_write_reg(0xf0, reg & ~(1 << 0));
+ g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0));
}
do {
@@ -818,27 +767,28 @@ INLINE void chip_wakeup(void)
/* Make sure chip is awake. This is an extra step that can be removed */
/* later to avoid the bus access overhead */
- if ((wilc_get_chipid(true) == 0)) {
+ if ((wilc_get_chipid(true) == 0))
wilc_debug(N_ERR, "Couldn't read chip id. Wake up failed\n");
- }
+
} while ((wilc_get_chipid(true) == 0) && ((++trials % 3) == 0));
} while (wilc_get_chipid(true) == 0);
if (genuChipPSstate == CHIP_SLEEPING_MANUAL) {
g_wlan.hif_func.hif_read_reg(0x1C0C, &reg);
- reg &= ~(1 << 0);
+ reg &= ~BIT(0);
g_wlan.hif_func.hif_write_reg(0x1C0C, reg);
if (wilc_get_chipid(false) >= 0x1002b0) {
/* Enable PALDO back right after wakeup */
- uint32_t val32;
+ u32 val32;
+
g_wlan.hif_func.hif_read_reg(0x1e1c, &val32);
- val32 |= (1 << 6);
+ val32 |= BIT(6);
g_wlan.hif_func.hif_write_reg(0x1e1c, val32);
g_wlan.hif_func.hif_read_reg(0x1e9c, &val32);
- val32 |= (1 << 6);
+ val32 |= BIT(6);
g_wlan.hif_func.hif_write_reg(0x1e9c, val32);
}
}
@@ -871,29 +821,35 @@ void chip_sleep_manually(u32 u32SleepTime)
* Tx, Rx queue handle functions
*
********************************************/
-static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount)
+int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
{
wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
int i, entries = 0;
- uint32_t sum;
- uint32_t reg;
- uint8_t *txb = p->tx_buffer;
- uint32_t offset = 0;
+ u32 sum;
+ u32 reg;
+ u8 *txb = p->tx_buffer;
+ u32 offset = 0;
int vmm_sz = 0;
struct txq_entry_t *tqe;
int ret = 0;
int counter;
int timeout;
- uint32_t vmm_table[WILC_VMM_TBL_SIZE];
+ u32 vmm_table[WILC_VMM_TBL_SIZE];
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
+
p->txq_exit = 0;
do {
if (p->quit)
break;
- /*Added by Amr - BugID_4720*/
- p->os_func.os_wait(p->txq_add_to_head_lock, CFG_PKTS_TIMEOUT);
+ linux_wlan_lock_timeout(&wilc->txq_add_to_head_cs,
+ CFG_PKTS_TIMEOUT);
#ifdef TCP_ACK_FILTER
- wilc_wlan_txq_filter_dup_tcp_ack();
+ wilc_wlan_txq_filter_dup_tcp_ack(dev);
#endif
/**
* build the vmm list
@@ -903,43 +859,31 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount)
i = 0;
sum = 0;
do {
- /* if ((tqe != NULL) && (i < (8)) && */
- /* if ((tqe != NULL) && (i < (WILC_VMM_TBL_SIZE-1)) && */
if ((tqe != NULL) && (i < (WILC_VMM_TBL_SIZE - 1)) /* reserve last entry to 0 */) {
- if (tqe->type == WILC_CFG_PKT) {
+ if (tqe->type == WILC_CFG_PKT)
vmm_sz = ETH_CONFIG_PKT_HDR_OFFSET;
- }
- /*Bug3959: transmitting mgmt frames received from host*/
- /*vmm_sz will only be equal to tqe->buffer_size + 4 bytes (HOST_HDR_OFFSET)*/
- /* in other cases WILC_MGMT_PKT and WILC_DATA_PKT_MAC_HDR*/
- else if (tqe->type == WILC_NET_PKT) {
+
+ else if (tqe->type == WILC_NET_PKT)
vmm_sz = ETH_ETHERNET_HDR_OFFSET;
- }
-#ifdef WILC_FULLY_HOSTING_AP
- else if (tqe->type == WILC_FH_DATA_PKT) {
- vmm_sz = FH_TX_HOST_HDR_OFFSET;
- }
-#endif
-#ifdef WILC_AP_EXTERNAL_MLME
- else {
+
+ else
vmm_sz = HOST_HDR_OFFSET;
- }
-#endif
+
vmm_sz += tqe->buffer_size;
PRINT_D(TX_DBG, "VMM Size before alignment = %d\n", vmm_sz);
if (vmm_sz & 0x3) { /* has to be word aligned */
vmm_sz = (vmm_sz + 4) & ~0x3;
}
- if ((sum + vmm_sz) > p->tx_buffer_size) {
+ if ((sum + vmm_sz) > LINUX_TX_SIZE)
break;
- }
+
PRINT_D(TX_DBG, "VMM Size AFTER alignment = %d\n", vmm_sz);
vmm_table[i] = vmm_sz / 4; /* table take the word size */
PRINT_D(TX_DBG, "VMMTable entry size = %d\n", vmm_table[i]);
if (tqe->type == WILC_CFG_PKT) {
- vmm_table[i] |= (1 << 10);
+ vmm_table[i] |= BIT(10);
PRINT_D(TX_DBG, "VMMTable entry changed for CFG packet = %d\n", vmm_table[i]);
}
#ifdef BIG_ENDIAN
@@ -949,7 +893,7 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount)
i++;
sum += vmm_sz;
PRINT_D(TX_DBG, "sum = %d\n", sum);
- tqe = wilc_wlan_txq_get_next(tqe);
+ tqe = wilc_wlan_txq_get_next(wilc, tqe);
} else {
break;
}
@@ -991,14 +935,13 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount)
**/
PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n");
release_bus(RELEASE_ALLOW_SLEEP);
- p->os_func.os_sleep(3); /* wait 3 ms */
+ usleep_range(3000, 3000);
acquire_bus(ACQUIRE_AND_WAKEUP);
}
} while (!p->quit);
- if (!ret) {
+ if (!ret)
goto _end_;
- }
timeout = 200;
do {
@@ -1006,7 +949,7 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount)
/**
* write to vmm table
**/
- ret = p->hif_func.hif_block_tx(WILC_VMM_TBL_RX_SHADOW_BASE, (uint8_t *)vmm_table, ((i + 1) * 4)); /* Bug 4477 fix */
+ ret = p->hif_func.hif_block_tx(WILC_VMM_TBL_RX_SHADOW_BASE, (u8 *)vmm_table, ((i + 1) * 4));
if (!ret) {
wilc_debug(N_ERR, "ERR block TX of VMM table.\n");
break;
@@ -1037,11 +980,10 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount)
* Get the entries
**/
entries = ((reg >> 3) & 0x3f);
- /* entries = ((reg>>3)&0x2f); */
break;
} else {
release_bus(RELEASE_ALLOW_SLEEP);
- p->os_func.os_sleep(3); /* wait 3 ms */
+ usleep_range(3000, 3000);
acquire_bus(ACQUIRE_AND_WAKEUP);
PRINT_WRN(GENERIC_DBG, "Can't get VMM entery - reg = %2x\n", reg);
}
@@ -1051,9 +993,8 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount)
break;
}
- if (!ret) {
+ if (!ret)
break;
- }
if (entries == 0) {
PRINT_WRN(GENERIC_DBG, "[wilc txq]: no more buffer in the chip (reg: %08x), retry later [[ %d, %x ]]\n", reg, i, vmm_table[i - 1]);
@@ -1064,7 +1005,7 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount)
wilc_debug(N_ERR, "[wilc txq]: fail can't read reg WILC_HOST_TX_CTRL..\n");
break;
}
- reg &= ~(1ul << 0);
+ reg &= ~BIT(0);
ret = p->hif_func.hif_write_reg(WILC_HOST_TX_CTRL, reg);
if (!ret) {
wilc_debug(N_ERR, "[wilc txq]: fail can't write reg WILC_HOST_TX_CTRL..\n");
@@ -1076,9 +1017,9 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount)
}
} while (1);
- if (!ret) {
+ if (!ret)
goto _end_;
- }
+
if (entries == 0) {
ret = WILC_TX_ERR_NO_BUF;
goto _end_;
@@ -1096,7 +1037,7 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount)
do {
tqe = wilc_wlan_txq_remove_from_head();
if (tqe != NULL && (vmm_table[i] != 0)) {
- uint32_t header, buffer_offset;
+ u32 header, buffer_offset;
#ifdef BIG_ENDIAN
vmm_table[i] = BYTE_SWAP(vmm_table[i]);
@@ -1104,14 +1045,10 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount)
vmm_sz = (vmm_table[i] & 0x3ff); /* in word unit */
vmm_sz *= 4;
header = (tqe->type << 31) | (tqe->buffer_size << 15) | vmm_sz;
- /*Bug3959: transmitting mgmt frames received from host*/
- /*setting bit 30 in the host header to indicate mgmt frame*/
-#ifdef WILC_AP_EXTERNAL_MLME
if (tqe->type == WILC_MGMT_PKT)
- header |= (1 << 30);
+ header |= BIT(30);
else
- header &= ~(1 << 30);
-#endif
+ header &= ~BIT(30);
#ifdef BIG_ENDIAN
header = BYTE_SWAP(header);
@@ -1120,20 +1057,13 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount)
if (tqe->type == WILC_CFG_PKT) {
buffer_offset = ETH_CONFIG_PKT_HDR_OFFSET;
}
- /*Bug3959: transmitting mgmt frames received from host*/
- /*buffer offset = HOST_HDR_OFFSET in other cases: WILC_MGMT_PKT*/
- /* and WILC_DATA_PKT_MAC_HDR*/
else if (tqe->type == WILC_NET_PKT) {
char *pBSSID = ((struct tx_complete_data *)(tqe->priv))->pBssid;
+
buffer_offset = ETH_ETHERNET_HDR_OFFSET;
/* copy the bssid at the sart of the buffer */
memcpy(&txb[offset + 4], pBSSID, 6);
}
-#ifdef WILC_FULLY_HOSTING_AP
- else if (tqe->type == WILC_FH_DATA_PKT) {
- buffer_offset = FH_TX_HOST_HDR_OFFSET;
- }
-#endif
else {
buffer_offset = HOST_HDR_OFFSET;
}
@@ -1145,11 +1075,10 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount)
if (tqe->tx_complete_func)
tqe->tx_complete_func(tqe->priv, tqe->status);
#ifdef TCP_ACK_FILTER
- if (tqe->tcp_PendingAck_index != NOT_TCP_ACK) {
+ if (tqe->tcp_PendingAck_index != NOT_TCP_ACK)
Pending_Acks_info[tqe->tcp_PendingAck_index].txqe = NULL;
- }
#endif
- p->os_func.os_free(tqe);
+ kfree(tqe);
} else {
break;
}
@@ -1181,8 +1110,7 @@ _end_:
if (ret != 1)
break;
} while (0);
- /*Added by Amr - BugID_4720*/
- p->os_func.os_signal(p->txq_add_to_head_lock);
+ up(&wilc->txq_add_to_head_cs);
p->txq_exit = 1;
PRINT_D(TX_DBG, "THREAD: Exiting txq\n");
@@ -1191,11 +1119,11 @@ _end_:
return ret;
}
-static void wilc_wlan_handle_rxq(void)
+static void wilc_wlan_handle_rxq(struct wilc *wilc)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
int offset = 0, size, has_packet = 0;
- uint8_t *buffer;
+ u8 *buffer;
struct rxq_entry_t *rqe;
p->rxq_exit = 0;
@@ -1206,10 +1134,10 @@ static void wilc_wlan_handle_rxq(void)
do {
if (p->quit) {
PRINT_D(RX_DBG, "exit 1st do-while due to Clean_UP function\n");
- p->os_func.os_signal(p->cfg_wait);
+ up(&wilc->cfg_event);
break;
}
- rqe = wilc_wlan_rxq_remove();
+ rqe = wilc_wlan_rxq_remove(wilc);
if (rqe == NULL) {
PRINT_D(RX_DBG, "nothing in the queue - exit 1st do-while\n");
break;
@@ -1222,9 +1150,10 @@ static void wilc_wlan_handle_rxq(void)
do {
- uint32_t header;
- uint32_t pkt_len, pkt_offset, tp_len;
+ u32 header;
+ u32 pkt_len, pkt_offset, tp_len;
int is_cfg_packet;
+
PRINT_D(RX_DBG, "In the 2nd do-while\n");
memcpy(&header, &buffer[offset], 4);
#ifdef BIG_ENDIAN
@@ -1244,8 +1173,6 @@ static void wilc_wlan_handle_rxq(void)
break;
}
-/*bug 3887: [AP] Allow Management frames to be passed to the host*/
- #if defined(WILC_AP_EXTERNAL_MLME) || defined(WILC_P2P)
#define IS_MANAGMEMENT 0x100
#define IS_MANAGMEMENT_CALLBACK 0x080
#define IS_MGMT_STATUS_SUCCES 0x040
@@ -1255,50 +1182,40 @@ static void wilc_wlan_handle_rxq(void)
/* reset mgmt indicator bit, to use pkt_offeset in furthur calculations */
pkt_offset &= ~(IS_MANAGMEMENT | IS_MANAGMEMENT_CALLBACK | IS_MGMT_STATUS_SUCCES);
-#ifdef USE_WIRELESS
- WILC_WFI_mgmt_rx(&buffer[offset + HOST_HDR_OFFSET], pkt_len);
-
-#endif
-
+ WILC_WFI_mgmt_rx(wilc, &buffer[offset + HOST_HDR_OFFSET], pkt_len);
}
- /* BUG4530 fix */
else
- #endif
{
if (!is_cfg_packet) {
-
- if (p->net_func.rx_indicate) {
- if (pkt_len > 0) {
- p->net_func.rx_indicate(&buffer[offset], pkt_len, pkt_offset);
- has_packet = 1;
- }
+ if (pkt_len > 0) {
+ frmw_to_linux(wilc,
+ &buffer[offset],
+ pkt_len,
+ pkt_offset);
+ has_packet = 1;
}
} else {
wilc_cfg_rsp_t rsp;
- p->cif_func.rx_indicate(&buffer[pkt_offset + offset], pkt_len, &rsp);
+ wilc_wlan_cfg_indicate_rx(&buffer[pkt_offset + offset], pkt_len, &rsp);
if (rsp.type == WILC_CFG_RSP) {
/**
* wake up the waiting task...
**/
PRINT_D(RX_DBG, "p->cfg_seq_no = %d - rsp.seq_no = %d\n", p->cfg_seq_no, rsp.seq_no);
- if (p->cfg_seq_no == rsp.seq_no) {
- p->os_func.os_signal(p->cfg_wait);
- }
+ if (p->cfg_seq_no == rsp.seq_no)
+ up(&wilc->cfg_event);
} else if (rsp.type == WILC_CFG_RSP_STATUS) {
/**
* Call back to indicate status...
**/
- if (p->indicate_func.mac_indicate) {
- p->indicate_func.mac_indicate(WILC_MAC_INDICATE_STATUS);
- }
+ linux_wlan_mac_indicate(wilc, WILC_MAC_INDICATE_STATUS);
} else if (rsp.type == WILC_CFG_RSP_SCAN) {
- if (p->indicate_func.mac_indicate)
- p->indicate_func.mac_indicate(WILC_MAC_INDICATE_SCAN);
+ linux_wlan_mac_indicate(wilc, WILC_MAC_INDICATE_SCAN);
}
}
}
@@ -1309,16 +1226,13 @@ static void wilc_wlan_handle_rxq(void)
#ifndef MEMORY_STATIC
- if (buffer != NULL)
- p->os_func.os_free((void *)buffer);
+ kfree(buffer);
#endif
- if (rqe != NULL)
- p->os_func.os_free((void *)rqe);
+ kfree(rqe);
+
+ if (has_packet)
+ linux_wlan_rx_complete();
- if (has_packet) {
- if (p->net_func.rx_complete)
- p->net_func.rx_complete();
- }
} while (1);
p->rxq_exit = 1;
@@ -1334,7 +1248,7 @@ static void wilc_unknown_isr_ext(void)
{
g_wlan.hif_func.hif_clear_int_ext(0);
}
-static void wilc_pllupdate_isr_ext(uint32_t int_stats)
+static void wilc_pllupdate_isr_ext(u32 int_stats)
{
int trials = 10;
@@ -1342,16 +1256,16 @@ static void wilc_pllupdate_isr_ext(uint32_t int_stats)
g_wlan.hif_func.hif_clear_int_ext(PLL_INT_CLR);
/* Waiting for PLL */
- g_wlan.os_func.os_atomic_sleep(WILC_PLL_TO);
+ mdelay(WILC_PLL_TO);
/* poll till read a valid data */
while (!(ISWILC1000(wilc_get_chipid(true)) && --trials)) {
PRINT_D(TX_DBG, "PLL update retrying\n");
- g_wlan.os_func.os_atomic_sleep(1);
+ mdelay(1);
}
}
-static void wilc_sleeptimer_isr_ext(uint32_t int_stats1)
+static void wilc_sleeptimer_isr_ext(u32 int_stats1)
{
g_wlan.hif_func.hif_clear_int_ext(SLEEP_INT_CLR);
#ifndef WILC_OPTIMIZE_SLEEP_INT
@@ -1359,15 +1273,15 @@ static void wilc_sleeptimer_isr_ext(uint32_t int_stats1)
#endif
}
-static void wilc_wlan_handle_isr_ext(uint32_t int_status)
+static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
#ifdef MEMORY_STATIC
- uint32_t offset = p->rx_buffer_offset;
+ u32 offset = p->rx_buffer_offset;
#endif
- uint8_t *buffer = NULL;
- uint32_t size;
- uint32_t retries = 0;
+ u8 *buffer = NULL;
+ u32 size;
+ u32 retries = 0;
int ret = 0;
struct rxq_entry_t *rqe;
@@ -1379,7 +1293,7 @@ static void wilc_wlan_handle_isr_ext(uint32_t int_status)
size = ((int_status & 0x7fff) << 2);
while (!size && retries < 10) {
- uint32_t time = 0;
+ u32 time = 0;
/*looping more secure*/
/*zero size make a crashe because the dma will not happen and that will block the firmware*/
wilc_debug(N_ERR, "RX Size equal zero ... Trying to read it again for %d time\n", time++);
@@ -1391,7 +1305,7 @@ static void wilc_wlan_handle_isr_ext(uint32_t int_status)
if (size > 0) {
#ifdef MEMORY_STATIC
- if (p->rx_buffer_size - offset < size)
+ if (LINUX_RX_SIZE - offset < size)
offset = 0;
if (p->rx_buffer)
@@ -1402,7 +1316,7 @@ static void wilc_wlan_handle_isr_ext(uint32_t int_status)
}
#else
- buffer = p->os_func.os_malloc(size);
+ buffer = kmalloc(size, GFP_KERNEL);
if (buffer == NULL) {
wilc_debug(N_ERR, "[wilc isr]: fail alloc host memory...drop the packets (%d)\n", size);
usleep_range(100 * 1000, 100 * 1000);
@@ -1436,46 +1350,41 @@ _end_:
/**
* add to rx queue
**/
- rqe = (struct rxq_entry_t *)p->os_func.os_malloc(sizeof(struct rxq_entry_t));
+ rqe = kmalloc(sizeof(struct rxq_entry_t), GFP_KERNEL);
if (rqe != NULL) {
rqe->buffer = buffer;
rqe->buffer_size = size;
PRINT_D(RX_DBG, "rxq entery Size= %d - Address = %p\n", rqe->buffer_size, rqe->buffer);
- wilc_wlan_rxq_add(rqe);
- p->os_func.os_signal(p->rxq_wait);
+ wilc_wlan_rxq_add(wilc, rqe);
}
} else {
#ifndef MEMORY_STATIC
- if (buffer != NULL)
- p->os_func.os_free(buffer);
+ kfree(buffer);
#endif
}
}
-#ifdef TCP_ENHANCEMENTS
- wilc_wlan_handle_rxq();
-#endif
+ wilc_wlan_handle_rxq(wilc);
}
-void wilc_handle_isr(void)
+void wilc_handle_isr(void *wilc)
{
- uint32_t int_status;
+ u32 int_status;
acquire_bus(ACQUIRE_AND_WAKEUP);
g_wlan.hif_func.hif_read_int(&int_status);
- if (int_status & PLL_INT_EXT) {
+ if (int_status & PLL_INT_EXT)
wilc_pllupdate_isr_ext(int_status);
- }
+
if (int_status & DATA_INT_EXT) {
- wilc_wlan_handle_isr_ext(int_status);
+ wilc_wlan_handle_isr_ext(wilc, int_status);
#ifndef WILC_OPTIMIZE_SLEEP_INT
/* Chip is up and talking*/
genuChipPSstate = CHIP_WAKEDUP;
#endif
}
- if (int_status & SLEEP_INT_EXT) {
+ if (int_status & SLEEP_INT_EXT)
wilc_sleeptimer_isr_ext(int_status);
- }
if (!(int_status & (ALL_INT_EXT))) {
#ifdef WILC_SDIO
@@ -1483,9 +1392,6 @@ void wilc_handle_isr(void)
#endif
wilc_unknown_isr_ext();
}
-#if ((!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO))
- linux_wlan_enable_irq();
-#endif
release_bus(RELEASE_ALLOW_SLEEP);
}
@@ -1494,26 +1400,18 @@ void wilc_handle_isr(void)
* Firmware download
*
********************************************/
-static int wilc_wlan_firmware_download(const uint8_t *buffer, uint32_t buffer_size)
+int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
- uint32_t offset;
- uint32_t addr, size, size2, blksz;
- uint8_t *dma_buffer;
+ wilc_wlan_dev_t *p = &g_wlan;
+ u32 offset;
+ u32 addr, size, size2, blksz;
+ u8 *dma_buffer;
int ret = 0;
- blksz = (1ul << 12); /* Bug 4703: 4KB Good enough size for most platforms = PAGE_SIZE. */
+ blksz = BIT(12);
/* Allocate a DMA coherent buffer. */
-#if (defined WILC_PREALLOC_AT_BOOT)
- {
- extern void *get_fw_buffer(void);
- dma_buffer = (uint8_t *)get_fw_buffer();
- PRINT_D(TX_DBG, "fw_buffer = 0x%x\n", dma_buffer);
- }
-#else
- dma_buffer = (uint8_t *)g_wlan.os_func.os_malloc(blksz);
-#endif
+ dma_buffer = kmalloc(blksz, GFP_KERNEL);
if (dma_buffer == NULL) {
/*EIO 5*/
ret = -5;
@@ -1563,12 +1461,7 @@ static int wilc_wlan_firmware_download(const uint8_t *buffer, uint32_t buffer_si
_fail_:
-#if (defined WILC_PREALLOC_AT_BOOT)
-
-#else
- if (dma_buffer)
- g_wlan.os_func.os_free(dma_buffer);
-#endif
+ kfree(dma_buffer);
_fail_1:
@@ -1580,35 +1473,19 @@ _fail_1:
* Common
*
********************************************/
-static int wilc_wlan_start(void)
+int wilc_wlan_start(void)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
- uint32_t reg = 0;
+ wilc_wlan_dev_t *p = &g_wlan;
+ u32 reg = 0;
int ret;
- uint32_t chipid;
+ u32 chipid;
/**
* Set the host interface
**/
-#ifdef OLD_FPGA_BITFILE
- acquire_bus(ACQUIRE_ONLY);
- ret = p->hif_func.hif_read_reg(WILC_VMM_CORE_CTL, &reg);
- if (!ret) {
- wilc_debug(N_ERR, "[wilc start]: fail read reg vmm_core_ctl...\n");
- release_bus(RELEASE_ALLOW_SLEEP);
- return ret;
- }
- reg |= (p->io_func.io_type << 2);
- ret = p->hif_func.hif_write_reg(WILC_VMM_CORE_CTL, reg);
- if (!ret) {
- wilc_debug(N_ERR, "[wilc start]: fail write reg vmm_core_ctl...\n");
- release_bus(RELEASE_ONLY);
- return ret;
- }
-#else
if (p->io_func.io_type == HIF_SDIO) {
reg = 0;
- reg |= (1 << 3); /* bug 4456 and 4557 */
+ reg |= BIT(3); /* bug 4456 and 4557 */
} else if (p->io_func.io_type == HIF_SPI) {
reg = 1;
}
@@ -1644,13 +1521,11 @@ static int wilc_wlan_start(void)
reg |= WILC_HAVE_LEGACY_RF_SETTINGS;
-/*BugID_5257*/
/*Set oscillator frequency*/
#ifdef XTAL_24
reg |= WILC_HAVE_XTAL_24;
#endif
-/*BugID_5271*/
/*Enable/Disable GPIO configuration for FW logs*/
#ifdef DISABLE_WILC_UART
reg |= WILC_HAVE_DISABLE_WILC_UART;
@@ -1664,8 +1539,6 @@ static int wilc_wlan_start(void)
ret = -5;
return ret;
}
-#endif
-
/**
* Bus related
@@ -1687,13 +1560,13 @@ static int wilc_wlan_start(void)
p->hif_func.hif_read_reg(WILC_GLB_RESET_0, &reg);
- if ((reg & (1ul << 10)) == (1ul << 10)) {
- reg &= ~(1ul << 10);
+ if ((reg & BIT(10)) == BIT(10)) {
+ reg &= ~BIT(10);
p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg);
p->hif_func.hif_read_reg(WILC_GLB_RESET_0, &reg);
}
- reg |= (1ul << 10);
+ reg |= BIT(10);
ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg);
p->hif_func.hif_read_reg(WILC_GLB_RESET_0, &reg);
release_bus(RELEASE_ONLY);
@@ -1704,17 +1577,18 @@ static int wilc_wlan_start(void)
void wilc_wlan_global_reset(void)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
+
acquire_bus(ACQUIRE_AND_WAKEUP);
p->hif_func.hif_write_reg(WILC_GLB_RESET_0, 0x0);
release_bus(RELEASE_ONLY);
}
-static int wilc_wlan_stop(void)
+int wilc_wlan_stop(void)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
- uint32_t reg = 0;
+ wilc_wlan_dev_t *p = &g_wlan;
+ u32 reg = 0;
int ret;
- uint8_t timeout = 10;
+ u8 timeout = 10;
/**
* TODO: stop the firmware, need a re-download
**/
@@ -1727,7 +1601,7 @@ static int wilc_wlan_stop(void)
return ret;
}
- reg &= ~(1 << 10);
+ reg &= ~BIT(10);
ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg);
@@ -1748,9 +1622,9 @@ static int wilc_wlan_stop(void)
}
PRINT_D(GENERIC_DBG, "Read RESET Reg %x : Retry%d\n", reg, timeout);
/*Workaround to ensure that the chip is actually reset*/
- if ((reg & (1 << 10))) {
+ if ((reg & BIT(10))) {
PRINT_D(GENERIC_DBG, "Bit 10 not reset : Retry %d\n", timeout);
- reg &= ~(1 << 10);
+ reg &= ~BIT(10);
ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg);
timeout--;
} else {
@@ -1766,31 +1640,31 @@ static int wilc_wlan_stop(void)
}
} while (timeout);
-#if 1
-/******************************************************************************/
-/* This was add at Bug 4595 to reset the chip while maintaining the bus state */
-/******************************************************************************/
- reg = ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 8) | (1 << 9) | (1 << 26) | (1 << 29) | (1 << 30) | (1 << 31)); /**/
- /**/
- p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); /**/
- reg = ~(1 << 10); /**/
- /**/
- ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); /**/
-/******************************************************************************/
-#endif
+ reg = (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(8) | BIT(9) | BIT(26) |
+ BIT(29) | BIT(30) | BIT(31));
+
+ p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg);
+ reg = (u32)~BIT(10);
+
+ ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg);
release_bus(RELEASE_ALLOW_SLEEP);
return ret;
}
-static void wilc_wlan_cleanup(void)
+void wilc_wlan_cleanup(struct net_device *dev)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
struct txq_entry_t *tqe;
struct rxq_entry_t *rqe;
- uint32_t reg = 0;
+ u32 reg = 0;
int ret;
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
p->quit = 1;
do {
@@ -1799,37 +1673,28 @@ static void wilc_wlan_cleanup(void)
break;
if (tqe->tx_complete_func)
tqe->tx_complete_func(tqe->priv, 0);
- p->os_func.os_free((void *)tqe);
+ kfree(tqe);
} while (1);
do {
- rqe = wilc_wlan_rxq_remove();
+ rqe = wilc_wlan_rxq_remove(wilc);
if (rqe == NULL)
break;
-#ifdef MEMORY_DYNAMIC
- p->os_func.os_free((void *)tqe->buffer);
+#ifndef MEMORY_STATIC
+ kfree(rqe->buffer);
#endif
- p->os_func.os_free((void *)rqe);
+ kfree(rqe);
} while (1);
/**
* clean up buffer
**/
-#if (defined WILC_PREALLOC_AT_BOOT)
-
-#else
#ifdef MEMORY_STATIC
- if (p->rx_buffer) {
- p->os_func.os_free(p->rx_buffer);
- p->rx_buffer = NULL;
- }
+ kfree(p->rx_buffer);
+ p->rx_buffer = NULL;
#endif
- if (p->tx_buffer) {
- p->os_func.os_free(p->tx_buffer);
- p->tx_buffer = NULL;
- }
-#endif
+ kfree(p->tx_buffer);
acquire_bus(ACQUIRE_AND_WAKEUP);
@@ -1853,9 +1718,9 @@ static void wilc_wlan_cleanup(void)
}
-static int wilc_wlan_cfg_commit(int type, uint32_t drvHandler)
+static int wilc_wlan_cfg_commit(int type, u32 drvHandler)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
+ wilc_wlan_dev_t *p = &g_wlan;
wilc_cfg_frame_t *cfg = &p->cfg_frame;
int total_len = p->cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE;
int seq_no = p->cfg_seq_no % 256;
@@ -1871,29 +1736,29 @@ static int wilc_wlan_cfg_commit(int type, uint32_t drvHandler)
cfg->wid_header[0] = 'Q';
}
cfg->wid_header[1] = seq_no; /* sequence number */
- cfg->wid_header[2] = (uint8_t)total_len;
- cfg->wid_header[3] = (uint8_t)(total_len >> 8);
- cfg->wid_header[4] = (uint8_t)driver_handler;
- cfg->wid_header[5] = (uint8_t)(driver_handler >> 8);
- cfg->wid_header[6] = (uint8_t)(driver_handler >> 16);
- cfg->wid_header[7] = (uint8_t)(driver_handler >> 24);
+ cfg->wid_header[2] = (u8)total_len;
+ cfg->wid_header[3] = (u8)(total_len >> 8);
+ cfg->wid_header[4] = (u8)driver_handler;
+ cfg->wid_header[5] = (u8)(driver_handler >> 8);
+ cfg->wid_header[6] = (u8)(driver_handler >> 16);
+ cfg->wid_header[7] = (u8)(driver_handler >> 24);
p->cfg_seq_no = seq_no;
/**
* Add to TX queue
**/
- /*Edited by Amr - BugID_4720*/
if (!wilc_wlan_txq_add_cfg_pkt(&cfg->wid_header[0], total_len))
return -1;
return 0;
}
-static int wilc_wlan_cfg_set(int start, uint32_t wid, uint8_t *buffer, uint32_t buffer_size, int commit, uint32_t drvHandler)
+int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
+ int commit, u32 drvHandler)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
- uint32_t offset;
+ wilc_wlan_dev_t *p = &g_wlan;
+ u32 offset;
int ret_size;
@@ -1904,7 +1769,8 @@ static int wilc_wlan_cfg_set(int start, uint32_t wid, uint8_t *buffer, uint32_t
p->cfg_frame_offset = 0;
offset = p->cfg_frame_offset;
- ret_size = p->cif_func.cfg_wid_set(p->cfg_frame.frame, offset, (uint16_t)wid, buffer, buffer_size);
+ ret_size = wilc_wlan_cfg_set_wid(p->cfg_frame.frame, offset, (u16)wid,
+ buffer, buffer_size);
offset += ret_size;
p->cfg_frame_offset = offset;
@@ -1913,11 +1779,11 @@ static int wilc_wlan_cfg_set(int start, uint32_t wid, uint8_t *buffer, uint32_t
PRINT_D(RX_DBG, "Processing cfg_set()\n");
p->cfg_frame_in_use = 1;
- /*Edited by Amr - BugID_4720*/
if (wilc_wlan_cfg_commit(WILC_CFG_SET, drvHandler))
- ret_size = 0; /* BugID_5213 */
+ ret_size = 0;
- if (p->os_func.os_wait(p->cfg_wait, CFG_PKTS_TIMEOUT)) {
+ if (linux_wlan_lock_timeout(&g_linux_wlan->cfg_event,
+ CFG_PKTS_TIMEOUT)) {
PRINT_D(TX_DBG, "Set Timed Out\n");
ret_size = 0;
}
@@ -1929,10 +1795,10 @@ static int wilc_wlan_cfg_set(int start, uint32_t wid, uint8_t *buffer, uint32_t
return ret_size;
}
-static int wilc_wlan_cfg_get(int start, uint32_t wid, int commit, uint32_t drvHandler)
+int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
- uint32_t offset;
+ wilc_wlan_dev_t *p = &g_wlan;
+ u32 offset;
int ret_size;
@@ -1943,19 +1809,19 @@ static int wilc_wlan_cfg_get(int start, uint32_t wid, int commit, uint32_t drvHa
p->cfg_frame_offset = 0;
offset = p->cfg_frame_offset;
- ret_size = p->cif_func.cfg_wid_get(p->cfg_frame.frame, offset, (uint16_t)wid);
+ ret_size = wilc_wlan_cfg_get_wid(p->cfg_frame.frame, offset, (u16)wid);
offset += ret_size;
p->cfg_frame_offset = offset;
if (commit) {
p->cfg_frame_in_use = 1;
- /*Edited by Amr - BugID_4720*/
if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, drvHandler))
- ret_size = 0; /* BugID_5213 */
+ ret_size = 0;
- if (p->os_func.os_wait(p->cfg_wait, CFG_PKTS_TIMEOUT)) {
+ if (linux_wlan_lock_timeout(&g_linux_wlan->cfg_event,
+ CFG_PKTS_TIMEOUT)) {
PRINT_D(TX_DBG, "Get Timed Out\n");
ret_size = 0;
}
@@ -1968,12 +1834,11 @@ static int wilc_wlan_cfg_get(int start, uint32_t wid, int commit, uint32_t drvHa
return ret_size;
}
-static int wilc_wlan_cfg_get_val(uint32_t wid, uint8_t *buffer, uint32_t buffer_size)
+int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size)
{
- wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
int ret;
- ret = p->cif_func.cfg_wid_get_val((uint16_t)wid, buffer, buffer_size);
+ ret = wilc_wlan_cfg_get_wid_value((u16)wid, buffer, buffer_size);
return ret;
}
@@ -1991,16 +1856,12 @@ void wilc_bus_set_default_speed(void)
/* Restore bus speed to default. */
g_wlan.hif_func.hif_set_default_bus_speed();
}
-uint32_t init_chip(void)
+u32 init_chip(void)
{
- uint32_t chipid;
- uint32_t reg, ret = 0;
+ u32 chipid;
+ u32 reg, ret = 0;
-#if defined(PLAT_RK3026_TCHIP)
- acquire_bus(ACQUIRE_AND_WAKEUP); /* AMR : 0422 RK3026 Crash issue */
-#else
acquire_bus(ACQUIRE_ONLY);
-#endif
chipid = wilc_get_chipid(true);
@@ -2017,7 +1878,7 @@ uint32_t init_chip(void)
wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1118 ...\n");
return ret;
}
- reg |= (1 << 0);
+ reg |= BIT(0);
ret = g_wlan.hif_func.hif_write_reg(0x1118, reg);
if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail write reg 0x1118 ...\n");
@@ -2040,13 +1901,13 @@ uint32_t init_chip(void)
}
-uint32_t wilc_get_chipid(uint8_t update)
+u32 wilc_get_chipid(u8 update)
{
- static uint32_t chipid;
+ static u32 chipid;
/* SDIO can't read into global variables */
/* Use this variable as a temp, then copy to the global */
- uint32_t tempchipid = 0;
- uint32_t rfrevid;
+ u32 tempchipid = 0;
+ u32 rfrevid;
if (chipid == 0 || update != 0) {
g_wlan.hif_func.hif_read_reg(0x1000, &tempchipid);
@@ -2076,25 +1937,7 @@ _fail_:
return chipid;
}
-#ifdef COMPLEMENT_BOOT
-uint8_t core_11b_ready(void)
-{
- uint32_t reg_val;
-
- acquire_bus(ACQUIRE_ONLY);
- g_wlan.hif_func.hif_write_reg(0x16082c, 1);
- g_wlan.hif_func.hif_write_reg(0x161600, 0x90);
- g_wlan.hif_func.hif_read_reg(0x161600, &reg_val);
- release_bus(RELEASE_ONLY);
-
- if (reg_val == 0x90)
- return 0;
- else
- return 1;
-}
-#endif
-
-int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)
+int wilc_wlan_init(wilc_wlan_inp_t *inp)
{
int ret = 0;
@@ -2106,37 +1949,10 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)
/**
* store the input
**/
- memcpy((void *)&g_wlan.os_func, (void *)&inp->os_func, sizeof(wilc_wlan_os_func_t));
memcpy((void *)&g_wlan.io_func, (void *)&inp->io_func, sizeof(wilc_wlan_io_func_t));
- memcpy((void *)&g_wlan.net_func, (void *)&inp->net_func, sizeof(wilc_wlan_net_func_t));
- memcpy((void *)&g_wlan.indicate_func, (void *)&inp->indicate_func, sizeof(wilc_wlan_net_func_t));
- g_wlan.hif_lock = inp->os_context.hif_critical_section;
- g_wlan.txq_lock = inp->os_context.txq_critical_section;
-
- /*Added by Amr - BugID_4720*/
- g_wlan.txq_add_to_head_lock = inp->os_context.txq_add_to_head_critical_section;
-
- /*Added by Amr - BugID_4720*/
- g_wlan.txq_spinlock = inp->os_context.txq_spin_lock;
-
- g_wlan.rxq_lock = inp->os_context.rxq_critical_section;
- g_wlan.txq_wait = inp->os_context.txq_wait_event;
- g_wlan.rxq_wait = inp->os_context.rxq_wait_event;
- g_wlan.cfg_wait = inp->os_context.cfg_wait_event;
- g_wlan.tx_buffer_size = inp->os_context.tx_buffer_size;
-#if defined (MEMORY_STATIC)
- g_wlan.rx_buffer_size = inp->os_context.rx_buffer_size;
-#endif
/***
* host interface init
**/
-#if defined(PLAT_RK3026_TCHIP) /* AMR : 0422 RK3026 Crash issue */
- if (!g_wilc_initialized) {
- custom_lock_bus(g_mac_open);
- custom_wakeup(g_mac_open);
- }
-#endif
-
if ((inp->io_func.io_type & 0x1) == HIF_SDIO) {
if (!hif_sdio.hif_init(inp, wilc_debug)) {
/* EIO 5 */
@@ -2165,32 +1981,17 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)
/***
* mac interface init
**/
- if (!mac_cfg.cfg_init(wilc_debug)) {
+ if (!wilc_wlan_cfg_init(wilc_debug)) {
/* ENOBUFS 105 */
ret = -105;
goto _fail_;
}
- memcpy((void *)&g_wlan.cif_func, &mac_cfg, sizeof(wilc_cfg_func_t));
-
/**
* alloc tx, rx buffer
**/
-#if (defined WILC_PREALLOC_AT_BOOT)
- extern void *get_tx_buffer(void);
- extern void *get_rx_buffer(void);
-
- PRINT_D(TX_DBG, "malloc before, g_wlan.tx_buffer = 0x%x, g_wlan.rx_buffer = 0x%x\n", g_wlan.tx_buffer, g_wlan.rx_buffer);
-#endif
-
-
-
if (g_wlan.tx_buffer == NULL)
-#if (defined WILC_PREALLOC_AT_BOOT)
- g_wlan.tx_buffer = (uint8_t *)get_tx_buffer();
-#else
- g_wlan.tx_buffer = (uint8_t *)g_wlan.os_func.os_malloc(g_wlan.tx_buffer_size);
-#endif
+ g_wlan.tx_buffer = kmalloc(LINUX_TX_SIZE, GFP_KERNEL);
PRINT_D(TX_DBG, "g_wlan.tx_buffer = %p\n", g_wlan.tx_buffer);
if (g_wlan.tx_buffer == NULL) {
@@ -2203,11 +2004,7 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)
/* rx_buffer is not used unless we activate USE_MEM STATIC which is not applicable, allocating such memory is useless*/
#if defined (MEMORY_STATIC)
if (g_wlan.rx_buffer == NULL)
- #if (defined WILC_PREALLOC_AT_BOOT)
- g_wlan.rx_buffer = (uint8_t *)get_rx_buffer();
- #else
- g_wlan.rx_buffer = (uint8_t *)g_wlan.os_func.os_malloc(g_wlan.rx_buffer_size);
- #endif
+ g_wlan.rx_buffer = kmalloc(LINUX_RX_SIZE, GFP_KERNEL);
PRINT_D(TX_DBG, "g_wlan.rx_buffer =%p\n", g_wlan.rx_buffer);
if (g_wlan.rx_buffer == NULL) {
/* ENOBUFS 105 */
@@ -2217,30 +2014,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)
}
#endif
- /**
- * export functions
- **/
- oup->wlan_firmware_download = wilc_wlan_firmware_download;
- oup->wlan_start = wilc_wlan_start;
- oup->wlan_stop = wilc_wlan_stop;
- oup->wlan_add_to_tx_que = wilc_wlan_txq_add_net_pkt;
- oup->wlan_handle_tx_que = wilc_wlan_handle_txq;
- oup->wlan_handle_rx_que = wilc_wlan_handle_rxq;
- oup->wlan_handle_rx_isr = wilc_handle_isr;
- oup->wlan_cleanup = wilc_wlan_cleanup;
- oup->wlan_cfg_set = wilc_wlan_cfg_set;
- oup->wlan_cfg_get = wilc_wlan_cfg_get;
- oup->wlan_cfg_get_value = wilc_wlan_cfg_get_val;
-
- /*Bug3959: transmitting mgmt frames received from host*/
- #if defined(WILC_AP_EXTERNAL_MLME) || defined(WILC_P2P)
- oup->wlan_add_mgmt_to_tx_que = wilc_wlan_txq_add_mgmt_pkt;
-
- #ifdef WILC_FULLY_HOSTING_AP
- oup->wlan_add_data_to_tx_que = wilc_FH_wlan_txq_add_net_pkt;
- #endif
- #endif
-
if (!init_chip()) {
/* EIO 5 */
ret = -5;
@@ -2250,72 +2023,48 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)
Init_TCP_tracking();
#endif
-#if defined(PLAT_RK3026_TCHIP) /* AMR : 0422 RK3026 Crash issue */
- if (!g_wilc_initialized)
- custom_unlock_bus(g_mac_open);
-#endif
-
return 1;
_fail_:
-#if (defined WILC_PREALLOC_AT_BOOT)
-
-#else
#ifdef MEMORY_STATIC
- if (g_wlan.rx_buffer) {
- g_wlan.os_func.os_free(g_wlan.rx_buffer);
- g_wlan.rx_buffer = NULL;
- }
+ kfree(g_wlan.rx_buffer);
+ g_wlan.rx_buffer = NULL;
#endif
- if (g_wlan.tx_buffer) {
- g_wlan.os_func.os_free(g_wlan.tx_buffer);
- g_wlan.tx_buffer = NULL;
- }
-#endif
-
-#if defined(PLAT_RK3026_TCHIP) /* AMR : 0422 RK3026 Crash issue */
- if (!g_wilc_initialized)
- custom_unlock_bus(g_mac_open);
-#endif
+ kfree(g_wlan.tx_buffer);
+ g_wlan.tx_buffer = NULL;
return ret;
}
-#define BIT31 (1 << 31)
-u16 Set_machw_change_vir_if(bool bValue)
+u16 Set_machw_change_vir_if(struct net_device *dev, bool bValue)
{
u16 ret;
u32 reg;
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
+
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
/*Reset WILC_CHANGING_VIR_IF register to allow adding futrue keys to CE H/W*/
- (&g_wlan)->os_func.os_enter_cs((&g_wlan)->hif_lock);
+ mutex_lock(&wilc->hif_cs);
ret = (&g_wlan)->hif_func.hif_read_reg(WILC_CHANGING_VIR_IF, &reg);
- if (!ret) {
+ if (!ret)
PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n");
- }
if (bValue)
- reg |= (BIT31);
+ reg |= BIT(31);
else
- reg &= ~(BIT31);
+ reg &= ~BIT(31);
ret = (&g_wlan)->hif_func.hif_write_reg(WILC_CHANGING_VIR_IF, reg);
- if (!ret) {
+ if (!ret)
PRINT_ER("Error while writing reg WILC_CHANGING_VIR_IF\n");
- }
- (&g_wlan)->os_func.os_leave_cs((&g_wlan)->hif_lock);
- return ret;
-}
+ mutex_unlock(&wilc->hif_cs);
-#ifdef WILC_FULLY_HOSTING_AP
-wilc_wlan_dev_t *Get_wlan_context(u16 *pu16size)
-{
- *pu16size = sizeof(wilc_wlan_dev_t);
- return &g_wlan;
+ return ret;
}
-#endif
-
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 244f7108a..57e1d5174 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -1,7 +1,6 @@
#ifndef WILC_WLAN_H
#define WILC_WLAN_H
-#include "wilc_oswrapper.h"
#define ISWILC1000(id) (((id & 0xfffff000) == 0x100000) ? 1 : 0)
@@ -22,7 +21,6 @@
#define ETH_ETHERNET_HDR_OFFSET (MAX_MAC_HDR_LEN + SUB_MSDU_HEADER_LENGTH + \
SNAP_HDR_LEN - ETHERNET_HDR_LEN + WORD_ALIGNMENT_PAD)
-/*Bug3959: transmitting mgmt frames received from host*/
#define HOST_HDR_OFFSET 4
#define ETHERNET_HDR_LEN 14
#define IP_HDR_LEN 20
@@ -34,11 +32,6 @@
#define ETH_CONFIG_PKT_HDR_OFFSET (ETH_ETHERNET_HDR_OFFSET + \
ETH_CONFIG_PKT_HDR_LEN)
-#define ACTION 0xD0
-#define PROBE_REQ 0x40
-#ifdef WILC_FULLY_HOSTING_AP
-#define FH_TX_HOST_HDR_OFFSET 24
-#endif
/********************************************
*
@@ -57,7 +50,6 @@
*
********************************************/
#define WILC_PERIPH_REG_BASE 0x1000
-/*BugID_5137*/
#define WILC_CHANGING_VIR_IF (0x108c)
#define WILC_CHIPID (WILC_PERIPH_REG_BASE)
#define WILC_GLB_RESET_0 (WILC_PERIPH_REG_BASE + 0x400)
@@ -108,8 +100,8 @@
#define WILC_AHB_DATA_MEM_BASE 0x30000
#define WILC_AHB_SHARE_MEM_BASE 0xd0000
-#define WILC_VMM_TBL_RX_SHADOW_BASE WILC_AHB_SHARE_MEM_BASE /* Bug 4477 fix */
-#define WILC_VMM_TBL_RX_SHADOW_SIZE (256) /* Bug 4477 fix */
+#define WILC_VMM_TBL_RX_SHADOW_BASE WILC_AHB_SHARE_MEM_BASE
+#define WILC_VMM_TBL_RX_SHADOW_SIZE (256)
#define WILC_GP_REG_0 0x149c
#define WILC_GP_REG_1 0x14a0
@@ -141,15 +133,8 @@
********************************************/
#define WILC_CFG_PKT 1
#define WILC_NET_PKT 0
-/*Bug3959: transmitting mgmt frames received from host*/
-#ifdef WILC_AP_EXTERNAL_MLME
#define WILC_MGMT_PKT 2
-#ifdef WILC_FULLY_HOSTING_AP
-#define WILC_FH_DATA_PKT 4
-#endif
-
-#endif /*WILC_AP_EXTERNAL_MLME*/
#define WILC_CFG_SET 1
#define WILC_CFG_QUERY 0
@@ -164,7 +149,7 @@
#endif
-#define ABORT_INT (1 << 31)
+#define ABORT_INT BIT(31)
/*******************************************/
/* E0 and later Interrupt flags. */
@@ -203,15 +188,15 @@
/* 7: Select VMM table 2 */
/* 8: Enable VMM */
/*******************************************/
-#define CLR_INT0 (1 << 0)
-#define CLR_INT1 (1 << 1)
-#define CLR_INT2 (1 << 2)
-#define CLR_INT3 (1 << 3)
-#define CLR_INT4 (1 << 4)
-#define CLR_INT5 (1 << 5)
-#define SEL_VMM_TBL0 (1 << 6)
-#define SEL_VMM_TBL1 (1 << 7)
-#define EN_VMM (1 << 8)
+#define CLR_INT0 BIT(0)
+#define CLR_INT1 BIT(1)
+#define CLR_INT2 BIT(2)
+#define CLR_INT3 BIT(3)
+#define CLR_INT4 BIT(4)
+#define CLR_INT5 BIT(5)
+#define SEL_VMM_TBL0 BIT(6)
+#define SEL_VMM_TBL1 BIT(7)
+#define EN_VMM BIT(8)
#define DATA_INT_EXT INT_0
#define PLL_INT_EXT INT_1
@@ -234,7 +219,7 @@
* Debug Type
*
********************************************/
-typedef void (*wilc_debug_func)(uint32_t, char *, ...);
+typedef void (*wilc_debug_func)(u32, char *, ...);
/********************************************
*
@@ -247,7 +232,7 @@ struct txq_entry_t {
struct txq_entry_t *prev;
int type;
int tcp_PendingAck_index;
- uint8_t *buffer;
+ u8 *buffer;
int buffer_size;
void *priv;
int status;
@@ -256,7 +241,7 @@ struct txq_entry_t {
struct rxq_entry_t {
struct rxq_entry_t *next;
- uint8_t *buffer;
+ u8 *buffer;
int buffer_size;
};
@@ -269,17 +254,17 @@ struct rxq_entry_t {
typedef struct {
int (*hif_init)(wilc_wlan_inp_t *, wilc_debug_func);
int (*hif_deinit)(void *);
- int (*hif_read_reg)(uint32_t, uint32_t *);
- int (*hif_write_reg)(uint32_t, uint32_t);
- int (*hif_block_rx)(uint32_t, uint8_t *, uint32_t);
- int (*hif_block_tx)(uint32_t, uint8_t *, uint32_t);
+ int (*hif_read_reg)(u32, u32 *);
+ int (*hif_write_reg)(u32, u32);
+ int (*hif_block_rx)(u32, u8 *, u32);
+ int (*hif_block_tx)(u32, u8 *, u32);
int (*hif_sync)(void);
int (*hif_clear_int)(void);
- int (*hif_read_int)(uint32_t *);
- int (*hif_clear_int_ext)(uint32_t);
- int (*hif_read_size)(uint32_t *);
- int (*hif_block_tx_ext)(uint32_t, uint8_t *, uint32_t);
- int (*hif_block_rx_ext)(uint32_t, uint8_t *, uint32_t);
+ int (*hif_read_int)(u32 *);
+ int (*hif_clear_int_ext)(u32);
+ int (*hif_read_size)(u32 *);
+ int (*hif_block_tx_ext)(u32, u8 *, u32);
+ int (*hif_block_rx_ext)(u32, u8 *, u32);
int (*hif_sync_ext)(int);
void (*hif_set_max_bus_speed)(void);
void (*hif_set_default_bus_speed)(void);
@@ -294,28 +279,34 @@ typedef struct {
#define MAX_CFG_FRAME_SIZE 1468
typedef struct {
- uint8_t ether_header[14];
- uint8_t ip_header[20];
- uint8_t udp_header[8];
- uint8_t wid_header[8];
- uint8_t frame[MAX_CFG_FRAME_SIZE];
+ u8 ether_header[14];
+ u8 ip_header[20];
+ u8 udp_header[8];
+ u8 wid_header[8];
+ u8 frame[MAX_CFG_FRAME_SIZE];
} wilc_cfg_frame_t;
typedef struct {
- int (*wlan_tx)(uint8_t *, uint32_t, wilc_tx_complete_func_t);
+ int (*wlan_tx)(u8 *, u32, wilc_tx_complete_func_t);
} wilc_wlan_cfg_func_t;
typedef struct {
int type;
- uint32_t seq_no;
+ u32 seq_no;
} wilc_cfg_rsp_t;
-typedef struct {
- int (*cfg_wid_set)(uint8_t *, uint32_t, uint16_t, uint8_t *, int);
- int (*cfg_wid_get)(uint8_t *, uint32_t, uint16_t);
- int (*cfg_wid_get_val)(uint16_t, uint8_t *, uint32_t);
- int (*rx_indicate)(uint8_t *, int, wilc_cfg_rsp_t *);
- int (*cfg_init)(wilc_debug_func);
-} wilc_cfg_func_t;
-
+int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size);
+int wilc_wlan_start(void);
+int wilc_wlan_stop(void);
+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 *pu32TxqCount);
+void wilc_handle_isr(void *wilc);
+void wilc_wlan_cleanup(struct net_device *dev);
+int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
+ int commit, u32 drvHandler);
+int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler);
+int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
+int wilc_wlan_txq_add_mgmt_pkt(void *priv, u8 *buffer, u32 buffer_size,
+ wilc_tx_complete_func_t func);
#endif
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index e2842d37b..a34a81cde 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -7,16 +7,12 @@
/* */
/* ///////////////////////////////////////////////////////////////////////// */
+#include <linux/string.h>
#include "wilc_wlan_if.h"
#include "wilc_wlan.h"
#include "wilc_wlan_cfg.h"
#include "coreconfigurator.h"
-#ifdef WILC_FULLY_HOSTING_AP
-#include "wilc_host_ap.h"
-void WILC_mgm_HOSTAPD_ACK(void *priv, bool bStatus);
-#endif
-
/********************************************
*
* Global Data
@@ -27,23 +23,23 @@ typedef struct {
wilc_debug_func dPrint;
int mac_status;
- uint8_t mac_address[7];
- uint8_t ip_address[5];
- uint8_t bssid[7];
- uint8_t ssid[34];
- uint8_t firmware_version[129];
- uint8_t supp_rate[24];
- uint8_t wep_key[28];
- uint8_t i_psk[66];
- uint8_t hardwareProductVersion[33];
- uint8_t phyversion[17];
- uint8_t supp_username[21];
- uint8_t supp_password[64];
- uint8_t assoc_req[256];
- uint8_t assoc_rsp[256];
- uint8_t firmware_info[8];
- uint8_t scan_result[256];
- uint8_t scan_result1[256];
+ u8 mac_address[7];
+ u8 ip_address[5];
+ u8 bssid[7];
+ u8 ssid[34];
+ u8 firmware_version[129];
+ u8 supp_rate[24];
+ u8 wep_key[28];
+ u8 i_psk[66];
+ u8 hardwareProductVersion[33];
+ u8 phyversion[17];
+ u8 supp_username[21];
+ u8 supp_password[64];
+ u8 assoc_req[256];
+ u8 assoc_rsp[256];
+ u8 firmware_info[8];
+ u8 scan_result[256];
+ u8 scan_result1[256];
} wilc_mac_cfg_t;
static wilc_mac_cfg_t g_mac;
@@ -165,72 +161,72 @@ static wilc_cfg_str_t g_cfg_str[] = {
*
********************************************/
-static int wilc_wlan_cfg_set_byte(uint8_t *frame, uint32_t offset, uint16_t id, uint8_t val8)
+static int wilc_wlan_cfg_set_byte(u8 *frame, u32 offset, u16 id, u8 val8)
{
- uint8_t *buf;
+ u8 *buf;
if ((offset + 4) >= MAX_CFG_FRAME_SIZE)
return 0;
buf = &frame[offset];
- buf[0] = (uint8_t)id;
- buf[1] = (uint8_t)(id >> 8);
+ buf[0] = (u8)id;
+ buf[1] = (u8)(id >> 8);
buf[2] = 1;
buf[3] = val8;
return 4;
}
-static int wilc_wlan_cfg_set_hword(uint8_t *frame, uint32_t offset, uint16_t id, uint16_t val16)
+static int wilc_wlan_cfg_set_hword(u8 *frame, u32 offset, u16 id, u16 val16)
{
- uint8_t *buf;
+ u8 *buf;
if ((offset + 5) >= MAX_CFG_FRAME_SIZE)
return 0;
buf = &frame[offset];
- buf[0] = (uint8_t)id;
- buf[1] = (uint8_t)(id >> 8);
+ buf[0] = (u8)id;
+ buf[1] = (u8)(id >> 8);
buf[2] = 2;
- buf[3] = (uint8_t)val16;
- buf[4] = (uint8_t)(val16 >> 8);
+ buf[3] = (u8)val16;
+ buf[4] = (u8)(val16 >> 8);
return 5;
}
-static int wilc_wlan_cfg_set_word(uint8_t *frame, uint32_t offset, uint16_t id, uint32_t val32)
+static int wilc_wlan_cfg_set_word(u8 *frame, u32 offset, u16 id, u32 val32)
{
- uint8_t *buf;
+ u8 *buf;
if ((offset + 7) >= MAX_CFG_FRAME_SIZE)
return 0;
buf = &frame[offset];
- buf[0] = (uint8_t)id;
- buf[1] = (uint8_t)(id >> 8);
+ buf[0] = (u8)id;
+ buf[1] = (u8)(id >> 8);
buf[2] = 4;
- buf[3] = (uint8_t)val32;
- buf[4] = (uint8_t)(val32 >> 8);
- buf[5] = (uint8_t)(val32 >> 16);
- buf[6] = (uint8_t)(val32 >> 24);
+ buf[3] = (u8)val32;
+ buf[4] = (u8)(val32 >> 8);
+ buf[5] = (u8)(val32 >> 16);
+ buf[6] = (u8)(val32 >> 24);
return 7;
}
-static int wilc_wlan_cfg_set_str(uint8_t *frame, uint32_t offset, uint16_t id, uint8_t *str, uint32_t size)
+static int wilc_wlan_cfg_set_str(u8 *frame, u32 offset, u16 id, u8 *str, u32 size)
{
- uint8_t *buf;
+ u8 *buf;
if ((offset + size + 3) >= MAX_CFG_FRAME_SIZE)
return 0;
buf = &frame[offset];
- buf[0] = (uint8_t)id;
- buf[1] = (uint8_t)(id >> 8);
- buf[2] = (uint8_t)size;
+ buf[0] = (u8)id;
+ buf[1] = (u8)(id >> 8);
+ buf[2] = (u8)size;
if ((str != NULL) && (size != 0))
memcpy(&buf[3], str, size);
@@ -238,20 +234,20 @@ static int wilc_wlan_cfg_set_str(uint8_t *frame, uint32_t offset, uint16_t id, u
return (size + 3);
}
-static int wilc_wlan_cfg_set_bin(uint8_t *frame, uint32_t offset, uint16_t id, uint8_t *b, uint32_t size)
+static int wilc_wlan_cfg_set_bin(u8 *frame, u32 offset, u16 id, u8 *b, u32 size)
{
- uint8_t *buf;
- uint32_t i;
- uint8_t checksum = 0;
+ u8 *buf;
+ u32 i;
+ u8 checksum = 0;
if ((offset + size + 5) >= MAX_CFG_FRAME_SIZE)
return 0;
buf = &frame[offset];
- buf[0] = (uint8_t)id;
- buf[1] = (uint8_t)(id >> 8);
- buf[2] = (uint8_t)size;
- buf[3] = (uint8_t)(size >> 8);
+ buf[0] = (u8)id;
+ buf[1] = (u8)(id >> 8);
+ buf[2] = (u8)size;
+ buf[3] = (u8)(size >> 8);
if ((b != NULL) && (size != 0)) {
memcpy(&buf[4], b, size);
@@ -271,9 +267,9 @@ static int wilc_wlan_cfg_set_bin(uint8_t *frame, uint32_t offset, uint16_t id, u
*
********************************************/
-static void wilc_wlan_parse_response_frame(uint8_t *info, int size)
+static void wilc_wlan_parse_response_frame(u8 *info, int size)
{
- uint32_t wid, len = 0, i = 0;
+ u32 wid, len = 0, i = 0;
static int seq;
while (size > 0) {
@@ -342,6 +338,7 @@ static void wilc_wlan_parse_response_frame(uint8_t *info, int size)
if (g_cfg_str[i].id == wid) {
if (wid == WID_SITE_SURVEY_RESULTS) {
static int toggle;
+
PRINT_INFO(GENERIC_DBG, "Site survey results received[%d]\n",
size);
@@ -365,10 +362,10 @@ static void wilc_wlan_parse_response_frame(uint8_t *info, int size)
}
}
-static int wilc_wlan_parse_info_frame(uint8_t *info, int size)
+static int wilc_wlan_parse_info_frame(u8 *info, int size)
{
- wilc_mac_cfg_t *pd = (wilc_mac_cfg_t *)&g_mac;
- uint32_t wid, len;
+ wilc_mac_cfg_t *pd = &g_mac;
+ u32 wid, len;
int type = WILC_CFG_RSP_STATUS;
wid = info[0] | (info[1] << 8);
@@ -389,9 +386,9 @@ static int wilc_wlan_parse_info_frame(uint8_t *info, int size)
*
********************************************/
-static int wilc_wlan_cfg_set_wid(uint8_t *frame, uint32_t offset, uint16_t id, uint8_t *buf, int size)
+int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size)
{
- uint8_t type = (id >> 12) & 0xf;
+ u8 type = (id >> 12) & 0xf;
int ret = 0;
if (type == 0) { /* byte command */
@@ -399,10 +396,10 @@ static int wilc_wlan_cfg_set_wid(uint8_t *frame, uint32_t offset, uint16_t id, u
ret = wilc_wlan_cfg_set_byte(frame, offset, id, *buf);
} else if (type == 1) { /* half word command */
if (size >= 2)
- ret = wilc_wlan_cfg_set_hword(frame, offset, id, *((uint16_t *)buf));
+ ret = wilc_wlan_cfg_set_hword(frame, offset, id, *((u16 *)buf));
} else if (type == 2) { /* word command */
if (size >= 4)
- ret = wilc_wlan_cfg_set_word(frame, offset, id, *((uint32_t *)buf));
+ ret = wilc_wlan_cfg_set_word(frame, offset, id, *((u32 *)buf));
} else if (type == 3) { /* string command */
ret = wilc_wlan_cfg_set_str(frame, offset, id, buf, size);
} else if (type == 4) { /* binary command */
@@ -414,28 +411,28 @@ static int wilc_wlan_cfg_set_wid(uint8_t *frame, uint32_t offset, uint16_t id, u
return ret;
}
-static int wilc_wlan_cfg_get_wid(uint8_t *frame, uint32_t offset, uint16_t id)
+int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id)
{
- uint8_t *buf;
+ u8 *buf;
if ((offset + 2) >= MAX_CFG_FRAME_SIZE)
return 0;
buf = &frame[offset];
- buf[0] = (uint8_t)id;
- buf[1] = (uint8_t)(id >> 8);
+ buf[0] = (u8)id;
+ buf[1] = (u8)(id >> 8);
return 2;
}
-static int wilc_wlan_cfg_get_wid_value(uint16_t wid, uint8_t *buffer, uint32_t buffer_size)
+int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size)
{
- uint32_t type = (wid >> 12) & 0xf;
+ u32 type = (wid >> 12) & 0xf;
int i, ret = 0;
if (wid == WID_STATUS) {
- *((uint32_t *)buffer) = g_mac.mac_status;
+ *((u32 *)buffer) = g_mac.mac_status;
return 4;
}
@@ -482,10 +479,12 @@ static int wilc_wlan_cfg_get_wid_value(uint16_t wid, uint8_t *buffer, uint32_t b
break;
if (g_cfg_str[i].id == wid) {
- uint32_t size = g_cfg_str[i].str[0];
+ u32 size = g_cfg_str[i].str[0];
+
if (buffer_size >= size) {
if (g_cfg_str[i].id == WID_SITE_SURVEY_RESULTS) {
static int toggle;
+
PRINT_INFO(GENERIC_DBG, "Site survey results value[%d]\n",
size);
i += toggle;
@@ -506,22 +505,11 @@ static int wilc_wlan_cfg_get_wid_value(uint16_t wid, uint8_t *buffer, uint32_t b
return ret;
}
-static int wilc_wlan_cfg_indicate_rx(uint8_t *frame, int size, wilc_cfg_rsp_t *rsp)
+int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, wilc_cfg_rsp_t *rsp)
{
int ret = 1;
- uint8_t msg_type;
- uint8_t msg_id;
- #ifdef WILC_FULLY_HOSTING_AP
- u32 *ptru32Frame;
- bool bStatus = frame[2];
-
- #ifdef BIG_ENDIAN
- ptru32Frame = (frame[4] << 24) | (frame[5] << 16) | (frame[6] << 8) | frame[7];
- #else
- ptru32Frame = (frame[7] << 24) | (frame[6] << 16) | (frame[5] << 8) | frame[4];
- #endif /* BIG_ENDIAN */
-
- #endif /* WILC_FULLY_HOSTING_AP */
+ u8 msg_type;
+ u8 msg_id;
msg_type = frame[0];
msg_id = frame[1]; /* seq no */
@@ -547,39 +535,16 @@ static int wilc_wlan_cfg_indicate_rx(uint8_t *frame, int size, wilc_cfg_rsp_t *r
GnrlAsyncInfoReceived(frame - 4, size + 4);
break;
- case 'L':
-#ifndef SWITCH_LOG_TERMINAL
- PRINT_ER("Unexpected firmware log message received\n");
-#else
- PRINT_D(FIRM_DBG, "\nFIRMWARE LOGS :\n<<\n%s\n>>\n", frame);
- break;
-
-#endif
-#if 1
case 'N':
NetworkInfoReceived(frame - 4, size + 4);
rsp->type = 0;
break;
-#endif
-/*bug3819:*/
case 'S':
PRINT_INFO(RX_DBG, "Scan Notification Received\n");
host_int_ScanCompleteReceived(frame - 4, size + 4);
break;
-#ifdef WILC_FULLY_HOSTING_AP
- case 'T':
- PRINT_INFO(RX_DBG, "TBTT Notification Received\n");
- process_tbtt_isr();
- break;
-
- case 'A':
- PRINT_INFO(RX_DBG, "HOSTAPD ACK Notification Received\n");
- WILC_mgm_HOSTAPD_ACK(ptru32Frame, bStatus);
- break;
-#endif
-
default:
PRINT_INFO(RX_DBG, "Receive unknown message type[%d-%d-%d-%d-%d-%d-%d-%d]\n",
frame[0], frame[1], frame[2], frame[3], frame[4],
@@ -593,17 +558,9 @@ static int wilc_wlan_cfg_indicate_rx(uint8_t *frame, int size, wilc_cfg_rsp_t *r
return ret;
}
-static int wilc_wlan_cfg_init(wilc_debug_func func)
+int wilc_wlan_cfg_init(wilc_debug_func func)
{
memset((void *)&g_mac, 0, sizeof(wilc_mac_cfg_t));
g_mac.dPrint = func;
return 1;
}
-
-wilc_cfg_func_t mac_cfg = {
- wilc_wlan_cfg_set_wid,
- wilc_wlan_cfg_get_wid,
- wilc_wlan_cfg_get_wid_value,
- wilc_wlan_cfg_indicate_rx,
- wilc_wlan_cfg_init,
-};
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 8906611b2..30e60ec4d 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -11,23 +11,29 @@
#define WILC_WLAN_CFG_H
typedef struct {
- uint16_t id;
- uint16_t val;
+ u16 id;
+ u16 val;
} wilc_cfg_byte_t;
typedef struct {
- uint16_t id;
- uint16_t val;
+ u16 id;
+ u16 val;
} wilc_cfg_hword_t;
typedef struct {
- uint32_t id;
- uint32_t val;
+ u32 id;
+ u32 val;
} wilc_cfg_word_t;
typedef struct {
- uint32_t id;
- uint8_t *str;
+ u32 id;
+ u8 *str;
} wilc_cfg_str_t;
+int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size);
+int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id);
+int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size);
+int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, wilc_cfg_rsp_t *rsp);
+int wilc_wlan_cfg_init(wilc_debug_func func);
+
#endif
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 5cf74e4c4..be972afe6 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -1,4 +1,4 @@
-/* ////////////////////////////////////////////////////////////////////////// */
+/* ///////////////////////////////////////////////////////////////////////// */
/* */
/* Copyright (c) Atmel Corporation. All rights reserved. */
/* */
@@ -7,34 +7,23 @@
/* */
/* ///////////////////////////////////////////////////////////////////////// */
-
#ifndef WILC_WLAN_IF_H
#define WILC_WLAN_IF_H
-/*bug 3887: [AP] Allow Management frames to be passed to the host*/
-#define WILC_AP_EXTERNAL_MLME
-#define WILC_P2P
-#define TCP_ENHANCEMENTS
-/* #define MEMORY_STATIC */
-/* #define WILC_FULLY_HOSTING_AP */
-/* #define USE_OLD_SPI_SW */
-
-
-#include "wilc_oswrapper.h"
+#include <linux/semaphore.h>
#include "linux_wlan_common.h"
-
/********************************************
*
* Debug Flags
*
********************************************/
-#define N_INIT 0x00000001
-#define N_ERR 0x00000002
-#define N_TXQ 0x00000004
-#define N_INTR 0x00000008
-#define N_RXQ 0x00000010
+#define N_INIT 0x00000001
+#define N_ERR 0x00000002
+#define N_TXQ 0x00000004
+#define N_INTR 0x00000008
+#define N_RXQ 0x00000010
/********************************************
*
@@ -42,10 +31,9 @@
*
********************************************/
-#define HIF_SDIO (0)
-#define HIF_SPI BIT(0)
-#define HIF_SDIO_GPIO_IRQ BIT(2)
-
+#define HIF_SDIO (0)
+#define HIF_SPI BIT(0)
+#define HIF_SDIO_GPIO_IRQ BIT(2)
/********************************************
*
@@ -53,8 +41,8 @@
*
********************************************/
-#define CE_TX_BUFFER_SIZE (64 * 1024)
-#define CE_RX_BUFFER_SIZE (384 * 1024)
+#define CE_TX_BUFFER_SIZE (64 * 1024)
+#define CE_RX_BUFFER_SIZE (384 * 1024)
/********************************************
*
@@ -63,47 +51,27 @@
********************************************/
typedef struct {
- uint32_t read_write: 1;
- uint32_t function: 3;
- uint32_t raw: 1;
- uint32_t address: 17;
- uint32_t data: 8;
+ u32 read_write: 1;
+ u32 function: 3;
+ u32 raw: 1;
+ u32 address: 17;
+ u32 data: 8;
} sdio_cmd52_t;
typedef struct {
/* struct { */
- uint32_t read_write: 1;
- uint32_t function: 3;
- uint32_t block_mode: 1;
- uint32_t increment: 1;
- uint32_t address: 17;
- uint32_t count: 9;
+ u32 read_write: 1;
+ u32 function: 3;
+ u32 block_mode: 1;
+ u32 increment: 1;
+ u32 address: 17;
+ u32 count: 9;
/* } bit; */
- uint8_t *buffer;
- uint32_t block_size;
+ u8 *buffer;
+ u32 block_size;
} sdio_cmd53_t;
typedef struct {
- void (*os_sleep)(uint32_t);
- void (*os_atomic_sleep)(uint32_t);
- void (*os_debug)(uint8_t *);
- void *(*os_malloc)(uint32_t);
- void *(*os_malloc_atomic)(uint32_t);
- void (*os_free)(void *);
- void (*os_lock)(void *);
- void (*os_unlock)(void *);
- int (*os_wait)(void *, u32);
- void (*os_signal)(void *);
- void (*os_enter_cs)(void *);
- void (*os_leave_cs)(void *);
-
- /*Added by Amr - BugID_4720*/
- void (*os_spin_lock)(void *, unsigned long *);
- void (*os_spin_unlock)(void *, unsigned long *);
-
-} wilc_wlan_os_func_t;
-
-typedef struct {
int io_type;
int (*io_init)(void *);
void (*io_deinit)(void *);
@@ -116,96 +84,39 @@ typedef struct {
} sdio;
struct {
int (*spi_max_speed)(void);
- int (*spi_tx)(uint8_t *, uint32_t);
- int (*spi_rx)(uint8_t *, uint32_t);
- int (*spi_trx)(uint8_t *, uint8_t *, uint32_t);
+ int (*spi_tx)(u8 *, u32);
+ int (*spi_rx)(u8 *, u32);
+ int (*spi_trx)(u8 *, u8 *, u32);
} spi;
} u;
} wilc_wlan_io_func_t;
-typedef struct {
- void (*rx_indicate)(uint8_t *, uint32_t, uint32_t);
- void (*rx_complete)(void);
-} wilc_wlan_net_func_t;
-
-typedef struct {
- void (*mac_indicate)(int);
-} wilc_wlan_indicate_func_t;
-#define WILC_MAC_INDICATE_STATUS 0x1
-#define WILC_MAC_STATUS_INIT -1
-#define WILC_MAC_STATUS_READY 0
-#define WILC_MAC_STATUS_CONNECT 1
+#define WILC_MAC_INDICATE_STATUS 0x1
+#define WILC_MAC_STATUS_INIT -1
+#define WILC_MAC_STATUS_READY 0
+#define WILC_MAC_STATUS_CONNECT 1
#define WILC_MAC_INDICATE_SCAN 0x2
typedef struct {
void *os_private;
-
- void *hif_critical_section;
-
- uint32_t tx_buffer_size;
- void *txq_critical_section;
-
- /*Added by Amr - BugID_4720*/
- void *txq_add_to_head_critical_section;
- void *txq_spin_lock;
-
- void *txq_wait_event;
-
-#if defined(MEMORY_STATIC)
- uint32_t rx_buffer_size;
-#endif
- void *rxq_critical_section;
- void *rxq_wait_event;
-
- void *cfg_wait_event;
} wilc_wlan_os_context_t;
typedef struct {
wilc_wlan_os_context_t os_context;
- wilc_wlan_os_func_t os_func;
wilc_wlan_io_func_t io_func;
- wilc_wlan_net_func_t net_func;
- wilc_wlan_indicate_func_t indicate_func;
} wilc_wlan_inp_t;
struct tx_complete_data {
- #ifdef WILC_FULLY_HOSTING_AP
- struct tx_complete_data *next;
- #endif
int size;
void *buff;
- uint8_t *pBssid;
+ u8 *pBssid;
struct sk_buff *skb;
};
-
typedef void (*wilc_tx_complete_func_t)(void *, int);
-#define WILC_TX_ERR_NO_BUF (-2)
-
-typedef struct {
- int (*wlan_firmware_download)(const uint8_t *, uint32_t);
- int (*wlan_start)(void);
- int (*wlan_stop)(void);
- int (*wlan_add_to_tx_que)(void *, uint8_t *, uint32_t, wilc_tx_complete_func_t);
- int (*wlan_handle_tx_que)(uint32_t *);
- void (*wlan_handle_rx_que)(void);
- void (*wlan_handle_rx_isr)(void);
- void (*wlan_cleanup)(void);
- int (*wlan_cfg_set)(int, uint32_t, uint8_t *, uint32_t, int, uint32_t);
- int (*wlan_cfg_get)(int, uint32_t, int, uint32_t);
- int (*wlan_cfg_get_value)(uint32_t, uint8_t *, uint32_t);
- /*Bug3959: transmitting mgmt frames received from host*/
- #if defined(WILC_AP_EXTERNAL_MLME) || defined(WILC_P2P)
- int (*wlan_add_mgmt_to_tx_que)(void *, uint8_t *, uint32_t, wilc_tx_complete_func_t);
-
- #ifdef WILC_FULLY_HOSTING_AP
- int (*wlan_add_data_to_tx_que)(void *, uint8_t *, uint32_t, wilc_tx_complete_func_t);
- #endif
-
- #endif
-} wilc_wlan_oup_t;
+#define WILC_TX_ERR_NO_BUF (-2)
/********************************************
*
@@ -216,156 +127,152 @@ typedef struct {
#define MAX_SSID_LEN 33
#define MAX_RATES_SUPPORTED 12
-#define INFINITE_SLEEP_TIME ((u32)0xFFFFFFFF)
+#define INFINITE_SLEEP_TIME ((u32)0xFFFFFFFF)
-#ifdef WILC_PARSE_SCAN_IN_HOST
typedef enum {
- SUPP_RATES_IE = 1,
- EXT_SUPP_RATES_IE = 50,
- HT_CAPABILITY_IE = 45,
- RSN_IE = 48,
- WPA_IE = 221,
- WMM_IE = 221,
- #ifdef WILC_P2P
- P2P_IE = 221,
- #endif
+ SUPP_RATES_IE = 1,
+ EXT_SUPP_RATES_IE = 50,
+ HT_CAPABILITY_IE = 45,
+ RSN_IE = 48,
+ WPA_IE = 221,
+ WMM_IE = 221,
+ P2P_IE = 221,
} BEACON_IE;
-#endif
+
typedef enum {
- INFRASTRUCTURE = 0,
+ INFRASTRUCTURE = 0,
INDEPENDENT,
AP,
} BSSTYPE_T;
typedef enum {
- RATE_AUTO = 0,
- RATE_1MB = 1,
- RATE_2MB = 2,
- RATE_5MB = 5,
- RATE_6MB = 6,
- RATE_9MB = 9,
- RATE_11MB = 11,
- RATE_12MB = 12,
- RATE_18MB = 18,
- RATE_24MB = 24,
- RATE_26MB = 36,
- RATE_48MB = 48,
- RATE_54MB = 54
+ RATE_AUTO = 0,
+ RATE_1MB = 1,
+ RATE_2MB = 2,
+ RATE_5MB = 5,
+ RATE_6MB = 6,
+ RATE_9MB = 9,
+ RATE_11MB = 11,
+ RATE_12MB = 12,
+ RATE_18MB = 18,
+ RATE_24MB = 24,
+ RATE_26MB = 36,
+ RATE_48MB = 48,
+ RATE_54MB = 54
} TX_RATE_T;
typedef enum {
- B_ONLY_MODE = 0, /* basic rate: 1, 2 Mbps, otherwise: 5, 11 Mbps */
- G_ONLY_MODE, /* basic rate: 6, 12, 24 Mbps, otherwise: 9, 18, 36, 48, 54 Mbps */
- G_MIXED_11B_1_MODE, /* basic rate: 1, 2, 5.5, 11 Mbps, otherwise: all on */
- G_MIXED_11B_2_MODE, /* basic rate: 1, 2, 5, 11, 6, 12, 24 Mbps, otherwise: all on */
+ B_ONLY_MODE = 0, /* 1, 2 M, otherwise 5, 11 M */
+ G_ONLY_MODE, /* 6,12,24 otherwise 9,18,36,48,54 */
+ G_MIXED_11B_1_MODE, /* 1,2,5.5,11 otherwise all on */
+ G_MIXED_11B_2_MODE, /* 1,2,5,11,6,12,24 otherwise all on */
} G_OPERATING_MODE_T;
typedef enum {
- G_SHORT_PREAMBLE = 0, /* Short Preamble */
- G_LONG_PREAMBLE = 1, /* Long Preamble */
- G_AUTO_PREAMBLE = 2, /* Auto Preamble Selection */
+ G_SHORT_PREAMBLE = 0, /* Short Preamble */
+ G_LONG_PREAMBLE = 1, /* Long Preamble */
+ G_AUTO_PREAMBLE = 2, /* Auto Preamble Selection */
} G_PREAMBLE_T;
-#define MAC_CONNECTED 1
-#define MAC_DISCONNECTED 0
+#define MAC_CONNECTED 1
+#define MAC_DISCONNECTED 0
-/*bug3819: */
#define SCAN_DONE TRUE
typedef enum {
- PASSIVE_SCAN = 0,
- ACTIVE_SCAN = 1,
+ PASSIVE_SCAN = 0,
+ ACTIVE_SCAN = 1,
} SCANTYPE_T;
typedef enum {
- NO_POWERSAVE = 0,
- MIN_FAST_PS = 1,
- MAX_FAST_PS = 2,
- MIN_PSPOLL_PS = 3,
- MAX_PSPOLL_PS = 4
+ NO_POWERSAVE = 0,
+ MIN_FAST_PS = 1,
+ MAX_FAST_PS = 2,
+ MIN_PSPOLL_PS = 3,
+ MAX_PSPOLL_PS = 4
} USER_PS_MODE_T;
typedef enum {
- CHIP_WAKEDUP = 0,
+ CHIP_WAKEDUP = 0,
CHIP_SLEEPING_AUTO = 1,
- CHIP_SLEEPING_MANUAL = 2
+ CHIP_SLEEPING_MANUAL = 2
} CHIP_PS_STATE_T;
typedef enum {
- ACQUIRE_ONLY = 0,
+ ACQUIRE_ONLY = 0,
ACQUIRE_AND_WAKEUP = 1,
} BUS_ACQUIRE_T;
typedef enum {
- RELEASE_ONLY = 0,
- RELEASE_ALLOW_SLEEP = 1,
+ RELEASE_ONLY = 0,
+ RELEASE_ALLOW_SLEEP = 1,
} BUS_RELEASE_T;
typedef enum {
- NO_SECURITY = 0,
- WEP_40 = 0x3,
- WEP_104 = 0x7,
- WPA_AES = 0x29,
- WPA_TKIP = 0x49,
- WPA_AES_TKIP = 0x69, /* Aes or Tkip */
- WPA2_AES = 0x31,
- WPA2_TKIP = 0x51,
- WPA2_AES_TKIP = 0x71, /* Aes or Tkip */
+ NO_SECURITY = 0,
+ WEP_40 = 0x3,
+ WEP_104 = 0x7,
+ WPA_AES = 0x29,
+ WPA_TKIP = 0x49,
+ WPA_AES_TKIP = 0x69, /* Aes or Tkip */
+ WPA2_AES = 0x31,
+ WPA2_TKIP = 0x51,
+ WPA2_AES_TKIP = 0x71, /* Aes or Tkip */
} SECURITY_T;
-typedef enum {
- OPEN_SYSTEM = 1,
- SHARED_KEY = 2,
- ANY = 3,
- IEEE8021 = 5
-} AUTHTYPE_T;
+enum AUTHTYPE {
+ OPEN_SYSTEM = 1,
+ SHARED_KEY = 2,
+ ANY = 3,
+ IEEE8021 = 5
+};
-typedef enum {
- SITE_SURVEY_1CH = 0,
- SITE_SURVEY_ALL_CH = 1,
- SITE_SURVEY_OFF = 2
-} SITE_SURVEY_T;
+enum SITESURVEY {
+ SITE_SURVEY_1CH = 0,
+ SITE_SURVEY_ALL_CH = 1,
+ SITE_SURVEY_OFF = 2
+};
typedef enum {
- NORMAL_ACK = 0,
+ NORMAL_ACK = 0,
NO_ACK,
} ACK_POLICY_T;
typedef enum {
- DONT_RESET = 0,
- DO_RESET = 1,
- NO_REQUEST = 2,
+ DONT_RESET = 0,
+ DO_RESET = 1,
+ NO_REQUEST = 2,
} RESET_REQ_T;
typedef enum {
- REKEY_DISABLE = 1,
+ REKEY_DISABLE = 1,
REKEY_TIME_BASE,
REKEY_PKT_BASE,
REKEY_TIME_PKT_BASE
} RSNA_REKEY_POLICY_T;
typedef enum {
- FILTER_NO = 0x00,
- FILTER_AP_ONLY = 0x01,
- FILTER_STA_ONLY = 0x02
+ FILTER_NO = 0x00,
+ FILTER_AP_ONLY = 0x01,
+ FILTER_STA_ONLY = 0x02
} SCAN_CLASS_FITLER_T;
typedef enum {
- PRI_HIGH_RSSI = 0x00,
- PRI_LOW_RSSI = 0x04,
- PRI_DETECT = 0x08
+ PRI_HIGH_RSSI = 0x00,
+ PRI_LOW_RSSI = 0x04,
+ PRI_DETECT = 0x08
} SCAN_PRI_T;
typedef enum {
- CH_FILTER_OFF = 0x00,
- CH_FILTER_ON = 0x10
+ CH_FILTER_OFF = 0x00,
+ CH_FILTER_ON = 0x10
} CH_FILTER_T;
typedef enum {
- AUTO_PROT = 0, /* Auto */
- NO_PROT, /* Do not use any protection */
- ERP_PROT, /* Protect all ERP frame exchanges */
- HT_PROT, /* Protect all HT frame exchanges */
- GF_PROT, /* Protect all GF frame exchanges */
+ AUTO_PROT = 0, /* Auto */
+ NO_PROT, /* Do not use any protection */
+ ERP_PROT, /* Protect all ERP frame exchanges */
+ HT_PROT, /* Protect all HT frame exchanges */
+ GF_PROT, /* Protect all GF frame exchanges */
} N_PROTECTION_MODE_T;
typedef enum {
@@ -374,29 +281,29 @@ typedef enum {
} G_PROTECTION_MODE_T;
typedef enum {
- HT_MIXED_MODE = 1,
+ HT_MIXED_MODE = 1,
HT_ONLY_20MHZ_MODE,
HT_ONLY_20_40MHZ_MODE,
} N_OPERATING_MODE_T;
typedef enum {
- NO_DETECT = 0,
- DETECT_ONLY = 1,
- DETECT_PROTECT = 2,
- DETECT_PROTECT_REPORT = 3,
+ NO_DETECT = 0,
+ DETECT_ONLY = 1,
+ DETECT_PROTECT = 2,
+ DETECT_PROTECT_REPORT = 3,
} N_OBSS_DETECTION_T;
typedef enum {
- RTS_CTS_NONHT_PROT = 0, /* RTS-CTS at non-HT rate */
- FIRST_FRAME_NONHT_PROT, /* First frame at non-HT rate */
- LSIG_TXOP_PROT, /* LSIG TXOP Protection */
- FIRST_FRAME_MIXED_PROT, /* First frame at Mixed format */
+ RTS_CTS_NONHT_PROT = 0, /* RTS-CTS at non-HT rate */
+ FIRST_FRAME_NONHT_PROT, /* First frame at non-HT rate */
+ LSIG_TXOP_PROT, /* LSIG TXOP Protection */
+ FIRST_FRAME_MIXED_PROT, /* First frame at Mixed format */
} N_PROTECTION_TYPE_T;
typedef enum {
- STATIC_MODE = 1,
- DYNAMIC_MODE = 2,
- MIMO_MODE = 3, /* power save disable */
+ STATIC_MODE = 1,
+ DYNAMIC_MODE = 2,
+ MIMO_MODE = 3, /* power save disable */
} N_SMPS_MODE_T;
typedef enum {
@@ -408,562 +315,632 @@ typedef enum {
SW_TRIGGER_ABORT,
} TX_ABORT_OPTION_T;
-typedef enum {
- WID_CHAR = 0,
- WID_SHORT = 1,
- WID_INT = 2,
- WID_STR = 3,
- WID_BIN_DATA = 4,
- WID_BIN = 5,
- WID_IP = 6,
- WID_ADR = 7,
- WID_UNDEF = 8,
- WID_TYPE_FORCE_32BIT = 0xFFFFFFFF
-
-} WID_TYPE_T, tenuWIDtype;
+enum WID_TYPE {
+ WID_CHAR = 0,
+ WID_SHORT = 1,
+ WID_INT = 2,
+ WID_STR = 3,
+ WID_BIN_DATA = 4,
+ WID_BIN = 5,
+ WID_IP = 6,
+ WID_ADR = 7,
+ WID_UNDEF = 8,
+ WID_TYPE_FORCE_32BIT = 0xFFFFFFFF
+};
typedef enum {
- WID_NIL = 0xffff,
-
-
- /* BSS Type */
- /* -------------------------------------------------------------- */
- /* Configuration : Infrastructure Independent Access Point */
- /* Values to set : 0 1 2 */
- /* -------------------------------------------------------------- */
- WID_BSS_TYPE = 0x0000,
-
- /* Transmit Rate */
- /* -------------------------------------------------------------- */
- /* Configuration : 1 2 5.5 11 6 9 12 18 24 36 48 54 */
- /* Values to set : 1 2 5 11 6 9 12 18 24 36 48 54 */
- /* -------------------------------------------------------------- */
- WID_CURRENT_TX_RATE = 0x0001,
-
- /* Channel */
- /* ------------------------------------------------------------------- */
- /* Configuration(g) : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
- /* Values to set : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
- /* -------------------------------------------------------------------- */
- WID_CURRENT_CHANNEL = 0x0002,
-
- /* Preamble */
- /* -------------------------------------------------------------- */
- /* Configuration : short long Auto */
- /* Values to set : 0 1 2 */
- /* -------------------------------------------------------------- */
- WID_PREAMBLE = 0x0003,
-
- /* 11g operating mode (ignored if 11g not present) */
- /* -------------------------------------------------------------- */
- /* Configuration : HighPerf Compat(RSet #1) Compat(RSet #2) */
- /* Values to set : 1 2 3 */
- /* -------------------------------------------------------------- */
- WID_11G_OPERATING_MODE = 0x0004,
-
- /* Mac status (response only) */
- /* -------------------------------------------------------------- */
- /* Configuration : disconnect connect */
- /* Values to get : 0 1 */
- /* -------------------------------------------------------------- */
- WID_STATUS = 0x0005,
-
- /* Scan type */
- /* -------------------------------------------------------------- */
- /* Configuration : Passive Scanning Active Scanning */
- /* Values to set : 0 1 */
- /* -------------------------------------------------------------- */
- WID_SCAN_TYPE = 0x0007,
-
- /* Key Id (WEP default key Id) */
- /* -------------------------------------------------------------- */
- /* Configuration : Any value between 0 to 3 */
- /* Values to set : Same value. Default is 0 */
- /* -------------------------------------------------------------- */
- WID_KEY_ID = 0x0009,
-
- /* QoS Enable */
- /* -------------------------------------------------------------- */
- /* Configuration : QoS Disable WMM Enable */
- /* Values to set : 0 1 */
- /* -------------------------------------------------------------- */
- WID_QOS_ENABLE = 0x000A,
-
- /* Power Management */
- /* ------------------------------------------------------------------ */
- /* Configuration : NO_POWERSAVE MIN_POWERSAVE MAX_POWERSAVE */
- /* Values to set : 0 1 2 */
- /* ------------------------------------------------------------------ */
- WID_POWER_MANAGEMENT = 0x000B,
-
- /* WEP/802 11I Configuration */
- /* ------------------------------------------------------------------ */
- /* Configuration : Disable WP40 WP104 WPA-AES WPA-TKIP RSN-AES RSN-TKIP */
- /* Values (0x) : 00 03 07 29 49 31 51 */
- /* */
- /* Configuration : WPA-AES+TKIP RSN-AES+TKIP */
- /* Values (0x) : 69 71 */
- /* ------------------------------------------------------------------ */
- WID_11I_MODE = 0x000C,
-
- /* WEP Configuration: Used in BSS STA mode only when WEP is enabled */
- /* ------------------------------------------------------------------ */
- /* Configuration : Open System Shared Key Any Type | 802.1x Auth */
- /* Values (0x) : 01 02 03 | BIT2 */
- /* ------------------------------------------------------------------ */
- WID_AUTH_TYPE = 0x000D,
-
- /* Site Survey Type */
- /* -------------------------------------------------------------- */
- /* Configuration : Values to set */
- /* Survey 1 Channel : 0 */
- /* survey all Channels : 1 */
- /* Disable Site Survey : 2 */
- /* -------------------------------------------------------------- */
- WID_SITE_SURVEY = 0x000E,
-
- /* Listen Interval */
- /* -------------------------------------------------------------- */
- /* Configuration : Any value between 1 to 255 */
- /* Values to set : Same value. Default is 3 */
- /* -------------------------------------------------------------- */
- WID_LISTEN_INTERVAL = 0x000F,
-
- /* DTIM Period */
- /* -------------------------------------------------------------- */
- /* Configuration : Any value between 1 to 255 */
- /* Values to set : Same value. Default is 3 */
- /* -------------------------------------------------------------- */
- WID_DTIM_PERIOD = 0x0010,
-
- /* ACK Policy */
- /* -------------------------------------------------------------- */
- /* Configuration : Normal Ack No Ack */
- /* Values to set : 0 1 */
- /* -------------------------------------------------------------- */
- WID_ACK_POLICY = 0x0011,
-
- /* Reset MAC (Set only) */
- /* -------------------------------------------------------------- */
- /* Configuration : Don't Reset Reset No Request */
- /* Values to set : 0 1 2 */
- /* -------------------------------------------------------------- */
- WID_RESET = 0x0012,
-
- /* Broadcast SSID Option: Setting this will adhere to "" SSID element */
- /* ------------------------------------------------------------------ */
- /* Configuration : Enable Disable */
- /* Values to set : 1 0 */
- /* ------------------------------------------------------------------ */
- WID_BCAST_SSID = 0x0015,
-
- /* Disconnect (Station) */
- /* ------------------------------------------------------------------ */
- /* Configuration : Association ID */
- /* Values to set : Association ID */
- /* ------------------------------------------------------------------ */
- WID_DISCONNECT = 0x0016,
-
- /* 11a Tx Power Level */
- /* -------------------------------------------------------------------- */
- /* Configuration : Sets TX Power (Higher the value greater the power) */
- /* Values to set : Any value between 0 and 63 (inclusive; Default is 48)*/
- /* -------------------------------------------------------------------- */
- WID_TX_POWER_LEVEL_11A = 0x0018,
-
- /* Group Key Update Policy Selection */
- /* -------------------------------------------------------------------- */
- /* Configuration : Disabled timeBased packetBased timePacketBased */
- /* Values to set : 1 2 3 4 */
- /* -------------------------------------------------------------------- */
- WID_REKEY_POLICY = 0x0019,
-
- /* Allow Short Slot */
- /* -------------------------------------------------------------- */
- /* Configuration : Disallow Short Slot Allow Short Slot */
- /* (Enable Only Long Slot) (Enable Short Slot if applicable)*/
- /* Values to set : 0 1 */
- /* -------------------------------------------------------------- */
- WID_SHORT_SLOT_ALLOWED = 0x001A,
-
- WID_PHY_ACTIVE_REG = 0x001B,
-
- /* 11b Tx Power Level */
- /* -------------------------------------------------------------------- */
- /* Configuration : Sets TX Power (Higher the value greater the power) */
- /* Values to set : Any value between 0 and 63 (inclusive; Default is 48)*/
- /* -------------------------------------------------------------------- */
- WID_TX_POWER_LEVEL_11B = 0x001D,
-
- /* Scan Request */
- /* -------------------------------------------------------------------- */
- /* Configuration : Request default scan */
- /* Values to set : 0 */
- /* -------------------------------------------------------------------- */
- WID_START_SCAN_REQ = 0x001E,
-
- /* Rssi (get only) */
- /* -------------------------------------------------------------------- */
- /* Configuration : */
- /* Values to get : Rssi value */
- /* -------------------------------------------------------------------- */
- WID_RSSI = 0x001F,
-
- /* Join Request */
- /* -------------------------------------------------------------------- */
- /* Configuration : Request to join */
- /* Values to set : index of scan result */
- /* -------------------------------------------------------------------- */
- WID_JOIN_REQ = 0x0020,
-
- WID_LINKSPEED = 0x0026,
-
- /* Enable User Control of TX Power */
- /* -------------------------------------------------------------------- */
- /* Configuration : Disable Enable */
- /* Values to set : 0 1 */
- /* -------------------------------------------------------------------- */
- WID_USER_CONTROL_ON_TX_POWER = 0x0027,
-
- WID_MEMORY_ACCESS_8BIT = 0x0029,
-
- /* Enable Auto RX Sensitivity feature */
- /* -------------------------------------------------------------------- */
- /* Configuration : Disable Enable */
- /* Values to set : 0 1 */
- /* -------------------------------------------------------------------- */
- WID_AUTO_RX_SENSITIVITY = 0x0032,
-
- /* Receive Buffer Based Ack */
- /* -------------------------------------------------------------------- */
- /* Configuration : Disable Enable */
- /* Values to set : 0 1 */
- /* -------------------------------------------------------------------- */
- WID_DATAFLOW_CONTROL = 0x0033,
-
- /* Scan Filter */
- /* -------------------------------------------------------------------- */
- /* Configuration : Class No filter AP only Station Only */
- /* Values to set : 0 1 2 */
- /* Configuration : Priority High Rssi Low Rssi Detect */
- /* Values to set : 0 0x4 0x08 */
- /* Configuration : Channel filter off filter on */
- /* Values to set : 0 0x10 */
- /* -------------------------------------------------------------------- */
- WID_SCAN_FILTER = 0x0036,
-
- /* Link Loss Threshold (measure in the beacon period) */
- /* -------------------------------------------------------------------- */
- /* Configuration : Any value between 10 and 254 (Set to 255 to disable it) */
- /* Values to set : Same value. Default is 10 */
- /* -------------------------------------------------------------------- */
- WID_LINK_LOSS_THRESHOLD = 0x0037,
-
- /*BugID_4978*/
- WID_ABORT_RUNNING_SCAN = 0x003E,
+ WID_NIL = 0xffff,
+
+ /*
+ * BSS Type
+ * -----------------------------------------------------------
+ * Configuration : Infrastructure Independent Access Point
+ * Values to set : 0 1 2
+ * -----------------------------------------------------------
+ */
+ WID_BSS_TYPE = 0x0000,
+
+ /*
+ * Transmit Rate
+ * -----------------------------------------------------------
+ * Configuration : 1 2 5.5 11 6 9 12 18 24 36 48 54
+ * Values to set : 1 2 5 11 6 9 12 18 24 36 48 54
+ * -----------------------------------------------------------
+ */
+ WID_CURRENT_TX_RATE = 0x0001,
+
+ /*
+ * Channel
+ * -----------------------------------------------------------
+ * Configuration(g) : 1 2 3 4 5 6 7 8 9 10 11 12 13 14
+ * Values to set : 1 2 3 4 5 6 7 8 9 10 11 12 13 14
+ * -----------------------------------------------------------
+ */
+ WID_CURRENT_CHANNEL = 0x0002,
+
+ /*
+ * Preamble
+ * -----------------------------------------------------------
+ * Configuration : short long Auto
+ * Values to set : 0 1 2
+ * -----------------------------------------------------------
+ */
+ WID_PREAMBLE = 0x0003,
+
+ /*
+ * 11g operating mode (ignored if 11g not present)
+ * -----------------------------------------------------------
+ * Configuration : HighPerf Compat(RSet #1) Compat(RSet #2)
+ * Values to set : 1 2 3
+ * -----------------------------------------------------------
+ */
+ WID_11G_OPERATING_MODE = 0x0004,
+
+ /*
+ * Mac status (response only)
+ * -----------------------------------------------------------
+ * Configuration : disconnect connect
+ * Values to get : 0 1
+ * -----------------------------------------------------------
+ */
+ WID_STATUS = 0x0005,
+
+ /*
+ * Scan type
+ * -----------------------------------------------------------
+ * Configuration : Passive Scanning Active Scanning
+ * Values to set : 0 1
+ * -----------------------------------------------------------
+ */
+ WID_SCAN_TYPE = 0x0007,
+
+ /*
+ * Key Id (WEP default key Id)
+ * -----------------------------------------------------------
+ * Configuration : Any value between 0 to 3
+ * Values to set : Same value. Default is 0
+ * -----------------------------------------------------------
+ */
+ WID_KEY_ID = 0x0009,
+
+ /*
+ * QoS Enable
+ * -----------------------------------------------------------
+ * Configuration : QoS Disable WMM Enable
+ * Values to set : 0 1
+ * -----------------------------------------------------------
+ */
+ WID_QOS_ENABLE = 0x000A,
+
+ /*
+ * Power Management
+ * -----------------------------------------------------------
+ * Configuration : NO_POWERSAVE MIN_POWERSAVE MAX_POWERSAVE
+ * Values to set : 0 1 2
+ * -----------------------------------------------------------
+ */
+ WID_POWER_MANAGEMENT = 0x000B,
+
+ /*
+ * WEP/802 11I Configuration
+ * -----------------------------------------------------------
+ * Configuration:Disable WP40 WP104 WPA-AES WPA-TKIP RSN-AES RSN-TKIP
+ * Values (0x) : 00 03 07 29 49 31 51
+ * Configuration:WPA-AES+TKIP RSN-AES+TKIP
+ * Values (0x) : 69 71
+ * -----------------------------------------------------------
+ */
+ WID_11I_MODE = 0x000C,
+
+ /*
+ * WEP Configuration: Used in BSS STA mode only when WEP is enabled
+ * -----------------------------------------------------------
+ * Configuration : Open System Shared Key Any Type | 802.1x Auth
+ * Values (0x) : 01 02 03 | BIT2
+ * -----------------------------------------------------------
+ */
+ WID_AUTH_TYPE = 0x000D,
+
+ /*
+ * Site Survey Type
+ * -----------------------------------------------------------
+ * Configuration : Values to set
+ * Survey 1 Channel : 0
+ * survey all Channels : 1
+ * Disable Site Survey : 2
+ * -----------------------------------------------------------
+ */
+ WID_SITE_SURVEY = 0x000E,
+
+ /*
+ * Listen Interval
+ * -----------------------------------------------------------
+ * Configuration : Any value between 1 to 255
+ * Values to set : Same value. Default is 3
+ * -----------------------------------------------------------
+ */
+ WID_LISTEN_INTERVAL = 0x000F,
+
+ /*
+ * DTIM Period
+ * -----------------------------------------------------------
+ * Configuration : Any value between 1 to 255
+ * Values to set : Same value. Default is 3
+ * -----------------------------------------------------------
+ */
+ WID_DTIM_PERIOD = 0x0010,
+
+ /*
+ * ACK Policy
+ * -----------------------------------------------------------
+ * Configuration : Normal Ack No Ack
+ * Values to set : 0 1
+ * -----------------------------------------------------------
+ */
+ WID_ACK_POLICY = 0x0011,
+
+ /*
+ * Reset MAC (Set only)
+ * -----------------------------------------------------------
+ * Configuration : Don't Reset Reset No Request
+ * Values to set : 0 1 2
+ * -----------------------------------------------------------
+ */
+ WID_RESET = 0x0012,
+
+ /*
+ * Broadcast SSID Option: Setting this will adhere to "" SSID element
+ * -----------------------------------------------------------
+ * Configuration : Enable Disable
+ * Values to set : 1 0
+ * -----------------------------------------------------------
+ */
+ WID_BCAST_SSID = 0x0015,
+
+ /*
+ * Disconnect (Station)
+ * -----------------------------------------------------------
+ * Configuration : Association ID
+ * Values to set : Association ID
+ * -----------------------------------------------------------
+ */
+ WID_DISCONNECT = 0x0016,
+
+ /*
+ * 11a Tx Power Level
+ * -----------------------------------------------------------
+ * Configuration : Sets TX Power (Higher the value greater the power)
+ * Values to set : Any value between 0 and 63 (inclusive Default 48)
+ * -----------------------------------------------------------
+ */
+ WID_TX_POWER_LEVEL_11A = 0x0018,
+
+ /*
+ * Group Key Update Policy Selection
+ * -----------------------------------------------------------
+ * Configuration : Disabled timeBased packetBased timePacketBased
+ * Values to set : 1 2 3 4
+ * -----------------------------------------------------------
+ */
+ WID_REKEY_POLICY = 0x0019,
+
+ /*
+ * Allow Short Slot
+ * -----------------------------------------------------------
+ * Configuration : Disallow Short Slot Allow Short Slot
+ * (Enable Only Long Slot) (Enable Short Slot if applicable)
+ * Values to set : 0 1
+ * -----------------------------------------------------------
+ */
+ WID_SHORT_SLOT_ALLOWED = 0x001A,
+
+ WID_PHY_ACTIVE_REG = 0x001B,
+
+ /*
+ * 11b Tx Power Level
+ * -----------------------------------------------------------
+ * Configuration : Sets TX Power (Higher the value greater the power)
+ * Values to set : Any value between 0 and 63 (inclusive Default 48)
+ * -----------------------------------------------------------
+ */
+ WID_TX_POWER_LEVEL_11B = 0x001D,
+
+ /*
+ * Scan Request
+ * -----------------------------------------------------------
+ * Configuration : Request default scan
+ * Values to set : 0
+ * -----------------------------------------------------------
+ */
+ WID_START_SCAN_REQ = 0x001E,
+
+ /*
+ * Rssi (get only)
+ * -----------------------------------------------------------
+ * Configuration :
+ * Values to get : Rssi value
+ * -----------------------------------------------------------
+ */
+ WID_RSSI = 0x001F,
+
+ /*
+ * Join Request
+ * -----------------------------------------------------------
+ * Configuration : Request to join
+ * Values to set : index of scan result
+ * -----------------------------------------------------------
+ */
+ WID_JOIN_REQ = 0x0020,
+
+ WID_LINKSPEED = 0x0026,
+
+ /*
+ * Enable User Control of TX Power
+ * -----------------------------------------------------------
+ * Configuration : Disable Enable
+ * Values to set : 0 1
+ * -----------------------------------------------------------
+ */
+ WID_USER_CONTROL_ON_TX_POWER = 0x0027,
+
+ WID_MEMORY_ACCESS_8BIT = 0x0029,
+
+ /*
+ * Enable Auto RX Sensitivity feature
+ * -----------------------------------------------------------
+ * Configuration : Disable Enable
+ * Values to set : 0 1
+ * -----------------------------------------------------------
+ */
+ WID_AUTO_RX_SENSITIVITY = 0x0032,
+
+ /*
+ * Receive Buffer Based Ack
+ * -----------------------------------------------------------
+ * Configuration : Disable Enable
+ * Values to set : 0 1
+ * -----------------------------------------------------------
+ */
+ WID_DATAFLOW_CONTROL = 0x0033,
+
+ /*
+ * Scan Filter
+ * -----------------------------------------------------------
+ * Configuration : Class No filter AP only Station Only
+ * Values to set : 0 1 2
+ * Configuration : Priority High Rssi Low Rssi Detect
+ * Values to set : 0 0x4 0x0
+ * Configuration : Channel filter off filter on
+ * Values to set : 0 0x10
+ * -----------------------------------------------------------
+ */
+ WID_SCAN_FILTER = 0x0036,
+
+ /*
+ * Link Loss Threshold (measure in the beacon period)
+ * -----------------------------------------------------------
+ * Configuration : Any value between 10 and 254(Set to 255 disable)
+ * Values to set : Same value. Default is 10
+ * -----------------------------------------------------------
+ */
+ WID_LINK_LOSS_THRESHOLD = 0x0037,
+
+ WID_ABORT_RUNNING_SCAN = 0x003E,
/* NMAC Character WID list */
- WID_WPS_START = 0x0043,
-
- /* Protection mode for MAC */
- /* -------------------------------------------------------------- */
- /* Configuration : Auto No protection ERP HT GF */
- /* Values to set : 0 1 2 3 4 */
- /* -------------------------------------------------------------- */
- WID_11N_PROT_MECH = 0x0080,
-
- /* ERP Protection type for MAC */
- /* -------------------------------------------------------------- */
- /* Configuration : Self-CTS RTS-CTS */
- /* Values to set : 0 1 */
- /* -------------------------------------------------------------- */
- WID_11N_ERP_PROT_TYPE = 0x0081,
-
- /* HT Option Enable */
- /* -------------------------------------------------------------- */
- /* Configuration : HT Enable HT Disable */
- /* Values to set : 1 0 */
- /* -------------------------------------------------------------- */
- WID_11N_ENABLE = 0x0082,
-
- /* 11n Operating mode (Note that 11g operating mode will also be */
- /* used in addition to this, if this is set to HT Mixed mode) */
- /* -------------------------------------------------------------- */
- /* Configuration : HT Mixed HT Only-20MHz HT Only-20/40MHz */
- /* Values to set : 1 2 3 */
- /* -------------------------------------------------------------- */
- WID_11N_OPERATING_MODE = 0x0083,
-
- /* 11n OBSS non-HT STA Detection flag */
- /* -------------------------------------------------------------- */
- /* Configuration : Do not detect */
- /* Values to set : 0 */
- /* Configuration : Detect, do not protect or report */
- /* Values to set : 1 */
- /* Configuration : Detect, protect and do not report */
- /* Values to set : 2 */
- /* Configuration : Detect, protect and report to other BSS */
- /* Values to set : 3 */
- /* -------------------------------------------------------------- */
- WID_11N_OBSS_NONHT_DETECTION = 0x0084,
-
- /* 11n HT Protection Type */
- /* -------------------------------------------------------------- */
- /* Configuration : RTS-CTS First Frame Exchange at non-HT-rate */
- /* Values to set : 0 1 */
- /* Configuration : LSIG TXOP First Frame Exchange in Mixed Fmt */
- /* Values to set : 2 3 */
- /* -------------------------------------------------------------- */
- WID_11N_HT_PROT_TYPE = 0x0085,
-
- /* 11n RIFS Protection Enable Flag */
- /* -------------------------------------------------------------- */
- /* Configuration : Disable Enable */
- /* Values to set : 0 1 */
- /* -------------------------------------------------------------- */
- WID_11N_RIFS_PROT_ENABLE = 0x0086,
-
- /* SMPS Mode */
- /* -------------------------------------------------------------- */
- /* Configuration : Static Dynamic MIMO (Power Save Disabled) */
- /* Values to set : 1 2 3 */
- /* -------------------------------------------------------------- */
- WID_11N_SMPS_MODE = 0x0087,
-
- /* Current transmit MCS */
- /* -------------------------------------------------------------- */
- /* Configuration : MCS Index for data rate */
- /* Values to set : 0 to 7 */
- /* -------------------------------------------------------------- */
- WID_11N_CURRENT_TX_MCS = 0x0088,
-
- WID_11N_PRINT_STATS = 0x0089,
-
- /* 11n Short GI Enable Flag */
- /* -------------------------------------------------------------- */
- /* Configuration : Disable Enable */
- /* Values to set : 0 1 */
- /* -------------------------------------------------------------- */
- WID_11N_SHORT_GI_ENABLE = 0x008D,
-
- /* 11n RIFS Enable Flag */
- /* -------------------------------------------------------------- */
- /* Configuration : Disable Enable */
- /* Values to set : 0 1 */
- /* -------------------------------------------------------------- */
- WID_RIFS_MODE = 0x0094,
-
- /* TX Abort Feature */
- /* -------------------------------------------------------------- */
- /* Configuration : Disable Self CTS Enable Self CTS */
- /* Values to set : 0 1 */
- /* Configuration : Disable TX Abort Enable TX Abort */
- /* Values to set : 2 3 */
- /* Configuration : Enable HW TX Abort Enable SW TX Abort */
- /* Values to set : 4 5 */
- /* -------------------------------------------------------------- */
- WID_TX_ABORT_CONFIG = 0x00A1,
-
- WID_REG_TSSI_11B_VALUE = 0x00A6,
- WID_REG_TSSI_11G_VALUE = 0x00A7,
- WID_REG_TSSI_11N_VALUE = 0x00A8,
- WID_TX_CALIBRATION = 0x00A9,
- WID_DSCR_TSSI_11B_VALUE = 0x00AA,
- WID_DSCR_TSSI_11G_VALUE = 0x00AB,
- WID_DSCR_TSSI_11N_VALUE = 0x00AC,
-
- /* Immediate Block-Ack Support */
- /* -------------------------------------------------------------- */
- /* Configuration : Disable Enable */
- /* Values to set : 0 1 */
- /* -------------------------------------------------------------- */
- WID_11N_IMMEDIATE_BA_ENABLED = 0x00AF,
-
- /* TXOP Disable Flag */
- /* -------------------------------------------------------------- */
- /* Configuration : Disable Enable */
- /* Values to set : 1 0 */
- /* -------------------------------------------------------------- */
- WID_11N_TXOP_PROT_DISABLE = 0x00B0,
-
-
- WID_TX_POWER_LEVEL_11N = 0x00B1,
+ WID_WPS_START = 0x0043,
+
+ /*
+ * Protection mode for MAC
+ * -----------------------------------------------------------
+ * Configuration : Auto No protection ERP HT GF
+ * Values to set : 0 1 2 3 4
+ * -----------------------------------------------------------
+ */
+ WID_11N_PROT_MECH = 0x0080,
+
+ /*
+ * ERP Protection type for MAC
+ * -----------------------------------------------------------
+ * Configuration : Self-CTS RTS-CTS
+ * Values to set : 0 1
+ * -----------------------------------------------------------
+ */
+ WID_11N_ERP_PROT_TYPE = 0x0081,
+
+ /*
+ * HT Option Enable
+ * -----------------------------------------------------------
+ * Configuration : HT Enable HT Disable
+ * Values to set : 1 0
+ * -----------------------------------------------------------
+ */
+ WID_11N_ENABLE = 0x0082,
+
+ /*
+ * 11n Operating mode (Note that 11g operating mode will also be
+ * used in addition to this, if this is set to HT Mixed mode)
+ * -----------------------------------------------------------
+ * Configuration : HT Mixed HT Only-20MHz HT Only-20/40MHz
+ * Values to set : 1 2 3
+ * -----------------------------------------------------------
+ */
+ WID_11N_OPERATING_MODE = 0x0083,
+
+ /*
+ * 11n OBSS non-HT STA Detection flag
+ * -----------------------------------------------------------
+ * Configuration : Do not detect
+ * Values to set : 0
+ * Configuration : Detect, do not protect or report
+ * Values to set : 1
+ * Configuration : Detect, protect and do not report
+ * Values to set : 2
+ * Configuration : Detect, protect and report to other BSS
+ * Values to set : 3
+ * -----------------------------------------------------------
+ */
+ WID_11N_OBSS_NONHT_DETECTION = 0x0084,
+
+ /*
+ * 11n HT Protection Type
+ * -----------------------------------------------------------
+ * Configuration : RTS-CTS First Frame Exchange at non-HT-rate
+ * Values to set : 0 1
+ * Configuration : LSIG TXOP First Frame Exchange in Mixed Fmt
+ * Values to set : 2 3
+ * -----------------------------------------------------------
+ */
+ WID_11N_HT_PROT_TYPE = 0x0085,
+
+ /*
+ * 11n RIFS Protection Enable Flag
+ * -----------------------------------------------------------
+ * Configuration : Disable Enable
+ * Values to set : 0 1
+ * -----------------------------------------------------------
+ */
+ WID_11N_RIFS_PROT_ENABLE = 0x0086,
+
+ /*
+ * SMPS Mode
+ * -----------------------------------------------------------
+ * Configuration : Static Dynamic MIMO (Power Save Disabled)
+ * Values to set : 1 2 3
+ * -----------------------------------------------------------
+ */
+ WID_11N_SMPS_MODE = 0x0087,
+
+ /*
+ * Current transmit MCS
+ * -----------------------------------------------------------
+ * Configuration : MCS Index for data rate
+ * Values to set : 0 to 7
+ * -----------------------------------------------------------
+ */
+ WID_11N_CURRENT_TX_MCS = 0x0088,
+
+ WID_11N_PRINT_STATS = 0x0089,
+
+ /*
+ * 11n Short GI Enable Flag
+ * -----------------------------------------------------------
+ * Configuration : Disable Enable
+ * Values to set : 0 1
+ * -----------------------------------------------------------
+ */
+ WID_11N_SHORT_GI_ENABLE = 0x008D,
+
+ /*
+ * 11n RIFS Enable Flag
+ * -----------------------------------------------------------
+ * Configuration : Disable Enable
+ * Values to set : 0 1
+ * -----------------------------------------------------------
+ */
+ WID_RIFS_MODE = 0x0094,
+
+ /*
+ * TX Abort Feature
+ * -----------------------------------------------------------
+ * Configuration : Disable Self CTS Enable Self CTS
+ * Values to set : 0 1
+ * Configuration : Disable TX Abort Enable TX Abort
+ * Values to set : 2 3
+ * Configuration : Enable HW TX Abort Enable SW TX Abort
+ * Values to set : 4 5
+ * -----------------------------------------------------------
+ */
+ WID_TX_ABORT_CONFIG = 0x00A1,
+
+ WID_REG_TSSI_11B_VALUE = 0x00A6,
+ WID_REG_TSSI_11G_VALUE = 0x00A7,
+ WID_REG_TSSI_11N_VALUE = 0x00A8,
+ WID_TX_CALIBRATION = 0x00A9,
+ WID_DSCR_TSSI_11B_VALUE = 0x00AA,
+ WID_DSCR_TSSI_11G_VALUE = 0x00AB,
+ WID_DSCR_TSSI_11N_VALUE = 0x00AC,
+
+ /*
+ * Immediate Block-Ack Support
+ * -----------------------------------------------------------
+ * Configuration : Disable Enable
+ * Values to set : 0 1
+ * -----------------------------------------------------------
+ */
+ WID_11N_IMMEDIATE_BA_ENABLED = 0x00AF,
+
+ /*
+ * TXOP Disable Flag
+ * -----------------------------------------------------------
+ * Configuration : Disable Enable
+ * Values to set : 1 0
+ * -----------------------------------------------------------
+ */
+ WID_11N_TXOP_PROT_DISABLE = 0x00B0,
+
+ WID_TX_POWER_LEVEL_11N = 0x00B1,
/* Custom Character WID list */
- WID_PC_TEST_MODE = 0x00C8,
- /*bug3819: */
+ WID_PC_TEST_MODE = 0x00C8,
/* SCAN Complete notification WID*/
WID_SCAN_COMPLETE = 0x00C9,
-#ifdef WILC_AP_EXTERNAL_MLME
- WID_DEL_BEACON = 0x00CA,
-#endif
-
- WID_LOGTerminal_Switch = 0x00CD,
- /* EMAC Short WID list */
- /* RTS Threshold */
- /* -------------------------------------------------------------- */
- /* Configuration : Any value between 256 to 2347 */
- /* Values to set : Same value. Default is 2347 */
- /* -------------------------------------------------------------- */
- WID_RTS_THRESHOLD = 0x1000,
-
- /* Fragmentation Threshold */
- /* -------------------------------------------------------------- */
- /* Configuration : Any value between 256 to 2346 */
- /* Values to set : Same value. Default is 2346 */
- /* -------------------------------------------------------------- */
- WID_FRAG_THRESHOLD = 0x1001,
-
- WID_SHORT_RETRY_LIMIT = 0x1002,
- WID_LONG_RETRY_LIMIT = 0x1003,
- WID_BEACON_INTERVAL = 0x1006,
- WID_MEMORY_ACCESS_16BIT = 0x1008,
- WID_RX_SENSE = 0x100B,
- WID_ACTIVE_SCAN_TIME = 0x100C,
- WID_PASSIVE_SCAN_TIME = 0x100D,
-
- WID_SITE_SURVEY_SCAN_TIME = 0x100E,
- WID_JOIN_START_TIMEOUT = 0x100F,
- WID_AUTH_TIMEOUT = 0x1010,
- WID_ASOC_TIMEOUT = 0x1011,
- WID_11I_PROTOCOL_TIMEOUT = 0x1012,
- WID_EAPOL_RESPONSE_TIMEOUT = 0x1013,
+ WID_DEL_BEACON = 0x00CA,
+
+ WID_LOGTerminal_Switch = 0x00CD,
+ /* EMAC Short WID list */
+ /* RTS Threshold */
+ /*
+ * -----------------------------------------------------------
+ * Configuration : Any value between 256 to 2347
+ * Values to set : Same value. Default is 2347
+ * -----------------------------------------------------------
+ */
+ WID_RTS_THRESHOLD = 0x1000,
+
+ /*
+ * Fragmentation Threshold
+ * -----------------------------------------------------------
+ * Configuration : Any value between 256 to 2346
+ * Values to set : Same value. Default is 2346
+ * -----------------------------------------------------------
+ */
+ WID_FRAG_THRESHOLD = 0x1001,
+
+ WID_SHORT_RETRY_LIMIT = 0x1002,
+ WID_LONG_RETRY_LIMIT = 0x1003,
+ WID_BEACON_INTERVAL = 0x1006,
+ WID_MEMORY_ACCESS_16BIT = 0x1008,
+ WID_RX_SENSE = 0x100B,
+ WID_ACTIVE_SCAN_TIME = 0x100C,
+ WID_PASSIVE_SCAN_TIME = 0x100D,
+
+ WID_SITE_SURVEY_SCAN_TIME = 0x100E,
+ WID_JOIN_START_TIMEOUT = 0x100F,
+ WID_AUTH_TIMEOUT = 0x1010,
+ WID_ASOC_TIMEOUT = 0x1011,
+ WID_11I_PROTOCOL_TIMEOUT = 0x1012,
+ WID_EAPOL_RESPONSE_TIMEOUT = 0x1013,
/* NMAC Short WID list */
- WID_11N_SIG_QUAL_VAL = 0x1085,
- WID_CCA_THRESHOLD = 0x1087,
+ WID_11N_SIG_QUAL_VAL = 0x1085,
+ WID_CCA_THRESHOLD = 0x1087,
/* Custom Short WID list */
/* EMAC Integer WID list */
- WID_FAILED_COUNT = 0x2000,
- WID_RETRY_COUNT = 0x2001,
- WID_MULTIPLE_RETRY_COUNT = 0x2002,
- WID_FRAME_DUPLICATE_COUNT = 0x2003,
- WID_ACK_FAILURE_COUNT = 0x2004,
- WID_RECEIVED_FRAGMENT_COUNT = 0x2005,
- WID_MCAST_RECEIVED_FRAME_COUNT = 0x2006,
- WID_FCS_ERROR_COUNT = 0x2007,
- WID_SUCCESS_FRAME_COUNT = 0x2008,
- WID_HUT_TX_COUNT = 0x200A,
- WID_TX_FRAGMENT_COUNT = 0x200B,
- WID_TX_MULTICAST_FRAME_COUNT = 0x200C,
- WID_RTS_SUCCESS_COUNT = 0x200D,
- WID_RTS_FAILURE_COUNT = 0x200E,
- WID_WEP_UNDECRYPTABLE_COUNT = 0x200F,
- WID_REKEY_PERIOD = 0x2010,
- WID_REKEY_PACKET_COUNT = 0x2011,
- WID_1X_SERV_ADDR = 0x2012,
- WID_STACK_IP_ADDR = 0x2013,
- WID_STACK_NETMASK_ADDR = 0x2014,
- WID_HW_RX_COUNT = 0x2015,
- WID_MEMORY_ADDRESS = 0x201E,
- WID_MEMORY_ACCESS_32BIT = 0x201F,
- WID_RF_REG_VAL = 0x2021,
-
+ WID_FAILED_COUNT = 0x2000,
+ WID_RETRY_COUNT = 0x2001,
+ WID_MULTIPLE_RETRY_COUNT = 0x2002,
+ WID_FRAME_DUPLICATE_COUNT = 0x2003,
+ WID_ACK_FAILURE_COUNT = 0x2004,
+ WID_RECEIVED_FRAGMENT_COUNT = 0x2005,
+ WID_MCAST_RECEIVED_FRAME_COUNT = 0x2006,
+ WID_FCS_ERROR_COUNT = 0x2007,
+ WID_SUCCESS_FRAME_COUNT = 0x2008,
+ WID_HUT_TX_COUNT = 0x200A,
+ WID_TX_FRAGMENT_COUNT = 0x200B,
+ WID_TX_MULTICAST_FRAME_COUNT = 0x200C,
+ WID_RTS_SUCCESS_COUNT = 0x200D,
+ WID_RTS_FAILURE_COUNT = 0x200E,
+ WID_WEP_UNDECRYPTABLE_COUNT = 0x200F,
+ WID_REKEY_PERIOD = 0x2010,
+ WID_REKEY_PACKET_COUNT = 0x2011,
+ WID_1X_SERV_ADDR = 0x2012,
+ WID_STACK_IP_ADDR = 0x2013,
+ WID_STACK_NETMASK_ADDR = 0x2014,
+ WID_HW_RX_COUNT = 0x2015,
+ WID_MEMORY_ADDRESS = 0x201E,
+ WID_MEMORY_ACCESS_32BIT = 0x201F,
+ WID_RF_REG_VAL = 0x2021,
/* NMAC Integer WID list */
- WID_11N_PHY_ACTIVE_REG_VAL = 0x2080,
+ WID_11N_PHY_ACTIVE_REG_VAL = 0x2080,
/* Custom Integer WID list */
- WID_GET_INACTIVE_TIME = 0x2084,
- WID_SET_DRV_HANDLER = 0X2085,
- WID_SET_OPERATION_MODE = 0X2086,
+ WID_GET_INACTIVE_TIME = 0x2084,
+ WID_SET_DRV_HANDLER = 0X2085,
+ WID_SET_OPERATION_MODE = 0X2086,
/* EMAC String WID list */
- WID_SSID = 0x3000,
- WID_FIRMWARE_VERSION = 0x3001,
- WID_OPERATIONAL_RATE_SET = 0x3002,
- WID_BSSID = 0x3003,
- WID_WEP_KEY_VALUE = 0x3004,
- WID_11I_PSK = 0x3008,
- WID_11E_P_ACTION_REQ = 0x3009,
- WID_1X_KEY = 0x300A,
- WID_HARDWARE_VERSION = 0x300B,
- WID_MAC_ADDR = 0x300C,
- WID_HUT_DEST_ADDR = 0x300D,
- WID_PHY_VERSION = 0x300F,
- WID_SUPP_USERNAME = 0x3010,
- WID_SUPP_PASSWORD = 0x3011,
- WID_SITE_SURVEY_RESULTS = 0x3012,
- WID_RX_POWER_LEVEL = 0x3013,
- WID_DEL_ALL_RX_BA = 0x3014,
- WID_SET_STA_MAC_INACTIVE_TIME = 0x3017,
- WID_ADD_WEP_KEY = 0x3019,
- WID_REMOVE_WEP_KEY = 0x301A,
- WID_ADD_PTK = 0x301B,
- WID_ADD_RX_GTK = 0x301C,
- WID_ADD_TX_GTK = 0x301D,
- WID_REMOVE_KEY = 0x301E,
- WID_ASSOC_REQ_INFO = 0x301F,
- WID_ASSOC_RES_INFO = 0x3020,
- WID_MANUFACTURER = 0x3026, /*Added for CAPI tool */
- WID_MODEL_NAME = 0x3027, /*Added for CAPI tool */
- WID_MODEL_NUM = 0x3028, /*Added for CAPI tool */
- WID_DEVICE_NAME = 0x3029, /*Added for CAPI tool */
+ WID_SSID = 0x3000,
+ WID_FIRMWARE_VERSION = 0x3001,
+ WID_OPERATIONAL_RATE_SET = 0x3002,
+ WID_BSSID = 0x3003,
+ WID_WEP_KEY_VALUE = 0x3004,
+ WID_11I_PSK = 0x3008,
+ WID_11E_P_ACTION_REQ = 0x3009,
+ WID_1X_KEY = 0x300A,
+ WID_HARDWARE_VERSION = 0x300B,
+ WID_MAC_ADDR = 0x300C,
+ WID_HUT_DEST_ADDR = 0x300D,
+ WID_PHY_VERSION = 0x300F,
+ WID_SUPP_USERNAME = 0x3010,
+ WID_SUPP_PASSWORD = 0x3011,
+ WID_SITE_SURVEY_RESULTS = 0x3012,
+ WID_RX_POWER_LEVEL = 0x3013,
+ WID_DEL_ALL_RX_BA = 0x3014,
+ WID_SET_STA_MAC_INACTIVE_TIME = 0x3017,
+ WID_ADD_WEP_KEY = 0x3019,
+ WID_REMOVE_WEP_KEY = 0x301A,
+ WID_ADD_PTK = 0x301B,
+ WID_ADD_RX_GTK = 0x301C,
+ WID_ADD_TX_GTK = 0x301D,
+ WID_REMOVE_KEY = 0x301E,
+ WID_ASSOC_REQ_INFO = 0x301F,
+ WID_ASSOC_RES_INFO = 0x3020,
+ WID_MANUFACTURER = 0x3026, /*Added for CAPI tool */
+ WID_MODEL_NAME = 0x3027, /*Added for CAPI tool */
+ WID_MODEL_NUM = 0x3028, /*Added for CAPI tool */
+ WID_DEVICE_NAME = 0x3029, /*Added for CAPI tool */
/* NMAC String WID list */
- WID_11N_P_ACTION_REQ = 0x3080,
- WID_HUT_TEST_ID = 0x3081,
- WID_PMKID_INFO = 0x3082,
- WID_FIRMWARE_INFO = 0x3083,
- #ifdef WILC_P2P
- WID_REGISTER_FRAME = 0x3084,
- #endif
- WID_DEL_ALL_STA = 0x3085,
- #ifdef WILC_P2P
- WID_REMAIN_ON_CHAN = 0x3996,
- #endif
- /*BugID_4156*/
- WID_SSID_PROBE_REQ = 0x3997,
- /*BugID_4124 WID to trigger modified Join Request using SSID and BSSID instead of bssListIdx (used by WID_JOIN_REQ)*/
- WID_JOIN_REQ_EXTENDED = 0x3998,
-
- /* BugID 4951: WID toset IP address in firmware */
- WID_IP_ADDRESS = 0x3999,
-
-
+ WID_11N_P_ACTION_REQ = 0x3080,
+ WID_HUT_TEST_ID = 0x3081,
+ WID_PMKID_INFO = 0x3082,
+ WID_FIRMWARE_INFO = 0x3083,
+ WID_REGISTER_FRAME = 0x3084,
+ WID_DEL_ALL_STA = 0x3085,
+ WID_REMAIN_ON_CHAN = 0x3996,
+ WID_SSID_PROBE_REQ = 0x3997,
+ WID_JOIN_REQ_EXTENDED = 0x3998,
+
+ WID_IP_ADDRESS = 0x3999,
/* Custom String WID list */
/* EMAC Binary WID list */
- WID_UAPSD_CONFIG = 0x4001,
- WID_UAPSD_STATUS = 0x4002,
- WID_WMM_AP_AC_PARAMS = 0x4003,
- WID_WMM_STA_AC_PARAMS = 0x4004,
- WID_NETWORK_INFO = 0x4005,
- WID_STA_JOIN_INFO = 0x4006,
- WID_CONNECTED_STA_LIST = 0x4007,
+ WID_UAPSD_CONFIG = 0x4001,
+ WID_UAPSD_STATUS = 0x4002,
+ WID_WMM_AP_AC_PARAMS = 0x4003,
+ WID_WMM_STA_AC_PARAMS = 0x4004,
+ WID_NETWORK_INFO = 0x4005,
+ WID_STA_JOIN_INFO = 0x4006,
+ WID_CONNECTED_STA_LIST = 0x4007,
/* NMAC Binary WID list */
- WID_11N_AUTORATE_TABLE = 0x4080,
+ WID_11N_AUTORATE_TABLE = 0x4080,
+ WID_SCAN_CHANNEL_LIST = 0x4084,
- /*Added here by Amr - BugID 4134*/
- WID_SCAN_CHANNEL_LIST = 0x4084,
+ WID_INFO_ELEMENT_PROBE = 0x4085,
+ WID_INFO_ELEMENT_ASSOCIATE = 0x4086,
+ WID_ADD_STA = 0X4087,
+ WID_REMOVE_STA = 0X4088,
+ WID_EDIT_STA = 0X4089,
+ WID_ADD_BEACON = 0x408a,
- /*BugID_3746 WID to add IE to be added in next probe request*/
- WID_INFO_ELEMENT_PROBE = 0x4085,
- /*BugID_3746 WID to add IE to be added in next associate request*/
- WID_INFO_ELEMENT_ASSOCIATE = 0x4086,
- WID_ADD_STA = 0X4087,
- WID_REMOVE_STA = 0X4088,
- WID_EDIT_STA = 0X4089,
- WID_ADD_BEACON = 0x408a,
-
- /* BugID 5108 */
WID_SETUP_MULTICAST_FILTER = 0x408b,
/* Miscellaneous WIDs */
- WID_ALL = 0x7FFE,
- WID_MAX = 0xFFFF
+ WID_ALL = 0x7FFE,
+ WID_MAX = 0xFFFF
} WID_T;
-int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup);
+int wilc_wlan_init(wilc_wlan_inp_t *inp);
void wilc_bus_set_max_speed(void);
void wilc_bus_set_default_speed(void);
-uint32_t wilc_get_chipid(uint8_t update);
-
+u32 wilc_get_chipid(u8 update);
#endif