kernel/kernel-generic.git
11 years agoath10k: set the UART baud rate to 19200
Bartosz Markowski [Tue, 3 Sep 2013 12:24:02 +0000 (14:24 +0200)]
ath10k: set the UART baud rate to 19200

When configuring the host_interests over BMI, set the UART
baud rate to 19200. This is valid for QCA988X_2.0 devices.

kvalo: found during code review, there should not be any functionality
changes

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: add htt_stats_enable debugfs file
Kalle Valo [Tue, 3 Sep 2013 08:44:10 +0000 (11:44 +0300)]
ath10k: add htt_stats_enable debugfs file

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: implement ath10k_debug_start/stop()
Kalle Valo [Tue, 3 Sep 2013 08:44:03 +0000 (11:44 +0300)]
ath10k: implement ath10k_debug_start/stop()

Needed for the HTT stats implementation.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: add trace event ath10k_htt_stats
Kalle Valo [Tue, 3 Sep 2013 08:43:55 +0000 (11:43 +0300)]
ath10k: add trace event ath10k_htt_stats

For analysing various data path statistics in user space.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: add missing braces to ath10k_pci_tx_pipe_cleanup
Dave Jones [Thu, 5 Sep 2013 03:51:28 +0000 (23:51 -0400)]
ath10k: add missing braces to ath10k_pci_tx_pipe_cleanup

The indentation here implies this was meant to be
a multi-statement if, but it lacks the braces.

kvalo: add "ath10k: " prefix

Signed-off-by: Dave Jones <davej@fedoraproject.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: add chip_id file to debugfs
Kalle Valo [Sun, 1 Sep 2013 08:22:21 +0000 (11:22 +0300)]
ath10k: add chip_id file to debugfs

So that's it's possible to query chip id from ath10k anytime.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: check chip id from the soc register during probe
Kalle Valo [Sun, 1 Sep 2013 08:22:14 +0000 (11:22 +0300)]
ath10k: check chip id from the soc register during probe

ath10k doesn't support qca988x hw1.0 boards anymore. Unfortunately
the PCI id is the same in hw1.0 and hw2.0 so ath10k tries to use
hw1.0 boards anyway. But without hw1.0 workarounds in place
ath10k just crashes horribly.

To avoid using hw1.0 boards at all add a chip id detection
and fail the probe if hw1.0 is detected:

[ 5265.786408] ath10k: ERROR: qca988x hw1.0 is not supported
[ 5265.786497] ath10k: Unsupported chip id 0x043200ff
[ 5265.786574] ath10k: could not register driver core (-95)
[ 5265.793191] ath10k_pci: probe of 0000:02:00.0 failed with error -95

Also add a warning if there's an unknown chip id but continue
the boot process normally anyway.

Reported-by: Zaki Bakar <zaki.bm@gmail.com>
Tested-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: simplify ath10k_ce_init() wake up handling
Kalle Valo [Sun, 1 Sep 2013 07:02:15 +0000 (10:02 +0300)]
ath10k: simplify ath10k_ce_init() wake up handling

ath10k_ce_init() and the functions it calls wakeup
the chip multiple times. Simplify that to call
ath10k_pci_wake() only once. This also makes it
easier to add error handling when wakeup fails.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: convert ath10k_pci_wake() to return
Kalle Valo [Sun, 1 Sep 2013 07:02:07 +0000 (10:02 +0300)]
ath10k: convert ath10k_pci_wake() to return

We should not try to access hw if wakeup fails so add
proper error checking for that. Also add the timeout lenght
to the warning message.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: clean up ath10k_ce_completed_send_next_nolock()
Kalle Valo [Sun, 1 Sep 2013 07:02:00 +0000 (10:02 +0300)]
ath10k: clean up ath10k_ce_completed_send_next_nolock()

The error handling was just weird, simplify it.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: convert ath10k_pci_reg_read/write32() to take struct ath10k
Kalle Valo [Sun, 1 Sep 2013 07:01:53 +0000 (10:01 +0300)]
ath10k: convert ath10k_pci_reg_read/write32() to take struct ath10k

This is consistent with all other functions.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: remove void pointer from struct ath10k_pci_compl
Kalle Valo [Sun, 1 Sep 2013 07:01:46 +0000 (10:01 +0300)]
ath10k: remove void pointer from struct ath10k_pci_compl

Void pointers are bad, mmkay.

No functional changes.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: make target_ce_config_wlan more readable
Kalle Valo [Sun, 1 Sep 2013 07:01:39 +0000 (10:01 +0300)]
ath10k: make target_ce_config_wlan more readable

It's easier to read t if the field names are visible.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: pci: make host_ce_config_wlan[] more readable
Kalle Valo [Sun, 1 Sep 2013 07:01:32 +0000 (10:01 +0300)]
ath10k: pci: make host_ce_config_wlan[] more readable

