Commit graph

31218 commits

Author SHA1 Message Date
Arend van Spriel
cf44066a38 brcm80211: fmac: use spinlock calls saving irq flags in brcmf_enq_event()
This function is executed within irq context. The call spin_unlock_irq
does enable interrupts which is not desired in the irq context. This patch
replaces them using the spin_loc_irqsave and spin_unlock_irqrestore
functions.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Kan Yan <kanyan@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:48:53 -05:00
Arend van Spriel
bcbec9e777 brcm80211: fmac: change allocation flag in brcmf_enq_event() function
As the function is called from atomic context it should not do the
kzalloc call with GFP_KERNEL.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Kan Yan <kanyan@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:48:52 -05:00
Arend van Spriel
1bb1f38462 brcm80211: fmac: update bus state in common driver part
The bus state is updated in the sdio bus init function, but it is
better to do it when the brcmf_bus_start() function is completed
successfully. The brcmf_netdev_open() function will return -EAGAIN
until the state is updated instead of calling brcmf_bus_start() to
avoid reentering that function.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:48:52 -05:00
Arend van Spriel
c0e89f084b brcm80211: fmac: only return success in brcmf_sdbrcm_bus_init() when true
The function brcmf_sdbrcm_bus_init() always returned success except for
firmware download failure. However, also when enabling SDIO function 2
is failing the function should return failure. This patch fixes that.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:48:51 -05:00
Arend van Spriel
f3d7cdc3b4 brcm80211: fmac: move module entry points to dhd_linux.c
The module_init/exit functions are moved to dhd_linux.c to prepare
for supporting multiple host interface types.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:48:51 -05:00
Arend van Spriel
0a332e4678 brcm80211: fmac: use specific types in struct brcmf_bus
The fields bus_priv and drvr are defined as void pointer. It is
preferred to have specific types for compiler type checking. To
prepare for other bus types the bus_priv field is defined as a
union containing the sdio bus private structure reference.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:48:51 -05:00
Franky Lin
89fdb468e2 brcm80211: fmac: make sure cancel_work_sync only called after INIT_WORK
INIT_WORK only gets called after brcmf_proto_attach returns
success. This dependency should be annotated in brcmf_detach to
avoid any error.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:48:51 -05:00
Arend van Spriel
2315992c2a brcm80211: fmac: resolve smatch issues in brcmfmac code
This patch resolves the following smatch issues:

wl_cfg80211.c +1377 brcmf_cfg80211_connect(65) warn: min_t truncates
here '(sme->ssid_len)' (4294967295 vs 9223372036854775807)
dhd_sdio.c +1275 brcmf_sdbrcm_rxglom(156) warn: min_t truncates here
'(pfirst->len)' (2147483647 vs 4294967295)
dhd_sdio.c +1457 brcmf_sdbrcm_rxglom(338) warn: min_t truncates here
'(pfirst->len)' (2147483647 vs 4294967295)
bcmsdh_sdmmc.c +300 brcmf_sdioh_request_buffer(10) warn: variable
dereferenced before check 'pkt' (see line 295)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:48:51 -05:00
Arend van Spriel
137dabed34 brcm80211: smac: remove smatch warnings from brcmsmac code
The patch fixes following smatch warnings:

main.c +2902 brcms_b_read_objmem(11) info: ignoring unreachable code.
mac80211_if.c +1146 brcms_suspend(8) error: we previously assumed 'wl'
could be null (see line 1145)
srom.c +641 _initvars_srom_pci(16) error: potential null dereference
'entry'.  (kzalloc returns null)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:48:50 -05:00
Arend van Spriel
5e379203c7 brcm80211: smac: fix endless retry of A-MPDU transmissions
The A-MPDU code checked against a retry limit, but it was using
the wrong variable to do so. This patch fixes this to assure
proper retry mechanism.

This problem had a side-effect causing the mac80211 flush callback
to remain waiting forever as well. That side effect has been fixed
by commit by Stanislaw Gruszka:

