cascardo/linux.git
12 years agoath6kl: cut power during suspend
Kalle Valo [Tue, 1 Nov 2011 06:44:44 +0000 (08:44 +0200)]
ath6kl: cut power during suspend

If sdio controller doesn't support keep power, cut power from hardware
during suspend and restart firmware during resume. If we are connected
during suspend, send a disconnected event to user space.

Earlier suspend failed with an error if sdio didn't support keep power.
Now suspend will happen succesfully even with that case.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: refactor sdio configuration to a separate function
Kalle Valo [Tue, 1 Nov 2011 06:44:36 +0000 (08:44 +0200)]
ath6kl: refactor sdio configuration to a separate function

These commands are also needed after cutpower suspend so create
a function for them. Also fix memory leaks in ath6kl_sdio_probe() error
path.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: add state variable depicting hw/fw state
Kalle Valo [Tue, 1 Nov 2011 06:44:28 +0000 (08:44 +0200)]
ath6kl: add state variable depicting hw/fw state

This way it's easier to track state changes and in the future add
more warnings about using hardware in wrong states. Currently there
are few random flags for trying to do the same, those will be cleaned
and removed in the future.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: implement ath6kl_cfg80211_suspend()
Kalle Valo [Tue, 1 Nov 2011 06:44:21 +0000 (08:44 +0200)]
ath6kl: implement ath6kl_cfg80211_suspend()

This is in preparation for cutpower suspend feature. HIF layer makes
the decision based on information provided by cfg80211 and what hardware
actually supports. Then it calls ath6kl_cfg80211_suspend() to enable
the chosen mode.

Functionality should be the same, this is just preparation for
more suspend modes (cutpower and wow).

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: reset CONNECT_PEND and CONNECTED flags in ath6kl_cfg80211_stop()
Kalle Valo [Tue, 1 Nov 2011 06:44:13 +0000 (08:44 +0200)]
ath6kl: reset CONNECT_PEND and CONNECTED flags in ath6kl_cfg80211_stop()

Otherwise first connection establish after cutpower suspend will
fail.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: create ath6kl_cfg80211_stop()
Kalle Valo [Tue, 1 Nov 2011 06:44:04 +0000 (08:44 +0200)]
ath6kl: create ath6kl_cfg80211_stop()

Just take code from deep sleep for now, will be improved later. No
functional changes.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: add aborted parameter to ath6kl_cfg80211_scan_complete_event()
Kalle Valo [Tue, 1 Nov 2011 06:43:56 +0000 (08:43 +0200)]
ath6kl: add aborted parameter to ath6kl_cfg80211_scan_complete_event()

Currently it takes an error code as status, but what we really want to
tell is if the scan was aborted or not.

Also fix a bug where we were comparing firmware scan status values
with kernel error codes, which is obviously wrong. This meant
that ath6kl didn't detect when firmware informed about failed scans. I
doubt that this fix doesn't make any difference in practise but it
still needs to be fixed. This is fixed by adding an enum for the success
status code and checking for that.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: print seqno in htc debug logs
Kalle Valo [Sun, 30 Oct 2011 19:16:49 +0000 (21:16 +0200)]
ath6kl: print seqno in htc debug logs

Makes it easier to debug where frames are going.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: print firmware crashes always
Kalle Valo [Sun, 30 Oct 2011 19:16:41 +0000 (21:16 +0200)]
ath6kl: print firmware crashes always

Currently firmware crash dump is printed only if debug is enabled.
Change it so that the crash dump is always printed.

Also move the code from init.c to hif.c.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: fix WLAN_ENABLE usage in ath6kl_close()
Kalle Valo [Sun, 30 Oct 2011 19:16:33 +0000 (21:16 +0200)]
ath6kl: fix WLAN_ENABLE usage in ath6kl_close()

If ath6kl_init_hw_stop() failed with an error WLAN_ENABLED would not
be cleared. Found during code review and just a theoretical issue.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: power down hardware when interface is down
Kalle Valo [Sun, 30 Oct 2011 19:16:15 +0000 (21:16 +0200)]
ath6kl: power down hardware when interface is down