It's much more readable if struct entries in host_ce_config_wlan
are explicitly set.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: remove un ar_pci->cacheline_sz field
Kalle Valo [Fri, 2 Aug 2013 07:56:01 +0000 (10:56 +0300)]
ath10k: remove un ar_pci->cacheline_sz field

cacheline_sz is not used anywhere and can be removed.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: rename ce_ring_state to ath10k_ce_ring
Michal Kazior [Tue, 27 Aug 2013 11:08:03 +0000 (13:08 +0200)]
ath10k: rename ce_ring_state to ath10k_ce_ring

The new naming makes more sense.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: rename ce_state to ath10k_ce_pipe
Michal Kazior [Tue, 27 Aug 2013 11:08:02 +0000 (13:08 +0200)]
ath10k: rename ce_state to ath10k_ce_pipe

The new naming makes more sense.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: rename hif_ce_pipe_info to ath10k_pci_pipe
Michal Kazior [Tue, 27 Aug 2013 11:08:01 +0000 (13:08 +0200)]
ath10k: rename hif_ce_pipe_info to ath10k_pci_pipe

The new naming makes more sense.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: remove unused ce_attr parameters
Michal Kazior [Tue, 27 Aug 2013 11:08:00 +0000 (13:08 +0200)]
ath10k: remove unused ce_attr parameters

Some parameters were unused and are not required.
They have no representation in firmware. Clean
them up.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: remove ce_op_state
Michal Kazior [Tue, 27 Aug 2013 11:07:59 +0000 (13:07 +0200)]
ath10k: remove ce_op_state

It was only written to and never read back. No use
to keep it around.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: use inline ce_state structure
Michal Kazior [Tue, 27 Aug 2013 11:07:58 +0000 (13:07 +0200)]
ath10k: use inline ce_state structure

Simplifies memory managament of ce_state.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: Fix mutex unlock balance
Mohammed Shafi Shajakhan [Wed, 21 Aug 2013 16:26:44 +0000 (21:56 +0530)]
ath10k: Fix mutex unlock balance

ath10k_debug_read_target_stats is properly
protected by data_lock (spinlock). Remove
the unwanted mutex_unlock(&ar->conf_mutex)

[ BUG: bad unlock balance detected! ]
-------------------------------------
kworker/u4:0/12459 is trying to release lock
(&ar->conf_mutex) at:
[<c16a170d>] mutex_unlock+0xd/0x10
but there are no more locks to release!

 Call Trace:
  [<c16a170d>] ? mutex_unlock+0xd/0x10
  [<c10b697d>] __lock_release+0x4d/0xe0
  [<f88ca0fc>] ? ath10k_debug_read_target_stats+0xac/0x290

  [<c16a170d>] ? mutex_unlock+0xd/0x10
  [<c10b6a5b>] lock_release+0x4b/0x150
  [<c16a1580>] __mutex_unlock_slowpath+0x70/0x150
  [<f88ca0fc>] ? ath10k_debug_read_target_stats+0xac/0x290

  [<c10b456b>] ? trace_hardirqs_on+0xb/0x10
  [<c16a170d>] mutex_unlock+0xd/0x10
  [<f88ca107>] ath10k_debug_read_target_stats+0xb7/0x290

  [<f88d337a>] ath10k_wmi_event_process+0x3fa/0x6e0

  [<c10b456b>] ? trace_hardirqs_on+0xb/0x10
  [<f88d36e1>] ath10k_wmi_event_work+0x21/0x40
               [ath10k_core]

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: add support for HTT 3.0
Michal Kazior [Fri, 9 Aug 2013 08:13:34 +0000 (10:13 +0200)]
ath10k: add support for HTT 3.0

New firmware comes with new HTT protocol version.
In 3.0 the separate mgmt tx command has been
removed. All traffic is to be pushed through data
tx (tx_frm) command with a twist - FW seems to not
be able (yet?) to access tx fragment table so for
manamgement frames frame pointer is passed
directly.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: add support for firmware newer than 636
Michal Kazior [Fri, 9 Aug 2013 08:13:33 +0000 (10:13 +0200)]
ath10k: add support for firmware newer than 636

The mgmt_rx event structure has been expanded.
Since the structure header is expanded the payload
(i.e. mgmt frame) is shifted by a few bytes. This
needs to be taken into account in order to support
both old and new firmware.

This introduces a fw_features to keep track of any
FW-related ABI/behaviour changes.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix WEP in AP and IBSS mode
Marek Puzyniak [Tue, 13 Aug 2013 09:45:22 +0000 (11:45 +0200)]
ath10k: fix WEP in AP and IBSS mode