commit f96b08a7e6
Date:   Tue Jan 17 12:38:50 2012 +0100

    brcmsmac: fix tx queue flush infinite loop

    Reference:
    https://bugzilla.kernel.org/show_bug.cgi?id=42576

Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:48:50 -05:00
Arend van Spriel
01343537e6 brcm80211: smac: remove redundant assignments from txpwrctrl_pwr_setup_nphy
The function wlc_phy_txpwrctrl_pwr_setup_nphy() does assign a local
variable target_pwr_qtrdbm in several code paths, but in the end all
code paths are coming to an assignment of that variable which does
override all previous. So those early and redundant assignments have
been removed.

Reported-by: Larry Finger <Larry.Finger@lwfinger.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:48:50 -05:00
Arend van Spriel
1570e53c14 brcm80211: smac: fix unintended fallthru in wlc_phy_radio_init_2057()
The radio initialization for 2057 rev 5 was using the incorrect
register table for the initialization. This patch fixes that.

Reported-by: Larry Finger <Larry.Finger@lwfinger.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:48:50 -05:00
Tristan Pourcelot
e1fa746029 Correcting typos in rtlwifi/base.c
This patch correct some typos in a comment.

Signed-off-by: Tristan Pourcelot <tristan.pourcelot@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:48:49 -05:00
Larry Finger
02b6ab0ab9 rtlwifi: rtl8192c-common: rtl8192se: rtl8192de: Simplify if statements
Devendra Naga <devendra.aaru@gmail.com> submitted a patch for rtl8192c_common
to change the tests in _rtl92c_store_pwrIndex_diffrate_offset(). This patch
improves on those changes and applies similar modifications to drivers rtl8192se
and rtl8192de.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:47:38 -05:00
John Li
b6df7f1d3b rt2x00:Add debug message for new chipset
Signed-off-by: John Li <chen-yang.li@mediatek.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:47:37 -05:00
John Li
6adaea3062 rt2x00:Fix typo
Signed-off-by: John Li <chen-yang.li@mediatek.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:47:37 -05:00
Devendra.Naga
2bd02d9aac rtlwifi/rtl8192c: in _rtl92c_phy_calculate_bit_shift remove comparing bitmask against 1
in _rtl92c_phy_calculate_bit_shift everytime the right shifted bitmask
is AND with 1 and compared against 1. i.e.
       if ((bitmask >> i) & 0x1 == 1)
               break;
which in the if condition is anyway becomes a 1 or 0.

Signed-off-by: Devendra.Naga <devendra.aaru@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:47:37 -05:00
John W. Linville
8715d941b2 Merge branch 'for-linville' of git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx 2012-02-22 14:44:50 -05:00
Meenakshi Venkataraman
758f555f5e iwlwifi: enable receiving beacons when not associated
If the firmware implements beacon filtering,
beacons are filtered when not associated. This causes
association failures on channels marked passive.

Enabling this flag indicates to the firmware to allow
the beacons to pass through when not associated only.

Signed-off-by: Meenakshi Venkataraman <meenakshi.venkataraman@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:58:39 -08:00
Wey-Yi Guy
dd63b84eb4 iwlwifi: remove un-necessary return
Already return 0, change to void

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:58:31 -08:00
Emmanuel Grumbach
dae66d0d2e iwlwifi: SRAM size moves from hw_params to cfg
This will allow to set the hw_params after we fetch the uCode.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:58:19 -08:00
Don Fry
4a986777a5 iwlwifi: save ucode capabilities in iwl_fw
The capabilities parsed from the ucode file are never saved.  Save
them in the iwl_fw structure.

Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:56:33 -08:00
Don Fry
06e03f8ce9 iwlwifi: changes args to iwl_nic for firmware operations
Remove the references to iwl_priv from the firmware request and
parsing routines.  They are generic to the nic.

Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:56:24 -08:00
Emmanuel Grumbach
69655ebf1a iwlwifi: the transport knows its state
This allows to handle races such as Tx packets on their way to be
sent although the transport has been stopped already.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:56:16 -08:00
Don Fry
8655112d91 iwlwifi: move event and err pointers to iwl_nic
Move the ucode offset pointers to the iwl_nic as they are nic related.

Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:56:08 -08:00
Emmanuel Grumbach
60396183a4 iwlwifi: document the transport layer
Fix a few typos in the existing comments too.
Enforce the comments with might_sleep.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:55:17 -08:00
Amit Beka
edabfa914d iwlwifi: send testmode hcmd reply with rx header
When a host command is sent through testmode, the whole
reply (including rx header) is returned to the user, and not
only the payload of the rx.
Before this commit the length was buggy - the reply contained 4 bytes
after the end of the payload.

