|
|
@@ -1,691 +1,14 @@
|
|
|
/*
|
|
|
-** Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/gl_kal.c#3
|
|
|
+* This program is free software; you can redistribute it and/or modify
|
|
|
+* it under the terms of the GNU General Public License version 2 as
|
|
|
+* published by the Free Software Foundation.
|
|
|
+*
|
|
|
+* This program is distributed in the hope that it will be useful,
|
|
|
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
+* See http://www.gnu.org/licenses/gpl-2.0.html for more details.
|
|
|
*/
|
|
|
|
|
|
-/*! \file gl_kal.c
|
|
|
- \brief GLUE Layer will export the required procedures here for internal driver stack.
|
|
|
-
|
|
|
- This file contains all routines which are exported from GLUE Layer to internal
|
|
|
- driver stack.
|
|
|
-*/
|
|
|
-
|
|
|
-/*
|
|
|
-** Log: gl_kal.c
|
|
|
-**
|
|
|
-** 08 20 2012 yuche.tsai
|
|
|
-** NULL
|
|
|
-** Fix possible KE issue.
|
|
|
- *
|
|
|
- * 07 17 2012 yuche.tsai
|
|
|
- * NULL
|
|
|
- * Let netdev bring up.
|
|
|
- *
|
|
|
- * 07 17 2012 yuche.tsai
|
|
|
- * NULL
|
|
|
- * Compile no error before trial run.
|
|
|
- *
|
|
|
- * 06 13 2012 yuche.tsai
|
|
|
- * NULL
|
|
|
- * Update maintrunk driver.
|
|
|
- * Add support for driver compose assoc request frame.
|
|
|
- *
|
|
|
- * 05 31 2012 terry.wu
|
|
|
- * NULL
|
|
|
- * .
|
|
|
- *
|
|
|
- * 03 26 2012 cp.wu
|
|
|
- * [WCXRP00001187] [MT6620 Wi-Fi][Driver][Android] Add error handling while firmware image doesn't exist
|
|
|
- * invoke put_cred() after get_current_cred() calls.
|
|
|
- *
|
|
|
- * 03 07 2012 yuche.tsai
|
|
|
- * NULL
|
|
|
- * Fix compile error when WiFi Direct is off.
|
|
|
- *
|
|
|
- * 03 02 2012 terry.wu
|
|
|
- * NULL
|
|
|
- * Snc CFG80211 modification for ICS migration from branch 2.2.
|
|
|
- *
|
|
|
- * 02 20 2012 cp.wu
|
|
|
- * [WCXRP00001187] [MT6620 Wi-Fi][Driver][Android] Add error handling while firmware image doesn't exist
|
|
|
- * do not need to invoke free() while firmware image file doesn't exist
|
|
|
- *
|
|
|
- * 01 05 2012 wh.su
|
|
|
- * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function
|
|
|
- * Adding the related ioctl / wlan oid function to set the Tx power cfg.
|
|
|
- *
|
|
|
- * 01 02 2012 wh.su
|
|
|
- * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function
|
|
|
- * Adding the proto type function for set_int set_tx_power and get int get_ch_list.
|
|
|
- *
|
|
|
- * 11 21 2011 cp.wu
|
|
|
- * [WCXRP00001118] [MT6620 Wi-Fi][Driver] Corner case protections to pass Monkey testing
|
|
|
- * 1. wlanoidQueryBssIdList might be passed with a non-zero length but a NULL pointer of buffer
|
|
|
- * add more checking for such cases
|
|
|
- *
|
|
|
- * 2. kalSendComplete() might be invoked with a packet belongs to P2P network right after P2P is unregistered.
|
|
|
- * add some tweaking to protect such cases because that net device has become invalid.
|
|
|
- *
|
|
|
- * 11 18 2011 yuche.tsai
|
|
|
- * NULL
|
|
|
- * CONFIG P2P support RSSI query, default turned off.
|
|
|
- *
|
|
|
- * 11 16 2011 yuche.tsai
|
|
|
- * NULL
|
|
|
- * Avoid using work thread.
|
|
|
- *
|
|
|
- * 11 10 2011 cp.wu
|
|
|
- * [WCXRP00001098] [MT6620 Wi-Fi][Driver] Replace printk by DBG LOG macros in linux porting layer
|
|
|
- * 1. eliminaite direct calls to printk in porting layer.
|
|
|
- * 2. replaced by DBGLOG, which would be XLOG on ALPS platforms.
|
|
|
- *
|
|
|
- * 10 12 2011 wh.su
|
|
|
- * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP
|
|
|
- * adding the 802.11w related function and define .
|
|
|
- *
|
|
|
- * 09 23 2011 yuche.tsai
|
|
|
- * [WCXRP00000998] [Volunteer Patch][WiFi Direct][FW] P2P Social Channel & country domain issue
|
|
|
- * Regulation domain feature check in.
|
|
|
- *
|
|
|
- * 08 12 2011 cp.wu
|
|
|
- * [WCXRP00000913] [MT6620 Wi-Fi] create repository of source code dedicated for MT6620 E6 ASIC
|
|
|
- * load WIFI_RAM_CODE_E6 for MT6620 E6 ASIC.
|
|
|
- *
|
|
|
- * 07 18 2011 chinghwa.yu
|
|
|
- * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm
|
|
|
- * Add CMD/Event for RDD and BWCS.
|
|
|
- *
|
|
|
- * 06 13 2011 eddie.chen
|
|
|
- * [WCXRP00000779] [MT6620 Wi-Fi][DRV] Add tx rx statistics in linux and use netif_rx_ni
|
|
|
- * Add tx rx statistics and netif_rx_ni.
|
|
|
- *
|
|
|
- * 04 15 2011 chinghwa.yu
|
|
|
- * [WCXRP00000065] Update BoW design and settings
|
|
|
- * Add BOW short range mode.
|
|
|
- *
|
|
|
- * 04 12 2011 cp.wu
|
|
|
- * [WCXRP00000635] [MT6620 Wi-Fi][Driver] Clear pending security frames when QM clear pending data frames for dedicated
|
|
|
- * network type
|
|
|
- * clear pending security frames for dedicated network type when BSS is being deactivated/disconnected
|
|
|
- *
|
|
|
- * 04 08 2011 cp.wu
|
|
|
- * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer
|
|
|
- * correct i4TxPendingFrameNum decreasing.
|
|
|
- *
|
|
|
- * 03 23 2011 cp.wu
|
|
|
- * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer
|
|
|
- * apply multi-queue operation only for linux kernel > 2.6.26
|
|
|
- *
|
|
|
- * 03 21 2011 cp.wu
|
|
|
- * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer
|
|
|
- * portability for compatible with linux 2.6.12.
|
|
|
- *
|
|
|
- * 03 21 2011 cp.wu
|
|
|
- * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer
|
|
|
- * improve portability for awareness of early version of linux kernel and wireless extension.
|
|
|
- *
|
|
|
- * 03 18 2011 cp.wu
|
|
|
- * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage
|
|
|
- * after system running for a long period
|
|
|
- * refix ...
|
|
|
- *
|
|
|
- * 03 18 2011 cp.wu
|
|
|
- * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage
|
|
|
- * after system running for a long period
|
|
|
- * correct compiling warning/error.
|
|
|
- *
|
|
|
- * 03 18 2011 cp.wu
|
|
|
- * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage
|
|
|
- * after system running for a long period
|
|
|
- * add more robust fault tolerance design when pre-allocation failed. (rarely happen)
|
|
|
- *
|
|
|
- * 03 17 2011 cp.wu
|
|
|
- * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage
|
|
|
- * after system running for a long period
|
|
|
- * use pre-allocated buffer for storing enhanced interrupt response as well
|
|
|
- *
|
|
|
- * 03 16 2011 cp.wu
|
|
|
- * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage
|
|
|
- * after system running for a long period
|
|
|
- * 1. pre-allocate physical continuous buffer while module is being loaded
|
|
|
- * 2. use pre-allocated physical continuous buffer for TX/RX DMA transfer
|
|
|
- *
|
|
|
- * The windows part remained the same as before, but added similar APIs to hide the difference.
|
|
|
- *
|
|
|
- * 03 15 2011 cp.wu
|
|
|
- * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous
|
|
|
- * memory consumption
|
|
|
- * 1. deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK
|
|
|
- * 2. Use common coalescing buffer for both TX/RX directions
|
|
|
- *
|
|
|
- *
|
|
|
- * 03 14 2011 jeffrey.chang
|
|
|
- * [WCXRP00000546] [MT6620 Wi-Fi][MT6620 Wi-Fi][Driver] fix kernel build warning message
|
|
|
- * fix kernel build warning message
|
|
|
- *
|
|
|
- * 03 07 2011 terry.wu
|
|
|
- * [WCXRP00000521] [MT6620 Wi-Fi][Driver] Remove non-standard debug message
|
|
|
- * Toggle non-standard debug messages to comments.
|
|
|
- *
|
|
|
- * 03 06 2011 chinghwa.yu
|
|
|
- * [WCXRP00000065] Update BoW design and settings
|
|
|
- * Sync BOW Driver to latest person development branch version..
|
|
|
- *
|
|
|
- * 03 03 2011 jeffrey.chang
|
|
|
- * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue
|
|
|
- * support concurrent network
|
|
|
- *
|
|
|
- * 03 03 2011 jeffrey.chang
|
|
|
- * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue
|
|
|
- * modify net device relative functions to support multiple H/W queues
|
|
|
- *
|
|
|
- * 03 02 2011 cp.wu
|
|
|
- * [WCXRP00000503] [MT6620 Wi-Fi][Driver] Take RCPI brought by association response as initial RSSI right after
|
|
|
- * connection is built.
|
|
|
- * use RCPI brought by ASSOC-RESP after connection is built as initial RCPI to avoid using a uninitialized MAC-RX RCPI.
|
|
|
- *
|
|
|
- * 02 21 2011 cp.wu
|
|
|
- * [WCXRP00000482] [MT6620 Wi-Fi][Driver] Simplify logic for checking NVRAM existence in driver domain
|
|
|
- * simplify logic for checking NVRAM existence only once.
|
|
|
- *
|
|
|
- * 01 24 2011 cp.wu
|
|
|
- * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving
|
|
|
- * 1. add an extra counter for tracking pending forward frames.
|
|
|
- * 2. notify TX service thread as well when there is pending forward frame
|
|
|
- * 3. correct build errors leaded by introduction of Wi-Fi direct separation module
|
|
|
- *
|
|
|
- * 01 19 2011 cp.wu
|
|
|
- * [WCXRP00000371] [MT6620 Wi-Fi][Driver] make linux glue layer portable for Android 2.3.1 with Linux 2.6.35.7
|
|
|
- * add compile option to check linux version 2.6.35 for different usage of system API to improve portability
|
|
|
- *
|
|
|
- * 01 12 2011 cp.wu
|
|
|
- * [WCXRP00000357] [MT6620 Wi-Fi][Driver][Bluetooth over Wi-Fi] add another net device interface for BT AMP
|
|
|
- * implementation of separate BT_OVER_WIFI data path.
|
|
|
- *
|
|
|
- * 01 10 2011 cp.wu
|
|
|
- * [WCXRP00000349] [MT6620 Wi-Fi][Driver] make kalIoctl() of linux port as a thread safe API to avoid potential issues
|
|
|
- * due to multiple access
|
|
|
- * use mutex to protect kalIoctl() for thread safe.
|
|
|
- *
|
|
|
- * 11 26 2010 cp.wu
|
|
|
- * [WCXRP00000209] [MT6620 Wi-Fi][Driver] Modify NVRAM checking mechanism to warning only with necessary data field
|
|
|
- * checking
|
|
|
- * 1. NVRAM error is now treated as warning only, thus normal operation is still available but extra scan result used
|
|
|
- * to indicate user is attached
|
|
|
- * 2. DPD and TX-PWR are needed fields from now on, if these 2 fields are not available then warning message is shown
|
|
|
- *
|
|
|
- * 11 04 2010 wh.su
|
|
|
- * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID
|
|
|
- * adding the p2p random ssid support.
|
|
|
- *
|
|
|
- * 11 02 2010 jeffrey.chang
|
|
|
- * [WCXRP00000145] [MT6620 Wi-Fi][Driver] fix issue of byte endian in packet classifier which discards BoW packets
|
|
|
- * .
|
|
|
- *
|
|
|
- * 11 01 2010 cp.wu
|
|
|
- * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver]
|
|
|
- * Add implementation for querying current TX rate from firmware auto rate module
|
|
|
- * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead
|
|
|
- * 2) Remove CNM CH-RECOVER event handling
|
|
|
- * 3) cfg read/write API renamed with kal prefix for unified naming rules.
|
|
|
- *
|
|
|
- * 11 01 2010 yarco.yang
|
|
|
- * [WCXRP00000149] [MT6620 WI-Fi][Driver]Fine tune performance on MT6516 platform
|
|
|
- * Add code to run WlanIST in SDIO callback.
|
|
|
- *
|
|
|
- * 10 26 2010 cp.wu
|
|
|
- * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW]
|
|
|
- * Support NIC capability query command
|
|
|
- * 1) update NVRAM content template to ver 1.02
|
|
|
- * 2) add compile option for querying NIC capability (default: off)
|
|
|
- * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting
|
|
|
- * 4) correct auto-rate compiler error under linux (treat warning as error)
|
|
|
- * 5) simplify usage of NVRAM and REG_INFO_T
|
|
|
- * 6) add version checking between driver and firmware
|
|
|
- *
|
|
|
- * 10 25 2010 jeffrey.chang
|
|
|
- * [WCXRP00000129] [MT6620] [Driver] Kernel panic when rmmod module on Andriod platform
|
|
|
- * Remove redundant code which cause mismatch of power control release
|
|
|
- *
|
|
|
- * 10 25 2010 jeffrey.chang
|
|
|
- * [WCXRP00000129] [MT6620] [Driver] Kernel panic when rmmod module on Andriod platform
|
|
|
- * Remove redundant GLUE_HALT condfition to avoid unmatched release of power control
|
|
|
- *
|
|
|
- * 10 18 2010 jeffrey.chang
|
|
|
- * [WCXRP00000116] [MT6620 Wi-Fi][Driver] Refine the set_scan ioctl to resolve the Android UI hanging issue
|
|
|
- * refine the scan ioctl to prevent hanging of Android UI
|
|
|
- *
|
|
|
- * 10 18 2010 cp.wu
|
|
|
- * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver]
|
|
|
- * The mac address is all zero at android
|
|
|
- * complete implementation of Android NVRAM access
|
|
|
- *
|
|
|
- * 10 06 2010 cp.wu
|
|
|
- * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check
|
|
|
- * if there is NVRAM, then use MAC address on NVRAM as default MAC address.
|
|
|
- *
|
|
|
- * 10 06 2010 cp.wu
|
|
|
- * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning
|
|
|
- * code reorganization to improve isolation between GLUE and CORE layers.
|
|
|
- *
|
|
|
- * 10 05 2010 cp.wu
|
|
|
- * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check
|
|
|
- * 1) add NVRAM access API
|
|
|
- * 2) fake scanning result when NVRAM doesn't exist and/or version mismatch. (off by compiler option)
|
|
|
- * 3) add OID implementation for NVRAM read/write service
|
|
|
- *
|
|
|
- * 09 21 2010 cp.wu
|
|
|
- * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS
|
|
|
- * associated
|
|
|
- * Do a complete reset with STA-REC null checking for RF test re-entry
|
|
|
- *
|
|
|
- * 09 21 2010 kevin.huang
|
|
|
- * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning
|
|
|
- * Eliminate Linux Compile Warning
|
|
|
- *
|
|
|
- * 09 07 2010 wh.su
|
|
|
- * NULL
|
|
|
- * adding the code for beacon/probe req/ probe rsp wsc ie at p2p.
|
|
|
- *
|
|
|
- * 09 03 2010 kevin.huang
|
|
|
- * NULL
|
|
|
- * Refine #include sequence and solve recursive/nested #include issue
|
|
|
- *
|
|
|
- * 08 30 2010 cp.wu
|
|
|
- * NULL
|
|
|
- * API added: nicTxPendingPackets(), for simplifying porting layer
|
|
|
- *
|
|
|
- * 08 20 2010 yuche.tsai
|
|
|
- * NULL
|
|
|
- * Support second interface indicate when enabling P2P.
|
|
|
- *
|
|
|
- * 08 18 2010 yarco.yang
|
|
|
- * NULL
|
|
|
- * 1. Fixed HW checksum offload function not work under Linux issue.
|
|
|
- * 2. Add debug message.
|
|
|
- *
|
|
|
- * 08 16 2010 jeffrey.chang
|
|
|
- * NULL
|
|
|
- * remove redundant code which cause kernel panic
|
|
|
- *
|
|
|
- * 08 16 2010 cp.wu
|
|
|
- * NULL
|
|
|
- * P2P packets are now marked when being queued into driver, and identified later without checking MAC address
|
|
|
- *
|
|
|
- * 08 02 2010 jeffrey.chang
|
|
|
- * NULL
|
|
|
- * 1) modify tx service thread to avoid busy looping
|
|
|
- * 2) add spin lock declartion for linux build
|
|
|
- *
|
|
|
- * 07 29 2010 cp.wu
|
|
|
- * NULL
|
|
|
- * simplify post-handling after TX_DONE interrupt is handled.
|
|
|
- *
|
|
|
- * 07 28 2010 jeffrey.chang
|
|
|
- * NULL
|
|
|
- * 1) remove unused spinlocks
|
|
|
- * 2) enable encyption ioctls
|
|
|
- * 3) fix scan ioctl which may cause supplicant to hang
|
|
|
- *
|
|
|
- * 07 23 2010 cp.wu
|
|
|
- *
|
|
|
- * 1) re-enable AIS-FSM beacon timeout handling.
|
|
|
- * 2) scan done API revised
|
|
|
- *
|
|
|
- * 07 23 2010 jeffrey.chang
|
|
|
- *
|
|
|
- * add new KAL api
|
|
|
- *
|
|
|
- * 07 23 2010 jeffrey.chang
|
|
|
- *
|
|
|
- * bug fix: allocate regInfo when disabling firmware download
|
|
|
- *
|
|
|
- * 07 23 2010 jeffrey.chang
|
|
|
- *
|
|
|
- * use glue layer api to decrease or increase counter atomically
|
|
|
- *
|
|
|
- * 07 22 2010 jeffrey.chang
|
|
|
- *
|
|
|
- * modify tx thread and remove some spinlock
|
|
|
- *
|
|
|
- * 07 22 2010 jeffrey.chang
|
|
|
- *
|
|
|
- * use different spin lock for security frame
|
|
|
- *
|
|
|
- * 07 22 2010 jeffrey.chang
|
|
|
- *
|
|
|
- * add new spinlock
|
|
|
- *
|
|
|
- * 07 19 2010 jeffrey.chang
|
|
|
- *
|
|
|
- * add spinlock for pending security frame count
|
|
|
- *
|
|
|
- * 07 19 2010 jeffrey.chang
|
|
|
- *
|
|
|
- * adjust the timer unit to microsecond
|
|
|
- *
|
|
|
- * 07 19 2010 jeffrey.chang
|
|
|
- *
|
|
|
- * timer should return value greater than zero
|
|
|
- *
|
|
|
- * 07 19 2010 jeffrey.chang
|
|
|
- *
|
|
|
- * add kal api for scanning done
|
|
|
- *
|
|
|
- * 07 19 2010 jeffrey.chang
|
|
|
- *
|
|
|
- * modify cmd/data path for new design
|
|
|
- *
|
|
|
- * 07 19 2010 jeffrey.chang
|
|
|
- *
|
|
|
- * add new kal api
|
|
|
- *
|
|
|
- * 07 19 2010 jeffrey.chang
|
|
|
- *
|
|
|
- * for linux driver migration
|
|
|
- *
|
|
|
- * 07 19 2010 jeffrey.chang
|
|
|
- *
|
|
|
- * Linux port modification
|
|
|
- *
|
|
|
- * 07 08 2010 cp.wu
|
|
|
- *
|
|
|
- * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
|
|
|
- *
|
|
|
- * 06 23 2010 yarco.yang
|
|
|
- * [WPD00003837][MT6620]Data Path Refine
|
|
|
- * Merge g_arStaRec[] into adapter->arStaRec[]
|
|
|
- *
|
|
|
- * 06 21 2010 cp.wu
|
|
|
- * [WPD00003833][MT6620 and MT5931] Driver migration
|
|
|
- * change MAC address updating logic.
|
|
|
- *
|
|
|
- * 06 06 2010 kevin.huang
|
|
|
- * [WPD00003832][MT6620 5931] Create driver base
|
|
|
- * [MT6620 5931] Create driver base
|
|
|
- *
|
|
|
- * 06 01 2010 cp.wu
|
|
|
- * [WPD00001943]Create WiFi test driver framework on WinXP
|
|
|
- * remove unused files.
|
|
|
- *
|
|
|
- * 05 29 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * fix private ioctl for rftest
|
|
|
- *
|
|
|
- * 05 29 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * workaround for fixing request_firmware() failure on android 2.1
|
|
|
- *
|
|
|
- * 05 28 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * fix kernel panic when debug mode enabled
|
|
|
- *
|
|
|
- * 05 26 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * 1) Modify set mac address code
|
|
|
- * 2) remove power management macro
|
|
|
- *
|
|
|
- * 05 17 2010 cp.wu
|
|
|
- * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support
|
|
|
- * 1) add timeout handler mechanism for pending command packets
|
|
|
- * 2) add p2p add/removal key
|
|
|
- *
|
|
|
- * 05 14 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * Disable network interface after disassociation
|
|
|
- *
|
|
|
- * 05 10 2010 cp.wu
|
|
|
- * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support
|
|
|
- * fill network type field while doing frame identification.
|
|
|
- *
|
|
|
- * 05 07 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * prevent supplicant accessing driver during resume
|
|
|
- *
|
|
|
- * 04 27 2010 cp.wu
|
|
|
- * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
|
|
|
- * identify BT Over Wi-Fi Security frame and mark it as 802.1X frame
|
|
|
- *
|
|
|
- * 04 27 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * 1) fix firmware download bug
|
|
|
- * 2) remove query statistics for acelerating firmware download
|
|
|
- *
|
|
|
- * 04 27 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * follow Linux's firmware framework, and remove unused kal API
|
|
|
- *
|
|
|
- * 04 22 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- *
|
|
|
- * 1) modify rx path code for supporting Wi-Fi direct
|
|
|
- * 2) modify config.h since Linux dont need to consider retaining packet
|
|
|
- *
|
|
|
- * 04 21 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * add for private ioctl support
|
|
|
- *
|
|
|
- * 04 15 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * change firmware name
|
|
|
- *
|
|
|
- * 04 14 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * flush pending TX packets while unloading driver
|
|
|
- *
|
|
|
- * 04 14 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * Set driver own before handling cmd queue
|
|
|
- *
|
|
|
- * 04 14 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * 1) prGlueInfo->pvInformationBuffer and prGlueInfo->u4InformationBufferLength are no longer used
|
|
|
- * 2) fix ioctl
|
|
|
- *
|
|
|
- * 04 14 2010 cp.wu
|
|
|
- * [WPD00001943]Create WiFi test driver framework on WinXP
|
|
|
- * information buffer for query oid/ioctl is now buffered in prCmdInfo
|
|
|
- * * * * * * * instead of glue-layer variable to improve multiple oid/ioctl capability
|
|
|
- *
|
|
|
- * 04 13 2010 cp.wu
|
|
|
- * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
|
|
|
- * add framework for BT-over-Wi-Fi support.
|
|
|
- * * * * * * * * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler
|
|
|
- * * * * * * * * * * * * * * * * * * capability
|
|
|
- * * * * * * * * * * * * * * * * * * 2) command sequence number is now increased atomically
|
|
|
- * * * * * * * * * * * * * * * * * * 3) private data could be hold and taken use for other purpose
|
|
|
- *
|
|
|
- * 04 09 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * fix spinlock usage
|
|
|
- *
|
|
|
- * 04 09 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * add spinlock for i4TxPendingFrameNum access
|
|
|
- *
|
|
|
- * 04 09 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * 1) add spinlock
|
|
|
- * * 2) add KAPI for handling association info
|
|
|
- *
|
|
|
- * 04 09 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * fix spinlock usage
|
|
|
- *
|
|
|
- * 04 09 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * adding firmware download KAPI
|
|
|
- *
|
|
|
- * 04 07 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * Set MAC address from firmware
|
|
|
- *
|
|
|
- * 04 07 2010 cp.wu
|
|
|
- * [WPD00001943]Create WiFi test driver framework on WinXP
|
|
|
- * 1. free cmdinfo after command is emiited.
|
|
|
- * 2. for BoW frames, user priority is extracted from sk_buff directly.
|
|
|
- *
|
|
|
- * 04 07 2010 cp.wu
|
|
|
- * [WPD00001943]Create WiFi test driver framework on WinXP
|
|
|
- * finish non-glue layer access to glue variables
|
|
|
- *
|
|
|
- * 04 07 2010 cp.wu
|
|
|
- * [WPD00001943]Create WiFi test driver framework on WinXP
|
|
|
- * accessing to firmware load/start address, and access to OID handling information
|
|
|
- * * * are now handled in glue layer
|
|
|
- *
|
|
|
- * 04 07 2010 cp.wu
|
|
|
- * [WPD00001943]Create WiFi test driver framework on WinXP
|
|
|
- * rWlanInfo should be placed at adapter rather than glue due to most operations
|
|
|
- * * * * * * * are done in adapter layer.
|
|
|
- *
|
|
|
- * 04 07 2010 cp.wu
|
|
|
- * [WPD00001943]Create WiFi test driver framework on WinXP
|
|
|
- * eliminate direct access to prGlueInfo->eParamMediaStateIndicated from non-glue layer
|
|
|
- *
|
|
|
- * 04 06 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * (1)deliver the kalOidComplete status to upper layer
|
|
|
- * (2) fix spin lock
|
|
|
- *
|
|
|
- * 04 06 2010 cp.wu
|
|
|
- * [WPD00001943]Create WiFi test driver framework on WinXP
|
|
|
- * add KAL API: kalFlushPendingTxPackets(), and take use of the API
|
|
|
- *
|
|
|
- * 04 06 2010 cp.wu
|
|
|
- * [WPD00001943]Create WiFi test driver framework on WinXP
|
|
|
- * eliminate direct access to prGlueInfo->rWlanInfo.eLinkAttr.ucMediaStreamMode from non-glue layer.
|
|
|
- *
|
|
|
- * 04 06 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * add timeout check in the kalOidComplete
|
|
|
- *
|
|
|
- * 04 06 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * improve none-glue code portability
|
|
|
- *
|
|
|
- * 04 06 2010 cp.wu
|
|
|
- * [WPD00001943]Create WiFi test driver framework on WinXP
|
|
|
- * code refine: fgTestMode should be at adapter rather than glue due to the device/fw is also involved
|
|
|
- *
|
|
|
- * 04 06 2010 cp.wu
|
|
|
- * [WPD00001943]Create WiFi test driver framework on WinXP
|
|
|
- * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer
|
|
|
- *
|
|
|
- * 04 06 2010 cp.wu
|
|
|
- * [WPD00001943]Create WiFi test driver framework on WinXP
|
|
|
- * 1) for some OID, never do timeout expiration
|
|
|
- * * * 2) add 2 kal API for later integration
|
|
|
- *
|
|
|
- * 04 06 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * raising the priority of processing interrupt
|
|
|
- *
|
|
|
- * 04 01 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * Bug fix: the tx thread will cause starvation of MMC thread, and the interrupt will never come in
|
|
|
- *
|
|
|
- * 03 30 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * emulate NDIS Pending OID facility
|
|
|
- *
|
|
|
- * 03 28 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * adding secondary command queue for improving non-glue code portability
|
|
|
- *
|
|
|
- * 03 26 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * [WPD00003826] Initial import for Linux port
|
|
|
- * adding firmware download kal api
|
|
|
- *
|
|
|
- * 03 25 2010 cp.wu
|
|
|
- * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
|
|
|
- * add Bluetooth-over-Wifi frame header check
|
|
|
- *
|
|
|
- * 03 24 2010 jeffrey.chang
|
|
|
- * [WPD00003826]Initial import for Linux port
|
|
|
- * initial import for Linux port
|
|
|
-** \main\maintrunk.MT5921\50 2009-09-28 20:19:08 GMT mtk01090
|
|
|
-** Add private ioctl to carry OID structures. Restructure public/private ioctl interfaces to Linux kernel.
|
|
|
-** \main\maintrunk.MT5921\49 2009-08-18 22:56:44 GMT mtk01090
|
|
|
-** Add Linux SDIO (with mmc core) support.
|
|
|
-** Add Linux 2.6.21, 2.6.25, 2.6.26.
|
|
|
-** Fix compile warning in Linux.
|
|
|
-** \main\maintrunk.MT5921\48 2009-06-23 23:18:58 GMT mtk01090
|
|
|
-** Add build option BUILD_USE_EEPROM and compile option CFG_SUPPORT_EXT_CONFIG for NVRAM support
|
|
|
-** \main\maintrunk.MT5921\47 2008-11-19 11:55:43 GMT mtk01088
|
|
|
-** fixed some lint warning, and rename some variable with pre-fix to avoid the misunderstanding
|
|
|
-** \main\maintrunk.MT5921\46 2008-09-02 21:07:42 GMT mtk01461
|
|
|
-** Remove ASSERT(pvBuf) in kalIndicateStatusAndComplete(), this parameter can be NULL
|
|
|
-** \main\maintrunk.MT5921\45 2008-08-29 16:03:21 GMT mtk01088
|
|
|
-** remove non-used code for code review, add assert check
|
|
|
-** \main\maintrunk.MT5921\44 2008-08-21 00:32:49 GMT mtk01461
|
|
|
-** \main\maintrunk.MT5921\43 2008-05-30 20:27:02 GMT mtk01461
|
|
|
-** Rename KAL function
|
|
|
-** \main\maintrunk.MT5921\42 2008-05-30 15:47:29 GMT mtk01461
|
|
|
-** \main\maintrunk.MT5921\41 2008-05-30 15:13:04 GMT mtk01084
|
|
|
-** rename wlanoid
|
|
|
-** \main\maintrunk.MT5921\40 2008-05-29 14:15:14 GMT mtk01084
|
|
|
-** remove un-used KAL function
|
|
|
-** \main\maintrunk.MT5921\39 2008-05-03 15:17:30 GMT mtk01461
|
|
|
-** Move Query Media Status to GLUE
|
|
|
-** \main\maintrunk.MT5921\38 2008-04-24 11:59:44 GMT mtk01461
|
|
|
-** change awake queue threshold and remove code which mark #if 0
|
|
|
-** \main\maintrunk.MT5921\37 2008-04-17 23:06:35 GMT mtk01461
|
|
|
-** Add iwpriv support for AdHocMode setting
|
|
|
-** \main\maintrunk.MT5921\36 2008-04-08 15:38:56 GMT mtk01084
|
|
|
-** add KAL function to setting pattern search function enable/ disable
|
|
|
-** \main\maintrunk.MT5921\35 2008-04-01 23:53:13 GMT mtk01461
|
|
|
-** Add comment
|
|
|
-** \main\maintrunk.MT5921\34 2008-03-26 15:36:48 GMT mtk01461
|
|
|
-** Add update MAC Address for Linux
|
|
|
-** \main\maintrunk.MT5921\33 2008-03-18 11:49:34 GMT mtk01084
|
|
|
-** update function for initial value access
|
|
|
-** \main\maintrunk.MT5921\32 2008-03-18 10:25:22 GMT mtk01088
|
|
|
-** use kal update associate request at linux
|
|
|
-** \main\maintrunk.MT5921\31 2008-03-06 23:43:08 GMT mtk01385
|
|
|
-** 1. add Query Registry Mac address function.
|
|
|
-** \main\maintrunk.MT5921\30 2008-02-26 09:47:57 GMT mtk01084
|
|
|
-** modify KAL set network address/ checksum offload part
|
|
|
-** \main\maintrunk.MT5921\29 2008-02-12 23:26:53 GMT mtk01461
|
|
|
-** Add debug option - Packet Order for Linux
|
|
|
-** \main\maintrunk.MT5921\28 2008-01-09 17:54:43 GMT mtk01084
|
|
|
-** modify the argument of kalQueryPacketInfo()
|
|
|
-** \main\maintrunk.MT5921\27 2007-12-24 16:02:03 GMT mtk01425
|
|
|
-** 1. Revise csum offload
|
|
|
-** \main\maintrunk.MT5921\26 2007-11-30 17:03:36 GMT mtk01425
|
|
|
-** 1. Fix bugs
|
|
|
-**
|
|
|
-** \main\maintrunk.MT5921\25 2007-11-29 01:57:17 GMT mtk01461
|
|
|
-** Fix Windows RX multiple packet retain problem
|
|
|
-** \main\maintrunk.MT5921\24 2007-11-20 11:24:07 GMT mtk01088
|
|
|
-** <workaround> CR90, not doing the netif_carrier_off to let supplicant 1x pkt can be rcv at hardstattXmit
|
|
|
-** \main\maintrunk.MT5921\23 2007-11-09 16:36:44 GMT mtk01425
|
|
|
-** 1. Modify for CSUM offloading with Tx Fragment
|
|
|
-** \main\maintrunk.MT5921\22 2007-11-07 18:37:39 GMT mtk01461
|
|
|
-** Add Tx Fragmentation Support
|
|
|
-** \main\maintrunk.MT5921\21 2007-11-06 19:34:06 GMT mtk01088
|
|
|
-** add the WPS code, indicate the mgmt frame to upper layer
|
|
|
-** \main\maintrunk.MT5921\20 2007-11-02 01:03:21 GMT mtk01461
|
|
|
-** Unify TX Path for Normal and IBSS Power Save + IBSS neighbor learning
|
|
|
-** \main\maintrunk.MT5921\19 2007-10-30 11:59:38 GMT MTK01425
|
|
|
-** 1. Update wlanQueryInformation
|
|
|
-** \main\maintrunk.MT5921\18 2007-10-30 10:44:57 GMT mtk01425
|
|
|
-** 1. Refine multicast list code
|
|
|
-** 2. Refine TCP/IP csum offload code
|
|
|
-**
|
|
|
-** Revision 1.5 2007/07/17 13:01:18 MTK01088
|
|
|
-** add associate req and rsp function
|
|
|
-**
|
|
|
-** Revision 1.4 2007/07/13 05:19:19 MTK01084
|
|
|
-** provide timer set functions
|
|
|
-**
|
|
|
-** Revision 1.3 2007/06/27 02:18:51 MTK01461
|
|
|
-** Update SCAN_FSM, Initial(Can Load Module), Proc(Can do Reg R/W), TX API
|
|
|
-**
|
|
|
-** Revision 1.2 2007/06/25 06:16:24 MTK01461
|
|
|
-** Update illustrations, gl_init.c, gl_kal.c, gl_kal.h, gl_os.h and RX API
|
|
|
-**
|
|
|
-*/
|
|
|
|
|
|
/*******************************************************************************
|
|
|
* C O M P I L E R F L A G S
|
|
|
@@ -747,6 +70,15 @@ static UINT_32 pvIoBufferUsage;
|
|
|
static struct notifier_block wlan_fb_notifier;
|
|
|
void *wlan_fb_notifier_priv_data = NULL;
|
|
|
BOOLEAN wlan_fb_power_down = FALSE;
|
|
|
+
|
|
|
+static struct KAL_HALT_CTRL_T rHaltCtrl = {
|
|
|
+ .lock = __SEMAPHORE_INITIALIZER(rHaltCtrl.lock, 1),
|
|
|
+ .owner = NULL,
|
|
|
+ .fgHalt = TRUE,
|
|
|
+ .fgHeldByKalIoctl = FALSE,
|
|
|
+ .u4HoldStart = 0,
|
|
|
+};
|
|
|
+
|
|
|
/*******************************************************************************
|
|
|
* M A C R O S
|
|
|
********************************************************************************
|
|
|
@@ -1306,6 +638,8 @@ PVOID kalPacketAlloc(IN P_GLUE_INFO_T prGlueInfo, IN UINT_32 u4Size, OUT PUINT_8
|
|
|
|
|
|
if (prSkb)
|
|
|
*ppucData = (PUINT_8) (prSkb->data);
|
|
|
+ else
|
|
|
+ DBGLOG(RX, WARN, "kalPacketAlloc fail!!\n");
|
|
|
#if DBG
|
|
|
{
|
|
|
PUINT_32 pu4Head = (PUINT_32) &prSkb->cb[0];
|
|
|
@@ -1650,6 +984,7 @@ kalIndicateStatusAndComplete(IN P_GLUE_INFO_T prGlueInfo, IN WLAN_STATUS eStatus
|
|
|
struct cfg80211_bss *bss;
|
|
|
UINT_8 ucChannelNum;
|
|
|
P_BSS_DESC_T prBssDesc = NULL;
|
|
|
+ UINT_16 u2StatusCode = WLAN_STATUS_AUTH_TIMEOUT;
|
|
|
|
|
|
GLUE_SPIN_LOCK_DECLARATION();
|
|
|
|
|
|
@@ -1698,6 +1033,9 @@ kalIndicateStatusAndComplete(IN P_GLUE_INFO_T prGlueInfo, IN WLAN_STATUS eStatus
|
|
|
IEEE80211_BAND_5GHZ));
|
|
|
}
|
|
|
|
|
|
+ if (!prChannel)
|
|
|
+ DBGLOG(SCN, ERROR, "prChannel is NULL and ucChannelNum is %d\n", ucChannelNum);
|
|
|
+
|
|
|
/* ensure BSS exists */
|
|
|
bss = cfg80211_get_bss(priv_to_wiphy(prGlueInfo), prChannel, arBssid,
|
|
|
ssid.aucSsid, ssid.u4SsidLen, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
|
|
|
@@ -1773,7 +1111,8 @@ kalIndicateStatusAndComplete(IN P_GLUE_INFO_T prGlueInfo, IN WLAN_STATUS eStatus
|
|
|
P_WIFI_VAR_T prWifiVar = &prGlueInfo->prAdapter->rWifiVar;
|
|
|
UINT_16 u2DeauthReason = prWifiVar->arBssInfo[NETWORK_TYPE_AIS_INDEX].u2DeauthReason;
|
|
|
/* CFG80211 Indication */
|
|
|
- DBGLOG(AIS, INFO, "[wifi] %s cfg80211_disconnected\n", prGlueInfo->prDevHandler->name);
|
|
|
+ DBGLOG(AIS, INFO, "[wifi] %s cfg80211_disconnected: Reason=%d\n",
|
|
|
+ prGlueInfo->prDevHandler->name, u2DeauthReason);
|
|
|
cfg80211_disconnected(prGlueInfo->prDevHandler, u2DeauthReason, NULL, 0,
|
|
|
eStatus == WLAN_STATUS_MEDIA_DISCONNECT_LOCALLY, GFP_KERNEL);
|
|
|
}
|
|
|
@@ -1800,15 +1139,28 @@ kalIndicateStatusAndComplete(IN P_GLUE_INFO_T prGlueInfo, IN WLAN_STATUS eStatus
|
|
|
if (prScanRequest != NULL)
|
|
|
cfg80211_scan_done(prScanRequest, FALSE);
|
|
|
break;
|
|
|
- case WLAN_STATUS_CONNECT_INDICATION:
|
|
|
+
|
|
|
+ case WLAN_STATUS_JOIN_FAILURE:
|
|
|
+ if (pvBuf)
|
|
|
+ u2StatusCode = *(UINT_16 *)pvBuf;
|
|
|
+
|
|
|
+ prBssDesc = prGlueInfo->prAdapter->rWifiVar.rAisFsmInfo.prTargetBssDesc;
|
|
|
+
|
|
|
+ DBGLOG(INIT, INFO, "JOIN Failure: u2StatusCode=%d", u2StatusCode);
|
|
|
+ if (prBssDesc)
|
|
|
+ COPY_MAC_ADDR(arBssid, prBssDesc->aucBSSID);
|
|
|
+ else
|
|
|
+ COPY_MAC_ADDR(arBssid, prGlueInfo->prAdapter->rWifiVar.rConnSettings.aucBSSID);
|
|
|
+
|
|
|
/* indicate AIS Jion fail event
|
|
|
if (prGlueInfo->prDevHandler->ieee80211_ptr->sme_state == CFG80211_SME_CONNECTING) */
|
|
|
cfg80211_connect_result(prGlueInfo->prDevHandler,
|
|
|
- prGlueInfo->prAdapter->rWifiVar.rAisFsmInfo.prTargetBssDesc->aucBSSID,
|
|
|
+ arBssid,
|
|
|
prGlueInfo->aucReqIe,
|
|
|
prGlueInfo->u4ReqIeLength,
|
|
|
prGlueInfo->aucRspIe,
|
|
|
- prGlueInfo->u4RspIeLength, WLAN_STATUS_AUTH_TIMEOUT, GFP_KERNEL);
|
|
|
+ prGlueInfo->u4RspIeLength, u2StatusCode, GFP_KERNEL);
|
|
|
+ prGlueInfo->eParamMediaStateIndicated = PARAM_MEDIA_STATE_DISCONNECTED;
|
|
|
break;
|
|
|
|
|
|
#if 0
|
|
|
@@ -2399,16 +1751,18 @@ kalIoctl(IN P_GLUE_INFO_T prGlueInfo,
|
|
|
/* return WLAN_STATUS_ADAPTER_NOT_READY; */
|
|
|
/* } */
|
|
|
|
|
|
- if (down_interruptible(&g_halt_sem))
|
|
|
+ /* if wait longer than double OID timeout timer, then will show backtrace who held halt lock.
|
|
|
+ at this case, we will return kalIoctl failure because tx_thread may be hung */
|
|
|
+ if (kalHaltLock(2 * WLAN_OID_TIMEOUT_THRESHOLD))
|
|
|
return WLAN_STATUS_FAILURE;
|
|
|
|
|
|
- if (g_u4HaltFlag) {
|
|
|
- up(&g_halt_sem);
|
|
|
+ if (kalIsHalted()) {
|
|
|
+ kalHaltUnlock();
|
|
|
return WLAN_STATUS_ADAPTER_NOT_READY;
|
|
|
}
|
|
|
|
|
|
if (down_interruptible(&prGlueInfo->ioctl_sem)) {
|
|
|
- up(&g_halt_sem);
|
|
|
+ kalHaltUnlock();
|
|
|
return WLAN_STATUS_FAILURE;
|
|
|
}
|
|
|
|
|
|
@@ -2472,7 +1826,7 @@ kalIoctl(IN P_GLUE_INFO_T prGlueInfo,
|
|
|
#endif
|
|
|
DBGLOG(OID, TEMP, "kalIoctl: done\n");
|
|
|
up(&prGlueInfo->ioctl_sem);
|
|
|
- up(&g_halt_sem);
|
|
|
+ kalHaltUnlock();
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
@@ -2683,10 +2037,13 @@ int tx_thread(void *data)
|
|
|
P_GL_IO_REQ_T prIoReq = NULL;
|
|
|
P_QUE_T prTxQueue = NULL;
|
|
|
P_QUE_T prCmdQue = NULL;
|
|
|
-
|
|
|
+ P_RX_CTRL_T prRxCtrl;
|
|
|
+ P_SW_RFB_T prSwRfb = NULL;
|
|
|
+ int i, u4UninitRfbNum = 0;
|
|
|
int ret = 0;
|
|
|
|
|
|
BOOLEAN fgNeedHwAccess = FALSE;
|
|
|
+ BOOLEAN fgIsUninitRfb = FALSE;
|
|
|
|
|
|
struct sk_buff *prSkb = NULL;
|
|
|
|
|
|
@@ -2695,6 +2052,7 @@ int tx_thread(void *data)
|
|
|
|
|
|
prTxQueue = &prGlueInfo->rTxQueue;
|
|
|
prCmdQue = &prGlueInfo->rCmdQueue;
|
|
|
+ prRxCtrl = &prGlueInfo->prAdapter->rRxCtrl;
|
|
|
|
|
|
current->flags |= PF_NOFREEZE;
|
|
|
|
|
|
@@ -2910,6 +2268,26 @@ int tx_thread(void *data)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ /* Process unInitialized Rfb*/
|
|
|
+ if (prRxCtrl->rUnInitializedRfbList.u4NumElem > 0) {
|
|
|
+ u4UninitRfbNum = prRxCtrl->rUnInitializedRfbList.u4NumElem;
|
|
|
+ DBGLOG(INIT, INFO, "tx_thread :process uninitialziation RFB num=%d\n", u4UninitRfbNum);
|
|
|
+ for (i = 0; i < u4UninitRfbNum; i++) {
|
|
|
+ fgIsUninitRfb = FALSE;
|
|
|
+ KAL_ACQUIRE_SPIN_LOCK(prGlueInfo->prAdapter, SPIN_LOCK_RX_QUE);
|
|
|
+ QUEUE_REMOVE_HEAD(&prRxCtrl->rUnInitializedRfbList, prSwRfb, P_SW_RFB_T);
|
|
|
+ KAL_RELEASE_SPIN_LOCK(prGlueInfo->prAdapter, SPIN_LOCK_RX_QUE);
|
|
|
+ if (prSwRfb) {
|
|
|
+ if (nicRxSetupRFB(prGlueInfo->prAdapter, prSwRfb)) {
|
|
|
+ DBGLOG(INIT, ERROR, "Setup RFB Fail! insert uninit List!\n");
|
|
|
+ fgIsUninitRfb = TRUE;
|
|
|
+ }
|
|
|
+ nicRxReturnRFBwithUninit(prGlueInfo->prAdapter, prSwRfb, fgIsUninitRfb);
|
|
|
+ } else {
|
|
|
+ DBGLOG(INIT, ERROR, "prSwRfb is NULL!\n");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/* Process RX, In linux, we don't need to free sk_buff by ourself */
|
|
|
|
|
|
@@ -3904,7 +3282,7 @@ kalIndicateBssInfo(IN P_GLUE_INFO_T prGlueInfo,
|
|
|
ieee80211_get_channel(wiphy, ieee80211_channel_to_frequency(ucChannelNum, IEEE80211_BAND_5GHZ));
|
|
|
}
|
|
|
|
|
|
- if (prChannel != NULL && (prGlueInfo->prScanRequest != NULL || prGlueInfo->prSchedScanRequest != NULL)) {
|
|
|
+ if (prChannel != NULL && prGlueInfo->fgIsRegistered == TRUE) {
|
|
|
struct cfg80211_bss *bss;
|
|
|
#if CFG_SUPPORT_TSF_USING_BOOTTIME
|
|
|
struct ieee80211_mgmt *prMgmtFrame = (struct ieee80211_mgmt *)pucBeaconProbeResp;
|
|
|
@@ -4476,6 +3854,73 @@ BOOLEAN kalIsWakeupByWlan(P_ADAPTER_T prAdapter)
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
+INT_32 kalHaltLock(UINT_32 waitMs)
|
|
|
+{
|
|
|
+ INT_32 i4Ret = 0;
|
|
|
+
|
|
|
+ if (waitMs) {
|
|
|
+ i4Ret = down_timeout(&rHaltCtrl.lock, MSEC_TO_JIFFIES(waitMs));
|
|
|
+ if (!i4Ret)
|
|
|
+ goto success;
|
|
|
+ if (i4Ret != -ETIME)
|
|
|
+ return i4Ret;
|
|
|
+ if (rHaltCtrl.fgHeldByKalIoctl) {
|
|
|
+ P_GLUE_INFO_T prGlueInfo = NULL;
|
|
|
+
|
|
|
+ wlanExportGlueInfo(&prGlueInfo);
|
|
|
+
|
|
|
+ DBGLOG(INIT, ERROR,
|
|
|
+ "kalIoctl was executed longer than %u ms, show backtrace of tx_thread!\n",
|
|
|
+ kalGetTimeTick() - rHaltCtrl.u4HoldStart);
|
|
|
+ if (prGlueInfo)
|
|
|
+ show_stack(prGlueInfo->main_thread, NULL);
|
|
|
+ } else {
|
|
|
+ DBGLOG(INIT, ERROR, "halt lock held by %s pid %d longer than %u ms!\n",
|
|
|
+ rHaltCtrl.owner->comm, rHaltCtrl.owner->pid,
|
|
|
+ kalGetTimeTick() - rHaltCtrl.u4HoldStart);
|
|
|
+ show_stack(rHaltCtrl.owner, NULL);
|
|
|
+ }
|
|
|
+ return i4Ret;
|
|
|
+ }
|
|
|
+ down(&rHaltCtrl.lock);
|
|
|
+success:
|
|
|
+ rHaltCtrl.owner = current;
|
|
|
+ rHaltCtrl.u4HoldStart = kalGetTimeTick();
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+INT_32 kalHaltTryLock(VOID)
|
|
|
+{
|
|
|
+ INT_32 i4Ret = 0;
|
|
|
+
|
|
|
+ i4Ret = down_trylock(&rHaltCtrl.lock);
|
|
|
+ if (i4Ret)
|
|
|
+ return i4Ret;
|
|
|
+ rHaltCtrl.owner = current;
|
|
|
+ rHaltCtrl.u4HoldStart = kalGetTimeTick();
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+VOID kalHaltUnlock(VOID)
|
|
|
+{
|
|
|
+ if (kalGetTimeTick() - rHaltCtrl.u4HoldStart > WLAN_OID_TIMEOUT_THRESHOLD * 2 &&
|
|
|
+ rHaltCtrl.owner)
|
|
|
+ DBGLOG(INIT, ERROR, "process %s pid %d hold halt lock longer than 4s!\n",
|
|
|
+ rHaltCtrl.owner->comm, rHaltCtrl.owner->pid);
|
|
|
+ rHaltCtrl.owner = NULL;
|
|
|
+ up(&rHaltCtrl.lock);
|
|
|
+}
|
|
|
+
|
|
|
+VOID kalSetHalted(BOOLEAN fgHalt)
|
|
|
+{
|
|
|
+ rHaltCtrl.fgHalt = fgHalt;
|
|
|
+}
|
|
|
+
|
|
|
+BOOLEAN kalIsHalted(VOID)
|
|
|
+{
|
|
|
+ return rHaltCtrl.fgHalt;
|
|
|
+}
|
|
|
+
|
|
|
VOID kalPerMonDump(IN P_GLUE_INFO_T prGlueInfo)
|
|
|
{
|
|
|
struct PERF_MONITOR_T *prPerMonitor;
|
|
|
@@ -4715,35 +4160,42 @@ static int wlan_fb_notifier_callback(struct notifier_block *self, unsigned long
|
|
|
{
|
|
|
struct fb_event *evdata = data;
|
|
|
INT_32 blank;
|
|
|
- P_GLUE_INFO_T prGlueInfo = NULL;
|
|
|
+ P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)wlan_fb_notifier_priv_data;
|
|
|
|
|
|
|
|
|
/* If we aren't interested in this event, skip it immediately ... */
|
|
|
if (event != FB_EVENT_BLANK)
|
|
|
return 0;
|
|
|
|
|
|
- down(&g_halt_sem);
|
|
|
+ if (prGlueInfo == NULL)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ if (kalHaltTryLock())
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ if (kalIsHalted())
|
|
|
+ goto end;
|
|
|
|
|
|
- prGlueInfo = (P_GLUE_INFO_T)wlan_fb_notifier_priv_data;
|
|
|
blank = *(INT_32 *)evdata->data;
|
|
|
|
|
|
switch (blank) {
|
|
|
case FB_BLANK_UNBLANK:
|
|
|
- if (!g_u4HaltFlag)
|
|
|
+ if (!kalIsHalted())
|
|
|
kalPerMonEnable(prGlueInfo);
|
|
|
wlan_fb_power_down = FALSE;
|
|
|
break;
|
|
|
case FB_BLANK_POWERDOWN:
|
|
|
wlan_fb_power_down = TRUE;
|
|
|
- if (!g_u4HaltFlag)
|
|
|
+ if (!kalIsHalted())
|
|
|
kalPerMonDisable(prGlueInfo);
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
- up(&g_halt_sem);
|
|
|
+end:
|
|
|
+ kalHaltUnlock();
|
|
|
return 0;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
INT_32 kalFbNotifierReg(IN P_GLUE_INFO_T prGlueInfo)
|