WEP encoding was not working properly for AP and IBSS mode.
TX frames were encrypted with default WEP tx key index set
always to zero, what sometimes was wrong when different
key index should be used. This patch allows to update
WEP key index also for AP and IBSS mode.
Problem detected during automated WEP tests.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: plug possible memory leak in WMI
Michal Kazior [Tue, 13 Aug 2013 05:59:38 +0000 (07:59 +0200)]
ath10k: plug possible memory leak in WMI

There was a possible memory leak when WMI command
queue reached it's limit. Command buffers were not
freed.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: implement 802.3 SNAP rx decap type A-MSDU handling
Michal Kazior [Tue, 13 Aug 2013 05:59:37 +0000 (07:59 +0200)]
ath10k: implement 802.3 SNAP rx decap type A-MSDU handling

This enables driver to rx another decapped a-msdu
frames. It should possibly help with throughputs
in some cases and reduce (or eliminate) number of
messages like this:

  ath10k: error processing msdus -524

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix HTT service setup
Michal Kazior [Tue, 13 Aug 2013 05:59:35 +0000 (07:59 +0200)]
ath10k: fix HTT service setup

The "disable credit flow" flag was set too late
and it never was in the HTC service request
message.

This patch prevents firmware from reporting
(useless) HTC credits for HTT service. HTT service
doesn't use nor need credits.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: print errcode when CE ring setup fails
Michal Kazior [Tue, 13 Aug 2013 05:54:57 +0000 (07:54 +0200)]
ath10k: print errcode when CE ring setup fails

This makes it possible to see the reason why the
setup fails. It also adheres to code style of
error checking in ath drivers.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: clean up PCI completion states
Michal Kazior [Tue, 13 Aug 2013 05:54:56 +0000 (07:54 +0200)]
ath10k: clean up PCI completion states

Improve code readability by using enum and a
switch-case.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: use sizeof(*var) in kmalloc
Michal Kazior [Tue, 13 Aug 2013 05:54:55 +0000 (07:54 +0200)]
ath10k: use sizeof(*var) in kmalloc

This fixes checkpatch warning from the latest
3.11-rc kernel tree.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: clean up monitor start code
Michal Kazior [Tue, 13 Aug 2013 05:54:54 +0000 (07:54 +0200)]
ath10k: clean up monitor start code

Remove useless code that was causing WARN_ON when
a 80MHz+ vif entered promiscuous mode or monitor
interface was started.

The channel mode is already computed by
chan_to_phymode().

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: check allocation errors in CE
Janusz Dziedzic [Fri, 9 Aug 2013 06:39:13 +0000 (08:39 +0200)]
ath10k: check allocation errors in CE

Handle pci_alloc_consistent(), kmalloc()
errors in copy engine module.
Found during code review.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: update supported FW build version
Bartosz Markowski [Wed, 7 Aug 2013 13:17:46 +0000 (15:17 +0200)]
ath10k: update supported FW build version

The latest supported and available FW build is 1.0.0.636.
Reflect this in ath10k code.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: Remove qca98xx hw1.0 support
Bartosz Markowski [Wed, 7 Aug 2013 13:17:45 +0000 (15:17 +0200)]
ath10k: Remove qca98xx hw1.0 support

Since the firmware support is no longer available for hw1.0,
drop all code (especially workarounds) for those units.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: setup peer UAPSD flag correctly
Janusz Dziedzic [Wed, 7 Aug 2013 10:10:49 +0000 (12:10 +0200)]
ath10k: setup peer UAPSD flag correctly

Setup UAPSD peer/peer rate flags correctly.
WMI_RC_UAPSD_FLAG is a peer rate capabilities flag
and should not be set as a peer flag.
Found during code review, doesn't fix a known
issues.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: Fix invalid pointer access on fuzz testing with AP mode
Mohammed Shafi Shajakhan [Mon, 5 Aug 2013 04:49:22 +0000 (10:19 +0530)]
ath6kl: Fix invalid pointer access on fuzz testing with AP mode

In our Fuz testing, reference client corrupts the dest mac to "00:00:00:00:00:00"
in the WPA2 handshake no 2. During driver init the sta_list entries mac
addresses are by default "00:00:00:00:00:00". Driver returns an invalid
pointer (conn) and the drver shall crash, if rxtids (aggr_conn)
skb queues are accessed, since they would not be initialized.

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: Fix race in heart beat polling
Vasanthakumar Thiagarajan [Thu, 20 Jun 2013 07:17:20 +0000 (12:47 +0530)]
ath6kl: Fix race in heart beat polling