Signed-off-by: Amit Beka <amit.beka@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:55:10 -08:00
Amit Beka
858b7c74dd iwlwifi: fixes to testmode indirect access
Fixed casting of buffer addressing, and added size to
the read method, like in __iwl_read_prph.

Signed-off-by: Amit Beka <amit.beka@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:55:00 -08:00
Emmanuel Grumbach
637d792591 iwlwifi: use enhance_sensitivity from iwl_fw
Remove another dependency between the nic layer and the iwl_priv
struct.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:54:51 -08:00
Emmanuel Grumbach
6d4dec7ba4 iwlwifi: iwl_set_hw_params returns always 0
Remove the return value.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:53:41 -08:00
Emmanuel Grumbach
78e5a46432 iwlwifi: kill iwl_down and s/__iwl_down/iwl_down
iwl_down was just a wrapper around __iwl_down which was called from
one place only. Replace it to direct call to iwl_down. Add lockdep
warning in iwl_down to ensure it was called with the mutex held.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:36:39 -08:00
Don Fry
655ccceb59 iwlwifi: change args to ucode routines
Change the prameters to the ucode (de)allocate routines to iwl_nic as
they are not transport operations.

Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:28:29 -08:00
Don Fry
6516174d1a iwlwifi: Move ucode pointers to iwl_fw
The ucode image is a ucode related thing not a transport one.  Move them.

Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:28:20 -08:00
Don Fry
96502ceb1c iwlwifi: move firmware_loading_complete to iwl_nic
Move firmware_loading_complete from iwl_priv to iwl_nic and rename it
to more accurately reflect what it does.

Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:28:06 -08:00
Don Fry
737805ff7a iwlwifi: move firmware_name to iwl_nic
Delete firmware_name from iwl_priv and use iwl_nic instead.

Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:28:01 -08:00
Don Fry
f6fd51d9a5 iwlwifi: move fw_index from iwl_priv to iwl_nic
Delete fw_index from iwl_priv and use iwl_nic instead.

Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:27:51 -08:00
Don Fry
d359667767 iwlwifi: move ucode_ver to iwl_nic
Delete ucode_ver from iwl_priv and use iwl_nic instead.

Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:27:44 -08:00
Don Fry
b1c23d9ec3 iwlwifi: create iwl_nic structure
Create iwl_nic structure and link it together.

Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:12:03 -08:00
Johannes Berg
7b11488fbb iwlwifi: give PCIe its own lock
Instead of using a global lock, the PCIe transport
can use an own lock for its IRQ. This will make it
possible to not disable IRQs for the shared lock.
The lock is currently used throughout the code but
this can be improved even further by splitting up
the locking for the queues.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Wey-Yi W Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:11:52 -08:00
Johannes Berg
1ee158d838 iwlwifi: move workqueue to priv
In order to separate the different parts of the
driver better, we are reducing the shared data.
This moves the workqueue to "priv", and removes
it from the transport. To do this, simply use
schedule_work() in the transport.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 10:10:28 -08:00
Johannes Berg
2655e314c4 iwlwifi: trace debug messages
Make iwlwifi record all debug messages into
tracing, even if debug_level is not enabled.
Due to the lack of APIs, the debug messages
are now recorded up to a max length of 100,
the only one above that is the RXON which is
not needed if you trace the commands as well
as it only dumps the command contents.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi W Guy <wey-yi.w.guy@intel.com>
2012-02-17 09:49:27 -08:00
Amit Beka
cdfef6c224 iwlwifi: added reply data to testmode HCMD send
The testmode command for host command send now replies
with a nl80211 message and the response it recieved from
the device.

