Commit Graph

591 Commits

Author SHA1 Message Date
Aarthi Thiruvengadam c86e4f44f1 ath6kl: handle probe response from P2P device in P2P GO mode
When the device is in P2P GO mode and in listen state, the correct behavior is
to see two different probe response frames - one from P2P device and the other
from GO. wpa_supplicant uses the same mechanism to send the frame in both cases
(ath6kl_mgmt_tx). For GO probe response, ath6kl needs to call
ath6kl_send_go_probe_resp (this will add only WSC/P2P IEs and the rest of the
IEs are filled in by the firmware). That was done based on the nw_type ==
AP_NETWORK which would work if P2P Device role were in a separate netdev. When
P2P Device and GO use the same netdev, ath6kl needs to use the special GO probe
response case only if SSID is longer than P2P wildcard SSID.

Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Reviewed-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-20 10:33:11 +02:00
John W. Linville 843dc6644b Merge branch 'for-linville' of git://github.com/kvalo/ath6kl 2012-03-13 14:45:40 -04:00
Kalle Valo 9df2a0b709 ath6kl: fix debug.c file mode
Commit 7504a3e1 ("ath6kl: add padding to firmware log records") accidentally
changed debug.c mode from 100644 to 100755. Revert that back to original.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-13 14:36:27 +02:00
Kalle Valo b5283871ce ath6kl: use max_t() in ath6kl_cfg80211_connect()
ath6kl/cfg80211.c:589: WARNING: max() should probably be
max_t(u16, vif->listen_intvl_t, ATH6KL_MAX_WOW_LISTEN_INTL)

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-13 14:18:34 +02:00
Kalle Valo 7433a49010 ath6kl: fix open parenthesis alignment in ath6kl_sdio_suspend()
ath6kl/sdio.c:875: CHECK: Alignment should match open parenthesis

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-13 14:18:34 +02:00
Kalle Valo 06f33f13ac ath6kl: replace strict_strtoul() with kstrtoul()
Recommended by checkpatch.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-13 14:18:34 +02:00
Kalle Valo b0fc7c1a64 ath6kl: fix regression in ath6kl_upload_board_file()
My patch 24fc32b3 ("ath6kl: add ath6kl_bmi_write_hi32()") caused a regression
in ath6kl_upload_board_file() and the board_address variable was not
properly initialised in some cases:

ath6kl/init.c:1068:6: warning: ‘board_address’ may be used uninitialized
in this function