Make sure to cancel heart beat timer before
freeing wmi to avoid potential NULL pointer
dereference.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: add SoC power save option to PCI features map
Bartosz Markowski [Fri, 2 Aug 2013 07:58:49 +0000 (09:58 +0200)]
ath10k: add SoC power save option to PCI features map

Unify the PCI options location.

By default the SoC PS option is disabled to boost the
performance and due to poor stability on early HW revisions.
In future we can remove the module parameter and turn on/off
the PS for given hardware.

This change also makes the pci module parameter for SoC PS static.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix device teardown
Michal Kazior [Fri, 2 Aug 2013 07:15:47 +0000 (09:15 +0200)]
ath10k: fix device teardown

This fixes interrupt-related issue when no
interfaces were running thus the device was
considered powered down.

The power_down() function isn't really powering
down the device. It simply assumed it won't
interrupt. This wasn't true in some cases and
could lead to paging failures upon FW indication
interrupt (i.e. FW crash) because some structures
aren't allocated in that device state.

One reason for that was that ar_pci->started
wasn't reset. The other is interrupts should've
been masked when teardown starts.

The patch reorganized interrupt setup and makes
sure ar_pci->started is reset accordingly.

Reported-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix failpath in MSI-X setup
Michal Kazior [Wed, 31 Jul 2013 08:55:15 +0000 (10:55 +0200)]
ath10k: fix failpath in MSI-X setup

pci_disable_msi() must be called if the initial
request_irq() fails.

Also add a warning message so it's possible to
distinguish request_irq() failure and
pci_enable_msi() failure.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: zero arvif memory on add_interface()
Michal Kazior [Wed, 31 Jul 2013 08:55:14 +0000 (10:55 +0200)]
ath10k: zero arvif memory on add_interface()

The private memory area in vif provided by
mac80211 isn't guaranteed to be zeroed.

This patch should fix issues when switching
between STA and AP interface types.