The benefit from this is that user space can control hardware's power state
by putting interface up and down. This is handy if firmware gets to some
weird state.

The downside will be that putting interface up takes a bit longer,
I was measuring ~500 ms during interface up.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: create ath6kl_hif_stop()
Kalle Valo [Sun, 30 Oct 2011 19:15:57 +0000 (21:15 +0200)]
ath6kl: create ath6kl_hif_stop()

This is to reset hif layer for powering down hw.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: change name of sdio driver to ath6kl
Kalle Valo [Fri, 28 Oct 2011 13:23:26 +0000 (16:23 +0300)]
ath6kl: change name of sdio driver to ath6kl

Currently the name of the driver in struct sdio_driver is "ath6kl_sdio",
this is for example what uevent advertises. This is wrong as the module
is named as ath6kl.ko. Change it to "ath6kl" so that the names match.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: don't print an error for canceled packets
Kalle Valo [Thu, 27 Oct 2011 15:49:08 +0000 (18:49 +0300)]
ath6kl: don't print an error for canceled packets

ath6kl_tx_complete() was printing an error when packet was canceled.
That causes unnecessary errors when hardware is powered off.

Also change the error to a warning and cleanup the message.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: create ath6kl_htc_reset()
Kalle Valo [Thu, 27 Oct 2011 15:49:00 +0000 (18:49 +0300)]
ath6kl: create ath6kl_htc_reset()

When rebooting hardware we need to reset the htc state in ath6kl_htc_stop().

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: add a timeout to ath6kl_hif_intr_bh_handler()
Kalle Valo [Thu, 27 Oct 2011 15:48:52 +0000 (18:48 +0300)]
ath6kl: add a timeout to ath6kl_hif_intr_bh_handler()

It's possible to busyloop forever in ath6kl_hif_intr_bh_handler(). Add
a check that it lasts only one second.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: remove useless cleanup call from ath6kl_bmi_done()
Kalle Valo [Thu, 27 Oct 2011 15:48:45 +0000 (18:48 +0300)]
ath6kl: remove useless cleanup call from ath6kl_bmi_done()

aht6kl core code will call the cleanup function when the device is removed.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: separate hardware boot code from module initialisation code
Kalle Valo [Thu, 27 Oct 2011 15:48:37 +0000 (18:48 +0300)]
ath6kl: separate hardware boot code from module initialisation code

Refactor the code needed to boot the hardware to a separate function so
that it will be easier boot and shutdown hardware.

No functional changes (hopefully).

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: merge ath6kl_init() to ath6kl_core_init()
Kalle Valo [Thu, 27 Oct 2011 15:48:29 +0000 (18:48 +0300)]
ath6kl: merge ath6kl_init() to ath6kl_core_init()

In preparation for splitting module initialisation and hardware boot
code from each other.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: add a fixme to ath6kl_htc_wait_target()
Kalle Valo [Thu, 27 Oct 2011 15:48:22 +0000 (18:48 +0300)]
ath6kl: add a fixme to ath6kl_htc_wait_target()

This doesn't look right, but investigate it later.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: move power control from sdio to core
Kalle Valo [Thu, 27 Oct 2011 15:48:14 +0000 (18:48 +0300)]
ath6kl: move power control from sdio to core

In preparation for cutting down power from the chip on the fly.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: rename ath6kl_wmi_qos_state_init() to _wmi_reset()
Kalle Valo [Thu, 27 Oct 2011 15:48:00 +0000 (18:48 +0300)]
ath6kl: rename ath6kl_wmi_qos_state_init() to _wmi_reset()

Just to make it more clear that this function is supposed to
reset wmi related variables.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: don't use cfg80211_scan_request after cfg80211_scan_done()
Kalle Valo [Thu, 27 Oct 2011 15:47:46 +0000 (18:47 +0300)]
ath6kl: don't use cfg80211_scan_request after cfg80211_scan_done()

Use of cfg80211_scan_request is not valid after calling cfg80211_scan_done()
but ath6kl_cfg80211_scan_complete_event() was doing exactly that. Change
the function to call cfg80211_scan_done() last.