This does not change the API directly, but adds a reply
to the testmode call.

Signed-off-by: Amit Beka <amit.beka@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 09:49:12 -08:00
Amit Beka
6c55f5ed3a iwlwifi: testmode new indirect RW API
Replaced the old SRAM and periphery indirect access functions
with a unified indirect memory access functions. These include
new IWL_TM_CMDs for buffer read/write/dump which replace the
SRAM read/dump commands, but the API for IWL_TM_CMD_INDIRECT_REG
read/write will now not be supported (returns error).

This also handles writing to periphery registers in 1-3 bytes.

Requires the corresponding patch in the library for the API change.

Signed-off-by: Amit Beka <amit.beka@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 09:49:05 -08:00
Wey-Yi Guy
2f73d7c2b1 iwlwifi: log as error when error detected
A lot of error conditions in testmode log as IWL_DEBUG_INFO which is not
logged by default. Change it

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-17 09:48:56 -08:00
John W. Linville
ca994a36f5 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
Conflicts:
	net/mac80211/debugfs_sta.c
	net/mac80211/sta_info.h
2012-02-15 16:24:37 -05:00
Pavel Roskin
2504a6423b ath9k: stop on rates with idx -1 in ath9k rate control's .tx_status
Rate control algorithms are supposed to stop processing when they
encounter a rate with the index -1.  Checking for rate->count not being
zero is not enough.

Allowing a rate with negative index leads to memory corruption in
ath_debug_stat_rc().

One consequence of the bug is discussed at
https://bugzilla.redhat.com/show_bug.cgi?id=768639

Signed-off-by: Pavel Roskin <proski@gnu.org>
Cc: stable@vger.kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-15 13:56:15 -05:00
Amitkumar Karwar
6670f15b1f mwifiex: clear previous security setting during association
Driver maintains different flags for WEP, WPA, WPA2 security modes.
Appropriate flag is set using security information provided in
connect request. mwifiex_is_network_compatible() routine uses them
to check if driver's setting is compatible with AP. Association is
aborted if the routine fails.

For some corner cases, it is observed that association is failed
even for valid security information based on association history.
This patch fixes the problem by clearing previous security setting
during each association.