The tim_bitmap could become polluted by STA bssid
field (since it's a union), wep_keys array
could also become polluted with invalid pointers
and probably much more.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: advertise more conservative intf combinations
Michal Kazior [Wed, 31 Jul 2013 08:55:13 +0000 (10:55 +0200)]
ath10k: advertise more conservative intf combinations

Apparently the available firmware has a limit of
handling 7 APs, 3 GOs or 8 STAs. This is based on
empirical tests and it is still possible some
combinations may crash the firmware.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: make sure to use passive scan when n_ssids is 0
Michal Kazior [Wed, 31 Jul 2013 08:55:12 +0000 (10:55 +0200)]
ath10k: make sure to use passive scan when n_ssids is 0

Normally user specifies broadcast ssid for
scanning. If the user wants to do a passive scan
it does not pass any ssids.

The patch makes sure we ath10k tells firmware to
not send anything at all in case it decides no
ssids equals broadcast ssid.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: prevent using invalid ringbuffer indexes
Michal Kazior [Wed, 31 Jul 2013 08:55:11 +0000 (10:55 +0200)]
ath10k: prevent using invalid ringbuffer indexes

If the device is removed and hotplug fails
ioread32() will return 0xFFFFFFFF. In that case
reading ringbuffer during device bringup led to
out-of-bounds addressing of a ringbuffer array
that in turn led to a paging failure.

This could be reproduced by the following:
 * boot without acpi/prevent hotplug from working
 * insert and manually detect (pci rescan) the device
 * remove the device physically
 * load ath10k driver
 * kernel crashed

Ringbuffer index reading is now protected by using
an appropriate mask to prevent addressing an
invalid array index.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: implement get_survey()
Michal Kazior [Wed, 31 Jul 2013 08:32:40 +0000 (10:32 +0200)]
ath10k: implement get_survey()

This implements a limited subset of what can be
reported in the survey dump.

This can be used for assessing approximate channel
load, e.g. for automatic channel selection.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: implement tx checksum offloading
Michal Kazior [Wed, 31 Jul 2013 08:47:57 +0000 (10:47 +0200)]
ath10k: implement tx checksum offloading

HW supports L3/L4 tx checksum offloading.

This should reduce CPU load and improve
performance on slow host machines.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: implement rx checksum offloading
Michal Kazior [Wed, 31 Jul 2013 08:47:56 +0000 (10:47 +0200)]
ath10k: implement rx checksum offloading

HW supports L3/L4 rx checksum offloading.

This should reduce CPU load and improve
performance on slow host machines.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: detect the number of spatial streams supported by hw
Michal Kazior [Wed, 24 Jul 2013 10:36:46 +0000 (12:36 +0200)]
ath10k: detect the number of spatial streams supported by hw

Until now ath10k assumed 3 spatial streams.
However some devices support only 2 spatial
streams.

This patch improves performance on devices that
don't support 3 spatial streams.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: improve tx throughput on slow machines
Michal Kazior [Mon, 22 Jul 2013 12:25:28 +0000 (14:25 +0200)]
ath10k: improve tx throughput on slow machines

It is more efficient to move just the 802.11
header instead of the whole payload in most cases.

This has no measurable effect on modern hardware.
It should improve performance by a few percent on
hardware such as an Access Point that have a slow
CPU compared to a typical desktop CPU.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix rts/fragmentation threshold setup
Michal Kazior [Mon, 22 Jul 2013 12:13:31 +0000 (14:13 +0200)]
ath10k: fix rts/fragmentation threshold setup

If RTS and fragmentation threshold values are
0xFFFFFFFF they should be considered disabled and
no min/max limits must be applied.

This fixes some issues with throughput issues,
especially with VHT.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix memleak in mac setup
Michal Kazior [Mon, 22 Jul 2013 12:13:30 +0000 (14:13 +0200)]
ath10k: fix memleak in mac setup

In some cases channel arrays were never freed.

The patch also unifies error handling in the mac
setup function.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: don't reset HTC endpoints unnecessarily
Michal Kazior [Mon, 22 Jul 2013 12:13:29 +0000 (14:13 +0200)]
ath10k: don't reset HTC endpoints unnecessarily

Endpoints are re-initialized upon HTC start anyway
so there's no need to do that twice in case of
restarting HTC (i.e. in case of hardware
recovery).

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: prevent HTC from being used after stopping
Michal Kazior [Mon, 22 Jul 2013 12:13:28 +0000 (14:13 +0200)]
ath10k: prevent HTC from being used after stopping

It was possible to submit new HTC commands
after/while HTC stopped. This led to memory
corruption in some rare cases.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: create debugfs interface to trigger fw crash
Michal Kazior [Mon, 22 Jul 2013 12:08:51 +0000 (14:08 +0200)]
ath10k: create debugfs interface to trigger fw crash

This can be useful for testing. To perform a
forced firmware crash write 'crash' to
'simulate_fw_crash' debugfs file. E.g.

  echo crash > /sys/kernel/debug/ieee80211/phy1/ath10k/simulate_fw_crash

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix NULL dereference for injected packets
Michal Kazior [Tue, 16 Jul 2013 09:04:54 +0000 (11:04 +0200)]
ath10k: fix NULL dereference for injected packets

Tx processing functions dereference vif and caused
NULL to be dereferenced for injected frames.

Don't call these functions at all for injected
frames. It doesn't make much sense to do so
anyway.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: implement fw crash simulation command
Michal Kazior [Tue, 16 Jul 2013 07:54:36 +0000 (09:54 +0200)]
ath10k: implement fw crash simulation command

This can be useful to test FW crash handling.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: implement device recovery
Michal Kazior [Tue, 16 Jul 2013 07:54:35 +0000 (09:54 +0200)]
ath10k: implement device recovery

Restart the hardware if FW crashes.

If FW crashes during recovery we leave the
hardware in a "wedged" state to avoid recursive
recoveries.

When in "wedged" state userspace may bring
interfaces down (to issue stop()) and then bring
one interface (to issue start()) to reload
hardware manually.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: skip fw stats debugfs interface if device is down
Michal Kazior [Tue, 16 Jul 2013 07:38:59 +0000 (09:38 +0200)]
ath10k: skip fw stats debugfs interface if device is down

If the device is not running then there may be no
FW at all to send the query to. If the FW is
already there it might still trigger a crash if
the command is sent before the device is fully
initialized.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: store firmware files in memory
Michal Kazior [Tue, 16 Jul 2013 07:38:58 +0000 (09:38 +0200)]
ath10k: store firmware files in memory

Different FW versions may provide different
functions thus mean different hw capabilities
advertised to mac80211.

It is safe to swap firmware files on disk during
driver/device runtime without worries.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: defer hw setup to start/stop mac80211 hooks
Michal Kazior [Tue, 16 Jul 2013 07:38:57 +0000 (09:38 +0200)]
ath10k: defer hw setup to start/stop mac80211 hooks

This fixes suspend-to-disk. The hardware is now
re-initialized upon freeze/thaw properly.

This also makes suspend/resume re-initialize the
hardware as WoWLAN support is not done yet.

With some little work it should be possible to
support hw reconfiguration for hw/fw recovery.

HW must be initialized once before registering to
mac80211 because FW determinates what hw
capabilities can be advertised.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: make sure all resources are freed upon ath10k_stop()
Michal Kazior [Tue, 16 Jul 2013 07:38:56 +0000 (09:38 +0200)]
ath10k: make sure all resources are freed upon ath10k_stop()

This is necessary for proper hw reconfiguration
and to avoid memory leaks.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: move free_vdev_map initialization
Michal Kazior [Tue, 16 Jul 2013 07:38:55 +0000 (09:38 +0200)]
ath10k: move free_vdev_map initialization

This is necessary for hw reconfiguration to work.
Since mac80211 is not calling remove_interface()
is such case we must reset free_vdev_map.

Also use a define instead of a hardcoded value for
vdev map initialization.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: decouple suspend code
Michal Kazior [Tue, 16 Jul 2013 07:38:54 +0000 (09:38 +0200)]
ath10k: decouple suspend code

Split up fw-related and hw-related suspension code.

Although we don't advertise WoW support to
mac80211 yet it's useful to keep the code in
suspend/resume hooks.

At this point there's no need to keep pci pm ops.
In case of WoW mac80211 calls ath10k_suspend()
which should take care of entering low-power mode.
In case WoW is not available mac80211 will go
through regular interface teradown and use start/stop.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: reset BMI state upon init
Michal Kazior [Tue, 16 Jul 2013 07:38:53 +0000 (09:38 +0200)]
ath10k: reset BMI state upon init

This is necessary if we want to be able to restart
hw on-the-fly.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: allow deferred regd update
Michal Kazior [Tue, 16 Jul 2013 07:38:52 +0000 (09:38 +0200)]
ath10k: allow deferred regd update

Regulatory domain notification hook can be called
regardless of the hw state (i.e. before start
mac80211 callback).

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: decouple core start/stop logic
Michal Kazior [Tue, 16 Jul 2013 07:38:51 +0000 (09:38 +0200)]
ath10k: decouple core start/stop logic

Enables code reuse for proper hw reconfiguration
that is in turn required for proper
suspend/hibernation/wowlan support.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: decouple pci start/stop logic
Michal Kazior [Tue, 16 Jul 2013 07:38:50 +0000 (09:38 +0200)]
ath10k: decouple pci start/stop logic

Split logic that prepares the device for BMI
phase/cleans up related resources.

This is necessary for ath10k to be able to restart
hw on the fly without reloading the module.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: add missing debug prints
Michal Kazior [Fri, 5 Jul 2013 13:15:17 +0000 (16:15 +0300)]
ath10k: add missing debug prints

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: abort scan properly if wmi_scan_stop fails
Michal Kazior [Fri, 5 Jul 2013 13:15:16 +0000 (16:15 +0300)]
ath10k: abort scan properly if wmi_scan_stop fails

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: improve locking
Michal Kazior [Fri, 5 Jul 2013 13:15:15 +0000 (16:15 +0300)]
ath10k: improve locking

Add more lockdep asserts and a few conf_mutex
locks. It's better to be on the safe side.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: embed HTT struct inside ath10k
Michal Kazior [Fri, 5 Jul 2013 13:15:14 +0000 (16:15 +0300)]
ath10k: embed HTT struct inside ath10k

This reduces number of allocations and simplifies
memory managemnt.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: embed HTC struct inside ath10k
Michal Kazior [Fri, 5 Jul 2013 13:15:13 +0000 (16:15 +0300)]
ath10k: embed HTC struct inside ath10k

This reduces number of allocations and simplifies
memory managemnt.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: rename hif callback
Michal Kazior [Fri, 5 Jul 2013 13:15:12 +0000 (16:15 +0300)]
ath10k: rename hif callback

The `set_callbacks` is a more appopriate name for
the function. Let's leave `init` for something
else.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: change function to take struct ath10k as arg
Michal Kazior [Fri, 5 Jul 2013 13:15:11 +0000 (16:15 +0300)]
ath10k: change function to take struct ath10k as arg

This aligns it to the argument list of other
similar functions.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: provide errno if bmi read/write fails
Michal Kazior [Fri, 5 Jul 2013 13:15:10 +0000 (16:15 +0300)]
ath10k: provide errno if bmi read/write fails

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: lower print level for a message
Michal Kazior [Fri, 5 Jul 2013 13:15:09 +0000 (16:15 +0300)]
ath10k: lower print level for a message

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: silent warning in IBSS mode
Michal Kazior [Fri, 5 Jul 2013 13:15:08 +0000 (16:15 +0300)]
ath10k: silent warning in IBSS mode

There is no TIM IE generated in IBSS beacons by
mac80211.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix typo in define name
Michal Kazior [Fri, 5 Jul 2013 13:15:07 +0000 (16:15 +0300)]
ath10k: fix typo in define name

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: remove ath10k_bus
Michal Kazior [Fri, 5 Jul 2013 13:15:06 +0000 (16:15 +0300)]
ath10k: remove ath10k_bus

It serves no purpose.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: do not setup rts/frag thresholds for suspended interfaces
Michal Kazior [Fri, 5 Jul 2013 13:15:05 +0000 (16:15 +0300)]
ath10k: do not setup rts/frag thresholds for suspended interfaces

mac80211 calls for rts/frag threshold hooks before
any interface is brought back up again when
resuming.

We would set vdev parameters before given vdev is
created lading to a FW crash.

rts/frag thresholds will be re-set accordingly in
add_interface() hook anyway.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: setup rts/frag thresholds upon vdev creation
Michal Kazior [Fri, 5 Jul 2013 13:15:04 +0000 (16:15 +0300)]
ath10k: setup rts/frag thresholds upon vdev creation

mac80211 configures rts/frag thresholds per-hw not
per-vif. ath10k FW expects those values to be set
per-vdev (i.e. per-vif).

ath10k should now respect rts/frag thresholds set
before a given interface was brought up.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix possible deadlock
Michal Kazior [Fri, 5 Jul 2013 13:15:03 +0000 (16:15 +0300)]
ath10k: fix possible deadlock

It was possible to have a deadlock due to inverted
locking of local->iflist_mtx and
ath10k->conf_mutex.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix teardown ordering
Michal Kazior [Fri, 5 Jul 2013 13:15:02 +0000 (16:15 +0300)]
ath10k: fix teardown ordering

This should fix memory corruption if HIF is tried
to be restarted.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agomwifiex: code rearrangement in sdio.c
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:56 +0000 (19:17 -0700)]
mwifiex: code rearrangement in sdio.c