This was found during code review, I didn't see any visible problems
due to this bug.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: fix missing copy of action frame contents
Aarthi Thiruvengadam [Thu, 27 Oct 2011 16:35:56 +0000 (09:35 -0700)]
ath6kl: fix missing copy of action frame contents

The wpa_supplicant was receiving incorrect frame contents in the
callback function that indicates the status of the frame transmitted.
This patch fixes a missing copy of the frame contents to a local
buffer. The local buffer keeps track of the last sent management frame.

Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Report unique remain-on-channel cookie values
Jouni Malinen [Thu, 27 Oct 2011 13:00:13 +0000 (16:00 +0300)]
ath6kl: Report unique remain-on-channel cookie values

Even though only a single concurrent remain-on-channel operation is
supported, there may be two pending remain-on-channel events (one to
indicate end of a canceled operation and another to indicate start of a
new operation). User space won't be able to distinguish these events
unless unique cookies are used.

The previous behavior resulted in wpa_supplicant getting quite
confused about the driver's offchannel state in various sequences
and this made the P2P state machine behave incorrectly. Use of
more than a single remain-on-channel cookie value fixes this.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Fix compilation error from of.h
Sangwook Lee [Wed, 26 Oct 2011 15:28:38 +0000 (16:28 +0100)]
ath6kl: Fix compilation error from of.h

When compiling ath6kl for ARM with device tree tree compilation fails
with errors like:

include/linux/of.h: In function 'of_property_read_u32_array':
include/linux/of.h:249:10: error: 'ENOSYS' undeclared

Workaround this by including errno.h from init.c.

kvalo: improved commit log

Signed-off-by: Sangwook Lee <sangwook.lee@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Implement support for power parameter control from userspace
Rishi Panjwani [Wed, 26 Oct 2011 02:52:41 +0000 (19:52 -0700)]
ath6kl: Implement support for power parameter control from userspace

In order to allow user space based control of power parameters, we use
available debugfs infrastructure. With these features user can control
power consumption by adjusting various sleep/wake up related parameters.
The feature has been added for testing purposes. All 5 parameters are
mandatory in correct order. They have to be written to the power_params
file. These are:

1) idle_period
2) no_of_pspoll
3) dtim_policy
4) tx_wakeup_policy
5) no_tx_to_wakeup

Example:

echo "200 1 0 1 1" > power_params

Signed-off-by: Rishi Panjwani <rpanjwan@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Implement support for listen interval from userspace
Rishi Panjwani [Wed, 26 Oct 2011 00:26:29 +0000 (17:26 -0700)]
ath6kl: Implement support for listen interval from userspace

In order to allow user space based control of listen interval, we use
available debugfs infrastructure. Listen interval implies how frequently
we want the WLAN chip to wake up and synchronize the beacons in case it
is in sleep mode. The command requires two parameters in the following order:

1) listen_interval_time
2) listen_interval_beacons

The user has to write the listen interval_time (in msecs) and
listen_interval_beacons (in no. of beacons) to the listen_interval file in
ath6kl debug directory.

Example:

echo "30 1" > listen_interval

Signed-off-by: Rishi Panjwani <rpanjwan@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: add support for WPS
Aarthi Thiruvengadam [Tue, 25 Oct 2011 18:25:52 +0000 (11:25 -0700)]
ath6kl: add support for WPS

Add control flag CONNECT_WPS_FLAG if a WPS IE is present in the
Association Request IEs. This flag is needed when the station must
connect to a WPS-enabled AP.

Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: add more boot debug messages
Kalle Valo [Mon, 24 Oct 2011 09:18:07 +0000 (12:18 +0300)]
ath6kl: add more boot debug messages

Move some of the debug logs to boot level because they are more
interesting when debugging boot issues.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: add debug messages for credit handling
Kalle Valo [Mon, 24 Oct 2011 09:17:59 +0000 (12:17 +0300)]
ath6kl: add debug messages for credit handling

Also take few from htc debug level which are more suitable for credit.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: remove unused debug levels
Kalle Valo [Mon, 24 Oct 2011 09:17:51 +0000 (12:17 +0300)]
ath6kl: remove unused debug levels