Most likely this broke ar6004 support but I can't test that right now.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-13 14:18:34 +02:00
Aarthi Thiruvengadam 17a7b16df4 ath6kl: Fix merge error in ath6kl_set_ies()
Portion of the commit id 080eec4fb4 ("ath6kl: Clear the IE in firmware
if not set") was overwritten by mistake due to a merge
conflict. This patch fixes the code back to how it should be.

kvalo: more details to the commit log

Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-12 09:46:56 +02:00
Kalle Valo b51f92e09a ath6kl: make ath6kl_bmi_[read|write]_hi32() endian safe
ath6kl_bmi_[read|write]_hi32() did not have endian support, fix that.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 20:04:00 +02:00
Kalle Valo 05aab177a9 ath6kl: fix too long lines
Found by checkpatch:

drivers/net/wireless/ath/ath6kl/init.c:78: WARNING: line over 80 characters
drivers/net/wireless/ath/ath6kl/init.c:397: WARNING: line over 80 characters
drivers/net/wireless/ath/ath6kl/init.c:407: WARNING: line over 80 characters
drivers/net/wireless/ath/ath6kl/htc.c:189: WARNING: line over 80 characters
drivers/net/wireless/ath/ath6kl/htc.c:704: WARNING: line over 80 characters
drivers/net/wireless/ath/ath6kl/htc.c:2452: WARNING: line over 80 characters

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 20:04:00 +02:00
Kalle Valo 12eb9444a8 ath6kl: document all spinlocks
Also fixes quite a few checkpatch warnings like this:

ath6kl/hif.h:226: CHECK: spinlock_t definition without comment

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 20:04:00 +02:00
Kalle Valo 8c9bb054f8 ath6kl: fix open paranthesis alignment in ath6kl_cfg80211_connect()
ath6kl/cfg80211.c:462: CHECK: Alignment should match open parenthesis

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 20:04:00 +02:00
Kalle Valo 1ca4d0b6b9 ath6kl: fix error handling ath6kl_target_config_wlan_params()
The error handling in ath6kl_target_config_wlan_params() was just weird,
fix that. This also fixes some of the open parenthesis alignment issues
reported by checkpatch.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 20:03:59 +02:00
Kalle Valo 80fb268639 ath6kl: add ath6kl_bmi_read_hi32()
There are few 32 bit reads from the host interest area. Add
ath6kl_bmi_read_hi32() to make it easier to do that. As code is cleaner
this also fixes few checkpatch warnings.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 20:03:59 +02:00
Kalle Valo 24fc32b356 ath6kl: add ath6kl_bmi_write_hi32()
We have a lot of 32 bit writes to the host interest area and the code
doing that is ugly. Clean that up by adding ath6kl_bmi_write_hi32().

This also fixes few checkpatch warnings.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 20:03:58 +02:00
Kalle Valo d0d670abcf ath6kl: remove multiple assignments
Found by checkpatch:

drivers/net/wireless/ath/ath6kl/cfg80211.c:1295: CHECK: multiple assignments should be avoided
drivers/net/wireless/ath/ath6kl/cfg80211.c:3000: CHECK: multiple assignments should be avoided

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 20:03:58 +02:00
Kalle Valo ddc3d77c80 ath6kl: logical continuations should be on the previous line
All found by checkpatch:

ath6kl/wmi.c:1036: CHECK: Logical continuations should be on the previous line

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 20:03:58 +02:00
Kalle Valo 96f1fadc94 ath6kl: alignment should match open parenthesis
Fix the issues which checkpatch found and were easy to fix. Especially
callers of ath6kl_bmi_write() are tricky and that needs to be fixed
separately.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 20:03:57 +02:00
Kalle Valo c650538f5d ath6kl: fix checkpatch error with EPSTAT() macro
ath6kl/debug.c:739: ERROR: Macros with complex values should be
enclosed in parenthesis

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 20:03:57 +02:00
Kalle Valo 51b56e263f ath6kl: fix pointer style
reported by checkpatch:

ath6kl/core.h:748: ERROR: "foo * bar" should be "foo *bar"
ath6kl/core.h:751: ERROR: "foo * bar" should be "foo *bar"

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 20:03:57 +02:00
Raja Mani ce0dc0cfea ath6kl: Set optimal listen intvl,bmiss,scan params while going to wow suspend
* In order to save the target power in WOW suspend state,
  configure the best optimal values for the below parameters,
     - listen interval.
     - beacon miss interval.
     - scan parameters.

  Default values for above attributes are reverted in
  wow resume operation.

* The default listen interval is set before the host issue
  connect request.

* New function is added to configure beacon miss count.

kvalo: minor changes to fix open parenthesis alignment

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 09:49:47 +02:00
Raja Mani 8f46fccd6c ath6kl: Maintain the listen interval per VIF specific
Firmware has the option to support the listen interval
per vif specific. Fix this.

Listen interval can be set by the TUs or by the number
of beacons. Current code enables the user to configure
the listen interval in the unit of 'number of beacons'
using debugfs entry "listen_interval". Going forward,
we need to alter the listen interval in the unit of TUs
to get good power numbers while going to WOW suspend/resume.

Allowing the user to change the listen interval in
the unit of "number of beacons"  in debugfs and changing
listen interval in wow suspend/resume in the unit of
time (TUs) would lead us to confuse.

This patch make sures the listen interval is changed only
in the unit of time (TUs).

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 09:38:25 +02:00
Raja Mani 390a8c8fae ath6kl: Check wow state before sending control and data pkt
Below two scenarios are taken care in this patch which helped
to fix the firmware crash during wow suspend/resume.

* TX operation (ctrl tx and data tx) has to be controlled based
  on suspend state. i.e, with respect to WOW mode, control packets
  are allowed to send from the host until the suspend state goes
  ATH6KL_STATE_WOW and the data packets are allowed until WOW
  suspend operation starts.

* Similarly, wow resume is NOT allowed if WOW suspend is in progress.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 09:34:14 +02:00
Raja Mani 1e9a905d9a ath6kl: Add provision to define suspend policy in disconnected state.
It gives flexibility to the user to define suspend policy
when the suspend mode is set to WOW and the device is in
disconnected state at the time of suspend.

New module parameter wow_mode is added to get the choice
from the user. This parameter is valid only if the module
parameter suspend_mode is set to WOW.

To force WOW in connected state and cut power
in disconnected state:
  suspend_mode=0x3 wow_mode=0x1

To force WOW in connected state and deep sleep
in disconnected state (this is also the default wow_mode):
   suspend_mode=0x3 wow_mode=0x2

If there is no value specified to wow_mode during insmod,
deep sleep mode will be tried in the disconnected state.

kvalo: clarified commit log

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-07 09:17:10 +02:00
Johannes Berg 804483e907 cfg80211/mac80211: report signal strength for mgmt frames
Add the signal strength (in dBm only for now) to
frames that are received via nl80211's various
frame APIs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-06 15:16:05 -05:00
Vasanthakumar Thiagarajan 068a4633bf ath6kl: Fix kernel panic while receiving fwlog during boot
"ath6kl: Defer wiphy and netdev registration till the end of ath6kl_core_init()"
causes kernel panic by accessing the unallocated debug resources during
boot time. To fix this, split the debug initialization funtion into two,
one initializes the debug resource and the other takes care of debugfs
initialization. When this issue shows up the kernel crash dump would
look like

 ath6kl_debug_fwlog_event+0x9c/0x10a
 [<c10666c9>] register_lock_class+0x57/0x288
 [<c1065cd3>] ? trace_hardirqs_on+0xb/0xd
 [<f801f4c9>] ? ath6kl_debug_fwlog_event+0x9c/0x10a
 [<c1066a8a>] __lock_acquire+0x96/0xbe5
 [<c106007b>] ? alarmtimer_suspend+0x80/0x127
 [<c10258da>] ? vprintk+0x394/0x3b1
 [<f801f4c9>] ? ath6kl_debug_fwlog_event+0x9c/0x10a
 [<c10676b3>] lock_acquire+0xda/0xf9
 [<f801f4c9>] ? ath6kl_debug_fwlog_event+0x9c/0x10a
 [<c1532ce3>] _raw_spin_lock+0x28/0x58
 [<f801f4c9>] ? ath6kl_debug_fwlog_event+0x9c/0x10a
 [<f801f4c9>] ath6kl_debug_fwlog_event+0x9c/0x10a
 [<f80310a4>] ath6kl_wmi_control_rx+0x69d/0xb50 [ath6kl_core]
 [<f802d2e1>] ? ath6kl_rx+0x3c/0x839 [ath6kl_core]
 [<f802d35d>] ath6kl_rx+0xb8/0x839 [ath6kl_core]
 [<c104b81e>] ? local_clock+0x2d/0x4e
 [<c102a0af>] ? _local_bh_enable_ip+0x94/0x98
 [<f802bfc0>] ? ath6kl_alloc_amsdu_rxbuf+0xb7/0xb7
 [<f8023b28>] ath6kl_htc_rxmsg_pending_handler+0x891/0x988 [ath6kl_core]
 [<f802bf00>] ? ath6kl_refill_amsdu_rxbufs+0x89/0x92
 [<f802d2a5>] ? aggr_timeout+0xed/0xed [ath6kl_core]
 [<f802bfc0>] ? ath6kl_alloc_amsdu_rxbuf+0xb7/0xb7
 [<f802c420>] ? ath6kl_tx_complete+0x376/0x376 [ath6kl_core]
 [<f8020e92>] ath6kl_hif_intr_bh_handler+0xf7/0x33e
 [<c138ab00>] ? mmc_host_disable+0x15/0x3a
 [<f8123b5c>] ath6kl_sdio_irq_handler+0x3c/0x90 [ath6kl_sdio]
 [<c1392f56>] sdio_irq_thread+0xb6/0x29c
 [<c1392ea0>] ? sdio_claim_irq+0x1cb/0x1cb
 [<c103d4c0>] kthread+0x67/0x6c
 [<c103d459>] ? __init_kthread_worker+0x42/0x42
 [<c153903a>] kernel_thread_helper+0x6/0xd
 BUG: unable to handle kernel NULL pointer dereference at
EIP: [<f801f4d4>] ath6kl_debug_fwlog_event+0xa7/0x10a

kvalo: rename new function to ath6kl_debug_init_fs() and add a comment
why it's needed

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>
2012-03-06 17:53:54 +02:00
Kalle Valo 05e5bd0f3d Merge remote branch 'wireless-next/master' into ath6kl-next
Conflicts:
	drivers/net/wireless/ath/ath6kl/cfg80211.c
2012-03-05 19:32:58 +02:00
Raja Mani daa16bc52a ath6kl: Restrict memcpy to bounce buffer only for write request
No need to copy received local buffer content to bounce buffer
(DMA buffer) while performing sync READ operation from the chip.

It's applicable for only WRITE operation.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-05 19:06:34 +02:00
Raja Mani d1f4159723 ath6kl: Fix random system lockup
The commit "ath6kl: Use a mutex_lock to avoid
race in diabling and handling irq" introduces a
state where ath6kl_sdio_irq_handler() would be waiting
to claim the sdio function for receive indefinitely
when things happen in the following order.

ath6kl_sdio_irq_handler()
	- aquires mtx_irq
	- sdio_release_host()
					ath6kl_sdio_irq_disable()
						- sdio_claim_host()
						- sleep on mtx_irq
	ath6kl_hif_intr_bh_handler()
		- (indefinitely) wait for the sdio
		  function to be released to exclusively claim
		  it again for receive operation.

Fix this by replacing the mtx_irq with an atomic
variable and a wait_queue.

kvalo: add ath6kl_sdio_is_on_irq() due to open parenthesis alignment

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-01 09:34:12 +02:00
Etay Luz af840ba7e2 ath6kl: Collect residue firmware logs
Collect residue firmware logs following firmware assert.
Firmware sends logs to host once the 1500 byte log buffer
has been filled. At time of assert, there could be residue
logs lying in the firmware. This patch pulls those residue
logs. This would give the full picture of the firmware.

Signed-off-by: Etay Luz <eluz@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-01 08:47:38 +02:00
Etay Luz 7504a3e1f5 ath6kl: add padding to firmware log records
firmware debug utility expects firmware log record size
to be 1500 bytes. This patch ensures that the
firmware record will be exactly 1500 bytes.

kvalo: remove trailing space

Signed-off-by: Etay Luz <eluz@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-01 08:47:21 +02:00
Thomas Pedersen 67cd22e48d ath6kl: implement hidden ssid
The ath6kl FW does not distinguish between different types of hidden
SSIDs (empty or null), so treat all cfg80211 requests for hidden ssid
the same.

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-01 08:39:12 +02:00
Aarthi Thiruvengadam 080eec4fb4 ath6kl: Clear the IE in firmware if not set
Remove check so that IE in firmware is cleared if not set. Without this fix, any
previously set IE will be used incorrectly in the next frame. For example,
consider the scenario where a P2P device scan is followed by a regular station
scan. The P2P IE set by the P2P scan needs to be cleared, otherwise the station
scan will contain the P2P IE.

kvalo: indentation fixes

Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-01 08:37:32 +02:00
Vasanthakumar Thiagarajan e5348a1e33 ath6kl: Make sure wiphy is registered before calling regulatory_hint()
As regulatory events are processed even before the wiphy is registered,
calling regulatory_hint() at early stage should be fixed.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-01 08:33:45 +02:00
Vasanthakumar Thiagarajan b796f0934a ath6kl: Defer wiphy and netdev registration till the end of ath6kl_core_init()
This makes the wiphy and initial netdev registration the last step
in dev initialization. Apart from the fact that this looks right,
it can also be used to setup wiphy with the regulatory information
received from firmware after uploading the firmware. Also it fixes
a FIXME in ath6kl_core_init() where mac address is copied into
netdev->dev_addr, ath6kl_interface_add() takes care of this as well.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-01 08:30:19 +02:00
Vasanthakumar Thiagarajan 81db48dc29 ath6kl: Skip vif index validation in ath6kl_rx() for wmi events
When the wmi event is vif specific, the validation of vif index
is taken care in ath6kl_wmi_proc_events_iface(). This also avoids
the need for a netdev to be registered while receiving initial events
like "target_ready" and "regulatory domain".

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-01 08:30:19 +02:00
Vasanthakumar Thiagarajan 5dbc811f42 ath6kl: Refactor ath6kl_wmi_control_rx()
Split the wmi event processing into the one which needs to be
vif specific and the reset. This is a step towards avoiding
the need for wiphy and a netdev registration before getting
any message from firmware.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-01 08:30:19 +02:00
Vasanthakumar Thiagarajan 4705b7036c ath6kl: Initialize netdev hw_features for every interface
Move netdev->hw_features setting from ath6kl_core_init() to
init_netdev() so that it is done for every interface.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-01 08:30:18 +02:00
Vasanthakumar Thiagarajan f2afdac709 ath6kl: Group wiphy initialization into ath6kl_cfg80211_init()
There are some code which initializes various wiphy members
left outside ath6kl_cfg80211_init(), in ath6kl_core_init().
Move them into a single palce.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-03-01 08:30:18 +02:00
Vasanthakumar Thiagarajan faaf192908 ath6kl: Register driver ht capabilities in wiphy
Register driver's ht capabilities in wiphy to avoid failures
in setting ht channels from hostapd.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-28 11:13:44 +02:00
Raja Mani 4480bb5936 ath6kl: Lower SDIO pad drive strength for hw2.1.1 board
Without this change, SDIO shuts down due to CRC error during
data communication to the firmware in some of the platform.
for example, scan request issued to the firmware doesn't
return scan completed events and cause the socket interface
to always return -16 (device busy).

SDIO pad drive strength should be reduced for hw2.1.1 board
to avoid such errors.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-28 10:44:03 +02:00
Vasanthakumar Thiagarajan 13423c3119 ath6kl: Make foreground scan a deterministic one
This makes the device get into scan state as soon as a
scan request is received, instead of blocking the scan
request till the traffic comes down. It is  necessary
for the deterministic foreground scan particularly when
having multiple vif operating where, if the scan is non-
deterministic, scan on one interface will not start
as long as there are traffic on the other interface. This
change passes 50 msec as foreground scan interval to fix this.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-28 10:39:39 +02:00
Vasanthakumar Thiagarajan 5378f244b6 ath6kl: Fix memory leak of rx packets in endpoint 0
htc_packet and htc_packet->buf_start are separately allocated
for endpoint 0. This is different for other endpoints where
packets are allocated as skb where htc_packet is skb->head
and they are freed properly. Free htc_packet and htc_packet->buf_start
separatly for endpoint 0.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-28 09:45:51 +02:00
Vasanthakumar Thiagarajan bd5b5ac287 ath6kl: Make sure to allocate rx buffers after the endpoint connection
Rx buffers should be allocated for control and best effort endpoints only
after the enpoints connection is esablished. But this is done before the
endpoint connection is complete, we don't even the control and BE endpoints
that time. Move the buffer allocation after endpoint connection is over,
after ath6kl_init_hw_start(). Found in review, never seen any real issue
with this.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-28 09:45:50 +02:00
Vasanthakumar Thiagarajan cc4d623de4 ath6kl: Remove bogus non-NULL pointer check
In ath6kl_cfg80211_add_key(), params is checked for non-NULL
but this pointer has been deferenced many times before this check. This
gives the following smatch warning. add_key() can never carry NULL as
params, remove this bogus check.

ath6kl_cfg80211_add_key(86) warn: variable dereferenced before check 'params'

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-27 19:24:30 +02:00
Vasanthakumar Thiagarajan e8ad9a0638 ath6kl: Fix missing release of semaphore in ath6kl_stop_txrx()
This fixes smatch warning "inconsistent returns sem:&ar->sem".

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-27 19:24:30 +02:00
Chilam Ng 0ea10f2b46 ath6kl: assign Tx packet drop threshold per endpoint based on AC priority
Tx packets will begin to drop when there are multiple traffic priorities
and the current traffic is not the highest priority and the remaining
cookies drop below a certain number, which is fixed for all AC. It is
possilbe that lower priority AC have more traffic which will consume
more cookies and lock out higher priority AC from having any. Assign
each endpoint (AC) with a different Tx-packet-drop threshold so lower
priority AC is more likely to drop packets and the cookies become more
available to higher priority AC.

Signed-off-by: Chilam Ng <chilamng@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-27 19:14:51 +02:00
Naveen Gangadharan d0ff7383a3 ath6kl: Add unicast mgmt frame buffering
PS buffering of unicast Action frames that are sent in a context
of a BSS. In AP mode when the recepient station goes to powersave
and PS_POLL flag is not set, we would buffer the frames. Send out
unicast mgmt bufferred frame when PS_POLL is received.

This fixes a bug in P2P GO behavior when sending a GO Discoverability
Request to a client that is in sleep mode.

kvalo: indentation fixes

Signed-off-by: Thirumalai Pachamuthu <tpachamu@qca.qualcomm.com>
Signed-off-by: Naveen Gangadharan <ngangadh@qca.qualcomm.com>
Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-27 15:49:06 +02:00
Johannes Berg 8860020e0b cfg80211: restructure AP/GO mode API
The AP/GO mode API isn't very clearly defined, it
has "set beacon" and "new beacon" etc.

Modify the API to the following:
 * start AP -- all settings
 * change beacon -- new beacon data
 * stop AP -- stop AP mode operation

This also reflects in the nl80211 API, rename
the commands there correspondingly (but keep
the old names for compatibility.)

Overall, this makes it much clearer what's going
on in the API.

Kalle developed the ath6kl changes, I created
the rest of the patch.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-02-22 14:51:18 -05:00
Naveen Gangadharan 3b96d49a79 ath6kl: Fix firmware crash dump
The firmware crash dump printout was wrong as it was using incorrect
offsets.

kvalo: improve commit log, change the "%d:" to print word indexes, not bytes

Signed-off-by: Naveen Gangadharan <ngangadh@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-08 11:44:41 +02:00
Prasanna Kumar fb1ac2efa3 ath6kl: add support for AR6003 2048 byte board file
AR6003 2.1.1 supports both 1792 and 2048 byte board files.
Add support for 2048 byte board file.

kvalo: add ath6kl prefix to the title

Signed-off-by: Prasanna Kumar <kumarpra@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-08 11:39:52 +02:00
Chilam Ng b29072cc7b ath6kl: prioritize Tx bundling based on AC priorities
Tx bundling is the more efficient use of SDIO bus and allows more packet
transfers with fewer bus transactions, and is a way to improve overall
throughput. However, Tx bundling has only 4 scatter request resources available.
When there are multiple traffic streams of different priorities, it's possible
that lower priority traffic may hog all the scatter requests and lock out the
higher prioirty traffic from bundling.
Tx bundling is now enabled per AC. When an AC do a scatter request and
the remaining scatter request resources is lower than a configurable
threshold, it will disable Tx bundling for all AC's of lower priorities.
When an AC has Tx bundling disabled and has no Tx bundles sent in a
consecutive and configurable number of packets, Tx bundling will be re-enabled
for that AC.

Signed-off-by: Chilam Ng <chilamng@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-08 11:33:49 +02:00
Vasanthakumar Thiagarajan 1b2df40734 ath6kl: Update license header
Update license header with the copyright to Qualcomm Atheros, Inc.
for the year 2011-2012.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-08 11:31:31 +02:00
Kalle Valo c807b30d25 ath6kl: add blocking debugfs file for retrieving firmware logs
When debugging firmware issues it's not always enough to get
the latest firmware logs, sometimes we need to get logs from a longer
period. To make this possible, add a debugfs file named fwlog_block. When
reading from this file ath6kl will send firmware logs whenever available
and otherwise it will block and wait for new logs.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-08 11:25:07 +02:00
Kalle Valo 9b9a4f2aca ath6kl: store firmware logs in skbuffs
Currently firmware logs are stored in a circular buffer, but this was
not very flexible and fragile. It's a lot easier to store logs to struct
skbuffs and store them in a skb queue. Also this makes it possible
to easily increase the buffer size, even dynamically if we so want (but
that's not yet supported).

From user space point of view nothing should change.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-08 11:25:07 +02:00
Chilam Ng 5fbea5dcc0 ath6kl: initialize the 'nominal_phy' field in the 'wmi_create_pstream_cmd' struct for create_qos command
The nominal_phy field is uninitialized. Initialize it to min_phy_rate for
create_qos.

kvalo: simplified the equation as checkpatch complained for a too long line

Signed-off-by: Chilam Ng <chilamng@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-02 10:19:54 +02:00
Kalle Valo 1b46dc0486 ath6kl: fix compiler warning in ath6kl_init_hw_params()
Both Luis and John reported that they see a compiler warning:

drivers/net/wireless/ath/ath6kl/init.c: In function 'ath6kl_init_hw_params':
drivers/net/wireless/ath/ath6kl/init.c:1377:26: warning: ‘hw’
may be used uninitialized in this function

Oddly enough I have never seen it. But AFAICT the code is correct and
hw is not used uninitalized so add uninitialized_var() to inform that to
the compiler.

Reported-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Reported-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-02 10:13:06 +02:00
Masanari Iida 3c325fbd0c ath6kl: Fix typo in cfg80211.c
Correct spelling "spported" to "supported" in
drivers/net/wireless/ath/ath6kl/cfg80211.c

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-02-02 10:09:37 +02:00
Santosh Sajjan cca4d5adcf ath6kl: Workaround to support Deep Sleep with MSM.
Set the host pm flag MMC_PM_WAKE_SDIO_IRQ to allow host
to disable the sdc2_clk and sdc2_h_clk,so that the MSM device
enter into TCXO shutdown.

Signed-off-by: Santosh Sajjan <ssajjan@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-31 21:06:46 +02:00
Raja Mani 3c411a4344 ath6kl: Return a proper error code when not in connected state
Error code ENOTCONN is more suitable than EINVAL to report
when the driver is not in connected state in ath6kl_wow_suspend().

I found this during code review.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-30 21:22:55 +02:00
Raja Mani 081c7a84e9 ath6kl: Wait for host sleep mode cmd processed event during WOW suspend
For every WMI_SET_HOST_SLEEP_MODE_CMDID command (send from the host),
the firmware sends WMI_SET_HOST_SLEEP_MODE_CMD_PROCESSED_EVENTID as
an acknowledgement to the host.

In order to being sync with the firmware, the host has to wait for
WMI_SET_HOST_SLEEP_MODE_CMD_PROCESSED_EVENT event before going to
the suspend state. This patch ensures ath6kl_wow_suspend() waits
until it gets this event after sending set host sleep mode command.

This patch adds,
 * New command WMI_SET_HOST_SLEEP_MODE_CMD_PROCESSED_EVENTID in
   WMI event table.
 * New WMI function ath6kl_wmi_host_sleep_mode_cmd_prcd_evt_rx()
   to process the event.
 * New flag HOST_SLEEP_MODE_CMD_PROCESSED in VIF flags to record
   the arrival of the event.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-30 21:22:55 +02:00
Raja Mani d91e8eee04 ath6kl: Configure WOW patterns while going to wow_suspend
First preference is given to the user configured WOW patterns.
If the user doesn't configure any patterns (for ex, via iw command),
the default patterns will be configured based on the current mode
(vif->nw_type) while going to WOW suspend.

Summary of changes:

  * ath6kl_wow_ap() is added to configure the below default
    patterns when the system enters into WOW suspend in AP mode.
      + Unicast IP, EAPOL-like and ARP packet pattern
      + ARP packet pattern
      + mDNS/SSDP/LLMNR pattern
      + DHCP broadcast pattern

 * ath6kl_wow_sta() is added to configure the below default
   patterns when the system enters into WOW suspend in STA mode.
      + Unicast packet pattern
      + mDNS/SSDP/LLMNR pattern

  * Move the user provided WOW patterns configuration code
    from ath6kl_wow_suspend() to a separate function called
    ath6kl_wow_usr().

  * Two argument variable's ('filter' and 'mask) data type in
    ath6kl_wmi_add_wow_pattern_cmd() are changed from 'u8 *' to
    'const u8 *'. This is needed to make all pattern and mask
    arrays to be 'static const u8' in the caller function.

  * New conditional check is added to make sure user
    configured pattern count is within the limit (WOW_MAX_FILTERS_PER_LIST).

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-30 21:22:55 +02:00
Raja Mani e390af779d ath6kl: Re-architect suspend mode handling in ath6kl_sdio_suspend
Using this patch, the user can bypass existing auto
suspend mode selection logic and force ath6kl to enter
into the suspend mode what he/she wants.

If the user doesn't choose any suspend mode while doing
insmod of the driver, auto suspend mode selection logic
will kick in and choose suspend mode based on the host
SDIO controller capability.

Generic module parameter is required to specify suspend
mode including Deep Sleep and WOW while doing insmod.
Renaming existing mod param variable suspend_cutpower
would be sufficient to meet this requirement.

New module parameter suspend_mode can take any one of
the below suspend state,
   1. cut power
   2. deep sleep
   3. wow

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-30 21:22:54 +02:00
Vasanthakumar Thiagarajan c86515412f ath6kl: Fix kernel panic during rx aggregation
"ath6kl: Define a structure for connection specific aggregation information"
introduces this. In aggr_conn_init(), vif->aggr_cntxt is assigned to
aggr_conn->aggr_info, but vif->aggr_cntxt is not initialized at this
point, this would end up accessing an invalid pointer in aggregation
receive path. Fix this by passing the correct aggr_info to aggr_conn_init().
The panic trace would look like.

[<ffffffff8159e02e>] panic+0xa1/0x1c6
[<ffffffff8103773d>] ? kmsg_dump+0xfd/0x160
[<ffffffff815a2f6a>] oops_end+0xea/0xf0
[<ffffffff8102b95d>] no_context+0x11d/0x2d0
[<ffffffff8102bc5d>] __bad_area_nosemaphore+0x14d/0x230
[<ffffffff815a5c4d>] ? do_page_fault+0x30d/0x520
[<ffffffff8102bd53>] bad_area_nosemaphore+0x13/0x20
[<ffffffff815a5cfd>] do_page_fault+0x3bd/0x520
[<ffffffff8108bd60>] ? __lock_acquire+0x320/0x1680
[<ffffffff812e3a9d>] ? trace_hardirqs_off_thunk+0x3a/0x3c
[<ffffffff815a2385>] page_fault+0x25/0x30
[<ffffffffa0487a5f>] ? aggr_slice_amsdu+0xdf/0x170 [ath6kl_core]
[<ffffffffa0487bac>] aggr_deque_frms+0xbc/0x190 [ath6kl_core]
[<ffffffffa0488404>] ath6kl_rx+0x3e4/0xae0 [ath6kl_core]
[<ffffffffa047ae77>] ath6kl_htc_rxmsg_pending_handler+0x8b7/0xf10 [ath6kl_core]
[<ffffffffa00c82f0>] ? mmc_do_release_host+0x70/0x90 [mmc_core]
[<ffffffffa00c833a>] ? mmc_release_host+0x2a/0x50 [mmc_core]
[<ffffffffa04865c0>] ? ath6kl_alloc_amsdu_rxbuf+0x140/0x140 [ath6kl_core]
[<ffffffffa0477772>] ath6kl_hif_intr_bh_handler+0x362/0x510 [ath6kl_core]
[<ffffffffa01f1000>] ath6kl_sdio_irq_handler+0x60/0xb0 [ath6kl_sdio]
[<ffffffffa00d30bc>] sdio_irq_thread+0xec/0x320 [mmc_core]
[<ffffffffa00d2fd0>] ? sdio_claim_irq+0x220/0x220 [mmc_core]
[<ffffffffa00d2fd0>] ? sdio_claim_irq+0x220/0x220 [mmc_core]
[<ffffffff8105b21e>] kthread+0xbe/0xd0
[<ffffffff815ab574>] kernel_thread_helper+0x4/0x10
[<ffffffff815a2174>] ? retint_restore_args+0x13/0x13
[<ffffffff8105b160>] ? __init_kthread_worker+0x70/0x70
[<ffffffff815ab570>] ? gs_change+0x13/0x13

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-30 21:11:30 +02:00
Kalle Valo 5f1127ffba ath6kl: fix testmode when fw-2.bin or fw-3.bin is used
Testmode (TCMD and ART) was not enabled when fw-2.bin or fw-3.bin files
were available, fix that by fetching testmode file just after the
board file but before rest of the firmware files are fetched.

I also added testmode field to struct ath6kl and moved the module parameter
to core.c. Now all module parameters are grouped in one place.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-30 21:08:45 +02:00
Vasanthakumar Thiagarajan 1d2a4456de ath6kl: Fix bug in maintaining aggregation state in AP mode
Currently rx aggregation related states are maintained per
vif, but this will not properly work when operating in AP mode.
Aggregation is completely broken when more than one
11n stations are connected to AP mode vif. Fix this issue
by keeping station specific aggregation state in sta_list.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-24 14:12:27 +02:00
Vasanthakumar Thiagarajan 3fdc099109 ath6kl: Fix bug in using tid given by addba/delba req events
The tid which is given in addba/delba req event is not
just tid but also muxed with the assoc id (MSB 4 bits)
which can be used to determine the corresponding connected
station in softap mode. The actual tid is LSB 4 bits. Using
the tid as it is with rx_tid[] would result in OOB or invalid
memory access in AP mode.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-24 14:12:27 +02:00
Vasanthakumar Thiagarajan 17741c8db4 ath6kl: Pass vif instead of ar to ath6kl_add_new_sta()
This will be used when initializing station specific aggregation
information.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-24 14:12:27 +02:00
Vasanthakumar Thiagarajan 7baef812eb ath6kl: Define a structure for connection specific aggregation information
This patch just groups connection specific aggregation information
from struct aggr_info into a new structure (struct aggr_info_conn)
so that, in softAP mode, this can be used when each connected station
is made to have it's own aggregation state.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-24 14:12:27 +02:00
Vasanthakumar Thiagarajan 0e7de662bc ath6kl: Fix memory leak when unloading ath6kl_sdio
The patch "ath6kl: create core.c" removes wiphy_free() from
ath6kl_cfg80211_cleanup() and misses to free wiphy in
ath6kl_sdio_remove(). This patch fixes this regression.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-24 14:12:26 +02:00
Vasanthakumar Thiagarajan 7a950ea81d ath6kl: Make sure to delete rx aggregation timer in aggr_reset_state()
The timer which is used to flush rx aggregation frames needs to
be disabled when resetting the aggregation state. This is found
in code review.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-24 14:12:26 +02:00
Kalle Valo 241b128b6b ath6kl: add back beginnings of USB support
John Linville had to revert the part of USB support which was already
in ath6kl due to build problems in commit cb00ec382b ("ath6kl: revert
USB support"). Now that I fixed the build problems properly by adding
ath6kl_core.ko kernel module it's possible to add back the
(incomplete) USB support. This patch is a revert of John's patch and
adds back the USB code which as already in ath6kl, only difference
being minor changes in Makefile and adapting usb.c to new core
function names.

Note that USB support in ath6kl is not complete yet. This code only
makes it possible to boot firmware but as HTC layer does not yet
support USB it's not possible to send any WMI commands nor data
packets to the firmware. That will be added soon.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-18 13:59:51 +02:00
Kalle Valo d6a434d60e ath6kl: create ath6kl_core.ko
Now ath6kl is ready for splitting core code to ath6kl_core.ko module.
This also makes it possible to link both sdio and usb code to kernel
at the same time, which earlier failed miserably.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-18 13:59:51 +02:00
Kalle Valo 3b1b7d0985 ath6kl: convert ath6kl_dbg() and ath6kl_dbg_dump() into functions
That way it's possible to not export debug_mask outside the upcoming
ath6kl_core.ko and that makes it easier to ath6kl_core.ko in the
following patch.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-18 13:59:50 +02:00
Kalle Valo 5afa5aa796 ath6kl: get rid of AR_DBG_LVL_CHECK()
We don't need it as debug calls already have a log level and compiler
should be smart enough to optimise away the code when ath6kl debug code
is not enabled. Also it makes it easier to abstract core code to
ath6kl_core.ko.

In ath6kl_dump_registers() I had to change the debug level from ANY to IRQ
as I removed the AR_DBG_LVL_CHECK() check before calling the function.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-18 13:59:49 +02:00
Kalle Valo 45eaa78f75 ath6kl: create core.c
Currently core functions are spread between various files, group all
the functions into file and rename the functions to follow the style
used elsewhere in the driver. This will make it easier to a separate core
module.

Also fix a bug where wiphy is freed too early.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-18 13:59:49 +02:00
Kalle Valo f29af97853 ath6kl: add ATH6KL_CONF_UART_DEBUG
Add ATH6KL_CONF_UART_DEBUG which is set whenever uart_debug module
parameter is enabled. This way we can keep the uart_debug parameter
static when core.c file is introduced.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-18 13:51:13 +02:00
Kalle Valo 46d33a21cf ath6kl: unify cfg80211 init/cleanup functions
Group them together and change the naming to follow the common style in
ath6kl. No functional changes.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-18 13:51:13 +02:00
Kalle Valo c25889e8a6 ath6kl: rename vif init and cleanup functions
ath6kl_cfg80211_vif_init/cleanup() follow more closely the style used
elsewhere in ath6kl.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-18 13:51:11 +02:00
Alex Yang cd23c1c9b8 ath6kl: add testmode 2 for 6003 ART
Add testmode 2 for 6003 ART. When you insmod ath6kl_sdio.ko testmode=2, ath6kl
will load ART firmware utf.bin and testscript nullTestFlow.bin. These files
should be put in the firmware folder.

kvalo: add "ath6kl:" to the title, word wrap the commit log and remove
extra line in the code

Signed-off-by: Alex Yang <xiaojuny@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-18 13:47:31 +02:00
Kalle Valo e572602884 ath6kl: fix uninitialized warning in ath6kl_process_uapsdq()
Before I commited patch c1762a3fe ("ath6kl: Add support for uAPSD") I
did a minor change how up variable is initialised in
ath6kl_process_uapsdq(). But I was sloppy and caused this compiler
warning:

txrx.c:88:5: warning: 'up' may be used uninitialized in this function

Revert my change to fix the warning.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-18 13:41:13 +02:00
Kalle Valo 3462735dad ath6kl: remove -D__CHECK_ENDIAN__ from Makefile
As drivers/net/wireless/ath/Makefile contains the flag to enable
endian checks there's no need to have it in ath6kl makefile anymore.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-18 13:41:12 +02:00
Kalle Valo d6f802612a ath6kl: use netdev_features_t
Commit c8f44affb7 ("net: introduce and use netdev_features_t for
device features sets") added netdev_features_t to ndo_set_features.
Change ath6kl to use the new type.

This fixes a warning:

ath6kl/main.c:1170: warning: initialization from incompatible pointer type

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-18 13:41:11 +02:00
Kalle Valo a0afd4f7c1 Merge remote branch 'wireless-next/master' into ath6kl-next
Conflicts:
	drivers/net/wireless/ath/ath6kl/usb.c
2012-01-13 13:57:45 +02:00
Raja Mani e80ec84d93 ath6kl: Remove useless initialization in ath6kl_read_fwlogs()
ath6kl_read_fwlogs() assigns the value zero to the variable 'ret'
at the time of declaration. Later, return value of ath6kl_diag_read32()
repalces the init value. Hence removing useless zero assignment.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-13 13:52:41 +02:00
Thirumalai Pachamuthu c1762a3fe1 ath6kl: Add support for uAPSD
* A new APSD power save queue is added in the station structure.
* When a station has APSD capability and goes to power save, the frame
  designated to the station will be buffered in APSD queue.
* When the host receives a frame which the firmware marked as trigger,
  host delivers the buffered frame from the APSD power save queue.
  Number of frames to deliver is decided by MAX SP length.
* When a station moves from sleep to awake state, all frames buffered
  in APSD power save queue are sent to the firmware.
* When a station is disconnected, all frames bufferes in APSD power save
  queue are dropped.
* When the host queues the first frame to the APSD queue or removes the
  last frame from the APSD queue, it is indicated to the firmware using
  WMI_AP_APSD_BUFFERED_TRAFFIC_CMD.

kvalo: fix buggy handling of sks queues, made it more obvious
the user priority when wmm is disabled, remove unneed else block and
combined some variable declarations

Signed-off-by: Thirumalai Pachamuthu <tpachamu@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-13 13:48:25 +02:00
Sujith Manoharan 8232736dab ath6kl: Fix listen interval handling
This patch addresses a few problems with the commit:

"ath6kl: Implement support for listen interval from userspace"

* The debugfs file required for reading/writing the listen interval
  wasn't created. Fix this.

* The interface index was being hardcoded to zero. Fix this.

* Two separate parameters, "listen_interval_time and listen_interval_beacons"
  were being used. This fails to work as expected because the FW assigns
  higher precedence to "listen_interval_beacons" and "listen_interval_time"
  ends up being never used at all.

  To handle this, fix the host driver to exclusively use listen interval
  based on units of beacon intervals.

To set the listen interval, a user would now do something like this:

echo "10" > /sys/kernel/debug/ieee80211/*/ath6kl/listen_interval

kvalo: fix two checkpatch warnings

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-12 13:36:37 +02:00
Sujith Manoharan cbec267a51 ath6kl: Initialize a variable properly
This prevents 'comp_pktq' from being used in an
incorrect manner.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-12 13:36:37 +02:00
Sujith Manoharan 4a8ce2fd05 ath6kl: Remove redundant pointer check
'params' is already used earlier and there is no point
in checking for a NULL condition again.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-12 13:36:37 +02:00
Sujith Manoharan 866dc88607 ath6kl: Fix SDIO error path
sdio_release_host() would be called twice if sdio_set_block_size()
fails for some reason, which would result in the following warning.

WARNING: at /home/sujith/dev/wireless-testing/drivers/mmc/core/core.c:828 mmc_release_host+0x42/0x50 [mmc_core]()

Call Trace:
[<ffffffff81064fdf>] warn_slowpath_common+0x7f/0xc0
[<ffffffff8106503a>] warn_slowpath_null+0x1a/0x20
[<ffffffffa03beb42>] mmc_release_host+0x42/0x50 [mmc_core]
[<ffffffffa03c917e>] sdio_release_host+0x1e/0x30 [mmc_core]
[<ffffffffa053fac7>] ath6kl_sdio_config+0xc7/0x110 [ath6kl_sdio]
[<ffffffffa053fd2c>] ath6kl_sdio_probe+0x21c/0x320 [ath6kl_sdio]
[<ffffffffa03beb2a>] ? mmc_release_host+0x2a/0x50 [mmc_core]
[<ffffffffa03c7d2a>] sdio_bus_probe+0xfa/0x130 [mmc_core]
[<ffffffff813015ae>] driver_probe_device+0x7e/0x1b0
[<ffffffff8130178b>] __driver_attach+0xab/0xb0
[<ffffffff813016e0>] ? driver_probe_device+0x1b0/0x1b0
[<ffffffff813016e0>] ? driver_probe_device+0x1b0/0x1b0
[<ffffffff81300504>] bus_for_each_dev+0x64/0xa0
[<ffffffff8130123e>] driver_attach+0x1e/0x20
[<ffffffff81300e80>] bus_add_driver+0x1b0/0x280
[<ffffffffa0065000>] ? 0xffffffffa0064fff
[<ffffffff81301d06>] driver_register+0x76/0x140
[<ffffffffa0065000>] ? 0xffffffffa0064fff
[<ffffffffa03c7b71>] sdio_register_driver+0x21/0x30 [mmc_core]
[<ffffffffa0065012>] ath6kl_sdio_init+0x12/0x35 [ath6kl_sdio]
[<ffffffff81002042>] do_one_initcall+0x42/0x180
[<ffffffff810b025f>] sys_init_module+0x8f/0x200
[<ffffffff81425ac2>] system_call_fastpath+0x16/0x1b

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-12 13:36:37 +02:00
Stephen Hemminger 4269a93054 ath6kl: make net_device_ops const
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-09 16:33:23 +02:00
Vasanthakumar Thiagarajan 9d82682d45 ath6kl: Use a mutex_lock to avoid race in diabling and handling irq
Currently this race is handled but in a messy way an atomic
variable is being checked in a loop which sleeps upto ms
in every iteration. Remove this logic and use a mutex
to make sure irq is not disabled when irq handling is in
progress.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-09 16:20:11 +02:00
Vasanthakumar Thiagarajan 982767b8c9 ath6kl: Change ielen in ath6kl_add_new_sta() from u8 to size_t
Otherwise if (ielen <= ATH6KL_MAX_IE) is dead code. It looks safe to
change the type of ielen from u8 to size_t instead of removing this
if check, this ielen can have the length of more than one ies in future.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-09 12:46:13 +02:00
Vasanthakumar Thiagarajan 3d6aba260b ath6kl: Remove deadcode in main.c
In ath6kl_reset_device(), since control can never reach switch..case
when the target_type is neither TARGET_TYPE_AR6003 nor TARGET_TYPE_AR6004,
remove the default option of switch statement.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-09 12:44:41 +02:00
Vasanthakumar Thiagarajan 80abaf9b4c ath6kl: Implement ndo_set_rx_mode()
There are maximum of seven multicast filter are supported
by hw. When the requested number of filters exceeds the
maximum supported one, multicast filtering is completely
disabled, the requested filters will be configured in
firmware and the only multicast frames that host is interested
in will be passed to host for further processing otherwise.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
2012-01-09 12:29:17 +02:00
Vasanthakumar Thiagarajan f914edd389 ath6kl: Add a function in wmi.c to add/delete a multicast filter
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
2012-01-09 12:24:41 +02:00
Vasanthakumar Thiagarajan 3f3c4ee735 ath6kl: Add a function in wmi to send WMI_MCAST_FILTER_CMDID
This will be used to disable/enable multicast receive.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
2012-01-09 12:24:40 +02:00
John W. Linville 1032c736e8 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts:
	drivers/net/wireless/b43legacy/dma.c
2012-01-05 10:13:24 -05:00
John W. Linville cb00ec382b ath6kl: revert USB support
The ath6kl driver is causing build failures when the ath6kl bits are
not built as modules.  A better fix is forthcoming in a future release,
but for now lets revert the problematic code.

This reverts the following commits:

	fde57764ef
	d70385a26a
	59d954dda4

Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-01-05 09:53:33 -05:00
John W. Linville 57adc1fcba Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts:
	drivers/net/wireless/b43/dma.c
	drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
2012-01-03 15:16:34 -05:00
Thomas Pedersen 4f34dacea1 ath6kl: send TCMD response through testmode events
ath6kl no longer knows what it is transmitting through
cfg80211_testmode, and simply passes opaque buffers between userspace
and the firmware. Leave the CONT_RX enum for backwards compatibility.

kvalo: change ATH6KL_TM_CMD_RX_REPORT to return -EOPNOTSUPP

Signed-off-by: Thomas Pedersen <twpedersen@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-02 18:50:42 +02:00
Vivek Natarajan 792ecb3308 ath6kl: Remove redundant key_index check.
Less-than-zero comparison of an unsigned value is never true.

kvalo: remove WMI_MIN_KEY_INDEX altogether, it's useless

Signed-off-by: Vivek Natarajan <nataraja@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-02 18:38:32 +02:00
Vasanthakumar Thiagarajan a10e2f2f6d ath6kl: Add a module parameter to enable uart debug
To enable firmware debug messages through uart interface,

modprobe ath6kl_sdio uart_debug=1.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-02 18:34:12 +02:00
Vasanthakumar Thiagarajan 351de2835d ath6kl: Remove few unnecessary spin_locks around set_bit()
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-02 18:34:11 +02:00
Rishi Panjwani bc48ad31c5 ath6kl: Support for TCP checksum offload to firmware
The change enables offloading TCP checksum calculation to firmware.
There are still some issues with the checksum offload so better to
disable it by default until the issues are resolved.

To enable TCP checksum offload for tx and rx paths, use
the ethtool as follows:
ethtool -K <interface> tx on
ethtool -K <interface> rx on

To disable TCP checksum offload, for tx and rx paths, use
the ethtool as follows:
ethtool -K <interface> tx off
ethtool -K <interface> rx off

kvalo: indentation changes

Signed-off-by: Rishi Panjwani <rpanjwan@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-02 18:23:10 +02:00
Jouni Malinen ba1f6fe393 ath6kl: Advertise TX/RX support for frames in AP mode
This is needed to fix current hostapd/wpa_supplicant AP operations for
frame registration. P2P GO mode already advertised these, but AP mode
was forgotten and could not be used after the hostapd/wpa_supplicant
frame registration changes.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-02 18:16:48 +02:00
Jouni Malinen 33e5308d8a ath6kl: Add del_station cfg80211_ops
hostapd/wpa_supplicant AP mode uses this operation to flush the station
entries. Implement this in ath6kl to avoid unnecessary warnings from
NL80211_CMD_DEL_STATION failing.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2012-01-02 18:14:54 +02:00
Sujith Manoharan e68f67509d ath6kl: Fix panic when setting a channel
cfg80211 could pass a NULL net_device to the driver via the
set_channel() callback, when it receives a request to set the
device's channel. Not handling this case properly results in this panic:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000cb0
IP: [<ffffffffa0374e49>] ath6kl_cfg80211_ready+0x9/0x70 [ath6kl_sdio]

Call Trace:
[<ffffffffa0374ed7>] ath6kl_set_channel+0x27/0x90 [ath6kl_sdio]
[<ffffffffa04dfd5f>] cfg80211_set_freq+0xff/0x1d0 [cfg80211]
[<ffffffffa04d3275>] ? nl80211_set_wiphy+0x85/0x660 [cfg80211]
[<ffffffffa04d3198>] __nl80211_set_channel.isra.39+0x118/0x140 [cfg80211]
[<ffffffffa04d34f3>] nl80211_set_wiphy+0x303/0x660 [cfg80211]
[<ffffffff813678d7>] ? rtnl_lock+0x17/0x20
[<ffffffffa04ca165>] ? nl80211_pre_doit+0xb5/0x150 [cfg80211]
[<ffffffff81382a45>] genl_rcv_msg+0x1d5/0x250
[<ffffffff81382870>] ? genl_rcv+0x40/0x40
[<ffffffff81381be9>] netlink_rcv_skb+0xa9/0xd0
[<ffffffff81382855>] genl_rcv+0x25/0x40
[<ffffffff811354f0>] ? might_fault+0x40/0x90
[<ffffffff81381519>] netlink_unicast+0x2d9/0x320
[<ffffffff813818e6>] netlink_sendmsg+0x2c6/0x320
[<ffffffff81343800>] ? sock_update_classid+0xb0/0x110
[<ffffffff8133f52e>] sock_sendmsg+0x10e/0x130
[<ffffffff81169933>] ? mem_cgroup_update_page_stat+0x193/0x250
[<ffffffff811354f0>] ? might_fault+0x40/0x90
[<ffffffff811354f0>] ? might_fault+0x40/0x90
[<ffffffff81135539>] ? might_fault+0x89/0x90
[<ffffffff811354f0>] ? might_fault+0x40/0x90
[<ffffffff8134d126>] ? verify_iovec+0x56/0xd0
[<ffffffff8133f9e6>] __sys_sendmsg+0x396/0x3b0
[<ffffffff8108e823>] ? up_read+0x23/0x40
[<ffffffff81040e68>] ? do_page_fault+0x208/0x4e0
[<ffffffff81193151>] ? vfsmount_lock_local_unlock+0x21/0x60
[<ffffffff811947d0>] ? mntput_no_expire+0x30/0xe0
[<ffffffff8119489f>] ? mntput+0x1f/0x30
[<ffffffff81342149>] sys_sendmsg+0x49/0x90
[<ffffffff81425482>] system_call_fastpath+0x16/0x1b

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-23 15:13:03 +02:00
Kalle Valo 65a8b4cc51 ath6kl: add support for FW API 3
As firmware starting from 3.2.0.12 has some API changes and doesn't work
with older versions of ath6kl we need to bump up the API version. This
way we don't break anything.

Also store which version of API is used and print that during boot:

ath6kl: ar6003 hw 2.1.1 sdio fw 3.2.0.13 api 3

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-23 14:53:22 +02:00
Kalle Valo c0038972b1 ath6kl: handle firmware names more dynamically
Currently ath6kl has just hardcoded paths to each firmware file. Change
this more dynamic by separating the the directory and file name from each
other. That way it's easier to dynamically create full paths to firmware and
code looks better. And now it's possible to remove a function needed by
devicetree code.

While at it add a structure inside struct ath6kl_hw to contain all
firmware names. I deliberately omitted board file support as
those will be handled later.

This is needed for firmware API 3.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-23 14:53:21 +02:00
Raja Mani c08631c6e4 ath6kl: Send own IP addr to the firmware during WOW suspend
Firmware ARP module requires own IP addr in order to respond
to the outside world when the target is in WOW suspend state.

At present, firmware ARP module has capability to hold 2 IP addr.
So, WOW mode will be disabled if the total IP addr configured in
net_dev for our device is greater than firmware limit (MAX_IP_ADDRS)
which is 2 at this moment.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Thirumalai Pachamuthu <tpachamu@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-23 14:50:06 +02:00
Raja Mani ca1d16a08f ath6kl: Avoid taking struct as argument in ath6kl_wmi_set_ip_cmd
In this way, caller is free to pass only the value of IP addr
to configure.

In addition to this,
  * 'ips' variable data type in struct wmi_set_ip_cmd is changed
     from __le32 to __be32 in order to match network byte order.
  *  ipv4_is_multicast() is used to validate multicast ip addr.
  *  New argument if_idx is added to supply correct vif index
     to ath6kl_wmi_cmd_send().

This will be used in the next patch.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Thirumalai Pachamuthu <tpachamu@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-23 14:50:05 +02:00
Jouni Malinen 6e786cb1e5 ath6kl: Fix connect command to clear previously used IEs
Empty IE buffer means that the new association is not supposed to
include extra IEs. Make sure any previously configured (Re)Association
Request frame IEs get cleared in such a case. This is based on a patch
from Shuibing.

Cc: Dai Shuibing <shuibing@qca.qualcomm.com>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-23 14:42:44 +02:00
Vasanthakumar Thiagarajan 5e13fd354a ath6kl: Use cfg80211_roamed_bss() to report roaming event
This is to avoid the scenario where the bss entry of the AP got
expired when reporting roaming event to current AP. As the bss
entry for the current bss is available in driver, pass this bss
to cfg80211. This fixes WARNING: at net/wireless/sme.c:586.

This patch depends on the following patch in cfg80211
"cfg80211: Fix race in bss timeout".

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>
2011-12-23 14:31:18 +02:00
Rusty Russell 3db1cd5c05 net: fix assignment of 0/1 to bool variables.
DaveM said:
   Please, this kind of stuff rots forever and not using bool properly
   drives me crazy.

Joe Perches <joe@perches.com> gave me the spatch script:

	@@
	bool b;
	@@
	-b = 0
	+b = false
	@@
	bool b;
	@@
	-b = 1
	+b = true

I merely installed coccinelle, read the documentation and took credit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-12-19 22:27:29 -05:00
Kalle Valo 7e95e365d5 Merge remote branch 'wireless-next/master' into ath6kl-next
Conflicts:
	drivers/net/wireless/ath/ath6kl/init.c
2011-12-16 21:10:39 +02:00
Aarthi Thiruvengadam 3ca9d1fc9a ath6kl: support for P2P mgmt operations on station interface
This patch enables support for doing P2P management operations like device
discovery on top of a station interface. After group formation, the station
interface will become a P2P GO/client interface as the case may be.

This feature requires modifications to a couple of existing WMI structures and
therefore new command ids and structures have been defined in order to be
compatible with older firmware versions and other chips. The exception here is
the wmi_connect_cmd. Adding a new field to the end of the structure will not
cause any issues with previous firmware versions since firmware only checks for
minimum length of the command. The other structures are of variable length,
hence it was not possible to add new fields to the end.

The new command ids have to be added to the end of enum wmi_cmd_id, so it has
updated to match the firmware.

The driver will support both the 'old' and the 'new' commands for a while by
checking the firmware capabilities.

Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-14 20:43:05 +02:00
Ryan Hsu 39586bf272 ath6kl: Support different uart_tx pin and refclk configuration
AR6003 family use uart_tx=8 and refclk=26Mhz by default, and AR6004 family
uses different uart_tx pin and could also support various xtal source,
moves these per hw configuration.

Signed-off-by: Ryan Hsu <ryanhsu@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-14 19:29:52 +02:00
Kalle Valo 10509f903e ath6kl: implement scheduled scan
ath6kl firmware supports scheduled scan functionality with the wow ssid
filter. But the firmware does not send any events after scan results
so I had to add a timer which notifies about new scan results.

Sched scan needs firmware version 3.2.0.6 or later. If firmware doesn't
support sched scan the driver will not enable the feature.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-13 15:03:49 +02:00
Kalle Valo 277d90f4ba ath6kl: fix reading of FW IE capabilities
For some strange reason I used ALIGN() to calculate index to the
buffer. That is totally bogus and wouldn't work when it tried to read
the second bit. Fix it by removing the ALIGN() altogether.

Also check that ie_len is not too short.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-13 15:03:48 +02:00
Kalle Valo 75ae3bc48f ath6kl: fix value of WOW_FILTER_SSID
According to the firmware engineers WOW_FILTER_SSID is actually the
second bit, not the first.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-13 15:03:47 +02:00
Kalle Valo 7125f01d98 ath6kl: implement ath6kl_cfg80211_stop_all()
During suspend we need to stop all vifs, not just the first.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-13 15:03:46 +02:00
Kalle Valo ed8491a796 ath6kl: call ath6kl_cfg80211_stop() from ath6kl_close()
This way it's possible to keep all disconnect logic in one function and
easier to add new functionality, like stopping scheduled scan.

There are some changes to commands called during network interface close,
but there should not be any visible changes in functionality.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-13 15:03:46 +02:00
Kalle Valo c97a31b002 ath6kl: remove a workaround from ath6kl_cfg80211_stop()
There's a workaround in ath6kl_cfg80211_stop() which emits disconnected
even when sme_state was disconnected. This is legacy from the old
staging driver and I can't repoduce the old problem anymore. I assume the
bug got fixed while the driver was cleaned up so let's get
rid of the hack.

This makes it possible to call ath6kl_cfg80211_stop from ath6kl_close()
which happens in a followup patch.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-13 15:03:45 +02:00
Kalle Valo d6d5c06c3c ath6kl: cleanup ath6kl_priv()
It really should not return a void pointer. Also remove useless casts
from its users.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-13 14:46:22 +02:00
Jouni Malinen 4703290af4 ath6kl: Use delayed key configuration for WAPI in AP mode
This is needed to allow WAPI AP to configure the initial group key
to the target in the same way as is done with TKIP/CCMP. This
fixes broadcast data frame delivery with the initial group key.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-12-13 14:21:30 +02:00
Vasanthakumar Thiagarajan 5081c80c7d ath6kl: Increase the maximum number of connections in AP mode
The maximum number of clients which ath6kl can support in AP mode
is 10. The limitation of 8 connections is only for older chipsets
which ath6kl does not support.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-24 14:35:31 +02:00
Kalle Valo 0bb4e30f13 ath6kl: remove unused sc_params from struct ath6kl
It was only initialised but not used anywhere. Also remove two defines
which ended up unused after this change.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-24 14:31:37 +02:00
Luis R. Rodriguez b992a28557 ath6kl: fix ath6kl's set tx power
ath6kl assumed cfg80211 passed to us power in dBm but it is in mBm.

Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-24 14:30:22 +02:00
Dan Carpenter 50553c2c81 ath6kl: use a larger buffer for debug output
The return value of snprintf() is the number of bytes which would
have been copied if there was enough space, but we want the number of
bytes actually copied.  The scnprintf() function does this.

Also in theory, a %u can take take 10 digits so we may as well make
the buffer larger as well.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-24 14:28:16 +02:00
John W. Linville 515db09338 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
Conflicts:
	drivers/net/wireless/iwlegacy/iwl-debugfs.c
	drivers/net/wireless/iwlegacy/iwl-rx.c
	drivers/net/wireless/iwlegacy/iwl-scan.c
	drivers/net/wireless/iwlegacy/iwl-tx.c
	include/net/bluetooth/bluetooth.h
2011-11-22 14:05:46 -05:00
Johannes Berg 7c4ef7122c cfg80211: add flags for off-channel capabilities
Currently mac80211 implements these for all devices,
but given restrictions of some devices that isn't
really true, so prepare for being able to remove the
capability for some mac80211 devices.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-11-21 16:20:49 -05:00
Raja Mani fdb28589b1 ath6kl: Use mutex to protect dma buffer in sync read write
Firmware crashes while starting Soft AP in 32 bit x86 platform.
The reason is that the single dma buffer (ar_sdio->dma_buffer)
is used in ath6kl_sdio_read_write_sync() for unaligned buffer
handling and this function is called in the multiple context
at the same time. So, finally hits dma buffer corruption and
firmware crash.

Mutex is used to protect dma buffer to avoid data corruption.
Spin lock can not used to fix this issue since mmc stack
read/write calls may for sleep.

Observed this issue with recently commited patch
"ath6kl: Claim sdio function only at appropriate places"
861dd058f4

kvalo: change name of mutex to more descriptive and add a comment
about what it protects

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-21 19:47:09 +02:00
Dan Carpenter 743b4518f9 ath6kl: unlock if ath6kl_cfg80211_connect() fails
There is an unlock missing on this error path.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-21 19:47:08 +02:00
Vasanthakumar Thiagarajan b64de35654 ath6kl: Enable multiple vif support
The maximum number of supported virtual interfaces are 3.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-21 19:47:08 +02:00
Vasanthakumar Thiagarajan f143379dbf ath6kl: Find ar->max_norm_iface in firmware IE parsing
Currently the max number of vifs which can be used for non-p2p
mode is determined in ath6kl_core_alloc(). But the maximum
supported vifs are parsed from firmware IE in ath6kl_fetch_fw_api2()
which would happen after ath6kl_core_alloc().

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-21 19:47:08 +02:00
Vasanthakumar Thiagarajan 774439ad88 ath6kl: Remove modparam multi_norm_if_support
This modparam was introduced to enable non-p2p mode operation
on two virtual interfaces. It does not seem to be necessary to
have a separate module parameter to do that. Instead, this option
can be enabled when any one of the interfaces is not going to be
used for p2p (ath6kl_p2p).

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-21 19:47:08 +02:00
Arik Nemtsov fb94333a62 ath6kl: indicate probe-resp offload support
The ath6kl responds to probe-requests in HW while operating as an AP. It
supports offloading exclusions to support the WPS, WPS2, P2P and
802.11u protocols.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-21 17:54:43 +02:00
Vasanthakumar Thiagarajan 59500b4864 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>
2011-11-16 10:51:12 +02:00
Raja Mani 542c519a0e 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>
2011-11-16 10:39:39 +02:00
Kalle Valo 368b1b0f4b ath6kl: add firmware IE for maximum number of vifs
Not all firmwares support multiple vifs and we need to read the limit from
the firmware image.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-16 10:22:34 +02:00
Kalle Valo 71f96ee6c6 ath6kl: make maximum number of vifs runtime configurable
Needed when detecting how many vifs firmware supports.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-16 10:22:34 +02:00
Kalle Valo d1a9421ddc ath6kl: add firmware filename info to struct ath6kl_hw
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-16 10:22:34 +02:00
Kalle Valo f0ea5d588a ath6kl: add ar6004 firmwares to sdio module
When adding ar6004 SDIO support I forgot to add corresponding
MODULE_FIRMWARE() definitions to sdio.c.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-16 10:22:34 +02:00
Kalle Valo 0d0192babc 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>
2011-11-16 10:22:33 +02:00
Kalle Valo 293badf4e2 ath6kl: add name field to struct ath6kl_hw
To make it easier to print name for each hardware type. Also move the hw
info print to ath6kl_init_hw_start() which is more logical place for it.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-16 10:22:33 +02:00
Kalle Valo 03ef0250ae ath6kl: add firmware IE for board data address
Board data address can change between firmwares so we need to read that
from the firmware image.

Also fix debug log for the patch address to print the address in hex.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-16 10:22:33 +02:00
Kalle Valo 0d4d72bf8e 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>
2011-11-16 10:22:33 +02:00
Kalle Valo 856f4b313a ath6kl: move hw version related to parameters to struct
It's easier to handle the values when they are defined in a struct.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-16 10:22:33 +02:00
Kalle Valo f275dc7117 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>
2011-11-16 10:22:33 +02:00
Vasanthakumar Thiagarajan be5abaafad 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>
2011-11-13 12:44:28 +02:00
Vasanthakumar Thiagarajan 7cefa44f14 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>
2011-11-13 12:44:28 +02:00
Kalle Valo fde57764ef 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>
2011-11-13 12:34:31 +02:00
Kalle Valo d70385a26a 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>
2011-11-13 12:34:30 +02:00
Kalle Valo 59d954dda4 ath6kl: add USB support
Add USB support for ar6004. Currently only firmware can be booted,
no commands can be sent to firmware yet as HTC layer doesn't work
with USB yet.

Based on patches by Kevin Fang.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-13 12:34:30 +02:00
Kalle Valo 77eab1e929 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>
2011-11-13 12:34:30 +02:00
Naveen Gangadharan d93e2c2f21 ath6kl: AR6004 SDIO support
Add support for AR6004 SDIO. Tested scan, association (open mode) and
ping.

kvalo: change commit log a bit, drop board address changes

Signed-off-by: Naveen Gangadharan <ngangadh@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-13 12:34:30 +02:00
Kalle Valo 50e2740b7b ath6kl: firmware boot fixes for ar6004
These have changed a bit since last time ar6004 code was commited.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-13 12:34:30 +02:00
Kalle Valo d5720e5941 ath6kl: update ar6004 definitions
Add also hw 1.1.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-13 12:34:29 +02:00
Kalle Valo c71114959d ath6kl: move diag commands to hif driver
This is preparation for USB support which will have different diag
commands.

Based on code by Kevin Fang.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-13 12:34:29 +02:00
Kalle Valo 1f4c894d3a ath6kl: change bmi sizes being configurable by HIF
SDIO and USB have different maximum sizes for BMI commands so make that
configurable.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-13 12:34:29 +02:00
Kalle Valo 66b693c3b8 ath6kl: move bmi calls to hif driver
In preparation for USB support which has it's own method for bmi.

Based on code by Kevin Fang.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-13 12:34:29 +02:00
Aarthi Thiruvengadam bd24a50fe6 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>
2011-11-13 12:31:50 +02:00
Raja Mani 4eab6f4f43 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.

WARNING: at net/wireless/ibss.c:33 __cfg80211_ibss_joined+0x153/0x180 [cfg80211]()
[..]
[ 4916.845878] Call Trace:
[ 4916.845889]  [<c10427d2>] warn_slowpath_common+0x72/0xa0
[ 4916.845905]  [<f8bccc63>] ? __cfg80211_ibss_joined+0x153/0x180 [cfg80211]
[ 4916.845918]  [<f8bccc63>] ? __cfg80211_ibss_joined+0x153/0x180 [cfg80211]
[ 4916.845923]  [<c1042822>] warn_slowpath_null+0x22/0x30
[ 4916.845934]  [<f8bccc63>] __cfg80211_ibss_joined+0x153/0x180 [cfg80211]
[ 4916.845941]  [<c1025108>] ? default_spin_lock_flags+0x8/0x10
[ 4916.845952]  [<f8bb7fcd>] cfg80211_process_rdev_events+0x19d/0x220 [cfg80211]
[ 4916.845962]  [<f8bb669b>] cfg80211_event_work+0x2b/0x50 [cfg80211]
[ 4916.845968]  [<c105aae6>] process_one_work+0x116/0x3c0
[ 4916.845977]  [<f8bb6670>] ? cfg80211_get_dev_from_info+0x40/0x40 [cfg80211]
[ 4916.845982]  [<c105cdf0>] worker_thread+0x140/0x3b0
[ 4916.845986]  [<c105ccb0>] ? manage_workers+0x1f0/0x1f0
[ 4916.845991]  [<c1060c64>] kthread+0x74/0x80
[ 4916.845995]  [<c1060bf0>] ? kthread_worker_fn+0x160/0x160
[ 4916.846001]  [<c14e7bbe>] kernel_thread_helper+0x6/0x10
[ 4916.846005] ---[ end trace 769254924e409367 ]---

This patch make sures that BSS info is delivered via cfg80211_inform_bss()
to cfg80211 in advance before intimating IBSS status to cfg80211.

In addition to this, one debug message is also added to know
ad-hoc mode status (creator/joiner).

kvalo: change subject

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-13 12:28:38 +02:00
Vasanthakumar Thiagarajan 901db39c84 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>
2011-11-13 11:30:08 +02:00
Vasanthakumar Thiagarajan f3803eb2f5 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.

WARNING: at drivers/net/wireless/ath/ath6kl/wmi.c:88 ath6kl_get_vif_by_index+0x5b/0x60 [ath6kl]()
Hardware name: 2842K3U
Modules linked in: ath6kl mmc_block cfg80211 binfmt_misc ppdev nfs nfsd lockd nfs_acl auth_rpcgss sunrpc exportfs snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel
+snd_hda_codec snd_hwdep snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_dummy thinkpad_acpi snd_seq_oss snd_seq_midi snd_rawmidi joydev fbcon tileblit font bitblit softcursor
+snd_seq_midi_event snd_seq snd_timer snd_seq_device i915 uvcvideo drm_kms_helper drm psmouse serio_raw snd i2c_algo_bit sdhci_pci videodev intel_agp soundcore intel_gtt jmb38x_ms
+memstick sdhci snd_page_alloc nvram lp parport agpgart video ahci r8169 mii libahci [last unloaded: ath6kl]
Pid: 15482, comm: kworker/u:1 Tainted: G        W   3.1.0-rc10-wl+ #2
Call Trace:
 [<c0144d72>] warn_slowpath_common+0x72/0xa0
 [<fb7c94fb>] ? ath6kl_get_vif_by_index+0x5b/0x60 [ath6kl]
 [<fb7c94fb>] ? ath6kl_get_vif_by_index+0x5b/0x60 [ath6kl]
 [<c0144dc2>] warn_slowpath_null+0x22/0x30
 [<fb7c94fb>] ath6kl_get_vif_by_index+0x5b/0x60 [ath6kl]
 [<fb7c7028>] ath6kl_tx_complete+0x128/0x4d0 [ath6kl]
 [<c04df920>] ? mmc_request_done+0x80/0x80
 [<fb7b9e2e>] htc_tx_complete+0x5e/0x70 [ath6kl]
 [<c05e4cf6>] ? _raw_spin_unlock_bh+0x16/0x20
 [<fb7ce588>] ? ath6kl_sdio_scatter_req_add+0x48/0x60 [ath6kl]
 [<fb7b9f42>] htc_async_tx_scat_complete+0xb2/0x120 [ath6kl]
 [<fb7ce9e7>] ath6kl_sdio_scat_rw+0x87/0x370 [ath6kl]
 [<c0101e12>] ? __switch_to+0xd2/0x190
 [<c01397b5>] ? finish_task_switch+0x45/0xd0
 [<c05e272e>] ? __schedule+0x3ae/0x8b0
 [<fb7cf00a>] ath6kl_sdio_write_async_work+0x4a/0xf0 [ath6kl]
 [<c015d266>] process_one_work+0x116/0x3c0
 [<fb7cefc0>] ? ath6kl_sdio_read_write_sync+0xb0/0xb0 [ath6kl]
 [<c015f5b0>] worker_thread+0x140/0x3b0
 [<c015f470>] ? manage_workers+0x1f0/0x1f0
 [<c0163424>] kthread+0x74/0x80
 [<c01633b0>] ? kthread_worker_fn+0x160/0x160
 [<c05ebdc6>] kernel_thread_helper+0x6/0x10

Reported-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-13 11:07:34 +02:00
Dai Shuibing 30677ae015 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>
2011-11-13 10:57:38 +02:00
Dai Shuibing b8214df1d9 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>
2011-11-13 10:57:38 +02:00
Dai Shuibing 5e07021e43 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>
2011-11-13 10:57:38 +02:00
Vasanthakumar Thiagarajan 8cb6d9915f ath6kl: Fix error in writing create_qos debugfs
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.

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

179 bytes are needed when the following vlaues are given so that
a maximum possible value in that data type can be given in decimal.

echo "255 255 255 255 255 4294967295 4294967295 4294967295 4294967295
 4294967295 255 65535 65535 4294967295 4294967295 4294967295 4294967295
 4294967295 4294967295 4294967295 4294967295" > create_qos

Following takes 187 bytes when given in hex

echo "0xff 0xff 0xff 0xff 0xff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
 0xff 0xffff 0xffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
 0xffffffff 0xffffffff" > create_qos

Increase the size to 200 bytes so that it can hold upto the maximum
value possible for that data type.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-11 13:00:01 +02:00
Vasanthakumar Thiagarajan a29517ce40 ath6kl: Fix tx packet drop in AP mode with bridge
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>
2011-11-11 13:00:01 +02:00
Raja Mani 902b46293b 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>
2011-11-11 13:00:00 +02:00
Raja Mani eae9e0661b 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>
2011-11-11 13:00:00 +02:00
Raja Mani 0737237411 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>
2011-11-11 13:00:00 +02:00
Raja Mani a918fb3cc6 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>
2011-11-11 13:00:00 +02:00
Raja Mani d7c44e0ba5 ath6kl: Invoke WOW suspend/resume calls during PM operation
Link ath6kl's wow suspend/resume functions with the actual suspend/resume path.

WOW mode is selected when the host sdio controller supports both
MMC_PM_KEEP_POWER and MMC_PM_WAKE_SDIO_IRQ capabilities.

kvalo: also adds a missing break in ath6kl_cfg80211_resume(), luckily
it didn't have any effect on functionality.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-11 13:00:00 +02:00
Raja Mani 524441e3a7 ath6kl: Move ath6kl_cfg80211_stop() call specific to deep sleep and cut pwr
ath6kl_cfg80211_stop() call is not applicable for WOW mode. Hence moving
this call to deep sleep and cut pwr specific cases.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-11 12:59:59 +02:00
Raja Mani dd6c0c63b4 ath6kl: Add new state for WOW mode
In addition to existing deep sleep and cut pwr mode, new state
is added in ath6kl_cfg_suspend_mode as well as in ath6kl_state for WOW.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-11 12:59:59 +02:00
Raja Mani 0f60e9f4c2 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>
2011-11-11 12:59:59 +02:00
Raja Mani 6cb3c714e7 ath6kl: Add WOW suspend/resume implementation
This is the core WOW suspend/resume functions will be called
in PM suspend/resume path.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-11 12:59:59 +02:00
Raja Mani 45cf110b2b ath6kl: Add wmi functions to configure WOW mode and host sleep mode
It will be used in WOW suspend/resume functions to
active/deactivate WOW suspend mode.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-11 12:59:59 +02:00
Raja Mani 5c9b4fa19a ath6kl: Add wmi functions to add/delete WOW patterns
These commands will be used in WOW suspend/resume functions
to configure WOW parameters like patterns to be matched
and it's mask value, etc.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-11 12:59:59 +02:00
Jouni Malinen f3e61eceb2 ath6kl: Do not hide ath6kl_wmi_addkey_cmd() error values
Instead of converting any error to EIO, just return the real error
value to upper layers.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-11 12:59:59 +02:00
Jouni Malinen f4bb9a6fbc 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>
2011-11-11 12:59:59 +02:00
Jouni Malinen 1ddc3377e1 ath6kl: Remove unused WMI crypto defines
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-11 12:59:58 +02:00
Kalle Valo 8277de15ef 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>
2011-11-11 12:59:58 +02:00
Kalle Valo cf97fa9fdf 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>
2011-11-11 12:59:00 +02:00
Vasanthakumar Thiagarajan 11f6e40d9f ath6kl: Fix lockdep warning
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:

        CPU0                    CPU1
        ----                    ----
   lock(&(&ar->list_lock)->rlock);
                                local_irq_disable();
                                lock(&(&ar->lock)->rlock);
                                lock(&(&ar->list_lock)->rlock);
   <Interrupt>
     lock(&(&ar->lock)->rlock);

  *** DEADLOCK ***

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>
2011-11-11 12:59:00 +02:00
Kalle Valo b4b2a0b116 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>
2011-11-11 12:59:00 +02:00
Kalle Valo e28e810486 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>
2011-11-11 12:59:00 +02:00
Kalle Valo 76a9fbe27e 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>
2011-11-11 12:59:00 +02:00
Kalle Valo 52d81a6883 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>
2011-11-11 12:59:00 +02:00
Kalle Valo 1f40525512 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>
2011-11-11 12:59:00 +02:00
Kalle Valo ec4b7f602d 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>
2011-11-11 12:58:59 +02:00
Kalle Valo 1c17d31389 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>
2011-11-11 12:58:59 +02:00
Kalle Valo 2387f0dcd1 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>
2011-11-11 12:58:59 +02:00
Kalle Valo 6250aac6df 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>
2011-11-11 12:58:59 +02:00
Kalle Valo 68469341f3 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>
2011-11-11 12:58:59 +02:00
Kalle Valo 5fe4dffbc1 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>
2011-11-11 12:58:59 +02:00
Kalle Valo 32a07e4448 ath6kl: create ath6kl_hif_stop()
This is to reset hif layer for powering down hw.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2011-11-11 12:58:58 +02:00