Some function definitions are moved to appropriate place
to avoid forward declarations.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: handle driver initialization error paths
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:55 +0000 (19:17 -0700)]
mwifiex: handle driver initialization error paths

mwifiex_fw_dpc() asynchronously takes care of firmware download
and initialization. Currently the error paths in mwifiex_fw_dpc()
are not handled. So if wrong firmware is downloaded, required
cleanup work is not performed. memory is leaked and workqueue
remains unterminated in this case.

mwifiex_terminate_workqueue() is moved to avoid forward
declaration.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
John W. Linville [Thu, 25 Jul 2013 20:48:01 +0000 (16:48 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless

11 years agobgmac: make bgmac depend on bcm47xx
Hauke Mehrtens [Tue, 23 Jul 2013 21:28:49 +0000 (23:28 +0200)]
bgmac: make bgmac depend on bcm47xx

bgmac uses bcm47xx_nvram.h which is only available when BCM47XX was
selected. Earlier BCMA_HOST_SOC depended on BCM47XX so this was not
build on any other archs, but that changed. We should modify this
driver to get access to the nvram or the variables through platform
data.

This fixes a build problem in linux-next reported by Stephen Rothwell:

drivers/net/ethernet/broadcom/bgmac.c:19:27: fatal error: bcm47xx_nvram.h: No such file or directory
 #include <bcm47xx_nvram.h>
                           ^

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowireless: rt2x00: rt2800usb: add RT3573 devices
Xose Vazquez Perez [Tue, 23 Jul 2013 12:55:15 +0000 (14:55 +0200)]
wireless: rt2x00: rt2800usb: add RT3573 devices

taken from Ralink linux and windows drivers:

0x1b75, 0x7733 AirLive 450Mbps Wireless-N Dual Band USB Adapter
0x0b05, 0x17bc ASUS USB-N66 450Mbps Dual Band USB Adapter
0x0b05, 0x17ad ASUS USB-N66 Dual Band N Network Adapter
0x050d, 0x1103 Belkin Wireless Adapter
0x148f, 0xf301 Cameo Ralink3573 3x3 single band USB dongle
0x7392, 0x7733 Edimax
0x0e66, 0x0020 Hawking HD45U Dual Band USB Wireless-N Adapter
0x0e66, 0x0021 Hawking HD45U Dual Band Wls-450N Adapter
0x04bb, 0x094e I-O DATA WN-AG450U Wireless LAN Adapter
0x0789, 0x016b Logitec LAN-W450AN/U2
0x0846, 0x9012 NETGEAR WNDA4100 N900 Wireless Dual Band USB Adapter
0x0846, 0x9019 NETGEAR WNDA4200D Wireless Dual Band USB Adapter
0x2019, 0xed19 Planex GW-USDual450
0x148f, 0x3573 Ralink 802.11n USB Wireless LAN Card
0x0df6, 0x0067 Sitecom Wireless Dualband Network Adapter N750 X6
0x0df6, 0x006a Sitecom Wireless Dualband Network Adapter N900 X7
0x0586, 0x3421 ZyXEL Dual-Band Wireless N450 USB Adapter

Cc: Ivo van Doorn <IvDoorn@gmail.com>
Cc: Gertjan van Wingerde <gwingerde@gmail.com>
Cc: Helmut Schaa <helmut.schaa@googlemail.com>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: users@rt2x00.serialmonkey.com
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Fix diversity combining for AR9285
Sujith Manoharan [Tue, 23 Jul 2013 10:55:17 +0000 (16:25 +0530)]
ath9k: Fix diversity combining for AR9285

When antenna diversity combining is enabled in the EEPROM,
the initial values for the MAIN/ALT config have to be
programmed correctly. This patch adds it for AR9285.

Since the diversity combining macros are common to all chip
families, remove the redundant AR9285 macros and move the
definitions to phy.h.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: modify mwifiex_ap_sta_limits to advertise support for P2P
Avinash Patil [Tue, 23 Jul 2013 02:17:58 +0000 (19:17 -0700)]
mwifiex: modify mwifiex_ap_sta_limits to advertise support for P2P

We support maximum simultaneous 2 non-AP station interfaces and
they can assume role of Station/P2P client/P2P GO.
Advertise this support to cfg80211 so that concurrent P2P/STA
operation is possible.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: remove duplicate structure host_cmd_tlv
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:57 +0000 (19:17 -0700)]
mwifiex: remove duplicate structure host_cmd_tlv

We already have 'struct mwifiex_ie_types_header' with same
definition. Hence host_cmd_tlv is removed in this patch.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: correction in mwifiex_check_fw_status() return status
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:54 +0000 (19:17 -0700)]
mwifiex: correction in mwifiex_check_fw_status() return status