Few levels had only one user so I changed them to use WLAN_CFG.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: use ath6kl_credit prefix consistently
Kalle Valo [Mon, 24 Oct 2011 09:17:28 +0000 (12:17 +0300)]
ath6kl: use ath6kl_credit prefix consistently

Not all credit functions used that prefix, fix that.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: move all credit distribution code to htc.c
Kalle Valo [Mon, 24 Oct 2011 09:17:20 +0000 (12:17 +0300)]
ath6kl: move all credit distribution code to htc.c

As htc is the only user there's no reason to keep it in main.c.

No functional changes.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: rename struct htc_credit_state_info to ath6kl_htc_credit_info
Kalle Valo [Mon, 24 Oct 2011 09:17:12 +0000 (12:17 +0300)]
ath6kl: rename struct htc_credit_state_info to ath6kl_htc_credit_info

Also rename cred_dist_cntxt to credit_info in struct htc_target.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: rename struct htc_endpoint_credit_dist.htc_rsvd to htc_ep
Kalle Valo [Mon, 24 Oct 2011 09:17:04 +0000 (12:17 +0300)]
ath6kl: rename struct htc_endpoint_credit_dist.htc_rsvd to htc_ep

No need to use void pointer here.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: use ath6kl prefix in credit functions
Kalle Valo [Mon, 24 Oct 2011 09:16:55 +0000 (12:16 +0300)]
ath6kl: use ath6kl prefix in credit functions

This is to follow the common style in the driver. Also add braces to
fix a style issue.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: remove unused A_CACHE_LINE_PAD
Kalle Valo [Mon, 24 Oct 2011 09:16:44 +0000 (12:16 +0300)]
ath6kl: remove unused A_CACHE_LINE_PAD

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Use appropriate wdev from vif
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:26 +0000 (19:34 +0530)]
ath6kl: Use appropriate wdev from vif

Remove the wdev reference in struct ath6kl.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Initialize target wlan values for every vif
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:25 +0000 (19:34 +0530)]
ath6kl: Initialize target wlan values for every vif

Wlan parameters need to be configured for every vif
in target.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Add a modparam to enable multi normal interface support
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:24 +0000 (19:34 +0530)]
ath6kl: Add a modparam to enable multi normal interface support

This option lets operate more than one vif in normal mode (AP/STA/IBSS)
when support for multiple vif is enabled. This modparam needs to be used
as

modprobe ath6kl multi_norm_if_support=1

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Implement add_virtual_intf() and del_virtual_intf()
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:23 +0000 (19:34 +0530)]
ath6kl: Implement add_virtual_intf() and del_virtual_intf()

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Configure inteface information at init time
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:22 +0000 (19:34 +0530)]
ath6kl: Configure inteface information at init time

Virtual interface information need to be configured during
init time to the target. With MAX_NUM_VIF is restricted to
1, currently only a single vif is being configured.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Use the other variant of netdev (un)register APIs
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:21 +0000 (19:34 +0530)]
ath6kl: Use the other variant of netdev (un)register APIs

Use replace (un)register_netdev() with (un)register_netdevice()
so that the same ath6kl function can be used with
add_virtual_intf()/del_virtual_intf().

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Maintain virtual interface in a list
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:20 +0000 (19:34 +0530)]
ath6kl: Maintain virtual interface in a list

This patch removes all references to ar->vif and takes
vif from a list.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Introduce spinlock to protect vif specific information
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:19 +0000 (19:34 +0530)]
ath6kl: Introduce spinlock to protect vif specific information

Use this spinlock to protect the vif's data instead of
one from ath6kl.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Store hw mac address in struct ath6kl
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:18 +0000 (19:34 +0530)]
ath6kl: Store hw mac address in struct ath6kl

WMI ready event gives the mac address, cache this
mac address in struct ath6kl so that it can be used to
compute the mac address for other vif in case of multi vif.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Use interface index from wmi data headr
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:17 +0000 (19:34 +0530)]
ath6kl: Use interface index from wmi data headr

Interface index is passed in wmi data header as well, use it
to get the corresponding vif structure.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Refactor ath6kl_destroy()
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:16 +0000 (19:34 +0530)]
ath6kl: Refactor ath6kl_destroy()