We should set WEP key provided in connect request as default tx key.
This missing change is also added here.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-15 13:56:15 -05:00
Dan Carpenter
51c4ed95a8 wl12xx: remove some dead code in wl1271_plt_init()
"ret" has already been checked at this point, and we don't need to check
it again.  This was left around from a previous patch 49d750ca14
"wl12xx: 1281/1283 support - New radio structs and functions".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 12:25:26 +02:00
Eliad Peller
9b44350b49 wl12xx: delete wl->vif (and allow multiple vifs)
Delete the global wl->vif (and the checks on it),
so multiple vifs could be added.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:36 +02:00
Eliad Peller
3dee43930f wl12xx: enter forced-psm on fw change
Enter forced psm when changing fw, in order to make the
sta a bit more disconnection-persistent.
(DPM doesn't know about the incoming recovery, so it
won't enter psm by itself)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:36 +02:00
Eliad Peller
4549d09c57 wl12xx: dynamically change fw according to number of active roles
wl12xx uses different fw for single-role and multi-role
scenarios (due to lack of space, some of the fw advanced
features are disabled in the multi-role fw).

Add checks on add_interfae and remove_interface in order
to determine whether a fw switch is needed (and initiate
recovery in this case).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:36 +02:00
Eliad Peller
3fcdab7066 wl12xx: Use a dedicated fw for PLT
A special PLT firmware is used for calibration.

Add multiple fw support by introducing a new fw_type member,
representing the currently saved fw (the actual fw state
can be determined by wl->state).

Signed-off-by: Gery Kahn <geryk@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:35 +02:00
Eyal Shapira
f95f9aad15 wl12xx: add split_scan_timeout debugfs file
Add control over split_scan_timeout through
debugfs. Values are in ms while 0 will disable split scan.

Signed-off-by: Eyal Shapira <eyal@wizey.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:35 +02:00
Eyal Shapira
d647f2dd1a wl12xx: use split scan for normal scan
Split scan allows the FW to schedule other activities
during a scan which may be a long operation. This is
achieved by setting a trigger TID to ANY_TID and a scan
trigger timeout other than 0. The default one is set to 50ms.

Signed-off-by: Eyal Shapira <eyal@wizey.com>
Signed-off-by: Igal Chernobelsky <igalc@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:35 +02:00
Ido Reis
c08e371a68 wl12xx: increase max probe-req template size to WL1271_CMD_TEMPL_MAX_SIZE
Increase max scan IEs to allow big probe-req frames

Report a correct max-length for the scan IEs we can support, according
to the now larger size of the probe-req template.

Signed-off-by: Ido Reis <idor@ti.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:35 +02:00
Eliad Peller
35d7742ff3 wl12xx: don't fail on AP scan
AP role uses its own role_id for scans, so there's
no reason to fail the scan if dev_role_id is invalid.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:35 +02:00
Eliad Peller
79aba1baf2 wl12xx: declare support for hw scan while idle
By allowing hw scan while idle, we no longer
need the redundant ROC/CROC that are done
on idle off/on, which helps simplifying the
state machine of the driver.

This way, we can also allow scanning while
there is an ongoing sched scan (otherwise,
we won't be able to ROC on idle-off)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:34 +02:00
Eliad Peller
76a74c8a65 wl12xx: configure arp filtering only after association
We have to configure arp filtering only after the role was
started, so move the BSS_CHANGED_ARP_FILTER handling after
the join.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:34 +02:00
Eliad Peller
b87f20c018 wl12xx: Revert "wl12xx: disable auto-arp"
This reverts commit e5e2f24b3e.

The encryption consideration on auto-arp configuration,
along with a fw fix, seem to resolve the crashes that
occured when auto-arp was enabled, so we can re-enable it now.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:34 +02:00
Eliad Peller
5ec8a448e0 wl12xx: consider encryption and QoS in auto arp template
When configuring the arp response template,
and encryption is enabled, we should add some
space and set the protected flag bit in the fc.

In order to track the encryption type, set
wlvif->encryption_type when setting an encryption key,
and reconfigure the arp response. Clear this field on
wl1271_join, as keys have to be re-configured
anyway after a join command.

Similarly, track whether QoS is configured.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:34 +02:00
Eyal Shapira
20ae7e5e4b wl12xx: add forced_ps debugfs file
Added control over forced_ps option through debugfs.
This can be either 1 or 0.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:34 +02:00
Eyal Shapira
5c0dc2fcfe wl12xx: add forced_ps mode
For certain WiFi certification tests forcing PS
is necessary. Since DPS is now enabled in the FW
and this can't be achieved by using netlatency
this required a new config option.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:33 +02:00
Eyal Shapira
59a10c66d0 wl12xx: add suspend_listen_interval debugfs file
Add read/write to suspend_dtim_interval file which
controls the number of DTIM periods between wakeups
while the host is suspended.
The value while the host is resumed is controlled
by the file dtim_interval which existed previously.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:33 +02:00
Eyal Shapira
dae728fe67 wl12xx: Set different wake up conditions in case of suspend
Added ability to set different wake up conditions for suspend/resume.
Set default values to wake up every 3 DTIMs while suspended
and every 1 DTIM while resumed

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:33 +02:00
Eliad Peller
26612c435b wl12xx: add new coex params
new params were added to the coex params.
Add them with default value of 0.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:33 +02:00
Eliad Peller
f4f57943f2 wl12xx: add TX_HW_ATTR_HOST_ENCRYPT flag
In WEP shared authentication, we encrypt the auth frame
in the host, and we want the fw to pass it as-is.
Use the TX_HW_ATTR_HOST_ENCRYPT flag in order to indicate
it to the fw.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:33 +02:00
Pontus Fuchs
defe02c720 wl12xx: Set IEEE80211_TX_RC_SHORT_GI if short GI was used on
New FW reports usage of short GI as a rate class index. Check for
this rate and set the IEEE80211_TX_RC_SHORT_GI if used.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:32 +02:00
Pontus Fuchs
d2e2d769e3 wl12xx: Set IEEE80211_TX_RC_MCS on MCS rates on TX complete.
IEEE80211_TX_RC_MCS was not set correctly leading to incorrect link
speed calculation.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Ido Reis <idor@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:32 +02:00
Eyal Shapira
d18da7fcca wl12xx: change WLVIF_FLAG_PSM name and remove WLVIF_FLAG_PSM_REQUESTED
WLVIF_FLAG_PSM turned to WLVIF_FLAG_IN_AUTO_PS which
marks that this vif is in AUTO PS.

WLVIF_FLAG_PSM_REQUESTED is not required as mac80211
calls op_config with CONF_PS after association.

wl12xx_config_vif() handling of CONF_PS was simplified
and cleaned up.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:32 +02:00
Eyal Shapira
ed471d3402 wl12xx: enable/disable BET with AUTO_PS/ACTIVE
While the FW with dynamic PS controls BET when going to PSM and back
internally within the FW, there's still a need to enable it from the driver
at least once (so enable on every entry to AUTO_PS)
and disable it once we explicitly go back to STATION_ACTIVE_MODE.
BET isn't relevant for 5GHz

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:32 +02:00
Eyal Shapira
248a0018f3 wl12xx: remove 2 unused parameters in wl1271_ps_set_mode()
cleanup 2 unused parameters of wl1271_ps_set_mode

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:32 +02:00
Eyal Shapira
1faff895df wl12xx: add dynamic_ps_timeout debugfs file
Enable read/write of dynamic_ps_timeout which controls the timeout
of the dynamic PS implemented in the FW.
dynamic_ps_timeout is the timeout (in msec) until going back to PS
when there's no Rx/Tx

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:31 +02:00
Eyal Shapira
f1d63a5963 wl12xx: add support for HW dynamic PS
FW now supports dynamic PS so we don't need to use mac80211 support.
FW will go to PSM after a specified timeout with no Rx/Tx traffic.
- Changed FW API to include new PS mode (AUTO_MODE) and including timeout parameter
- The default PS mode would be dynamic PS
- Default timeout is 100ms (same as it used to be in mac80211)
- Avoid using mac80211 APIs to disable/enable dynamic PS as we're not
using mac80211 PS control anymore.
- COEX is handled by the FW while in dynamic PS so removed
handling of SOFT_GEMINI

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:31 +02:00
Eyal Shapira
d6bf9ada92 wl12xx: remove PS management code
Removal of PS management code from the driver as PS
is handled by the FW (dynamic PS)

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:31 +02:00
Eliad Peller
8332f0f6dc wl12xx: fw api change - update cmd/acx/event enums
Update enums/structs to the new fw api.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:31 +02:00
Eliad Peller
9c531149af wl12xx: fw api change - add role_id to tsf_info
The ACX_TSF_INFO command now takes role_id as param.
change the struct accordingly, and pass the wlvif
to the wl1271_acx_tsf_info() function.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:31 +02:00
Eliad Peller
c059beb2ad wl12xx: use dev_role_id for scans
Use device role for scans when the sta is not
associated.

sched_scan is used only when the sta is
not associated, and thus should use
the dev role (instead of sta role).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:30 +02:00
Eliad Peller
cdaac62811 wl12xx: fw api change - add role_id to set_template
The set_template commands now takes the role_id as
parameter.

Usually, we'll use the vif's main role_id.
However, sometimes we'll want to use
wlvif->dev_role_id instead of wlvif->role_id,
so pass the wanted role_id as param.

Update WL127X_FW_NAME/WL128X_FW_NAME.

(This commit starts a series of fw update patches,
and changes the start() callback to return an error
in order to prevent the use of the driver during the
transition. This change will be reverted in the
last patch of series)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:30 +02:00
Eliad Peller
1ebaa2d041 wl12xx: don't release/claim sdio on suspend/resume
Since we reverted to claiming the host only when needed,
we no longer need to release/claim the host on suspend/resume.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:30 +02:00
Eliad Peller
b474830636 Revert "wl12xx: Change claiming of the SDIO bus"
This reverts commit 393fb560d3.

Commit b6ad726 ("mmc: core: Prevent too long response times
for suspend") fails the suspend if the mmc host can't be
claimed before suspend. As the host is claimed by us as long
as the chip is powered on, suspend will always fail.

Revert to claiming the sdio bus only when needed.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:30 +02:00
Eliad Peller
2801d69e84 wl12xx: remove wl1271_tx_update_filters
wl1271_tx_update_filters() is used as some workaround
to open filters while roaming on the same channel.

However, it doesn't handle roaming to a different channel,
and it might also sleep in the tx path, which is a bug.

With the new auth/assoc redesign, roaming is much simpler,
and this function is not needed anymore.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:30 +02:00
Eliad Peller
7db4ee6d0a wl12xx: check bss_conf->assoc on CHANGED_BSSID
with the new auth/assoc redesign, we get CHANGED_BSSID
indication before CHANGED_ASSOC indication, while our
CHANGED_BSSID handling block assumes we are already
associated.

Fix it by checking we are either in ibss mode, or
already associated.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:30 +02:00
Luciano Coelho
2c882fa475 wl12xx: fix typo in fwlog module param description
Fix a copy and paste bug in the MODULE_PARAM_DESC for fwlog.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:29 +02:00
Luciano Coelho
775e1a4bd5 wl12xx: remove unnecessary shadow declaration
The vif variable was being declared inside one of the internal blocks
of wl1271_event_process.  This is not necessary, since this variable
is already declared in the function context.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:29 +02:00
Luciano Coelho
75f25548be wl12xx: add testmode operation to read the BD_ADDR from Fuse ROM
Add a testmode command to retrieve the BD_ADDR that is stored in the
Fuse ROM in newer PGs.  In old PGs this operation is not supported.
The caller can then derive the MAC addresses from it.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:29 +02:00
Luciano Coelho
5e037e7480 wl12xx: use two MAC addresses based on the NVS or from fuse ROM
Add support for two MAC addresses.  If the NVS has a valid MAC
address, that takes precedence and we use two sequential address
starting from the one specified.

If the NVS doesn't contain a valid MAC address (ie. if it is set to
00:00:00:00:00:00), we check if the HW PG version in use has the
BD_ADDR written in the fuse ROM.  If it does, we read it and derive
the two subsequent addresses for WLAN.

During production, 3 addresses are reserved per device.  The first for
Bluetooth (burnt in the fuse ROM) and the following two for WLAN.

This patch has some code by Igal and Arik (squashed from internal
patches).

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Igal Chernobelsky <igalc@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:29 +02:00
Luciano Coelho
30c5dbd1ee wl12xx: read chip ID and HW PG version during probe
In order to read the MAC addresses from the fuse ROM, we need to know
the chip ID and the HW PG version.  We need to know the MAC address
during probe, because that's when we register our HW with mac80211.

To prepare for that, this patch reads the chip ID and HW PG version
during probe instead of doing it at boot time.  We power the chip on
briefly in order to do that.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:29 +02:00
Luciano Coelho
0becb14ab4 wl12xx: move partition table definition to io.c
Up till now we only needed to access the partition table in boot.c.
But to add support for reading the MAC address from the FUSE in
testmode, we will have to change the partition in testmode.c.

Thus, we move the partition table to io.c and export it via io.h.  It
makes more sense to have it in the io part anyway.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:28 +02:00
Luciano Coelho
f6fbeccd3e wl12xx: cancel delayed elp work and clear flags when stopping PLT
In some cases a race condition can happen if we don't cancel any
pending ELP work before stopping PLT.  With this commit we cancel ELP
work and clear the wl->flags bitmask.  Also clean up the wl elements
after powering off.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:28 +02:00
Ido Yariv
46b0cc9ffc wl12xx: Fix potential interrupt storm
The interrupt threaded handler exits immediately if the driver's state
is WL1271_STATE_OFF. As a result, the interrupt status is not read. If
the interrupt is level triggered, it will be fired again.

Fix this by disabling interrupts before setting the state to OFF.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:28 +02:00
Ido Yariv
a454969ede wl12xx: Power off after flushing work
When stopping plt, the chip is powered off before all current work items
are flushed and interrupts are disabled. This might introduce a race in
which the driver tries to communicate with a powered off chip.

Fix this by powering off the device only after interrupts are disabled
and all work items are flushed.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:28 +02:00
Ido Yariv
f3df1331f2 wl12xx: Acquire lock before stopping plt
__wl1271_plt_stop is called from both wl1271_plt_stop and
wl1271_unregister_hw. While wl1271_plt_stop acquires a mutex,
wl1271_unregister_hw does not.

Fix this by calling wl1271_plt_stop instead of __wl1271_plt_stop from
wl1271_unregister_hw.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:28 +02:00
Pontus Fuchs
9e0dc890ce wl12xx: Make sure HW is available in sched scan ops
The sched_scan_(stop|start) ops fails to check for WL1271_STATE_OFF.
This can lead to a race where the driver tries to access the HW
while it's off.

Fix this by checking for WL1271_STATE_OFF before accessing the HW.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:28 +02:00
Luciano Coelho
15944aef29 wl12xx: enable sparse endianess check by default
Following the good example of the Intel (and more recently Atheros)
drivers, enable endianess check by default when running sparse.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:27 +02:00
Luciano Coelho
ebff1bae94 wl1251: enable sparse endianess check by default
Following the good example of the Intel (and more recently Atheros)
drivers, enable endianess check by default when running sparse.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:27 +02:00
Luciano Coelho
ac9e2d9afa wl1251: convert 32-bit values to le32 before writing to the chip
The 32-bit values were not converted before writing them to the chip.
Change the wl1251_read32() and wl1251_write32() so that they always
read and write le32 values and convert to and from the CPU endianess.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:27 +02:00
Luciano Coelho
059625e757 wl1251: fix sparse warning
The wl1251 driver was generating the following warning:

drivers/net/wireless/wl1251/boot.c:467:21: warning: incorrect type in assignment (different base types)
drivers/net/wireless/wl1251/boot.c:467:21:    expected unsigned int [unsigned] [assigned] [usertype] val
drivers/net/wireless/wl1251/boot.c:467:21:    got restricted __le32 [usertype] <noident>

Fix this by removing one cpu_to_le32() call in the wrong place.

Signed-off-by: Luciano Coelho <coelho@ti.com>
2012-02-15 08:38:27 +02:00
Simon Graham
c27111e5b8 rtlwifi: Modify rtl_pci_init to return 0 on success
Fixes problem where caller would think routine succeeded when it failed
leading to divide by zero panic.

Signed-off-by: Simon Graham <simon.graham@virtualcomputer.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-09 15:17:29 -05:00
John W. Linville
12325280df rtlwifi: Modify rtl_pci_init to return 0 on success
Fixes problem where caller would think routine succeeded when it failed
leading to divide by zero panic.

(This also reverts an earlier attempt, commit 42bc0c97 "rtlwifi: Return
correct failure code on error". -- JWL)

Signed-off-by: Simon Graham <simon.graham@virtualcomputer.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-09 14:49:37 -05:00
Simon Graham
42bc0c9716 rtlwifi: Return correct failure code on error
Callers of rtl_pci_init expect zero to be returned on error. Returning
the error code leads to, amongst other things, divide by zero panics
attempting to use the ring size that is set to zero.

Signed-off-by: Simon Graham <simon.graham@virtualcomputer.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-08 16:07:24 -05:00