For PCIe cards, when wrong firmware is downloaded, firmware is
failed to be ready in 10 seconds. We should return an error at
this point. But currently we are sending first command to firmware.
As expected firmware doesn't respond to this command and command
timeout occurs.

This patch fixes the problem by removing unnecessary 'ret'
variable modifications in "if (ret) {" block.
The block is just supposed to update "adapter->winner" flag.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: replace mdelay with msleep
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:53 +0000 (19:17 -0700)]
mwifiex: replace mdelay with msleep

It is observed that when wrong firmware is downloaded for
PCIe card, system hangs for 10 seconds. The reason is mdelay()
is used when firmware status is polled.

Replace mdelay with msleep(non-blocking API) to fix the issue.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: reduce firmware poll retries
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:52 +0000 (19:17 -0700)]
mwifiex: reduce firmware poll retries

After downloading the firmware, firmware status is checked by
reading a register. Polling interval is 100 msecs. Therefore 100
retries means the status is checked for 10 secs which is more than
sufficient for firmware to get ready.

This patch removes 1000 retries macro usage, because 100secs
time is not practical.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: add unregister_dev handler for usb interface
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:51 +0000 (19:17 -0700)]
mwifiex: add unregister_dev handler for usb interface

Clear the data pointer stored in USB interface structure in
this handler. This helps to return from mwifiex_usb_disconnect()
if driver deinitialization is already performed while handling
an error path for mwifiex_usb_probe().