So that the deinitialization of ath6kl and vif are separated.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Cleanup parameters in ath6kl_init_control_info() and ath6kl_init_profile_info()
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:15 +0000 (19:34 +0530)]
ath6kl: Cleanup parameters in ath6kl_init_control_info() and ath6kl_init_profile_info()

Pass vif structure to those functions instead of ath6kl because these
functions do vif specific information initialization.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Remove net_device from ath6kl
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:14 +0000 (19:34 +0530)]
ath6kl: Remove net_device from ath6kl

Use one which is available in vif structure instead.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Take vif information from wmi event
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:13 +0000 (19:34 +0530)]
ath6kl: Take vif information from wmi event

Interface index is passed in wmi command header from target.
Use this index to get the appropriate vif.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Maintain firmware interface index in struct ath6kl_vif
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:12 +0000 (19:34 +0530)]
ath6kl: Maintain firmware interface index in struct ath6kl_vif

Pass this index to target in wmi commands to specify the interface
for which the command needs to be handled.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Make net and target stats vif specific
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:11 +0000 (19:34 +0530)]
ath6kl: Make net and target stats vif specific

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Move few more vif specific information to struct ath6kl_vif
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:10 +0000 (19:34 +0530)]
ath6kl: Move few more vif specific information to struct ath6kl_vif

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Move scan_req info and sme_state to vif
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:09 +0000 (19:34 +0530)]
ath6kl: Move scan_req info and sme_state to vif

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Move disconnect timer to vif structure
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:08 +0000 (19:34 +0530)]
ath6kl: Move disconnect timer to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Move aggregation information to vif structure
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:07 +0000 (19:34 +0530)]
ath6kl: Move aggregation information to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Move key information to vif structure
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:06 +0000 (19:34 +0530)]
ath6kl: Move key information to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Move channel information to vif structure
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:05 +0000 (19:34 +0530)]
ath6kl: Move channel information to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Move bssid information to vif structure
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:04 +0000 (19:34 +0530)]
ath6kl: Move bssid information to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Move nw_type to vif structure
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:03 +0000 (19:34 +0530)]
ath6kl: Move nw_type to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Move ssid and crypto information to vif structure
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:02 +0000 (19:34 +0530)]
ath6kl: Move ssid and crypto information to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Define interface specific states
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:01 +0000 (19:34 +0530)]
ath6kl: Define interface specific states

Currently ar->flag maintains interface stats. Move interface
specific states from ar->flag to vif->flags.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Define an initial vif structure and use it
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:04:00 +0000 (19:34 +0530)]
ath6kl: Define an initial vif structure and use it

vif specific information need to be moved from struct ath6kl.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Cleanup fw interface type setting
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:03:59 +0000 (19:33 +0530)]
ath6kl: Cleanup fw interface type setting

It is not necessary to use ath6kl_get_fw_iftype() to find out the
firmware interface type during initialization because the type
of the initial interface in INFRA_NETWORK. Hardcode the fw interface
type corresponding to INFRA_BSS instead of using ath6kl_get_fw_iftype().

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Refactor wiphy dev and net dev init functions
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:03:58 +0000 (19:33 +0530)]
ath6kl: Refactor wiphy dev and net dev init functions

This refactoring is done in a manner that it can be used
for multiple virtual interface.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Keep wiphy reference in ath6kl structure
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:03:57 +0000 (19:33 +0530)]
ath6kl: Keep wiphy reference in ath6kl structure

This is to avoid using ar->wdev to get wiphy pointer, this
may need further cleanup for multi vif support.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Pass ath6kl structure to ath6kl_init() instead of net_device
Vasanthakumar Thiagarajan [Tue, 25 Oct 2011 14:03:56 +0000 (19:33 +0530)]
ath6kl: Pass ath6kl structure to ath6kl_init() instead of net_device

ar is again taken from private area of net_device in ath6kl_init(), pass
ar directly.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Implement support for background scan control from userspace
Rishi Panjwani [Wed, 19 Oct 2011 00:20:06 +0000 (17:20 -0700)]
ath6kl: Implement support for background scan control from userspace

