ath6kl: Fix AP mode operation after interface down/up
When operating AP interface is brough down the mode is reset to
STA. This STA will be reconfigured into AP mode when the interface
is brought up again. This sequence will be successful only when
change_virtual_intf() returns with no error, but there is a
check in this callback which does the type change only when
that interface is active. This callback does nothing more
than saving the new interface type to vif and wdev, so the
sanity check for interface state and wmi state is not necessary.
This makes the AP interface functional again after interface down/up.
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Raja Mani [Tue, 15 Nov 2011 08:44:56 +0000 (14:14 +0530)]
ath6kl: Clear WPS ctrl flag if zero length IE is received from cfg80211
Connect control flag CONNECT_WPS_FLAG has to be cleared
by default even if the driver receives zero length IE
from cfg80211.
Otherwise this flag would be always set after WPS exchange
which would lead wpa_supplicant to fail to connect with
the received WPS credentials. This issue is observed only
in OPEN security.
kvalo: use cfg80211 instead of CFG in the commit log
Signed-off-by: Raja Mani <rmani@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Kalle Valo [Mon, 14 Nov 2011 17:31:07 +0000 (19:31 +0200)]
ath6kl: use hardware version names consistently
Part of ath6kl uses "REV3" style of naming hardware versions and elsewhere
"hw 2.1.1" is used instead for the same version. This is confusing, use
the latter term everywhere.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Kalle Valo [Mon, 14 Nov 2011 17:30:39 +0000 (19:30 +0200)]
ath6kl: add board address to struct ath6kl_hw
This is to make it configurable by firmware IEs. Also determine if we need
to write or read the board address to the chip by checking if board address
is set or not.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Kalle Valo [Mon, 14 Nov 2011 17:30:13 +0000 (19:30 +0200)]
ath6kl: remove hw version related parameter defines
Having separate defines, in a different file, makes it difficult to read
the actual values. As we are just setting named fields in a struct
the defines don't make any sense anymore.
There are no functional changes, only moving of constants.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath6kl: Fix bug in setting dot11_auth_mode in AP mode
OPEN_AUTH is passed as dot11_auth_mode by default, this would
affect the AP mode when configured with shared authentication
type. Assign appropriate auth type to fix this from driver.
A patch in wpa_supplicant (wpa_supplicant: Set configured auth_algs)
is also needed to fix this.
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath6kl: Fix bug in setting default key index for tx in AP mode
vif->def_txkey_index is set to key_index in ath6kl_cfg80211_add_key().
If the interface is configured with multiple static wep keys,
vif->def_txkey_index would be holding the index of the last key configured,
not the default tx key index. Remove this unnecessary default key index setting
in ath6kl_cfg80211_add_key() to configure the right key index in WEP thereby
make it work when multiple wep keys are configured.
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Kalle Valo [Fri, 11 Nov 2011 10:18:45 +0000 (12:18 +0200)]
ath6kl: enable USB support
Now two modules are built, ath6kl_sdio.ko and ath6kl_usb.ko. But the USB
module isn't fully functional yet as HTC layer is missing support and
that's why it's marked as experimental for now.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Kalle Valo [Fri, 11 Nov 2011 10:18:37 +0000 (12:18 +0200)]
ath6kl: disable HTC for USB devices
As HTC layer doesn't support USB devices return an error if that happens.
USB support will be added to HTC in the future, this is just a temporary
solution.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Kalle Valo [Fri, 11 Nov 2011 10:18:22 +0000 (12:18 +0200)]
ath6kl: add hif_type
In some rare cases core code needs to know what hif type is used. Add
a field to struct ath6kl to denote that. Hopefully this is just a
temporary solution.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath6kl: Fix target minimum length requirement for WMI_SEND_PROBE_RESPONSE_CMDID
The firmware expects the minimum length of
WMI_SEND_PROBE_RESPONSE_CMDID to be 13. However, when the device is a
P2P GO and it needs to send a probe response to a non-P2P client,
there are no P2P IEs to be added, and therefore the length of the WMI
command is 12. This command gets rejected by the firmware. To fix
this, add an extra byte to satisfy the minimum length requirement.
Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Raja Mani [Wed, 9 Nov 2011 11:32:23 +0000 (17:02 +0530)]
ath6kl: Fix cfg80211 warning while starting IBSS mode
When the connect event is received from the target in IBSS mode,
cfg80211_ibss_joined() is called without informing BSS info to
cfg80211 layer which internally hits the below WARN_ON message.
ath6kl: Fix packet drop when ath6kl_cookie runs out
"ath6kl: Maintain virtual interface in a list" mistakenly stops the
netq only when the mode is ibss. This causes packet drops in sta mode
when the available cookies (buffer abstraction in ath6kl and also used
for tx throttling) runs out for the highest priority traffic. This patch
just fixes this regression though the original code may still need fixes
which can be addressed in separate patches.
Reported-by: Kalle Valo <kvalo@qca.qualcomm.com> Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath6kl: Fix accessing wrong skb->data in ath6kl_tx_complete()
When buffer alignmnet is applied, the data pointer of skb taken from
cookie will no longer point to the first byte of the actual data.
But the skb->data pointer is used in ath6kl_tx_complete() to get
the index of the virtual interface which will not give the correct
interface index and sometimes may give the following WARN_ON() message.
Use packet->buf instead of skb->data to fix this.
Dai Shuibing [Thu, 3 Nov 2011 09:39:39 +0000 (11:39 +0200)]
ath6kl: Indicate WAPI IE from (Re)Association Request frame
This is needed to know whether the STA requests WAPI to be used and if
so, with what AKM and cipher.
Signed-off-by: Dai Shuibing <shuibing@qca.qualcomm.com> Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Dai Shuibing [Thu, 3 Nov 2011 09:39:38 +0000 (11:39 +0200)]
ath6kl: Allow SMS4 to be configured in AP mode
Signed-off-by: Dai Shuibing <shuibing@qca.qualcomm.com> Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Dai Shuibing [Thu, 3 Nov 2011 09:39:37 +0000 (11:39 +0200)]
ath6kl: Add support for configuring SMS4 keys
Indicate support for WPI-SMS4 cipher and allow SMS4 keys to be
configured.
Signed-off-by: Dai Shuibing <shuibing@qca.qualcomm.com> Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
100 bytes are allocated to store the parameters which are needed
to create a priority stream. These 100 bytes are not sufficiant and
throws error when running the following command.
skb is dropped in ath6kl_data_tx() when the headroom in skb
is insufficient. We hit this condition for every skb in AP mode
which is used with bridge, so all tx packets are getting dropped
when tried to send traffic to wireless client from bridge. Fix
this by reallocating the headroom instead of dropping the skb
when it has lesser headroom than needed.
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Raja Mani [Mon, 7 Nov 2011 20:52:47 +0000 (22:52 +0200)]
ath6kl: Remove few unused WMI stuff
* Removed unused WOW_MAX_FILTER_LISTS macro.
* Removed empty ath6kl_wmi_get_wow_list_event_rx() function.
List of configured WOW patterns are maintained in CFG layer
itself. No need to have this function in ath6kl to get
configured WOW pattern list. It can added later if we need
it for debugging.
Signed-off-by: Raja Mani <rmani@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Raja Mani [Mon, 7 Nov 2011 20:52:46 +0000 (22:52 +0200)]
ath6kl: Expose ath6kl's WOW capabilities to cfg80211
Set the list of ath6kl's WOW trigger options in wiphy->wowlan.flags
variable during wiphy registration. So that, those options can be
configured via iw.
Signed-off-by: Raja Mani <rmani@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Raja Mani [Mon, 7 Nov 2011 20:52:46 +0000 (22:52 +0200)]
ath6kl: Remove WARN_ON msg in Suspend path
In the current code, WOW resume is executed first from RX path
and ar->state is moved to ATH6KL_STATE_ON. When platform calls
ath6kl_sdio_resume() in CFG resume context, that time ar->state
could have moved to ON state. Printing WARN_ON(1) is void in
this context. Hence removing this.
Once WOW resume is removed from RX path, This WARN_ON msg can be
reverted.
Signed-off-by: Raja Mani <rmani@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Raja Mani [Mon, 7 Nov 2011 20:52:46 +0000 (22:52 +0200)]
ath6kl: Perform WOW resume in RX path in case of SDIO IRQ wake up
The target triggers sdio data line to wake up the host when
WOW pattern matches. This causes sdio irq handler is being
executed in the host side which internally hits ath6kl's RX path.
WOW resume should happen before start processing any data from
the target. So it's required to perform WOW resume in RX path.
This area needs bit rework to avoid WOW resume in RX path,
As of now it's fine to have this model, rework will be done later.
Signed-off-by: Raja Mani <rmani@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Raja Mani [Mon, 7 Nov 2011 20:52:45 +0000 (22:52 +0200)]
ath6kl: Include new parameter in suspend path for wowlan
cfg80211 layer provides user defined wow parameters like Filter options, Patterns,
Pattern's mask, etc via "struct cfg80211_wowlan *wow" to suspend function.
Right now, this wowlan parameter is not handled in __ath6kl_cfg80211_suspend func.
This parameter has to be passed to HIF layer, So that it can be passed back to
ath6kl's cfg interface layer when WOW mode is selected.
In case of deep sleep and cut power mode, it's not handled.
Signed-off-by: Raja Mani <rmani@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Jouni Malinen [Wed, 2 Nov 2011 21:45:55 +0000 (23:45 +0200)]
ath6kl: Fix key configuration to copy at most seq_len from seq
There is no guarantee on the caller using 8-octet buffer for
key->seq, so better follow the key->seq_len parameter on figuring
out how many octets to copy.
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Kalle Valo [Thu, 3 Nov 2011 10:18:31 +0000 (12:18 +0200)]
ath6kl: add suspend_cutpower module parameter
This is to force ath6kl to power off hardware during suspend even if
sdio support keep power. This is needed, for example, when sdio
controller is buggy or maximum powersaving is desired.
Usage:
insmod ath6kl.ko suspend_cutpower=1
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Kalle Valo [Thu, 3 Nov 2011 09:53:57 +0000 (11:53 +0200)]
ath6kl: don't power down hardware when interface is down
Jouni reported that my patch "ath6kl: power down hardware when interface
is down" caused a regression on his x86 boxes and scan didn't work anymore.
I was able to reproduce the problem by disabling all debug messages.
So there has to be a race condition somewhere in the code and disable the
functionality until the race is fixed. Now hardware is powered from the
point where module is loaded until it's removed.
Reported-by: Jouni Malinen <jouni@qca.qualcomm.com> Tested-by: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
The following is the lockdep warning which detects possible
deadlock condition with the way ar->lock and ar->list_lock
are being used.
(&(&ar->lock)->rlock){+.-...}, at: [<ffffffffa0492d13>] ath6kl_indicate_tx_activity+0x83/0x110 [ath6kl]
but this lock took another, SOFTIRQ-unsafe lock in the past:
(&(&ar->list_lock)->rlock){+.+...}
and interrupts could create inverse lock ordering between them.
other info that might help us debug this:
Possible interrupt unsafe locking scenario:
softirqs have to be disabled when acquiring ar->list_lock to avoid
the above deadlock condition. When the above warning printed the
interface is still up and running without issue.
Reported-by: Kalle Valo <kvalo@qca.qualcomm.com> Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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:
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:
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>
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>
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>
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>
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>