USB8797 card gets enumerated twice. First enumeration is for
firmware download and second enumeration expects firmware
initialization. mwifiex_usb_probe() always takes care of
deinitialization for first enumeration after firmware download.

Also, this change matches our handling for SDIO and PCIe
interfaces.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: move if_ops.cleanup_if() call
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:50 +0000 (19:17 -0700)]
mwifiex: move if_ops.cleanup_if() call

As if_ops.init_if() is called in mwifiex_register(),
corresponding cleanup routine should be called in
mwifiex_unregister().

Currently it's there in mwifiex_adapter_cleanup(), hence
interface specific cleanup is not performed if driver
initialization is failed.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: remove unnecessary del_timer(cmd_timer)
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:49 +0000 (19:17 -0700)]
mwifiex: remove unnecessary del_timer(cmd_timer)

It is already there in mwifiex_unregister(). So unnecessary
call in mwifiex_adapter_cleanup() is removed in this patch.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: move del_timer_sync(scan_delay_timer) call to fix memleak
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:48 +0000 (19:17 -0700)]
mwifiex: move del_timer_sync(scan_delay_timer) call to fix memleak

Currently it is in mwifiex_adapter_cleanup() which doesn't get
called if driver initialization is failed causing memory leak.

scan_delay_timer is initialized in mwifiex_register(), so it
should be deleted in mwifiex_unregister(). Hence it has been
moved to appropriate place.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: add PCIe shutdown handler to avoid system hang on reboot
Amitkumar Karwar [Tue, 23 Jul 2013 02:17:47 +0000 (19:17 -0700)]
mwifiex: add PCIe shutdown handler to avoid system hang on reboot

If reboot command is issued when device is in connected state,
system hangs while booting. This issue is fixed by doing cleanup
in shutdown handler.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>