In order to allow user space based control of background scan interval,
we use available debugfs infrastructure. The feature has been added for
testing purposes. The user has to write the bgscan interval (in secs) to
the bgscan_interval file in ath6kl debug directory. To disable bgscan,
a '0' is to be written to the bgscan_interval file.

Example:

echo "2" > bgscan_interval

This will make the background scan interval as 2 seconds

kvalo: changed implementation so that there's only one call to
ath6kl_wmi_scanparams_cmd()

Signed-off-by: Rishi Panjwani <rpanjwan@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: add debug level for hif
Kalle Valo [Thu, 13 Oct 2011 12:21:53 +0000 (15:21 +0300)]
ath6kl: add debug level for hif

That way we htc level debug messages can be removed from hif files. Also
add few new messages and remove useless debug message about using
synchrous irq processing (we don't support anything else).

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: don't dump full htc packets
Kalle Valo [Thu, 13 Oct 2011 12:21:45 +0000 (15:21 +0300)]
ath6kl: don't dump full htc packets

It's currently possible to dump full sdio packets, so dumping htc packets
is not strictly needed. So remove it, we can always add it back if
there ever comes a need for that.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: cleanup htc debug messages
Kalle Valo [Thu, 13 Oct 2011 12:21:37 +0000 (15:21 +0300)]
ath6kl: cleanup htc debug messages

Unify debug message format and other minor changes.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: merge htc debug levels
Kalle Valo [Thu, 13 Oct 2011 12:21:15 +0000 (15:21 +0300)]
ath6kl: merge htc debug levels

It's not really necessary to have separate debug levels for htc tx and rx
so combine them.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Implement support for QOS-enable and QOS-disable from userspace
Rishi Panjwani [Sat, 15 Oct 2011 00:48:07 +0000 (17:48 -0700)]
ath6kl: Implement support for QOS-enable and QOS-disable from userspace

In order to allow user space based QOS control we use the available debugfs
infrastructure. With this feature, user can make changes to qos parameters,
thereby allowing creation and deletion of user defined priority streams and
features like uapsd. This feature has been added for testing purposes.

All 21 parameters for the create_qos command are mandatory in the correct
order. They have to be written to the create_qos file in
the ath6kl debug directory. These parameters(in order) are:

1)user priority
2)direction
3)traffic class
4)traffic type
5)voice PS capability
6)min service intvl
7)max service intvl
8)inactivity intvl
9)suspension intvl
10)serv start time
11)tsid
12)nominal msdu
13)max msdu
14)min data rate
15)mean data rate
16)peak data rate
17)max burst size
18)delay bound
19)min phy rate
20)surplus bw allowance
21)medium time

To create a qos stream:

echo "6 2 3 1 1 9999999 9999999 9999999 7777777 0 6 45000 200 56789000
56789000 5678900 0 0 9999999 20000 0" > create_qos

delete_qos requires 2 parameters:

1)traffic class
2)tsid

To delete a qos stream:

echo "3 1" > delete_qos

kvalo: minor commit log cleanup

Signed-off-by: Rishi Panjwani <rpanjwan@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Fix endpoint_stats debugfs buffer length calculation
Jouni Malinen [Tue, 11 Oct 2011 19:08:21 +0000 (22:08 +0300)]
ath6kl: Fix endpoint_stats debugfs buffer length calculation

The previous version did not really make much sense and the theoretical
maximum length would be a bit longer. Calculate the length more
accurately. In addition, there is no need to clear the buffer, so use
kmalloc instead of kzalloc. For bonus points, add the forgotten
cred_rpt_from_other value to the file.

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: unbreak suspend
Sam Leffler [Thu, 13 Oct 2011 10:20:32 +0000 (13:20 +0300)]
ath6kl: unbreak suspend

Add missing {}'s that caused ath6kl_sdio_suspend to always return -EINVAL
causing suspend to be aborted.

kvalo: I broke this in commit f7325b85e ("ath6kl: add sdio debug messages")

Signed-off-by: Sam Leffler <sleffler@chromium.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: fix firmware start address for ar6003 hw2.0
Kalle Valo [Wed, 12 Oct 2011 06:58:28 +0000 (09:58 +0300)]
ath6kl: fix firmware start address for ar6003 hw2.0

Sangwook found out that commit 639d0b89 ("ath6kl: read firmware start
address from hardware") broke firmware boot on ar6003 hw2.0 as it seems
it's not posible to automatically query the address from hardware. So
we need to hardcode the address for hw2.0.

Reported-by: Sangwook Lee <sangwook.lee@linaro.org>
Tested-by: Sangwook Lee <sangwook.lee@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Allow CCKM AKM and KRK to be configured
Jouni Malinen [Tue, 11 Oct 2011 14:31:57 +0000 (17:31 +0300)]
ath6kl: Allow CCKM AKM and KRK to be configured

Use vendor-specific suite selectors to allow CCKM to be configured.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Add debugfs control for keepalive and disconnection timeout
Jouni Malinen [Tue, 11 Oct 2011 14:31:56 +0000 (17:31 +0300)]
ath6kl: Add debugfs control for keepalive and disconnection timeout

The new debugfs files keepalive and disconnect_timeout can be used to
fetch the current values and to change the values for keepalive and
disconnect event timeout (both in seconds).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Add debugfs files for roaming control
Jouni Malinen [Tue, 11 Oct 2011 14:31:55 +0000 (17:31 +0300)]
ath6kl: Add debugfs files for roaming control

Roaming mode can be changed by writing roam mode (default, bssbias, or
lock) to roam_mode. Forced roam can be requested by writing the BSSID
into force_roam.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Add debugfs file for target roam table
Jouni Malinen [Tue, 11 Oct 2011 14:31:54 +0000 (17:31 +0300)]
ath6kl: Add debugfs file for target roam table

The new roam_table debugfs file can be used to display the current
roam table from the target.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Add endpoint_stats debugfs file
Jouni Malinen [Tue, 11 Oct 2011 14:31:53 +0000 (17:31 +0300)]
ath6kl: Add endpoint_stats debugfs file

This file can be used to fetch endpoint statistics counters and
to clear them by writing 0 to it.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Add WSC IE on the associate message
Kevin Fang [Fri, 7 Oct 2011 00:51:19 +0000 (08:51 +0800)]
ath6kl: Add WSC IE on the associate message

For some WPS test items, such as item "5.1.14"
STAUT must include the WSC IE in the 802.11 Association Request frame.
Therefore, add the corresponding IE in association message.

Signed-off-by: Kevin Fang <kevin.fang@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: fix null skb dereference in ath6kl_rx()
Kalle Valo [Thu, 6 Oct 2011 11:32:32 +0000 (14:32 +0300)]
ath6kl: fix null skb dereference in ath6kl_rx()

smatch found that skb might be null in some cases in ath6kl_rx():

ath6kl/txrx.c +1252 ath6kl_rx(222) error: potential null derefence 'skb'.

This will happen when ath6kl is in AP mode and two clients send traffic
to each other.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: move remaining content from htc_hif.h to hif.h
Kalle Valo [Wed, 5 Oct 2011 09:23:49 +0000 (12:23 +0300)]
ath6kl: move remaining content from htc_hif.h to hif.h

Now htc_hif.h can be removed.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: remove unused values from htc_hif.h
Kalle Valo [Wed, 5 Oct 2011 09:23:42 +0000 (12:23 +0300)]
ath6kl: remove unused values from htc_hif.h

Also remove some cache line optimisation. It was using hardcoded values
which is wrong.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: move htc_hif to hif.c
Kalle Valo [Wed, 5 Oct 2011 09:23:33 +0000 (12:23 +0300)]
ath6kl: move htc_hif to hif.c

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: return error block size is not power of 2
Kalle Valo [Wed, 5 Oct 2011 09:23:25 +0000 (12:23 +0300)]
ath6kl: return error block size is not power of 2

Currently only a warning is emitted but no error is returned.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: fix struct host_app_area endian handling
Kalle Valo [Wed, 5 Oct 2011 09:23:17 +0000 (12:23 +0300)]
ath6kl: fix struct host_app_area endian handling

It was missing endian annotation.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: remove unused parameters from struct wmi
Kalle Valo [Wed, 5 Oct 2011 09:23:05 +0000 (12:23 +0300)]
ath6kl: remove unused parameters from struct wmi

There's no use for these, at least right now, so better to remove them.
If some of them are ever needed, we can always add them back.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: make sure WLAN power save is enabled during suspend
Chilam Ng [Wed, 5 Oct 2011 07:12:52 +0000 (10:12 +0300)]
ath6kl: make sure WLAN power save is enabled during suspend

Power save is enabled during ath6kl init. But when user space disables power
save, the system will go into suspend with power save disabled. The ath6kl
driver will now explicitly enable power save prior to entering suspend and
restore its previous setting upon resume

Signed-off-by: Chilam Ng <chilamng@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Minor cleanup in msg_look_ahead parameter in ath6kl_htc_rxmsg_pending_handler()
Vasanthakumar Thiagarajan [Mon, 3 Oct 2011 11:56:27 +0000 (17:26 +0530)]
ath6kl: Minor cleanup in msg_look_ahead parameter in ath6kl_htc_rxmsg_pending_handler()

It is just a four byte information of the received message
from ath6kl_htc_rxmsg_pending_handler(). Remove unnecessary
array representaion.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Avoid processing failed rx packets
Vasanthakumar Thiagarajan [Mon, 3 Oct 2011 11:56:26 +0000 (17:26 +0530)]
ath6kl: Avoid processing failed rx packets

It is not necessary to process an htc_packet which is allocated for rx
but failed in sdio rx. Though it does not fix any real issue, it does
not make much sense to process the failed frame.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Fix htc_packet leak in ath6kl_htc_rx_fetch()
Vasanthakumar Thiagarajan [Mon, 3 Oct 2011 11:58:25 +0000 (17:28 +0530)]
ath6kl: Fix htc_packet leak in ath6kl_htc_rx_fetch()

It is found during the code review. As the leak would happen only
in failure case, the imapct is not easily visible.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Fix htc_packet leak in ath6kl_htc_rx_process_packets()
Vasanthakumar Thiagarajan [Mon, 3 Oct 2011 11:58:07 +0000 (17:28 +0530)]
ath6kl: Fix htc_packet leak in ath6kl_htc_rx_process_packets()

Packet is not reclaimed when ath6kl_htc_rx_process_hdr() fails.
Fix this by deferring the packet deletion from comp_pktq till
ath6kl_htc_rx_process_hdr() returns success. This bug is found
in code review, impact is not easily visible as the leak happens
only in failure cases.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Claim sdio function only at appropriate places
Vasanthakumar Thiagarajan [Fri, 30 Sep 2011 16:16:59 +0000 (21:46 +0530)]
ath6kl: Claim sdio function only at appropriate places

There are places where tx_complete callbacks are called with
claiming the sdio function. It is not necessary to hold the
sdio func for longer. This may even affect the host side power
save, if it is supported by the controller.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Replace spin_lock_irqsave with spin_lock_bh
Vasanthakumar Thiagarajan [Fri, 30 Sep 2011 13:48:43 +0000 (19:18 +0530)]
ath6kl: Replace spin_lock_irqsave with spin_lock_bh

It is not necessary to use spinlock primitive to
protect data which is accessed in hard irq context as
nothing is running in hard irq with this driver. The
spinlock primitive meant to protect data in softirq
context is more appropriate.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Fix sparse warning "symbol 'conn' shadows an earlier one"
Vasanthakumar Thiagarajan [Fri, 30 Sep 2011 13:48:42 +0000 (19:18 +0530)]
ath6kl: Fix sparse warning "symbol 'conn' shadows an earlier one"

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 years agoath6kl: Enable force foreground scan in connected state
Vasanthakumar Thiagarajan [Sat, 1 Oct 2011 10:42:36 +0000 (16:12 +0530)]
ath6kl: Enable force foreground scan in connected state

This was disabled beacause there was a network stall
issue when scan is issued. This issue does not happen
with the new firmware (3.1.1.609), enable it back.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>