From kvalo at qca.qualcomm.com  Tue Oct  1 12:27:52 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 1 Oct 2013 19:27:52 +0300
Subject: [PATCH 1/2] ath10k: Fix bug in max. VHT A-MPDU size
In-Reply-To: <1380292567-2363-2-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Fri, 27 Sep 2013 16:36:06 +0200")
References: <1380292567-2363-1-git-send-email-michal.kazior@tieto.com>
 <1380292567-2363-2-git-send-email-michal.kazior@tieto.com>
Message-ID: <87a9it6jnb.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> From: Sujith Manoharan <c_manoha at qca.qualcomm.com>
>
> For VHT peers, the maximum A-MPDU size has to be calculated
> from the VHT capabilities element and not the HT-cap. The formula
> is the same, but a higher value is used in VHT, allowing larger
> aggregates to be transmitted.
>
> Signed-off-by: Sujith Manoharan <c_manoha at qca.qualcomm.com>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

This kills the TCP TX throughput with D-Link DIR-865L (ath10k x86 as the
client) from ~350 Mbps to ~120 Mbps. Sujith mentioned private there's a
workaround for this, this patch should have that.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Tue Oct  1 12:35:45 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 1 Oct 2013 19:35:45 +0300
Subject: [PATCH 2/2] ath10k: fix scheduling while atomic bug
In-Reply-To: <1380292567-2363-3-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Fri, 27 Sep 2013 16:36:07 +0200")
References: <1380292567-2363-1-git-send-email-michal.kazior@tieto.com>
 <1380292567-2363-3-git-send-email-michal.kazior@tieto.com>
Message-ID: <8761th6ja6.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> Recent WMI/HTC changes broke WEP with multiple
> keys. If WMI had no HTC TX credits to submit
> command for default wep index update it would
> trigger a bug.
>
> This simply moves the wep key index update to a
> worker.
>
> The key update may happen some time after first
> frame with a different wep key has been sent (i.e.
> some frames will be sent with old key). This was
> the case before too as WMI commands were
> asynchronous.
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

This looks problematic. Basically you just delay sending the WMI
command, but there's no guarantee that we actually have free credits at
the time of transmission. So to me it looks like this fixes the issue
just by luck.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Tue Oct  1 13:48:36 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 1 Oct 2013 20:48:36 +0300
Subject: Pull request: ath 20131001
Message-ID: <87wqlw6fwr.fsf@kamboji.qca.qualcomm.com>

Hi John,

here's a bigger pull request including patches applied during the merge
window. Major changes are:

* throughput improvements including aligning the RX frames correctly and
  optimising HTT layer (Michal)

* remove qca98xx hw1.0 support (Bartosz)

* add support for firmware version 999.999.0.636 (Michal)

* firmware htt statistics support (Kalle)

* fix WEP in AP and IBSS mode (Marek)

* fix a mutex unlock balance in debugfs file (Shafi)

And of course there's a lot of smaller fixes and cleanup.

To avoid the pull request getting too big, I didn't include the latest
patches from ath.git. I'm planning to send them once you have pulled
this one. Please let me know if there are any problems.

Kalle


The following changes since commit 9d0e2f0772d394060bf3b17cd1f3a35574365103:

  ath6kl: Fix invalid pointer access on fuzz testing with AP mode (2013-08-07 10:58:59 +0300)

are available in the git repository at:

  git://github.com/kvalo/ath.git tags/for-linville-20131001

for you to fetch changes up to 6e712d427cb0542afdd5220edb6e4f4f8a5b952d:

  ath10k: replenish HTT RX buffers in a tasklet (2013-09-26 17:22:54 +0300)

----------------------------------------------------------------
Bartosz Markowski (5):
      ath10k: Remove qca98xx hw1.0 support
      ath10k: update supported FW build version
      ath10k: set the UART baud rate to 19200
      ath10k: remove obsolete INIT STATUS definitions
      ath10k: define ath10k_debug_start/_stop as static inline

Dave Jones (1):
      ath10k: add missing braces to ath10k_pci_tx_pipe_cleanup

Janusz Dziedzic (2):
      ath10k: setup peer UAPSD flag correctly
      ath10k: check allocation errors in CE

Jingoo Han (1):
      wireless: ath10k: remove unnecessary pci_set_drvdata()

Kalle Valo (22):
      ath10k: remove un ar_pci->cacheline_sz field
      ath10k: pci: make host_ce_config_wlan[] more readable
      ath10k: make target_ce_config_wlan more readable
      ath10k: remove void pointer from struct ath10k_pci_compl
      ath10k: convert ath10k_pci_reg_read/write32() to take struct ath10k
      ath10k: clean up ath10k_ce_completed_send_next_nolock()
      ath10k: convert ath10k_pci_wake() to return
      ath10k: simplify ath10k_ce_init() wake up handling
      ath10k: check chip id from the soc register during probe
      ath10k: add chip_id file to debugfs
      ath10k: add trace event ath10k_htt_stats
      ath10k: implement ath10k_debug_start/stop()
      ath10k: add htt_stats_enable debugfs file
      ath10k: add BMI log level
      ath10k: rename ATH10K_DBG_CORE to BOOT
      ath10k: cleanup debug messages in core.c
      ath10k: add boot debug messages to pci.c and ce.c
      ath10k: add boot debug messages to htc.c
      ath10k: add boot messages to htt.c
      ath10k: clean mac.c debug messages
      ath10k: print phymode as a string
      ath10k: delete struct ce_sendlist

Marek Puzyniak (1):
      ath10k: fix WEP in AP and IBSS mode

Michal Kazior (36):
      ath10k: clean up monitor start code
      ath10k: use sizeof(*var) in kmalloc
      ath10k: clean up PCI completion states
      ath10k: print errcode when CE ring setup fails
      ath10k: fix HTT service setup
      ath10k: implement 802.3 SNAP rx decap type A-MSDU handling
      ath10k: plug possible memory leak in WMI
      ath10k: add support for firmware newer than 636
      ath10k: add support for HTT 3.0
      ath10k: use inline ce_state structure
      ath10k: remove ce_op_state
      ath10k: remove unused ce_attr parameters
      ath10k: rename hif_ce_pipe_info to ath10k_pci_pipe
      ath10k: rename ce_state to ath10k_ce_pipe
      ath10k: rename ce_ring_state to ath10k_ce_ring
      ath10k: prevent CE from looping indefinitely
      ath10k: simplify HTC credits calculation
      ath10k: add HTC TX credits replenishing notification
      ath10k: make WMI commands block by design
      ath10k: simplify HTC command submitting
      ath10k: improve beacon submission latency
      ath10k: remove wmi pending count limit
      ath10k: remove wmi event worker thread
      ath10k: fix tracing build for ath10k_wmi_cmd
      ath10k: fix num_sends_allowed replenishing
      ath10k: use num_pending_tx instead of msdu id bitmap
      ath10k: avoid needless memset on TX path
      ath10k: decouple HTT TX completions
      ath10k: cleanup HTT TX functions
      ath10k: use msdu headroom to store txfrag
      ath10k: report A-MSDU subframes individually
      ath10k: document decap modes
      ath10k: cleanup RX decap handling
      ath10k: fix Native Wifi decap mode RX
      ath10k: align RX frames properly
      ath10k: replenish HTT RX buffers in a tasklet

Mohammed Shafi Shajakhan (1):
      ath10k: Fix mutex unlock balance

Sujith Manoharan (1):
      ath10k: Calculate correct peer PHY mode for VHT

 drivers/net/wireless/ath/ath10k/bmi.c     |   42 ++-
 drivers/net/wireless/ath/ath10k/ce.c      |  382 +++++++++++-------------
 drivers/net/wireless/ath/ath10k/ce.h      |  120 ++------
 drivers/net/wireless/ath/ath10k/core.c    |   70 +++--
 drivers/net/wireless/ath/ath10k/core.h    |   35 ++-
 drivers/net/wireless/ath/ath10k/debug.c   |  144 +++++++++-
 drivers/net/wireless/ath/ath10k/debug.h   |   14 +-
 drivers/net/wireless/ath/ath10k/htc.c     |  241 ++++------------
 drivers/net/wireless/ath/ath10k/htc.h     |    5 +-
 drivers/net/wireless/ath/ath10k/htt.c     |   19 +-
 drivers/net/wireless/ath/ath10k/htt.h     |   13 +-
 drivers/net/wireless/ath/ath10k/htt_rx.c  |  314 +++++++++++---------
 drivers/net/wireless/ath/ath10k/htt_tx.c  |  285 +++++++++---------
 drivers/net/wireless/ath/ath10k/hw.h      |   25 +-
 drivers/net/wireless/ath/ath10k/mac.c     |  244 ++++++++--------
 drivers/net/wireless/ath/ath10k/pci.c     |  446 +++++++++++++++++------------
 drivers/net/wireless/ath/ath10k/pci.h     |   73 ++---
 drivers/net/wireless/ath/ath10k/rx_desc.h |   24 +-
 drivers/net/wireless/ath/ath10k/trace.h   |   32 ++-
 drivers/net/wireless/ath/ath10k/txrx.c    |   67 ++---
 drivers/net/wireless/ath/ath10k/txrx.h    |    5 +-
 drivers/net/wireless/ath/ath10k/wmi.c     |  232 +++++++--------
 drivers/net/wireless/ath/ath10k/wmi.h     |   71 ++++-
 23 files changed, 1534 insertions(+), 1369 deletions(-)

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Tue Oct  1 14:11:49 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 1 Oct 2013 21:11:49 +0300
Subject: Scheduling while atomic while setting the PS mode
Message-ID: <87eh846eu2.fsf@kamboji.qca.qualcomm.com>

Hi,

I haven't been testing with all debug tests enabled for few days.
Enabled them now and see the BUG below. This is with commit 71bcca1ff7f.

Kalle

[  250.125852] ath10k_pci 0000:02:00.0: irq 49 for MSI/MSI-X
[  250.126959] ath10k: MSI interrupt handling
[  251.357561] ath10k: UART prints disabled
[  251.432475] ath10k: firmware 999.999.0.716 booted
[  251.443440] ath10k: htt target version 3.0
[  251.447488] BUG: scheduling while atomic: ip/2695/0x00000002
[  251.447604] INFO: lockdep is turned off.
[  251.447714] Modules linked in: ath10k_pci ath10k_core ath mac80211 cfg80211 [last unloaded: cfg80211]
[  251.449514] CPU: 1 PID: 2695 Comm: ip Tainted: G        W    3.11.0-wl-ath+ #77
[  251.449631] Hardware name: Hewlett-Packard HP ProBook 6540b/1722, BIOS 68CDD Ver. F.04 01/27/2010
[  251.449743]  00000000 00000000 eea437e8 c17859c9 edf75680 eea43804 c1781f31 c19a5e18
[  251.451591]  edf75960 00000a87 00000002 f4620000 eea43894 c178c533 00000000 00000002
[  251.453479]  00000001 00000000 c12f812f 00000000 edf75680 c1bbe000 c1a9aec8 eea43850
[  251.454499] Call Trace:
[  251.455469]  [<c17859c9>] dump_stack+0x4b/0x66
[  251.455597]  [<c1781f31>] __schedule_bug+0x64/0x76
[  251.455720]  [<c178c533>] __schedule+0x943/0xb30
[  251.455844]  [<c12f812f>] ? debug_object_activate+0x6f/0x150
[  251.455970]  [<c10ad8eb>] ? trace_hardirqs_off+0xb/0x10
[  251.456091]  [<c178e696>] ? _raw_spin_unlock_irqrestore+0x36/0x60
[  251.456211]  [<c10b3638>] ? trace_hardirqs_on_caller+0x18/0x1c0
[  251.456352]  [<c178c9d3>] schedule+0x23/0x60
[  251.456525]  [<c1789003>] schedule_timeout+0x103/0x280
[  251.457480]  [<f92e6ee0>] ? ieee80211_iterate_active_interfaces+0x130/0x130 [mac80211]
[  251.457610]  [<c1053140>] ? call_timer_fn+0x2c0/0x2c0
[  251.457738]  [<f939a38f>] ath10k_wmi_cmd_send+0xaf/0x110 [ath10k_core]
[  251.457861]  [<c106bdb0>] ? __init_waitqueue_head+0x60/0x60
[  251.457986]  [<f939c57a>] ath10k_wmi_set_psmode+0x6a/0x80 [ath10k_core]
[  251.458110]  [<f938e557>] ath10k_ps_iter+0x87/0x140 [ath10k_core]
[  251.458258]  [<f92e701a>] ieee80211_iterate_active_interfaces_atomic+0x13a/0x2c0 [mac80211]
[  251.458435]  [<f92e6ee0>] ? ieee80211_iterate_active_interfaces+0x130/0x130 [mac80211]
[  251.458613]  [<f938e4d0>] ? ath10k_configure_filter+0x3d0/0x3d0 [ath10k_core]
[  251.459542]  [<f938e775>] ath10k_config+0x165/0x310 [ath10k_core]
[  251.459685]  [<f92b2c05>] ieee80211_hw_config+0x85/0x620 [mac80211]
[  251.459824]  [<f92b2d5b>] ? ieee80211_hw_config+0x1db/0x620 [mac80211]
[  251.459968]  [<f92cd6ca>] ieee80211_do_open+0x65a/0x1650 [mac80211]
[  251.460091]  [<c107199f>] ? raw_notifier_call_chain+0x1f/0x30
[  251.460214]  [<c1632301>] ? call_netdevice_notifiers_info+0x1/0x70
[  251.460384]  [<f92ce720>] ieee80211_open+0x60/0x70 [mac80211]
[  251.460554]  [<c163839b>] __dev_open+0xab/0x120
[  251.461387]  [<c178e735>] ? _raw_spin_unlock_bh+0x35/0x40
[  251.461520]  [<c1638632>] __dev_change_flags+0x82/0x150
[  251.461641]  [<c16387b1>] dev_change_flags+0x21/0x60
[  251.461763]  [<c1645df0>] do_setlink+0x220/0x870
[  251.461886]  [<c115d6c9>] ? deactivate_slab+0x399/0x540
[  251.462007]  [<c12ffa0f>] ? nla_parse+0x1f/0xa0
[  251.462127]  [<c178e652>] ? _raw_spin_unlock+0x22/0x30
[  251.462247]  [<c1647309>] rtnl_newlink+0x349/0x530
[  251.462393]  [<c129d003>] ? selinux_task_to_inode+0xf3/0x170
[  251.463348]  [<c12a0ae2>] ? selinux_capable+0x32/0x40
[  251.463475]  [<c104f1b8>] ? ns_capable+0x38/0x70
[  251.463597]  [<c1646eee>] rtnetlink_rcv_msg+0x10e/0x1e0
[  251.463718]  [<c1645a34>] ? rtnl_lock+0x14/0x20
[  251.463838]  [<c1645a34>] ? rtnl_lock+0x14/0x20
[  251.463958]  [<c1646de0>] ? __rtnl_unlock+0x20/0x20
[  251.464080]  [<c165f81e>] netlink_rcv_skb+0x8e/0xb0
[  251.464200]  [<c1645a5c>] rtnetlink_rcv+0x1c/0x30
[  251.464340]  [<c165f1ab>] netlink_unicast+0x13b/0x180
[  251.465288]  [<c165f615>] netlink_sendmsg+0x375/0x3f0
[  251.465425]  [<c161bf8e>] sock_sendmsg+0xbe/0xe0
[  251.465550]  [<c1143254>] ? might_fault+0x94/0xa0
[  251.465673]  [<c12f0c82>] ? _copy_from_user+0x42/0x60
[  251.465794]  [<c16295f4>] ? verify_iovec+0x44/0xb0
[  251.465914]  [<c161c21f>] ___sys_sendmsg+0x21f/0x230
[  251.466035]  [<c1142cdf>] ? __do_fault+0x19f/0x4b0
[  251.466157]  [<c1121136>] ? unlock_page+0x46/0x50
[  251.466296]  [<c1142cee>] ? __do_fault+0x1ae/0x4b0
[  251.467227]  [<c11821bf>] ? fget_light+0x28f/0x440
[  251.467372]  [<c161e39e>] __sys_sendmsg+0x3e/0x70
[  251.467528]  [<c161e3e6>] SyS_sendmsg+0x16/0x20
[  251.467650]  [<c161e91f>] SyS_socketcall+0x11f/0x2e0
[  251.467771]  [<c10b3638>] ? trace_hardirqs_on_caller+0x18/0x1c0
[  251.467893]  [<c107072b>] ? up_write+0x1b/0x30
[  251.468016]  [<c17969ba>] sysenter_do_call+0x12/0x32
[  251.469317] ip (2695) used greatest stack depth: 4244 bytes left

-- 
Kalle Valo


From joe at perches.com  Tue Oct  1 22:04:40 2013
From: joe at perches.com (Joe Perches)
Date: Tue, 01 Oct 2013 19:04:40 -0700
Subject: [PATCH net-next] net:drivers/net: Miscellaneous conversions to
 ETH_ALEN
Message-ID: <1380679480.2081.24.camel@joe-AO722>

Convert the memset/memcpy uses of 6 to ETH_ALEN
where appropriate.

Also convert some struct definitions and u8 array
declarations of [6] to ETH_ALEN.

Signed-off-by: Joe Perches <joe at perches.com>
---
 drivers/net/ethernet/8390/ax88796.c                |  2 +-
 drivers/net/ethernet/amd/atarilance.c              |  4 +-
 drivers/net/ethernet/amd/au1000_eth.c              |  2 +-
 drivers/net/ethernet/amd/pcnet32.c                 |  2 +-
 drivers/net/ethernet/apple/bmac.c                  |  4 +-
 drivers/net/ethernet/broadcom/b44.c                |  2 +-
 drivers/net/ethernet/broadcom/bnx2.c               |  6 +-
 drivers/net/ethernet/broadcom/cnic.c               |  4 +-
 drivers/net/ethernet/broadcom/tg3.c                | 10 +--
 drivers/net/ethernet/chelsio/cxgb/pm3393.c         |  4 +-
 drivers/net/ethernet/davicom/dm9000.c              |  2 +-
 .../net/ethernet/freescale/fs_enet/fs_enet-main.c  |  2 +-
 drivers/net/ethernet/freescale/ucc_geth.c          |  2 +-
 drivers/net/ethernet/i825xx/82596.c                |  4 +-
 drivers/net/ethernet/i825xx/lib82596.c             |  6 +-
 drivers/net/ethernet/ibm/emac/core.c               |  2 +-
 drivers/net/ethernet/ibm/ibmveth.c                 |  4 +-
 drivers/net/ethernet/intel/igb/igb_main.c          |  2 +-
 drivers/net/ethernet/intel/igbvf/vf.c              |  4 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c     |  9 +--
 drivers/net/ethernet/intel/ixgbevf/vf.c            |  4 +-
 drivers/net/ethernet/jme.c                         |  4 +-
 drivers/net/ethernet/korina.c                      |  2 +-
 drivers/net/ethernet/marvell/mv643xx_eth.c         |  4 +-
 drivers/net/ethernet/micrel/ks8851_mll.c           |  4 +-
 drivers/net/ethernet/myricom/myri10ge/myri10ge.c   |  4 +-
 drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c |  2 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c     |  2 +-
 drivers/net/ethernet/renesas/sh_eth.c              |  2 +-
 drivers/net/ethernet/sgi/meth.c                    |  2 +-
 drivers/net/ethernet/smsc/smsc911x.c               |  2 +-
 drivers/net/ethernet/sun/cassini.c                 |  2 +-
 drivers/net/ethernet/sun/sungem.c                  |  2 +-
 drivers/net/ethernet/sun/sunhme.c                  | 10 +--
 drivers/net/ethernet/sun/sunqe.c                   |  2 +-
 drivers/net/ethernet/ti/davinci_emac.c             |  2 +-
 drivers/net/ethernet/tile/tilegx.c                 |  2 +-
 drivers/net/ethernet/xilinx/xilinx_emaclite.c      |  2 +-
 drivers/net/fddi/skfp/fplustm.c                    |  2 +-
 drivers/net/fddi/skfp/skfddi.c                     |  6 +-
 drivers/net/plip/plip.c                            |  2 +-
 drivers/net/usb/catc.c                             |  8 +-
 drivers/net/wireless/ath/ath10k/wmi.c              |  2 +-
 drivers/net/wireless/ath/wil6210/cfg80211.c        |  4 +-
 drivers/net/wireless/atmel.c                       | 92 +++++++++++-----------
 drivers/net/wireless/b43/xmit.c                    |  2 +-
 drivers/net/wireless/b43legacy/xmit.c              |  2 +-
 drivers/net/wireless/brcm80211/brcmsmac/main.c     |  6 +-
 drivers/net/wireless/hostap/hostap_info.c          |  2 +-
 drivers/net/wireless/ipw2x00/ipw2200.c             |  2 +-
 drivers/net/wireless/prism54/isl_ioctl.c           | 10 +--
 drivers/net/wireless/prism54/islpci_dev.c          |  2 +-
 drivers/net/wireless/prism54/oid_mgt.c             |  2 +-
 drivers/net/wireless/rtlwifi/core.c                | 10 +--
 net/bridge/br_multicast.c                          |  4 +-
 net/bridge/netfilter/ebt_among.c                   |  2 +-
 net/mac80211/trace.h                               |  4 +-
 57 files changed, 146 insertions(+), 149 deletions(-)

diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c
index f92f001..36fa577 100644
--- a/drivers/net/ethernet/8390/ax88796.c
+++ b/drivers/net/ethernet/8390/ax88796.c
@@ -702,7 +702,7 @@ static int ax_init_dev(struct net_device *dev)
 			for (i = 0; i < 16; i++)
 				SA_prom[i] = SA_prom[i+i];
 
-		memcpy(dev->dev_addr, SA_prom, 6);
+		memcpy(dev->dev_addr, SA_prom, ETH_ALEN);
 	}
 
 #ifdef CONFIG_AX88796_93CX6
diff --git a/drivers/net/ethernet/amd/atarilance.c b/drivers/net/ethernet/amd/atarilance.c
index 10ceca5..e07ce5f 100644
--- a/drivers/net/ethernet/amd/atarilance.c
+++ b/drivers/net/ethernet/amd/atarilance.c
@@ -586,10 +586,10 @@ static unsigned long __init lance_probe1( struct net_device *dev,
 	switch( lp->cardtype ) {
 	  case OLD_RIEBL:
 		/* No ethernet address! (Set some default address) */
-		memcpy( dev->dev_addr, OldRieblDefHwaddr, 6 );
+		memcpy(dev->dev_addr, OldRieblDefHwaddr, ETH_ALEN);
 		break;
 	  case NEW_RIEBL:
-		lp->memcpy_f( dev->dev_addr, RIEBL_HWADDR_ADDR, 6 );
+		lp->memcpy_f(dev->dev_addr, RIEBL_HWADDR_ADDR, ETH_ALEN);
 		break;
 	  case PAM_CARD:
 		i = IO->eeprom;
diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
index 91d52b4..427c148 100644
--- a/drivers/net/ethernet/amd/au1000_eth.c
+++ b/drivers/net/ethernet/amd/au1000_eth.c
@@ -1138,7 +1138,7 @@ static int au1000_probe(struct platform_device *pdev)
 		aup->phy1_search_mac0 = 1;
 	} else {
 		if (is_valid_ether_addr(pd->mac)) {
-			memcpy(dev->dev_addr, pd->mac, 6);
+			memcpy(dev->dev_addr, pd->mac, ETH_ALEN);
 		} else {
 			/* Set a random MAC since no valid provided by platform_data. */
 			eth_hw_addr_random(dev);
diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c
index 2d8e288..bd4e640 100644
--- a/drivers/net/ethernet/amd/pcnet32.c
+++ b/drivers/net/ethernet/amd/pcnet32.c
@@ -1675,7 +1675,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
 				pr_cont(" warning: CSR address invalid,\n");
 				pr_info("    using instead PROM address of");
 			}
-			memcpy(dev->dev_addr, promaddr, 6);
+			memcpy(dev->dev_addr, promaddr, ETH_ALEN);
 		}
 	}
 
diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c
index a597b76..daae0e0 100644
--- a/drivers/net/ethernet/apple/bmac.c
+++ b/drivers/net/ethernet/apple/bmac.c
@@ -1220,8 +1220,8 @@ static void bmac_reset_and_enable(struct net_device *dev)
 	if (skb != NULL) {
 		data = skb_put(skb, ETHERMINPACKET);
 		memset(data, 0, ETHERMINPACKET);
-		memcpy(data, dev->dev_addr, 6);
-		memcpy(data+6, dev->dev_addr, 6);
+		memcpy(data, dev->dev_addr, ETH_ALEN);
+		memcpy(data + ETH_ALEN, dev->dev_addr, ETH_ALEN);
 		bmac_transmit_packet(skb, dev);
 	}
 	spin_unlock_irqrestore(&bp->lock, flags);
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index c96930f..079a597 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -2111,7 +2111,7 @@ static int b44_get_invariants(struct b44 *bp)
 	 * valid PHY address. */
 	bp->phy_addr &= 0x1F;
 
-	memcpy(bp->dev->dev_addr, addr, 6);
+	memcpy(bp->dev->dev_addr, addr, ETH_ALEN);
 
 	if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){
 		pr_err("Invalid MAC address found in EEPROM\n");
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index e838a3f..6111870 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -5761,8 +5761,8 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode)
 	if (!skb)
 		return -ENOMEM;
 	packet = skb_put(skb, pkt_size);
-	memcpy(packet, bp->dev->dev_addr, 6);
-	memset(packet + 6, 0x0, 8);
+	memcpy(packet, bp->dev->dev_addr, ETH_ALEN);
+	memset(packet + ETH_ALEN, 0x0, 8);
 	for (i = 14; i < pkt_size; i++)
 		packet[i] = (unsigned char) (i & 0xff);
 
@@ -8514,7 +8514,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	pci_set_drvdata(pdev, dev);
 
-	memcpy(dev->dev_addr, bp->mac_addr, 6);
+	memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN);
 
 	dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
 		NETIF_F_TSO | NETIF_F_TSO_ECN |
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index 99394bd..f58a8b8 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -393,7 +393,7 @@ static int cnic_iscsi_nl_msg_recv(struct cnic_dev *dev, u32 msg_type,
 
 			csk->vlan_id = path_resp->vlan_id;
 
-			memcpy(csk->ha, path_resp->mac_addr, 6);
+			memcpy(csk->ha, path_resp->mac_addr, ETH_ALEN);
 			if (test_bit(SK_F_IPV6, &csk->flags))
 				memcpy(&csk->src_ip[0], &path_resp->src.v6_addr,
 				       sizeof(struct in6_addr));
@@ -5572,7 +5572,7 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev)
 	if (cdev->max_fcoe_conn > BNX2X_FCOE_NUM_CONNECTIONS)
 		cdev->max_fcoe_conn = BNX2X_FCOE_NUM_CONNECTIONS;
 
-	memcpy(cdev->mac_addr, ethdev->iscsi_mac, 6);
+	memcpy(cdev->mac_addr, ethdev->iscsi_mac, ETH_ALEN);
 
 	cp->cnic_ops = &cnic_bnx2x_ops;
 	cp->start_hw = cnic_start_bnx2x_hw;
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 221a181..d9ed140 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -13207,8 +13207,8 @@ static int tg3_run_loopback(struct tg3 *tp, u32 pktsz, bool tso_loopback)
 		return -ENOMEM;
 
 	tx_data = skb_put(skb, tx_len);
-	memcpy(tx_data, tp->dev->dev_addr, 6);
-	memset(tx_data + 6, 0x0, 8);
+	memcpy(tx_data, tp->dev->dev_addr, ETH_ALEN);
+	memset(tx_data + ETH_ALEN, 0x0, 8);
 
 	tw32(MAC_RX_MTU_SIZE, tx_len + ETH_FCS_LEN);
 
@@ -16654,8 +16654,8 @@ static int tg3_get_macaddr_sparc(struct tg3 *tp)
 	int len;
 
 	addr = of_get_property(dp, "local-mac-address", &len);
-	if (addr && len == 6) {
-		memcpy(dev->dev_addr, addr, 6);
+	if (addr && len == ETH_ALEN) {
+		memcpy(dev->dev_addr, addr, ETH_ALEN);
 		return 0;
 	}
 	return -ENODEV;
@@ -16665,7 +16665,7 @@ static int tg3_get_default_macaddr_sparc(struct tg3 *tp)
 {
 	struct net_device *dev = tp->dev;
 
-	memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
+	memcpy(dev->dev_addr, idprom->id_ethaddr, ETH_ALEN);
 	return 0;
 }
 #endif
diff --git a/drivers/net/ethernet/chelsio/cxgb/pm3393.c b/drivers/net/ethernet/chelsio/cxgb/pm3393.c
index 40c7b93..eb33a31 100644
--- a/drivers/net/ethernet/chelsio/cxgb/pm3393.c
+++ b/drivers/net/ethernet/chelsio/cxgb/pm3393.c
@@ -499,7 +499,7 @@ static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac,
 
 static int pm3393_macaddress_get(struct cmac *cmac, u8 mac_addr[6])
 {
-	memcpy(mac_addr, cmac->instance->mac_addr, 6);
+	memcpy(mac_addr, cmac->instance->mac_addr, ETH_ALEN);
 	return 0;
 }
 
@@ -526,7 +526,7 @@ static int pm3393_macaddress_set(struct cmac *cmac, u8 ma[6])
 	 */
 
 	/* Store local copy */
-	memcpy(cmac->instance->mac_addr, ma, 6);
+	memcpy(cmac->instance->mac_addr, ma, ETH_ALEN);
 
 	lo  = ((u32) ma[1] << 8) | (u32) ma[0];
 	mid = ((u32) ma[3] << 8) | (u32) ma[2];
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index 5f5896e..be8efee 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -1603,7 +1603,7 @@ dm9000_probe(struct platform_device *pdev)
 
 	if (!is_valid_ether_addr(ndev->dev_addr) && pdata != NULL) {
 		mac_src = "platform data";
-		memcpy(ndev->dev_addr, pdata->dev_addr, 6);
+		memcpy(ndev->dev_addr, pdata->dev_addr, ETH_ALEN);
 	}
 
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index 6b60582..56f2f60 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -1083,7 +1083,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
 
 	mac_addr = of_get_mac_address(ofdev->dev.of_node);
 	if (mac_addr)
-		memcpy(ndev->dev_addr, mac_addr, 6);
+		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 
 	ret = fep->ops->allocate_bd(ndev);
 	if (ret)
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index 5930c39..d58a3df 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -3899,7 +3899,7 @@ static int ucc_geth_probe(struct platform_device* ofdev)
 
 	mac_addr = of_get_mac_address(np);
 	if (mac_addr)
-		memcpy(dev->dev_addr, mac_addr, 6);
+		memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
 
 	ugeth->ug_info = ug_info;
 	ugeth->dev = device;
diff --git a/drivers/net/ethernet/i825xx/82596.c b/drivers/net/ethernet/i825xx/82596.c
index e388161..a15877a 100644
--- a/drivers/net/ethernet/i825xx/82596.c
+++ b/drivers/net/ethernet/i825xx/82596.c
@@ -711,7 +711,7 @@ static int init_i596_mem(struct net_device *dev)
 	i596_add_cmd(dev, &lp->cf_cmd.cmd);
 
 	DEB(DEB_INIT,printk(KERN_DEBUG "%s: queuing CmdSASetup\n", dev->name));
-	memcpy(lp->sa_cmd.eth_addr, dev->dev_addr, 6);
+	memcpy(lp->sa_cmd.eth_addr, dev->dev_addr, ETH_ALEN);
 	lp->sa_cmd.cmd.command = CmdSASetup;
 	i596_add_cmd(dev, &lp->sa_cmd.cmd);
 
@@ -1155,7 +1155,7 @@ struct net_device * __init i82596_probe(int unit)
 			err = -ENODEV;
 			goto out;
 		}
-		memcpy(eth_addr, (void *) 0xfffc1f2c, 6);	/* YUCK! Get addr from NOVRAM */
+		memcpy(eth_addr, (void *) 0xfffc1f2c, ETH_ALEN);	/* YUCK! Get addr from NOVRAM */
 		dev->base_addr = MVME_I596_BASE;
 		dev->irq = (unsigned) MVME16x_IRQ_I596;
 		goto found;
diff --git a/drivers/net/ethernet/i825xx/lib82596.c b/drivers/net/ethernet/i825xx/lib82596.c
index d653bac..861fa15 100644
--- a/drivers/net/ethernet/i825xx/lib82596.c
+++ b/drivers/net/ethernet/i825xx/lib82596.c
@@ -607,7 +607,7 @@ static int init_i596_mem(struct net_device *dev)
 	i596_add_cmd(dev, &dma->cf_cmd.cmd);
 
 	DEB(DEB_INIT, printk(KERN_DEBUG "%s: queuing CmdSASetup\n", dev->name));
-	memcpy(dma->sa_cmd.eth_addr, dev->dev_addr, 6);
+	memcpy(dma->sa_cmd.eth_addr, dev->dev_addr, ETH_ALEN);
 	dma->sa_cmd.cmd.command = SWAP16(CmdSASetup);
 	DMA_WBACK(dev, &(dma->sa_cmd), sizeof(struct sa_cmd));
 	i596_add_cmd(dev, &dma->sa_cmd.cmd);
@@ -1396,13 +1396,13 @@ static void set_multicast_list(struct net_device *dev)
 		netdev_for_each_mc_addr(ha, dev) {
 			if (!cnt--)
 				break;
-			memcpy(cp, ha->addr, 6);
+			memcpy(cp, ha->addr, ETH_ALEN);
 			if (i596_debug > 1)
 				DEB(DEB_MULTI,
 				    printk(KERN_DEBUG
 					   "%s: Adding address %pM\n",
 					   dev->name, cp));
-			cp += 6;
+			cp += ETH_ALEN;
 		}
 		DMA_WBACK_INV(dev, &dma->mc_cmd, sizeof(struct mc_cmd));
 		i596_add_cmd(dev, &cmd->cmd);
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index 6b5c722..ef21a2e 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -2676,7 +2676,7 @@ static int emac_init_config(struct emac_instance *dev)
 		       np->full_name);
 		return -ENXIO;
 	}
-	memcpy(dev->ndev->dev_addr, p, 6);
+	memcpy(dev->ndev->dev_addr, p, ETH_ALEN);
 
 	/* IAHT and GAHT filter parameterization */
 	if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) {
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 5d41aee..952d795 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1185,7 +1185,7 @@ static void ibmveth_set_multicast_list(struct net_device *netdev)
 		netdev_for_each_mc_addr(ha, netdev) {
 			/* add the multicast address to the filter table */
 			unsigned long mcast_addr = 0;
-			memcpy(((char *)&mcast_addr)+2, ha->addr, 6);
+			memcpy(((char *)&mcast_addr)+2, ha->addr, ETH_ALEN);
 			lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address,
 						   IbmVethMcastAddFilter,
 						   mcast_addr);
@@ -1370,7 +1370,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
 	netif_napi_add(netdev, &adapter->napi, ibmveth_poll, 16);
 
 	adapter->mac_addr = 0;
-	memcpy(&adapter->mac_addr, mac_addr_p, 6);
+	memcpy(&adapter->mac_addr, mac_addr_p, ETH_ALEN);
 
 	netdev->irq = dev->irq;
 	netdev->netdev_ops = &ibmveth_netdev_ops;
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index a56266e..a505d3b 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -5708,7 +5708,7 @@ static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf)
 
 	/* reply to reset with ack and vf mac address */
 	msgbuf[0] = E1000_VF_RESET | E1000_VT_MSGTYPE_ACK;
-	memcpy(addr, vf_mac, 6);
+	memcpy(addr, vf_mac, ETH_ALEN);
 	igb_write_mbx(hw, msgbuf, 3, vf);
 }
 
diff --git a/drivers/net/ethernet/intel/igbvf/vf.c b/drivers/net/ethernet/intel/igbvf/vf.c
index eea0e10..955ad8c 100644
--- a/drivers/net/ethernet/intel/igbvf/vf.c
+++ b/drivers/net/ethernet/intel/igbvf/vf.c
@@ -154,7 +154,7 @@ static s32 e1000_reset_hw_vf(struct e1000_hw *hw)
 		ret_val = mbx->ops.read_posted(hw, msgbuf, 3);
 		if (!ret_val) {
 			if (msgbuf[0] == (E1000_VF_RESET | E1000_VT_MSGTYPE_ACK))
-				memcpy(hw->mac.perm_addr, addr, 6);
+				memcpy(hw->mac.perm_addr, addr, ETH_ALEN);
 			else
 				ret_val = -E1000_ERR_MAC_INIT;
 		}
@@ -314,7 +314,7 @@ static void e1000_rar_set_vf(struct e1000_hw *hw, u8 * addr, u32 index)
 
 	memset(msgbuf, 0, 12);
 	msgbuf[0] = E1000_VF_SET_MAC_ADDR;
-	memcpy(msg_addr, addr, 6);
+	memcpy(msg_addr, addr, ETH_ALEN);
 	ret_val = mbx->ops.write_posted(hw, msgbuf, 3);
 
 	if (!ret_val)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index 276d7b1..1fe7cb0 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -558,7 +558,7 @@ static int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter,
 	struct ixgbe_hw *hw = &adapter->hw;
 	int rar_entry = hw->mac.num_rar_entries - (vf + 1);
 
-	memcpy(adapter->vfinfo[vf].vf_mac_addresses, mac_addr, 6);
+	memcpy(adapter->vfinfo[vf].vf_mac_addresses, mac_addr, ETH_ALEN);
 	hw->mac.ops.set_rar(hw, rar_entry, mac_addr, vf, IXGBE_RAH_AV);
 
 	return 0;
@@ -621,16 +621,13 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,
 
 int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask)
 {
-	unsigned char vf_mac_addr[6];
 	struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
 	unsigned int vfn = (event_mask & 0x3f);
 
 	bool enable = ((event_mask & 0x10000000U) != 0);
 
-	if (enable) {
-		eth_zero_addr(vf_mac_addr);
-		memcpy(adapter->vfinfo[vfn].vf_mac_addresses, vf_mac_addr, 6);
-	}
+	if (enable)
+		eth_zero_addr(adapter->vfinfo[vfn].vf_mac_addresses);
 
 	return 0;
 }
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c
index 387b526..4d44d64 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.c
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.c
@@ -242,7 +242,7 @@ static s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
 	msgbuf[0] |= index << IXGBE_VT_MSGINFO_SHIFT;
 	msgbuf[0] |= IXGBE_VF_SET_MACVLAN;
 	if (addr)
-		memcpy(msg_addr, addr, 6);
+		memcpy(msg_addr, addr, ETH_ALEN);
 	ret_val = mbx->ops.write_posted(hw, msgbuf, 3);
 
 	if (!ret_val)
@@ -275,7 +275,7 @@ static s32 ixgbevf_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr,
 
 	memset(msgbuf, 0, sizeof(msgbuf));
 	msgbuf[0] = IXGBE_VF_SET_MAC_ADDR;
-	memcpy(msg_addr, addr, 6);
+	memcpy(msg_addr, addr, ETH_ALEN);
 	ret_val = mbx->ops.write_posted(hw, msgbuf, 3);
 
 	if (!ret_val)
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
index 23de82a..b56d2a2 100644
--- a/drivers/net/ethernet/jme.c
+++ b/drivers/net/ethernet/jme.c
@@ -309,7 +309,7 @@ static void
 jme_load_macaddr(struct net_device *netdev)
 {
 	struct jme_adapter *jme = netdev_priv(netdev);
-	unsigned char macaddr[6];
+	unsigned char macaddr[ETH_ALEN];
 	u32 val;
 
 	spin_lock_bh(&jme->macaddr_lock);
@@ -321,7 +321,7 @@ jme_load_macaddr(struct net_device *netdev)
 	val = jread32(jme, JME_RXUMA_HI);
 	macaddr[4] = (val >>  0) & 0xFF;
 	macaddr[5] = (val >>  8) & 0xFF;
-	memcpy(netdev->dev_addr, macaddr, 6);
+	memcpy(netdev->dev_addr, macaddr, ETH_ALEN);
 	spin_unlock_bh(&jme->macaddr_lock);
 }
 
diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index a36fa80..4a5e3b0 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -1110,7 +1110,7 @@ static int korina_probe(struct platform_device *pdev)
 	lp = netdev_priv(dev);
 
 	bif->dev = dev;
-	memcpy(dev->dev_addr, bif->mac, 6);
+	memcpy(dev->dev_addr, bif->mac, ETH_ALEN);
 
 	lp->rx_irq = platform_get_irq_byname(pdev, "korina_rx");
 	lp->tx_irq = platform_get_irq_byname(pdev, "korina_tx");
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 7fb5677..99f16cb 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2514,7 +2514,7 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
 
 	mac_addr = of_get_mac_address(pnp);
 	if (mac_addr)
-		memcpy(ppd.mac_addr, mac_addr, 6);
+		memcpy(ppd.mac_addr, mac_addr, ETH_ALEN);
 
 	mv643xx_eth_property(pnp, "tx-queue-size", ppd.tx_queue_size);
 	mv643xx_eth_property(pnp, "tx-sram-addr", ppd.tx_sram_addr);
@@ -2696,7 +2696,7 @@ static void set_params(struct mv643xx_eth_private *mp,
 	struct net_device *dev = mp->dev;
 
 	if (is_valid_ether_addr(pd->mac_addr))
-		memcpy(dev->dev_addr, pd->mac_addr, 6);
+		memcpy(dev->dev_addr, pd->mac_addr, ETH_ALEN);
 	else
 		uc_addr_get(mp, dev->dev_addr);
 
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
index 075f4e2..c83d16d 100644
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
@@ -1248,7 +1248,7 @@ static void ks_set_mac(struct ks_net *ks, u8 *data)
 	w = ((u & 0xFF) << 8) | ((u >> 8) & 0xFF);
 	ks_wrreg16(ks, KS_MARL, w);
 
-	memcpy(ks->mac_addr, data, 6);
+	memcpy(ks->mac_addr, data, ETH_ALEN);
 
 	if (ks->enabled)
 		ks_start_rx(ks);
@@ -1651,7 +1651,7 @@ static int ks8851_probe(struct platform_device *pdev)
 	}
 	netdev_info(netdev, "Mac address is: %pM\n", ks->mac_addr);
 
-	memcpy(netdev->dev_addr, ks->mac_addr, 6);
+	memcpy(netdev->dev_addr, ks->mac_addr, ETH_ALEN);
 
 	ks_set_mac(ks, netdev->dev_addr);
 
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index 149355b..6ddaf7b 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -3164,7 +3164,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
 
 	/* Walk the multicast list, and add each address */
 	netdev_for_each_mc_addr(ha, dev) {
-		memcpy(data, &ha->addr, 6);
+		memcpy(data, &ha->addr, ETH_ALEN);
 		cmd.data0 = ntohl(data[0]);
 		cmd.data1 = ntohl(data[1]);
 		err = myri10ge_send_cmd(mgp, MXGEFW_JOIN_MULTICAST_GROUP,
@@ -3207,7 +3207,7 @@ static int myri10ge_set_mac_address(struct net_device *dev, void *addr)
 	}
 
 	/* change the dev structure */
-	memcpy(dev->dev_addr, sa->sa_data, 6);
+	memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN);
 	return 0;
 }
 
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
index 8375cbd..67efe75 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
@@ -648,7 +648,7 @@ nx_p3_sre_macaddr_change(struct netxen_adapter *adapter, u8 *addr, unsigned op)
 
 	mac_req = (nx_mac_req_t *)&req.words[0];
 	mac_req->op = op;
-	memcpy(mac_req->mac_addr, addr, 6);
+	memcpy(mac_req->mac_addr, addr, ETH_ALEN);
 
 	return netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
 }
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
index f8adc7b..73e72eb 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
@@ -445,7 +445,7 @@ int qlcnic_82xx_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr,
 
 	mac_req = (struct qlcnic_mac_req *)&req.words[0];
 	mac_req->op = op;
-	memcpy(mac_req->mac_addr, addr, 6);
+	memcpy(mac_req->mac_addr, addr, ETH_ALEN);
 
 	vlan_req = (struct qlcnic_vlan_req *)&req.words[1];
 	vlan_req->vlan_id = cpu_to_le16(vlan_id);
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 5cd831e..c8df52b 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -868,7 +868,7 @@ static void update_mac_address(struct net_device *ndev)
 static void read_mac_address(struct net_device *ndev, unsigned char *mac)
 {
 	if (mac[0] || mac[1] || mac[2] || mac[3] || mac[4] || mac[5]) {
-		memcpy(ndev->dev_addr, mac, 6);
+		memcpy(ndev->dev_addr, mac, ETH_ALEN);
 	} else {
 		ndev->dev_addr[0] = (sh_eth_read(ndev, MAHR) >> 24);
 		ndev->dev_addr[1] = (sh_eth_read(ndev, MAHR) >> 16) & 0xFF;
diff --git a/drivers/net/ethernet/sgi/meth.c b/drivers/net/ethernet/sgi/meth.c
index 770036b..513ed8b 100644
--- a/drivers/net/ethernet/sgi/meth.c
+++ b/drivers/net/ethernet/sgi/meth.c
@@ -839,7 +839,7 @@ static int meth_probe(struct platform_device *pdev)
 	dev->watchdog_timeo	= timeout;
 	dev->irq		= MACE_ETHERNET_IRQ;
 	dev->base_addr		= (unsigned long)&mace->eth;
-	memcpy(dev->dev_addr, o2meth_eaddr, 6);
+	memcpy(dev->dev_addr, o2meth_eaddr, ETH_ALEN);
 
 	priv = netdev_priv(dev);
 	spin_lock_init(&priv->meth_lock);
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 5fdbc26..01f8459 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -2502,7 +2502,7 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
 		SMSC_TRACE(pdata, probe,
 			   "MAC Address is specified by configuration");
 	} else if (is_valid_ether_addr(pdata->config.mac)) {
-		memcpy(dev->dev_addr, pdata->config.mac, 6);
+		memcpy(dev->dev_addr, pdata->config.mac, ETH_ALEN);
 		SMSC_TRACE(pdata, probe,
 			   "MAC Address specified by platform data");
 	} else {
diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c
index 759441b..a72ecc4 100644
--- a/drivers/net/ethernet/sun/cassini.c
+++ b/drivers/net/ethernet/sun/cassini.c
@@ -3354,7 +3354,7 @@ use_random_mac_addr:
 #if defined(CONFIG_SPARC)
 	addr = of_get_property(cp->of_node, "local-mac-address", NULL);
 	if (addr != NULL) {
-		memcpy(dev_addr, addr, 6);
+		memcpy(dev_addr, addr, ETH_ALEN);
 		goto done;
 	}
 #endif
diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c
index e62df2b..a235bd9 100644
--- a/drivers/net/ethernet/sun/sungem.c
+++ b/drivers/net/ethernet/sun/sungem.c
@@ -2779,7 +2779,7 @@ static int gem_get_device_address(struct gem *gp)
 		return -1;
 #endif
 	}
-	memcpy(dev->dev_addr, addr, 6);
+	memcpy(dev->dev_addr, addr, ETH_ALEN);
 #else
 	get_gem_mac_nonobp(gp->pdev, gp->dev->dev_addr);
 #endif
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
index e37b587..99043b7 100644
--- a/drivers/net/ethernet/sun/sunhme.c
+++ b/drivers/net/ethernet/sun/sunhme.c
@@ -2675,10 +2675,10 @@ static int happy_meal_sbus_probe_one(struct platform_device *op, int is_qfe)
 
 		addr = of_get_property(dp, "local-mac-address", &len);
 
-		if (qfe_slot != -1 && addr && len == 6)
-			memcpy(dev->dev_addr, addr, 6);
+		if (qfe_slot != -1 && addr && len == ETH_ALEN)
+			memcpy(dev->dev_addr, addr, ETH_ALEN);
 		else
-			memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
+			memcpy(dev->dev_addr, idprom->id_ethaddr, ETH_ALEN);
 	}
 
 	hp = netdev_priv(dev);
@@ -3024,9 +3024,9 @@ static int happy_meal_pci_probe(struct pci_dev *pdev,
 		    (addr = of_get_property(dp, "local-mac-address", &len))
 			!= NULL &&
 		    len == 6) {
-			memcpy(dev->dev_addr, addr, 6);
+			memcpy(dev->dev_addr, addr, ETH_ALEN);
 		} else {
-			memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
+			memcpy(dev->dev_addr, idprom->id_ethaddr, ETH_ALEN);
 		}
 #else
 		get_hme_mac_nonsparc(pdev, &dev->dev_addr[0]);
diff --git a/drivers/net/ethernet/sun/sunqe.c b/drivers/net/ethernet/sun/sunqe.c
index b072f4d..5695ae2 100644
--- a/drivers/net/ethernet/sun/sunqe.c
+++ b/drivers/net/ethernet/sun/sunqe.c
@@ -843,7 +843,7 @@ static int qec_ether_init(struct platform_device *op)
 	if (!dev)
 		return -ENOMEM;
 
-	memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
+	memcpy(dev->dev_addr, idprom->id_ethaddr, ETH_ALEN);
 
 	qe = netdev_priv(dev);
 
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 67df09e..fba1c48 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1853,7 +1853,7 @@ static int davinci_emac_probe(struct platform_device *pdev)
 	}
 
 	/* MAC addr and PHY mask , RMII enable info from platform_data */
-	memcpy(priv->mac_addr, pdata->mac_addr, 6);
+	memcpy(priv->mac_addr, pdata->mac_addr, ETH_ALEN);
 	priv->phy_id = pdata->phy_id;
 	priv->rmii_en = pdata->rmii_en;
 	priv->version = pdata->version;
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c
index 13e6fff..628b736 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -2230,7 +2230,7 @@ static void tile_net_dev_init(const char *name, const uint8_t *mac)
 		nz_addr |= mac[i];
 
 	if (nz_addr) {
-		memcpy(dev->dev_addr, mac, 6);
+		memcpy(dev->dev_addr, mac, ETH_ALEN);
 		dev->addr_len = 6;
 	} else {
 		eth_hw_addr_random(dev);
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 80dd404..74234a5 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1172,7 +1172,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
 
 	if (mac_address)
 		/* Set the MAC address. */
-		memcpy(ndev->dev_addr, mac_address, 6);
+		memcpy(ndev->dev_addr, mac_address, ETH_ALEN);
 	else
 		dev_warn(dev, "No MAC address found\n");
 
diff --git a/drivers/net/fddi/skfp/fplustm.c b/drivers/net/fddi/skfp/fplustm.c
index a20ed1a..f839935 100644
--- a/drivers/net/fddi/skfp/fplustm.c
+++ b/drivers/net/fddi/skfp/fplustm.c
@@ -453,7 +453,7 @@ static void directed_beacon(struct s_smc *smc)
 	 */
 	* (char *) a = (char) ((long)DBEACON_INFO<<24L) ;
 	a[1] = 0 ;
-	memcpy((char *)a+1,(char *) &smc->mib.m[MAC0].fddiMACUpstreamNbr,6) ;
+	memcpy((char *)a+1, (char *) &smc->mib.m[MAC0].fddiMACUpstreamNbr, ETH_ALEN);
 
 	CHECK_NPP() ;
 	 /* set memory address reg for writes */
diff --git a/drivers/net/fddi/skfp/skfddi.c b/drivers/net/fddi/skfp/skfddi.c
index f5d7305..713d303 100644
--- a/drivers/net/fddi/skfp/skfddi.c
+++ b/drivers/net/fddi/skfp/skfddi.c
@@ -436,7 +436,7 @@ static  int skfp_driver_init(struct net_device *dev)
 	}
 	read_address(smc, NULL);
 	pr_debug("HW-Addr: %pMF\n", smc->hw.fddi_canon_addr.a);
-	memcpy(dev->dev_addr, smc->hw.fddi_canon_addr.a, 6);
+	memcpy(dev->dev_addr, smc->hw.fddi_canon_addr.a, ETH_ALEN);
 
 	smt_reset_defaults(smc, 0);
 
@@ -503,7 +503,7 @@ static int skfp_open(struct net_device *dev)
 	 *               address.
 	 */
 	read_address(smc, NULL);
-	memcpy(dev->dev_addr, smc->hw.fddi_canon_addr.a, 6);
+	memcpy(dev->dev_addr, smc->hw.fddi_canon_addr.a, ETH_ALEN);
 
 	init_smt(smc, NULL);
 	smt_online(smc, 1);
@@ -1213,7 +1213,7 @@ static void CheckSourceAddress(unsigned char *frame, unsigned char *hw_addr)
 	if ((unsigned short) frame[1 + 10] != 0)
 		return;
 	SRBit = frame[1 + 6] & 0x01;
-	memcpy(&frame[1 + 6], hw_addr, 6);
+	memcpy(&frame[1 + 6], hw_addr, ETH_ALEN);
 	frame[8] |= SRBit;
 }				// CheckSourceAddress
 
diff --git a/drivers/net/plip/plip.c b/drivers/net/plip/plip.c
index 1f7bef9..7b4ff35 100644
--- a/drivers/net/plip/plip.c
+++ b/drivers/net/plip/plip.c
@@ -1002,7 +1002,7 @@ plip_rewrite_address(const struct net_device *dev, struct ethhdr *eth)
 		/* Any address will do - we take the first */
 		const struct in_ifaddr *ifa = in_dev->ifa_list;
 		if (ifa) {
-			memcpy(eth->h_source, dev->dev_addr, 6);
+			memcpy(eth->h_source, dev->dev_addr, ETH_ALEN);
 			memset(eth->h_dest, 0xfc, 2);
 			memcpy(eth->h_dest+2, &ifa->ifa_address, 4);
 		}
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index 8d5cac2..df507e6 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -640,10 +640,10 @@ static void catc_set_multicast_list(struct net_device *netdev)
 {
 	struct catc *catc = netdev_priv(netdev);
 	struct netdev_hw_addr *ha;
-	u8 broadcast[6];
+	u8 broadcast[ETH_ALEN];
 	u8 rx = RxEnable | RxPolarity | RxMultiCast;
 
-	memset(broadcast, 0xff, 6);
+	memset(broadcast, 0xff, ETH_ALEN);
 	memset(catc->multicast, 0, 64);
 
 	catc_multicast(broadcast, catc->multicast);
@@ -778,7 +778,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
 	struct usb_device *usbdev = interface_to_usbdev(intf);
 	struct net_device *netdev;
 	struct catc *catc;
-	u8 broadcast[6];
+	u8 broadcast[ETH_ALEN];
 	int i, pktsz;
 
 	if (usb_set_interface(usbdev,
@@ -882,7 +882,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
 		
 		dev_dbg(dev, "Filling the multicast list.\n");
 	  
-		memset(broadcast, 0xff, 6);
+		memset(broadcast, 0xff, ETH_ALEN);
 		catc_multicast(broadcast, catc->multicast);
 		catc_multicast(netdev->dev_addr, catc->multicast);
 		catc_write_mem(catc, 0xfa80, catc->multicast, 64);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 55f90c7..bee88e8 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1918,7 +1918,7 @@ int ath10k_wmi_peer_set_param(struct ath10k *ar, u32 vdev_id,
 	cmd->vdev_id     = __cpu_to_le32(vdev_id);
 	cmd->param_id    = __cpu_to_le32(param_id);
 	cmd->param_value = __cpu_to_le32(param_value);
-	memcpy(&cmd->peer_macaddr.addr, peer_addr, 6);
+	memcpy(&cmd->peer_macaddr.addr, peer_addr, ETH_ALEN);
 
 	ath10k_dbg(ATH10K_DBG_WMI,
 		   "wmi vdev %d peer 0x%pM set param %d value %d\n",
diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c
index 61c302a..5b34076 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -316,8 +316,8 @@ static int wil_cfg80211_connect(struct wiphy *wiphy,
 	}
 	conn.channel = ch - 1;
 
-	memcpy(conn.bssid, bss->bssid, 6);
-	memcpy(conn.dst_mac, bss->bssid, 6);
+	memcpy(conn.bssid, bss->bssid, ETH_ALEN);
+	memcpy(conn.dst_mac, bss->bssid, ETH_ALEN);
 	/*
 	 * FW don't support scan after connection attempt
 	 */
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index b827d51..a55ae64 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -844,18 +844,18 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
 	if (priv->wep_is_on)
 		frame_ctl |= IEEE80211_FCTL_PROTECTED;
 	if (priv->operating_mode == IW_MODE_ADHOC) {
-		skb_copy_from_linear_data(skb, &header.addr1, 6);
-		memcpy(&header.addr2, dev->dev_addr, 6);
-		memcpy(&header.addr3, priv->BSSID, 6);
+		skb_copy_from_linear_data(skb, &header.addr1, ETH_ALEN);
+		memcpy(&header.addr2, dev->dev_addr, ETH_ALEN);
+		memcpy(&header.addr3, priv->BSSID, ETH_ALEN);
 	} else {
 		frame_ctl |= IEEE80211_FCTL_TODS;
-		memcpy(&header.addr1, priv->CurrentBSSID, 6);
-		memcpy(&header.addr2, dev->dev_addr, 6);
-		skb_copy_from_linear_data(skb, &header.addr3, 6);
+		memcpy(&header.addr1, priv->CurrentBSSID, ETH_ALEN);
+		memcpy(&header.addr2, dev->dev_addr, ETH_ALEN);
+		skb_copy_from_linear_data(skb, &header.addr3, ETH_ALEN);
 	}
 
 	if (priv->use_wpa)
-		memcpy(&header.addr4, SNAP_RFC1024, 6);
+		memcpy(&header.addr4, SNAP_RFC1024, ETH_ALEN);
 
 	header.frame_control = cpu_to_le16(frame_ctl);
 	/* Copy the wireless header into the card */
@@ -929,11 +929,11 @@ static void fast_rx_path(struct atmel_private *priv,
 		}
 	}
 
-	memcpy(skbp, header->addr1, 6); /* destination address */
+	memcpy(skbp, header->addr1, ETH_ALEN); /* destination address */
 	if (le16_to_cpu(header->frame_control) & IEEE80211_FCTL_FROMDS)
-		memcpy(&skbp[6], header->addr3, 6);
+		memcpy(&skbp[ETH_ALEN], header->addr3, ETH_ALEN);
 	else
-		memcpy(&skbp[6], header->addr2, 6); /* source address */
+		memcpy(&skbp[ETH_ALEN], header->addr2, ETH_ALEN); /* source address */
 
 	skb->protocol = eth_type_trans(skb, priv->dev);
 	skb->ip_summed = CHECKSUM_NONE;
@@ -969,14 +969,14 @@ static void frag_rx_path(struct atmel_private *priv,
 			 u16 msdu_size, u16 rx_packet_loc, u32 crc, u16 seq_no,
 			 u8 frag_no, int more_frags)
 {
-	u8 mac4[6];
-	u8 source[6];
+	u8 mac4[ETH_ALEN];
+	u8 source[ETH_ALEN];
 	struct sk_buff *skb;
 
 	if (le16_to_cpu(header->frame_control) & IEEE80211_FCTL_FROMDS)
-		memcpy(source, header->addr3, 6);
+		memcpy(source, header->addr3, ETH_ALEN);
 	else
-		memcpy(source, header->addr2, 6);
+		memcpy(source, header->addr2, ETH_ALEN);
 
 	rx_packet_loc += 24; /* skip header */
 
@@ -984,9 +984,9 @@ static void frag_rx_path(struct atmel_private *priv,
 		msdu_size -= 4;
 
 	if (frag_no == 0) { /* first fragment */
-		atmel_copy_to_host(priv->dev, mac4, rx_packet_loc, 6);
-		msdu_size -= 6;
-		rx_packet_loc += 6;
+		atmel_copy_to_host(priv->dev, mac4, rx_packet_loc, ETH_ALEN);
+		msdu_size -= ETH_ALEN;
+		rx_packet_loc += ETH_ALEN;
 
 		if (priv->do_rx_crc)
 			crc = crc32_le(crc, mac4, 6);
@@ -994,9 +994,9 @@ static void frag_rx_path(struct atmel_private *priv,
 		priv->frag_seq = seq_no;
 		priv->frag_no = 1;
 		priv->frag_len = msdu_size;
-		memcpy(priv->frag_source, source, 6);
-		memcpy(&priv->rx_buf[6], source, 6);
-		memcpy(priv->rx_buf, header->addr1, 6);
+		memcpy(priv->frag_source, source, ETH_ALEN);
+		memcpy(&priv->rx_buf[ETH_ALEN], source, ETH_ALEN);
+		memcpy(priv->rx_buf, header->addr1, ETH_ALEN);
 
 		atmel_copy_to_host(priv->dev, &priv->rx_buf[12], rx_packet_loc, msdu_size);
 
@@ -1006,13 +1006,13 @@ static void frag_rx_path(struct atmel_private *priv,
 			atmel_copy_to_host(priv->dev, (void *)&netcrc, rx_packet_loc + msdu_size, 4);
 			if ((crc ^ 0xffffffff) != netcrc) {
 				priv->dev->stats.rx_crc_errors++;
-				memset(priv->frag_source, 0xff, 6);
+				memset(priv->frag_source, 0xff, ETH_ALEN);
 			}
 		}
 
 	} else if (priv->frag_no == frag_no &&
 		   priv->frag_seq == seq_no &&
-		   memcmp(priv->frag_source, source, 6) == 0) {
+		   memcmp(priv->frag_source, source, ETH_ALEN) == 0) {
 
 		atmel_copy_to_host(priv->dev, &priv->rx_buf[12 + priv->frag_len],
 				   rx_packet_loc, msdu_size);
@@ -1024,7 +1024,7 @@ static void frag_rx_path(struct atmel_private *priv,
 			atmel_copy_to_host(priv->dev, (void *)&netcrc, rx_packet_loc + msdu_size, 4);
 			if ((crc ^ 0xffffffff) != netcrc) {
 				priv->dev->stats.rx_crc_errors++;
-				memset(priv->frag_source, 0xff, 6);
+				memset(priv->frag_source, 0xff, ETH_ALEN);
 				more_frags = 1; /* don't send broken assembly */
 			}
 		}
@@ -1033,7 +1033,7 @@ static void frag_rx_path(struct atmel_private *priv,
 		priv->frag_no++;
 
 		if (!more_frags) { /* last one */
-			memset(priv->frag_source, 0xff, 6);
+			memset(priv->frag_source, 0xff, ETH_ALEN);
 			if (!(skb = dev_alloc_skb(priv->frag_len + 14))) {
 				priv->dev->stats.rx_dropped++;
 			} else {
@@ -1129,7 +1129,7 @@ static void rx_done_irq(struct atmel_private *priv)
 			atmel_copy_to_host(priv->dev, (unsigned char *)&priv->rx_buf, rx_packet_loc + 24, msdu_size);
 
 			/* we use the same buffer for frag reassembly and control packets */
-			memset(priv->frag_source, 0xff, 6);
+			memset(priv->frag_source, 0xff, ETH_ALEN);
 
 			if (priv->do_rx_crc) {
 				/* last 4 octets is crc */
@@ -1557,7 +1557,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
 	priv->last_qual = jiffies;
 	priv->last_beacon_timestamp = 0;
 	memset(priv->frag_source, 0xff, sizeof(priv->frag_source));
-	memset(priv->BSSID, 0, 6);
+	memset(priv->BSSID, 0, ETH_ALEN);
 	priv->CurrentBSSID[0] = 0xFF; /* Initialize to something invalid.... */
 	priv->station_was_associated = 0;
 
@@ -1718,7 +1718,7 @@ static int atmel_get_wap(struct net_device *dev,
 			 char *extra)
 {
 	struct atmel_private *priv = netdev_priv(dev);
-	memcpy(awrq->sa_data, priv->CurrentBSSID, 6);
+	memcpy(awrq->sa_data, priv->CurrentBSSID, ETH_ALEN);
 	awrq->sa_family = ARPHRD_ETHER;
 
 	return 0;
@@ -2356,7 +2356,7 @@ static int atmel_get_scan(struct net_device *dev,
 	for (i = 0; i < priv->BSS_list_entries; i++) {
 		iwe.cmd = SIOCGIWAP;
 		iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
-		memcpy(iwe.u.ap_addr.sa_data, priv->BSSinfo[i].BSSID, 6);
+		memcpy(iwe.u.ap_addr.sa_data, priv->BSSinfo[i].BSSID, ETH_ALEN);
 		current_ev = iwe_stream_add_event(info, current_ev,
 						  extra + IW_SCAN_MAX_DATA,
 						  &iwe, IW_EV_ADDR_LEN);
@@ -2760,7 +2760,7 @@ static void atmel_enter_state(struct atmel_private *priv, int new_state)
 static void atmel_scan(struct atmel_private *priv, int specific_ssid)
 {
 	struct {
-		u8 BSSID[6];
+		u8 BSSID[ETH_ALEN];
 		u8 SSID[MAX_SSID_LENGTH];
 		u8 scan_type;
 		u8 channel;
@@ -2771,7 +2771,7 @@ static void atmel_scan(struct atmel_private *priv, int specific_ssid)
 		u8 SSID_size;
 	} cmd;
 
-	memset(cmd.BSSID, 0xff, 6);
+	memset(cmd.BSSID, 0xff, ETH_ALEN);
 
 	if (priv->fast_scan) {
 		cmd.SSID_size = priv->SSID_size;
@@ -2816,7 +2816,7 @@ static void join(struct atmel_private *priv, int type)
 
 	cmd.SSID_size = priv->SSID_size;
 	memcpy(cmd.SSID, priv->SSID, priv->SSID_size);
-	memcpy(cmd.BSSID, priv->CurrentBSSID, 6);
+	memcpy(cmd.BSSID, priv->CurrentBSSID, ETH_ALEN);
 	cmd.channel = (priv->channel & 0x7f);
 	cmd.BSS_type = type;
 	cmd.timeout = cpu_to_le16(2000);
@@ -2837,7 +2837,7 @@ static void start(struct atmel_private *priv, int type)
 
 	cmd.SSID_size = priv->SSID_size;
 	memcpy(cmd.SSID, priv->SSID, priv->SSID_size);
-	memcpy(cmd.BSSID, priv->BSSID, 6);
+	memcpy(cmd.BSSID, priv->BSSID, ETH_ALEN);
 	cmd.BSS_type = type;
 	cmd.channel = (priv->channel & 0x7f);
 
@@ -2883,9 +2883,9 @@ static void send_authentication_request(struct atmel_private *priv, u16 system,
 	header.frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH);
 	header.duration_id = cpu_to_le16(0x8000);
 	header.seq_ctrl = 0;
-	memcpy(header.addr1, priv->CurrentBSSID, 6);
-	memcpy(header.addr2, priv->dev->dev_addr, 6);
-	memcpy(header.addr3, priv->CurrentBSSID, 6);
+	memcpy(header.addr1, priv->CurrentBSSID, ETH_ALEN);
+	memcpy(header.addr2, priv->dev->dev_addr, ETH_ALEN);
+	memcpy(header.addr3, priv->CurrentBSSID, ETH_ALEN);
 
 	if (priv->wep_is_on && priv->CurrentAuthentTransactionSeqNum != 1)
 		/* no WEP for authentication frames with TrSeqNo 1 */
@@ -2916,7 +2916,7 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc)
 	struct ass_req_format {
 		__le16 capability;
 		__le16 listen_interval;
-		u8 ap[6]; /* nothing after here directly accessible */
+		u8 ap[ETH_ALEN]; /* nothing after here directly accessible */
 		u8 ssid_el_id;
 		u8 ssid_len;
 		u8 ssid[MAX_SSID_LENGTH];
@@ -2930,9 +2930,9 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc)
 	header.duration_id = cpu_to_le16(0x8000);
 	header.seq_ctrl = 0;
 
-	memcpy(header.addr1, priv->CurrentBSSID, 6);
-	memcpy(header.addr2, priv->dev->dev_addr, 6);
-	memcpy(header.addr3, priv->CurrentBSSID, 6);
+	memcpy(header.addr1, priv->CurrentBSSID, ETH_ALEN);
+	memcpy(header.addr2, priv->dev->dev_addr, ETH_ALEN);
+	memcpy(header.addr3, priv->CurrentBSSID, ETH_ALEN);
 
 	body.capability = cpu_to_le16(WLAN_CAPABILITY_ESS);
 	if (priv->wep_is_on)
@@ -2944,7 +2944,7 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc)
 
 	/* current AP address - only in reassoc frame */
 	if (is_reassoc) {
-		memcpy(body.ap, priv->CurrentBSSID, 6);
+		memcpy(body.ap, priv->CurrentBSSID, ETH_ALEN);
 		ssid_el_p = &body.ssid_el_id;
 		bodysize = 18 + priv->SSID_size;
 	} else {
@@ -3021,7 +3021,7 @@ static void store_bss_info(struct atmel_private *priv,
 	int i, index;
 
 	for (index = -1, i = 0; i < priv->BSS_list_entries; i++)
-		if (memcmp(bss, priv->BSSinfo[i].BSSID, 6) == 0)
+		if (memcmp(bss, priv->BSSinfo[i].BSSID, ETH_ALEN) == 0)
 			index = i;
 
 	/* If we process a probe and an entry from this BSS exists
@@ -3032,7 +3032,7 @@ static void store_bss_info(struct atmel_private *priv,
 		if (priv->BSS_list_entries == MAX_BSS_ENTRIES)
 			return;
 		index = priv->BSS_list_entries++;
-		memcpy(priv->BSSinfo[index].BSSID, bss, 6);
+		memcpy(priv->BSSinfo[index].BSSID, bss, ETH_ALEN);
 		priv->BSSinfo[index].RSSI = rssi;
 	} else {
 		if (rssi > priv->BSSinfo[index].RSSI)
@@ -3235,7 +3235,7 @@ static void atmel_join_bss(struct atmel_private *priv, int bss_index)
 {
 	struct bss_info *bss =  &priv->BSSinfo[bss_index];
 
-	memcpy(priv->CurrentBSSID, bss->BSSID, 6);
+	memcpy(priv->CurrentBSSID, bss->BSSID, ETH_ALEN);
 	memcpy(priv->SSID, bss->SSID, priv->SSID_size = bss->SSIDsize);
 
 	/* The WPA stuff cares about the current AP address */
@@ -3767,7 +3767,7 @@ static int probe_atmel_card(struct net_device *dev)
 				0x00, 0x04, 0x25, 0x00, 0x00, 0x00
 			};
 			printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name);
-			memcpy(dev->dev_addr, default_mac, 6);
+			memcpy(dev->dev_addr, default_mac, ETH_ALEN);
 		}
 	}
 
@@ -3819,7 +3819,7 @@ static void build_wpa_mib(struct atmel_private *priv)
 
 	struct { /* NB this is matched to the hardware, don't change. */
 		u8 cipher_default_key_value[MAX_ENCRYPTION_KEYS][MAX_ENCRYPTION_KEY_SIZE];
-		u8 receiver_address[6];
+		u8 receiver_address[ETH_ALEN];
 		u8 wep_is_on;
 		u8 default_key; /* 0..3 */
 		u8 group_key;
@@ -3837,7 +3837,7 @@ static void build_wpa_mib(struct atmel_private *priv)
 
 	mib.wep_is_on = priv->wep_is_on;
 	mib.exclude_unencrypted = priv->exclude_unencrypted;
-	memcpy(mib.receiver_address, priv->CurrentBSSID, 6);
+	memcpy(mib.receiver_address, priv->CurrentBSSID, ETH_ALEN);
 
 	/* zero all the keys before adding in valid ones. */
 	memset(mib.cipher_default_key_value, 0, sizeof(mib.cipher_default_key_value));
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 8cb206a..4ae63f4 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -278,7 +278,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
 	else
 		txhdr->phy_rate = b43_plcp_get_ratecode_cck(rate);
 	txhdr->mac_frame_ctl = wlhdr->frame_control;
-	memcpy(txhdr->tx_receiver, wlhdr->addr1, 6);
+	memcpy(txhdr->tx_receiver, wlhdr->addr1, ETH_ALEN);
 
 	/* Calculate duration for fallback rate */
 	if ((rate_fb == rate) ||
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
index 849a28c..86588c9 100644
--- a/drivers/net/wireless/b43legacy/xmit.c
+++ b/drivers/net/wireless/b43legacy/xmit.c
@@ -215,7 +215,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
 	rate_fb_ofdm = b43legacy_is_ofdm_rate(rate_fb->hw_value);
 
 	txhdr->mac_frame_ctl = wlhdr->frame_control;
-	memcpy(txhdr->tx_receiver, wlhdr->addr1, 6);
+	memcpy(txhdr->tx_receiver, wlhdr->addr1, ETH_ALEN);
 
 	/* Calculate duration for fallback rate */
 	if ((rate_fb->hw_value == rate) ||
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 4608e0e..69b14dc 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -1906,14 +1906,14 @@ static void brcms_c_get_macaddr(struct brcms_hardware *wlc_hw, u8 etheraddr[ETH_
 
 	/* If macaddr exists, use it (Sromrev4, CIS, ...). */
 	if (!is_zero_ether_addr(sprom->il0mac)) {
-		memcpy(etheraddr, sprom->il0mac, 6);
+		memcpy(etheraddr, sprom->il0mac, ETH_ALEN);
 		return;
 	}
 
 	if (wlc_hw->_nbands > 1)
-		memcpy(etheraddr, sprom->et1mac, 6);
+		memcpy(etheraddr, sprom->et1mac, ETH_ALEN);
 	else
-		memcpy(etheraddr, sprom->il0mac, 6);
+		memcpy(etheraddr, sprom->il0mac, ETH_ALEN);
 }
 
 /* power both the pll and external oscillator on/off */
diff --git a/drivers/net/wireless/hostap/hostap_info.c b/drivers/net/wireless/hostap/hostap_info.c
index 970a48b..de7c4ff 100644
--- a/drivers/net/wireless/hostap/hostap_info.c
+++ b/drivers/net/wireless/hostap/hostap_info.c
@@ -217,7 +217,7 @@ static void prism2_host_roaming(local_info_t *local)
 		}
 	}
 
-	memcpy(req.bssid, selected->bssid, 6);
+	memcpy(req.bssid, selected->bssid, ETH_ALEN);
 	req.channel = selected->chid;
 	spin_unlock_irqrestore(&local->lock, flags);
 
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 6b823a1..8711a51 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -2698,7 +2698,7 @@ static u16 eeprom_read_u16(struct ipw_priv *priv, u8 addr)
 /* data's copy of the eeprom data                                 */
 static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac)
 {
-	memcpy(mac, &priv->eeprom[EEPROM_MAC_ADDRESS], 6);
+	memcpy(mac, &priv->eeprom[EEPROM_MAC_ADDRESS], ETH_ALEN);
 }
 
 static void ipw_read_eeprom(struct ipw_priv *priv)
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
index 1c22b81..8863a6c 100644
--- a/drivers/net/wireless/prism54/isl_ioctl.c
+++ b/drivers/net/wireless/prism54/isl_ioctl.c
@@ -183,7 +183,7 @@ prism54_update_stats(struct work_struct *work)
 	data = r.ptr;
 
 	/* copy this MAC to the bss */
-	memcpy(bss.address, data, 6);
+	memcpy(bss.address, data, ETH_ALEN);
 	kfree(data);
 
 	/* now ask for the corresponding bss */
@@ -531,7 +531,7 @@ prism54_set_wap(struct net_device *ndev, struct iw_request_info *info,
 		return -EINVAL;
 
 	/* prepare the structure for the set object */
-	memcpy(&bssid[0], awrq->sa_data, 6);
+	memcpy(&bssid[0], awrq->sa_data, ETH_ALEN);
 
 	/* set the bssid -- does this make sense when in AP mode? */
 	rvalue = mgt_set_request(priv, DOT11_OID_BSSID, 0, &bssid);
@@ -550,7 +550,7 @@ prism54_get_wap(struct net_device *ndev, struct iw_request_info *info,
 	int rvalue;
 
 	rvalue = mgt_get_request(priv, DOT11_OID_BSSID, 0, NULL, &r);
-	memcpy(awrq->sa_data, r.ptr, 6);
+	memcpy(awrq->sa_data, r.ptr, ETH_ALEN);
 	awrq->sa_family = ARPHRD_ETHER;
 	kfree(r.ptr);
 
@@ -582,7 +582,7 @@ prism54_translate_bss(struct net_device *ndev, struct iw_request_info *info,
 	size_t wpa_ie_len;
 
 	/* The first entry must be the MAC address */
-	memcpy(iwe.u.ap_addr.sa_data, bss->address, 6);
+	memcpy(iwe.u.ap_addr.sa_data, bss->address, ETH_ALEN);
 	iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
 	iwe.cmd = SIOCGIWAP;
 	current_ev = iwe_stream_add_event(info, current_ev, end_buf,
@@ -2489,7 +2489,7 @@ prism54_set_mac_address(struct net_device *ndev, void *addr)
 			      &((struct sockaddr *) addr)->sa_data);
 	if (!ret)
 		memcpy(priv->ndev->dev_addr,
-		       &((struct sockaddr *) addr)->sa_data, 6);
+		       &((struct sockaddr *) addr)->sa_data, ETH_ALEN);
 
 	return ret;
 }
diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c
index 5970ff6..41a16d3 100644
--- a/drivers/net/wireless/prism54/islpci_dev.c
+++ b/drivers/net/wireless/prism54/islpci_dev.c
@@ -837,7 +837,7 @@ islpci_setup(struct pci_dev *pdev)
 	/* ndev->set_multicast_list = &islpci_set_multicast_list; */
 	ndev->addr_len = ETH_ALEN;
 	/* Get a non-zero dummy MAC address for nameif. Jean II */
-	memcpy(ndev->dev_addr, dummy_mac, 6);
+	memcpy(ndev->dev_addr, dummy_mac, ETH_ALEN);
 
 	ndev->watchdog_timeo = ISLPCI_TX_TIMEOUT;
 
diff --git a/drivers/net/wireless/prism54/oid_mgt.c b/drivers/net/wireless/prism54/oid_mgt.c
index a01606b..056af38 100644
--- a/drivers/net/wireless/prism54/oid_mgt.c
+++ b/drivers/net/wireless/prism54/oid_mgt.c
@@ -682,7 +682,7 @@ mgt_update_addr(islpci_private *priv)
 				     isl_oid[GEN_OID_MACADDRESS].size, &res);
 
 	if ((ret == 0) && res && (res->header->operation != PIMFOR_OP_ERROR))
-		memcpy(priv->ndev->dev_addr, res->data, 6);
+		memcpy(priv->ndev->dev_addr, res->data, ETH_ALEN);
 	else
 		ret = -EIO;
 	if (res)
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c
index 733b7ce..210ce7c 100644
--- a/drivers/net/wireless/rtlwifi/core.c
+++ b/drivers/net/wireless/rtlwifi/core.c
@@ -115,7 +115,7 @@ static void rtl_op_stop(struct ieee80211_hw *hw)
 	mutex_lock(&rtlpriv->locks.conf_mutex);
 
 	mac->link_state = MAC80211_NOLINK;
-	memset(mac->bssid, 0, 6);
+	memset(mac->bssid, 0, ETH_ALEN);
 	mac->vendor = PEER_UNKNOWN;
 
 	/*reset sec info */
@@ -280,7 +280,7 @@ static void rtl_op_remove_interface(struct ieee80211_hw *hw,
 	mac->p2p = 0;
 	mac->vif = NULL;
 	mac->link_state = MAC80211_NOLINK;
-	memset(mac->bssid, 0, 6);
+	memset(mac->bssid, 0, ETH_ALEN);
 	mac->vendor = PEER_UNKNOWN;
 	mac->opmode = NL80211_IFTYPE_UNSPECIFIED;
 	rtlpriv->cfg->ops->set_network_type(hw, mac->opmode);
@@ -721,7 +721,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
 			mac->link_state = MAC80211_LINKED;
 			mac->cnt_after_linked = 0;
 			mac->assoc_id = bss_conf->aid;
-			memcpy(mac->bssid, bss_conf->bssid, 6);
+			memcpy(mac->bssid, bss_conf->bssid, ETH_ALEN);
 
 			if (rtlpriv->cfg->ops->linked_set_reg)
 				rtlpriv->cfg->ops->linked_set_reg(hw);
@@ -750,7 +750,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
 			if (ppsc->p2p_ps_info.p2p_ps_mode > P2P_PS_NONE)
 				rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE);
 			mac->link_state = MAC80211_NOLINK;
-			memset(mac->bssid, 0, 6);
+			memset(mac->bssid, 0, ETH_ALEN);
 			mac->vendor = PEER_UNKNOWN;
 
 			if (rtlpriv->dm.supp_phymode_switch) {
@@ -826,7 +826,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
 			 bss_conf->bssid);
 
 		mac->vendor = PEER_UNKNOWN;
-		memcpy(mac->bssid, bss_conf->bssid, 6);
+		memcpy(mac->bssid, bss_conf->bssid, ETH_ALEN);
 		rtlpriv->cfg->ops->set_network_type(hw, vif->type);
 
 		rcu_read_lock();
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index d1c5786..005d876 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -363,7 +363,7 @@ static struct sk_buff *br_ip4_multicast_alloc_query(struct net_bridge *br,
 	skb_reset_mac_header(skb);
 	eth = eth_hdr(skb);
 
-	memcpy(eth->h_source, br->dev->dev_addr, 6);
+	memcpy(eth->h_source, br->dev->dev_addr, ETH_ALEN);
 	eth->h_dest[0] = 1;
 	eth->h_dest[1] = 0;
 	eth->h_dest[2] = 0x5e;
@@ -433,7 +433,7 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br,
 	skb_reset_mac_header(skb);
 	eth = eth_hdr(skb);
 
-	memcpy(eth->h_source, br->dev->dev_addr, 6);
+	memcpy(eth->h_source, br->dev->dev_addr, ETH_ALEN);
 	eth->h_proto = htons(ETH_P_IPV6);
 	skb_put(skb, sizeof(*eth));
 
diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c
index 8b84c58..3fb3c84 100644
--- a/net/bridge/netfilter/ebt_among.c
+++ b/net/bridge/netfilter/ebt_among.c
@@ -28,7 +28,7 @@ static bool ebt_mac_wormhash_contains(const struct ebt_mac_wormhash *wh,
 	uint32_t cmp[2] = { 0, 0 };
 	int key = ((const unsigned char *)mac)[5];
 
-	memcpy(((char *) cmp) + 2, mac, 6);
+	memcpy(((char *) cmp) + 2, mac, ETH_ALEN);
 	start = wh->table[key];
 	limit = wh->table[key + 1];
 	if (ip) {
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 1aba645..3fb9dd6 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -77,13 +77,13 @@ DECLARE_EVENT_CLASS(local_sdata_addr_evt,
 	TP_STRUCT__entry(
 		LOCAL_ENTRY
 		VIF_ENTRY
-		__array(char, addr, 6)
+		__array(char, addr, ETH_ALEN)
 	),
 
 	TP_fast_assign(
 		LOCAL_ASSIGN;
 		VIF_ASSIGN;
-		memcpy(__entry->addr, sdata->vif.addr, 6);
+		memcpy(__entry->addr, sdata->vif.addr, ETH_ALEN);
 	),
 
 	TP_printk(




From kvalo at qca.qualcomm.com  Wed Oct  2 00:59:36 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 2 Oct 2013 07:59:36 +0300
Subject: [PATCH net-next] net:drivers/net: Miscellaneous conversions to
 ETH_ALEN
In-Reply-To: <1380679480.2081.24.camel@joe-AO722> (Joe Perches's message of
 "Tue, 01 Oct 2013 19:04:40 -0700")
References: <1380679480.2081.24.camel@joe-AO722>
Message-ID: <87k3hw469z.fsf@kamboji.qca.qualcomm.com>

(Cutting the CC smaller)

Joe Perches <joe at perches.com> writes:

> Convert the memset/memcpy uses of 6 to ETH_ALEN
> where appropriate.
>
> Also convert some struct definitions and u8 array
> declarations of [6] to ETH_ALEN.
>
> Signed-off-by: Joe Perches <joe at perches.com>

[...]

> diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
> index 55f90c7..bee88e8 100644
> --- a/drivers/net/wireless/ath/ath10k/wmi.c
> +++ b/drivers/net/wireless/ath/ath10k/wmi.c
> @@ -1918,7 +1918,7 @@ int ath10k_wmi_peer_set_param(struct ath10k *ar, u32 vdev_id,
>  	cmd->vdev_id     = __cpu_to_le32(vdev_id);
>  	cmd->param_id    = __cpu_to_le32(param_id);
>  	cmd->param_value = __cpu_to_le32(param_value);
> -	memcpy(&cmd->peer_macaddr.addr, peer_addr, 6);
> +	memcpy(&cmd->peer_macaddr.addr, peer_addr, ETH_ALEN);
>  
>  	ath10k_dbg(ATH10K_DBG_WMI,
>  		   "wmi vdev %d peer 0x%pM set param %d value %d\n",

Acked-by: Kalle Valo <kvalo at qca.qualcomm.com>

-- 
Kalle Valo


From michal.kazior at tieto.com  Wed Oct  2 01:35:37 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 2 Oct 2013 07:35:37 +0200
Subject: [PATCH 2/2] ath10k: fix scheduling while atomic bug
In-Reply-To: <8761th6ja6.fsf@kamboji.qca.qualcomm.com>
References: <1380292567-2363-1-git-send-email-michal.kazior@tieto.com>
 <1380292567-2363-3-git-send-email-michal.kazior@tieto.com>
 <8761th6ja6.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CA+BoTQnjG9MnbPsLM-RtAwuGNp_ZAfbvwvR_zg1Ks0ZmUxAtrQ@mail.gmail.com>

On 1 October 2013 18:35, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Michal Kazior <michal.kazior at tieto.com> writes:
>
>> Recent WMI/HTC changes broke WEP with multiple
>> keys. If WMI had no HTC TX credits to submit
>> command for default wep index update it would
>> trigger a bug.
>>
>> This simply moves the wep key index update to a
>> worker.
>>
>> The key update may happen some time after first
>> frame with a different wep key has been sent (i.e.
>> some frames will be sent with old key). This was
>> the case before too as WMI commands were
>> asynchronous.
>>
>> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
>
> This looks problematic. Basically you just delay sending the WMI
> command, but there's no guarantee that we actually have free credits at
> the time of transmission. So to me it looks like this fixes the issue
> just by luck.

One thing at a time.

This patch fixes 'scheduling while atomic' bug that was introduced
with recent HTC/WMI changes.

Multiple wep key handling had the same issue you point out before
HTC/WMI changes.

To fix the issue you mention we'd need to stop mac80211 queues, queue
frame(s) with a new key on internal queue, schedule a work. The work
should set new wep key index, send pending frames from internal queue
and wake mac80211 queues. This is a bit more complex than it sounds
though.


Micha?


From michal.kazior at tieto.com  Wed Oct  2 01:43:31 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 2 Oct 2013 07:43:31 +0200
Subject: Scheduling while atomic while setting the PS mode
In-Reply-To: <87eh846eu2.fsf@kamboji.qca.qualcomm.com>
References: <87eh846eu2.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CA+BoTQkk9m4zej9nW2E7YPc5VUcXPis9W_FacBQ2QSSAEncQnQ@mail.gmail.com>

On 1 October 2013 20:11, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Hi,
>
> I haven't been testing with all debug tests enabled for few days.
> Enabled them now and see the BUG below. This is with commit 71bcca1ff7f.
>
> Kalle
>
> [ 250.125852] ath10k_pci 0000:02:00.0: irq 49 for MSI/MSI-X
> [ 250.126959] ath10k: MSI interrupt handling
> [ 251.357561] ath10k: UART prints disabled
> [  251.432475] ath10k: firmware 999.999.0.716 booted
> [  251.443440] ath10k: htt target version 3.0
> [  251.447488] BUG: scheduling while atomic: ip/2695/0x00000002
> [  251.447604] INFO: lockdep is turned off.
> [  251.447714] Modules linked in: ath10k_pci ath10k_core ath mac80211 cfg80211 [last unloaded: cfg80211]
> [  251.449514] CPU: 1 PID: 2695 Comm: ip Tainted: G        W    3.11.0-wl-ath+ #77
> [  251.449631] Hardware name: Hewlett-Packard HP ProBook 6540b/1722, BIOS 68CDD Ver. F.04 01/27/2010
> [  251.449743]  00000000 00000000 eea437e8 c17859c9 edf75680 eea43804 c1781f31 c19a5e18
> [  251.451591]  edf75960 00000a87 00000002 f4620000 eea43894 c178c533 00000000 00000002
> [  251.453479]  00000001 00000000 c12f812f 00000000 edf75680 c1bbe000 c1a9aec8 eea43850
> [  251.454499] Call Trace:
> [  251.455469]  [<c17859c9>] dump_stack+0x4b/0x66
> [  251.455597]  [<c1781f31>] __schedule_bug+0x64/0x76
> [  251.455720]  [<c178c533>] __schedule+0x943/0xb30
> [  251.455844]  [<c12f812f>] ? debug_object_activate+0x6f/0x150
> [  251.455970]  [<c10ad8eb>] ? trace_hardirqs_off+0xb/0x10
> [  251.456091]  [<c178e696>] ? _raw_spin_unlock_irqrestore+0x36/0x60
> [  251.456211]  [<c10b3638>] ? trace_hardirqs_on_caller+0x18/0x1c0
> [  251.456352]  [<c178c9d3>] schedule+0x23/0x60
> [  251.456525]  [<c1789003>] schedule_timeout+0x103/0x280
> [  251.457480]  [<f92e6ee0>] ? ieee80211_iterate_active_interfaces+0x130/0x130 [mac80211]
> [  251.457610]  [<c1053140>] ? call_timer_fn+0x2c0/0x2c0
> [  251.457738]  [<f939a38f>] ath10k_wmi_cmd_send+0xaf/0x110 [ath10k_core]
> [  251.457861]  [<c106bdb0>] ? __init_waitqueue_head+0x60/0x60
> [  251.457986]  [<f939c57a>] ath10k_wmi_set_psmode+0x6a/0x80 [ath10k_core]
> [  251.458110]  [<f938e557>] ath10k_ps_iter+0x87/0x140 [ath10k_core]
> [  251.458258]  [<f92e701a>] ieee80211_iterate_active_interfaces_atomic+0x13a/0x2c0 [mac80211]
> [  251.458435]  [<f92e6ee0>] ? ieee80211_iterate_active_interfaces+0x130/0x130 [mac80211]

Ah, this is another thing I've missed with the WMI/HTC changes (along
with the wep key indexes) :-/

I wonder if it's about time to have a per-arvif config worker.


Micha?


From joe at perches.com  Wed Oct  2 02:40:54 2013
From: joe at perches.com (Joe Perches)
Date: Tue, 01 Oct 2013 23:40:54 -0700
Subject: [PATCH net-next] net:drivers/net: Miscellaneous conversions to
 ETH_ALEN
In-Reply-To: <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
Message-ID: <1380696054.2081.35.camel@joe-AO722>

On Wed, 2013-10-02 at 07:59 +0300, Kalle Valo wrote:
> (Cutting the CC smaller)

Please include netdev.  (cc'd)

> Joe Perches <joe at perches.com> writes:
> 
> > Convert the memset/memcpy uses of 6 to ETH_ALEN
> > where appropriate.
[]
> > Signed-off-by: Joe Perches <joe at perches.com>
[]
> Acked-by: Kalle Valo <kvalo at qca.qualcomm.com>





From bartosz.markowski at tieto.com  Wed Oct  2 02:48:51 2013
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Wed,  2 Oct 2013 08:48:51 +0200
Subject: [PATCH 1/2] ath10k: advestise 10.X fw support on wmi_attach
Message-ID: <1380696532-4147-1-git-send-email-bartosz.markowski@tieto.com>

Since the WMI API has been added and we can detect from the
FW IEs what firmware variant we deal with, turn on 10.X support.

Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index be75571..416dabb 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1970,26 +1970,21 @@ static void ath10k_wmi_process_rx(struct ath10k *ar, struct sk_buff *skb)
 /* WMI Initialization functions */
 int ath10k_wmi_attach(struct ath10k *ar)
 {
-	int ret;
-
 	if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) {
-		ath10k_warn("Firmware 10.X is not yet supported\n");
 		ar->wmi.cmd = &wmi_10x_cmd_map;
 		ar->wmi.vdev_param = &wmi_10x_vdev_param_map;
 		ar->wmi.pdev_param = &wmi_10x_pdev_param_map;
-		ret = -ENOTSUPP;
 	} else {
 		ar->wmi.cmd = &wmi_cmd_map;
 		ar->wmi.vdev_param = &wmi_vdev_param_map;
 		ar->wmi.pdev_param = &wmi_pdev_param_map;
-		ret = 0;
 	}
 
 	init_completion(&ar->wmi.service_ready);
 	init_completion(&ar->wmi.unified_ready);
 	init_waitqueue_head(&ar->wmi.tx_credits_wq);
 
-	return ret;
+	return 0;
 }
 
 void ath10k_wmi_detach(struct ath10k *ar)
-- 
1.7.9.5



From bartosz.markowski at tieto.com  Wed Oct  2 02:48:52 2013
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Wed,  2 Oct 2013 08:48:52 +0200
Subject: [PATCH 2/2] ath10k: extend the max_scan time
In-Reply-To: <1380696532-4147-1-git-send-email-bartosz.markowski@tieto.com>
References: <1380696532-4147-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <1380696532-4147-2-git-send-email-bartosz.markowski@tieto.com>

It was observed few times, the artificial max_scan limit we
are using mainly to detect FW hangs, can be not enough for
instance while being associated and during heavy traffic.

What we do if the FW won't return with scan results within
the max_time time is a scan abort.

This is especially visible with 10.X fw which in combination
with dual band HW (scanning 32 channels) can end up with
hw_scan close to 10 seconds.

Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 416dabb..f9766fa 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2522,7 +2522,7 @@ void ath10k_wmi_start_scan_init(struct ath10k *ar,
 	arg->repeat_probe_time = 0;
 	arg->probe_spacing_time = 0;
 	arg->idle_time = 0;
-	arg->max_scan_time = 5000;
+	arg->max_scan_time = 20000;
 	arg->probe_delay = 5;
 	arg->notify_scan_events = WMI_SCAN_EVENT_STARTED
 		| WMI_SCAN_EVENT_COMPLETED
-- 
1.7.9.5



From arend at broadcom.com  Wed Oct  2 03:27:00 2013
From: arend at broadcom.com (Arend van Spriel)
Date: Wed, 2 Oct 2013 09:27:00 +0200
Subject: [PATCH net-next] net:drivers/net: Miscellaneous conversions
 to ETH_ALEN
In-Reply-To: <1380679480.2081.24.camel@joe-AO722>
References: <1380679480.2081.24.camel@joe-AO722>
Message-ID: <524BCAC4.6060209@broadcom.com>

On 10/02/2013 04:04 AM, Joe Perches wrote:
> Convert the memset/memcpy uses of 6 to ETH_ALEN
> where appropriate.
>
> Also convert some struct definitions and u8 array
> declarations of [6] to ETH_ALEN.
>
For brcmsmac

Acked-by: Arend van Spriel <arend at broadcom.com>
> Signed-off-by: Joe Perches <joe at perches.com>
> ---
>   drivers/net/wireless/brcm80211/brcmsmac/main.c     |  6 +-




From michal.kazior at tieto.com  Wed Oct  2 05:03:37 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 2 Oct 2013 11:03:37 +0200
Subject: [PATCH v2 0/4] ath10k: clean ups
In-Reply-To: <1380292706-3609-1-git-send-email-michal.kazior@tieto.com>
References: <1380292706-3609-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380704621-4670-1-git-send-email-michal.kazior@tieto.com>

Hi,

First two patches are non-functional changes.

The latter two should remove some overhead from TX
path and CE processing. Nothing extraordinary.


PATCH v2:
 * add commit messages for patch #1 and #2 (Kalle)


Michal Kazior (4):
  ath10k: split tid calculation from tx function
  ath10k: split vdev_id calculation from tx function
  ath10k: remove ce_sendlist_send
  ath10k: remove num_sends_allowed

 drivers/net/wireless/ath/ath10k/ce.c  |   35 ++++++------------------
 drivers/net/wireless/ath/ath10k/ce.h  |   16 +----------
 drivers/net/wireless/ath/ath10k/mac.c |   48 ++++++++++++++++++++-------------
 drivers/net/wireless/ath/ath10k/pci.c |   25 +++--------------
 drivers/net/wireless/ath/ath10k/pci.h |    3 ---
 5 files changed, 42 insertions(+), 85 deletions(-)

-- 
1.7.9.5



From michal.kazior at tieto.com  Wed Oct  2 05:03:38 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 2 Oct 2013 11:03:38 +0200
Subject: [PATCH v2 1/4] ath10k: split tid calculation from tx function
In-Reply-To: <1380704621-4670-1-git-send-email-michal.kazior@tieto.com>
References: <1380292706-3609-1-git-send-email-michal.kazior@tieto.com>
 <1380704621-4670-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380704621-4670-2-git-send-email-michal.kazior@tieto.com>

Tidy up ath10k_tx().

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 8684e03..7415a60 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1407,6 +1407,20 @@ static void ath10k_reg_notifier(struct wiphy *wiphy,
 /* TX handlers */
 /***************/
 
+static u8 ath10k_tx_h_get_tid(struct ieee80211_hdr *hdr)
+{
+	if (ieee80211_is_mgmt(hdr->frame_control))
+		return HTT_DATA_TX_EXT_TID_MGMT;
+
+	if (!ieee80211_is_data_qos(hdr->frame_control))
+		return HTT_DATA_TX_EXT_TID_NON_QOS_MCAST_BCAST;
+
+	if (!is_unicast_ether_addr(ieee80211_get_DA(hdr)))
+		return HTT_DATA_TX_EXT_TID_NON_QOS_MCAST_BCAST;
+
+	return ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK;
+}
+
 /*
  * Frames sent to the FW have to be in "Native Wifi" format.
  * Strip the QoS field from the 802.11 header.
@@ -1788,14 +1802,7 @@ static void ath10k_tx(struct ieee80211_hw *hw,
 
 	/* we must calculate tid before we apply qos workaround
 	 * as we'd lose the qos control field */
-	tid = HTT_DATA_TX_EXT_TID_NON_QOS_MCAST_BCAST;
-	if (ieee80211_is_mgmt(hdr->frame_control)) {
-		tid = HTT_DATA_TX_EXT_TID_MGMT;
-	} else if (ieee80211_is_data_qos(hdr->frame_control) &&
-		   is_unicast_ether_addr(ieee80211_get_DA(hdr))) {
-		u8 *qc = ieee80211_get_qos_ctl(hdr);
-		tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
-	}
+	tid = ath10k_tx_h_get_tid(hdr);
 
 	/* it makes no sense to process injected frames like that */
 	if (info->control.vif &&
-- 
1.7.9.5



From michal.kazior at tieto.com  Wed Oct  2 05:03:39 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 2 Oct 2013 11:03:39 +0200
Subject: [PATCH v2 2/4] ath10k: split vdev_id calculation from tx function
In-Reply-To: <1380704621-4670-1-git-send-email-michal.kazior@tieto.com>
References: <1380292706-3609-1-git-send-email-michal.kazior@tieto.com>
 <1380704621-4670-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380704621-4670-3-git-send-email-michal.kazior@tieto.com>

Tidy up ath10k_tx().

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 7415a60..4b7c949 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1421,6 +1421,19 @@ static u8 ath10k_tx_h_get_tid(struct ieee80211_hdr *hdr)
 	return ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK;
 }
 
+static u8 ath10k_tx_h_get_vdev_id(struct ath10k *ar,
+				  struct ieee80211_tx_info *info)
+{
+	if (info->control.vif)
+		return ath10k_vif_to_arvif(info->control.vif)->vdev_id;
+
+	if (ar->monitor_enabled)
+		return ar->monitor_vdev_id;
+
+	ath10k_warn("could not resolve vdev id\n");
+	return 0;
+}
+
 /*
  * Frames sent to the FW have to be in "Native Wifi" format.
  * Strip the QoS field from the 802.11 header.
@@ -1785,16 +1798,7 @@ static void ath10k_tx(struct ieee80211_hw *hw,
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 	struct ath10k *ar = hw->priv;
-	struct ath10k_vif *arvif = NULL;
-	u32 vdev_id = 0;
-	u8 tid;
-
-	if (info->control.vif) {
-		arvif = ath10k_vif_to_arvif(info->control.vif);
-		vdev_id = arvif->vdev_id;
-	} else if (ar->monitor_enabled) {
-		vdev_id = ar->monitor_vdev_id;
-	}
+	u8 tid, vdev_id;
 
 	/* We should disable CCK RATE due to P2P */
 	if (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE)
@@ -1803,6 +1807,7 @@ static void ath10k_tx(struct ieee80211_hw *hw,
 	/* we must calculate tid before we apply qos workaround
 	 * as we'd lose the qos control field */
 	tid = ath10k_tx_h_get_tid(hdr);
+	vdev_id = ath10k_tx_h_get_vdev_id(ar, info);
 
 	/* it makes no sense to process injected frames like that */
 	if (info->control.vif &&
-- 
1.7.9.5



From michal.kazior at tieto.com  Wed Oct  2 05:03:40 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 2 Oct 2013 11:03:40 +0200
Subject: [PATCH v2 3/4] ath10k: remove ce_sendlist_send
In-Reply-To: <1380704621-4670-1-git-send-email-michal.kazior@tieto.com>
References: <1380292706-3609-1-git-send-email-michal.kazior@tieto.com>
 <1380704621-4670-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380704621-4670-4-git-send-email-michal.kazior@tieto.com>

It is completely pointless to keep this function
around. It doesn't do anything different than
ce_send except it introduces more overhead.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/ce.c  |   34 ---------------------------------
 drivers/net/wireless/ath/ath10k/ce.h  |   15 ---------------
 drivers/net/wireless/ath/ath10k/pci.c |    4 ++--
 3 files changed, 2 insertions(+), 51 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index 834e29e..9e6daa9 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -338,40 +338,6 @@ int ath10k_ce_send(struct ath10k_ce_pipe *ce_state,
 	return ret;
 }
 
-int ath10k_ce_sendlist_send(struct ath10k_ce_pipe *ce_state,
-			    void *per_transfer_context,
-			    unsigned int transfer_id,
-			    u32 paddr, unsigned int nbytes,
-			    u32 flags)
-{
-	struct ath10k_ce_ring *src_ring = ce_state->src_ring;
-	struct ath10k *ar = ce_state->ar;
-	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
-	unsigned int nentries_mask = src_ring->nentries_mask;
-	unsigned int sw_index;
-	unsigned int write_index;
-	int delta, ret = -ENOMEM;
-
-	spin_lock_bh(&ar_pci->ce_lock);
-
-	sw_index = src_ring->sw_index;
-	write_index = src_ring->write_index;
-
-	delta = CE_RING_DELTA(nentries_mask, write_index, sw_index - 1);
-
-	if (delta >= 1) {
-		ret = ath10k_ce_send_nolock(ce_state, per_transfer_context,
-					    paddr, nbytes,
-					    transfer_id, flags);
-		if (ret)
-			ath10k_warn("CE send failed: %d\n", ret);
-	}
-
-	spin_unlock_bh(&ar_pci->ce_lock);
-
-	return ret;
-}
-
 int ath10k_ce_recv_buf_enqueue(struct ath10k_ce_pipe *ce_state,
 			       void *per_recv_context,
 			       u32 buffer)
diff --git a/drivers/net/wireless/ath/ath10k/ce.h b/drivers/net/wireless/ath/ath10k/ce.h
index aec8028..949b174 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -156,21 +156,6 @@ void ath10k_ce_send_cb_register(struct ath10k_ce_pipe *ce_state,
 				void (*send_cb)(struct ath10k_ce_pipe *),
 				int disable_interrupts);
 
-/*
- * Queue a "sendlist" of buffers to be sent using gather to a single
- * anonymous destination buffer
- *   ce         - which copy engine to use
- *   sendlist        - list of simple buffers to send using gather
- *   transfer_id     - arbitrary ID; reflected to destination
- * Returns 0 on success; otherwise an error status.
- *
- * Implemenation note: Pushes multiple buffers with Gather to Source ring.
- */
-int ath10k_ce_sendlist_send(struct ath10k_ce_pipe *ce_state,
-			    void *per_transfer_context,
-			    unsigned int transfer_id,
-			    u32 paddr, unsigned int nbytes,
-			    u32 flags);
 
 /*==================Recv=======================*/
 
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index dff23d9..4f6a978 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -730,8 +730,8 @@ static int ath10k_pci_hif_send_head(struct ath10k *ar, u8 pipe_id,
 	pipe_info->num_sends_allowed--;
 	spin_unlock_bh(&pipe_info->pipe_lock);
 
-	ret = ath10k_ce_sendlist_send(ce_hdl, nbuf, transfer_id,
-				      skb_cb->paddr, len, flags);
+	ret = ath10k_ce_send(ce_hdl, nbuf, skb_cb->paddr, len, transfer_id,
+			     flags);
 	if (ret)
 		ath10k_warn("CE send failed: %p\n", nbuf);
 
-- 
1.7.9.5



From michal.kazior at tieto.com  Wed Oct  2 05:03:41 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 2 Oct 2013 11:03:41 +0200
Subject: [PATCH v2 4/4] ath10k: remove num_sends_allowed
In-Reply-To: <1380704621-4670-1-git-send-email-michal.kazior@tieto.com>
References: <1380292706-3609-1-git-send-email-michal.kazior@tieto.com>
 <1380704621-4670-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380704621-4670-5-git-send-email-michal.kazior@tieto.com>

The value provided by num_sends_allowed is now
derived from CE source ringbuffer state.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/ce.c  |   17 ++++++++++++++++-
 drivers/net/wireless/ath/ath10k/ce.h  |    1 +
 drivers/net/wireless/ath/ath10k/pci.c |   21 +--------------------
 drivers/net/wireless/ath/ath10k/pci.h |    3 ---
 4 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index 9e6daa9..e46951b 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -283,7 +283,7 @@ static int ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state,
 
 	if (unlikely(CE_RING_DELTA(nentries_mask,
 				   write_index, sw_index - 1) <= 0)) {
-		ret = -EIO;
+		ret = -ENOSR;
 		goto exit;
 	}
 
@@ -338,6 +338,21 @@ int ath10k_ce_send(struct ath10k_ce_pipe *ce_state,
 	return ret;
 }
 
+int ath10k_ce_num_free_src_entries(struct ath10k_ce_pipe *pipe)
+{
+	struct ath10k *ar = pipe->ar;
+	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+	int delta;
+
+	spin_lock_bh(&ar_pci->ce_lock);
+	delta = CE_RING_DELTA(pipe->src_ring->nentries_mask,
+			      pipe->src_ring->write_index,
+			      pipe->src_ring->sw_index - 1);
+	spin_unlock_bh(&ar_pci->ce_lock);
+
+	return delta;
+}
+
 int ath10k_ce_recv_buf_enqueue(struct ath10k_ce_pipe *ce_state,
 			       void *per_recv_context,
 			       u32 buffer)
diff --git a/drivers/net/wireless/ath/ath10k/ce.h b/drivers/net/wireless/ath/ath10k/ce.h
index 949b174..15d45b5 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -156,6 +156,7 @@ void ath10k_ce_send_cb_register(struct ath10k_ce_pipe *ce_state,
 				void (*send_cb)(struct ath10k_ce_pipe *),
 				int disable_interrupts);
 
+int ath10k_ce_num_free_src_entries(struct ath10k_ce_pipe *pipe);
 
 /*==================Recv=======================*/
 
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 4f6a978..f8d59c7 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -720,16 +720,6 @@ static int ath10k_pci_hif_send_head(struct ath10k *ar, u8 pipe_id,
 			"ath10k tx: data: ",
 			nbuf->data, nbuf->len);
 
-	/* Make sure we have resources to handle this request */
-	spin_lock_bh(&pipe_info->pipe_lock);
-	if (!pipe_info->num_sends_allowed) {
-		ath10k_warn("Pipe: %d is full\n", pipe_id);
-		spin_unlock_bh(&pipe_info->pipe_lock);
-		return -ENOSR;
-	}
-	pipe_info->num_sends_allowed--;
-	spin_unlock_bh(&pipe_info->pipe_lock);
-
 	ret = ath10k_ce_send(ce_hdl, nbuf, skb_cb->paddr, len, transfer_id,
 			     flags);
 	if (ret)
@@ -741,14 +731,7 @@ static int ath10k_pci_hif_send_head(struct ath10k *ar, u8 pipe_id,
 static u16 ath10k_pci_hif_get_free_queue_number(struct ath10k *ar, u8 pipe)
 {
 	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
-	struct ath10k_pci_pipe *pipe_info = &(ar_pci->pipe_info[pipe]);
-	int ret;
-
-	spin_lock_bh(&pipe_info->pipe_lock);
-	ret = pipe_info->num_sends_allowed;
-	spin_unlock_bh(&pipe_info->pipe_lock);
-
-	return ret;
+	return ath10k_ce_num_free_src_entries(ar_pci->pipe_info[pipe].ce_hdl);
 }
 
 static void ath10k_pci_hif_dump_area(struct ath10k *ar)
@@ -863,7 +846,6 @@ static int ath10k_pci_start_ce(struct ath10k *ar)
 						   ath10k_pci_ce_send_done,
 						   disable_interrupts);
 			completions += attr->src_nentries;
-			pipe_info->num_sends_allowed = attr->src_nentries - 1;
 		}
 
 		if (attr->dest_nentries) {
@@ -1033,7 +1015,6 @@ static void ath10k_pci_process_ce(struct ath10k *ar)
 		 */
 		spin_lock_bh(&compl->pipe_info->pipe_lock);
 		list_add_tail(&compl->list, &compl->pipe_info->compl_free);
-		compl->pipe_info->num_sends_allowed += send_done;
 		spin_unlock_bh(&compl->pipe_info->pipe_lock);
 	}
 
diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h
index 7c49f6f..52fb7b9 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -178,9 +178,6 @@ struct ath10k_pci_pipe {
 	/* List of free CE completion slots */
 	struct list_head compl_free;
 
-	/* Limit the number of outstanding send requests. */
-	int num_sends_allowed;
-
 	struct ath10k_pci *ar_pci;
 	struct tasklet_struct intr;
 };
-- 
1.7.9.5



From michal.kazior at tieto.com  Wed Oct  2 05:51:07 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 2 Oct 2013 11:51:07 +0200
Subject: [PATCH] ath10k: fix scheduling while atomic bug on config
Message-ID: <1380707467-30387-1-git-send-email-michal.kazior@tieto.com>

Recent WMI/HTC changes introduces this bug because
now WMI commands can sleep.

Use appropriate interface iteration function.

Reported-By: Kalle Valo <kvalo at qca.qualcomm.com>
Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 8684e03..b65df84 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1935,9 +1935,8 @@ static void ath10k_config_ps(struct ath10k *ar)
 	memset(&ar_iter, 0, sizeof(struct ath10k_generic_iter));
 	ar_iter.ar = ar;
 
-	ieee80211_iterate_active_interfaces_atomic(
-		ar->hw, IEEE80211_IFACE_ITER_NORMAL,
-		ath10k_ps_iter, &ar_iter);
+	ieee80211_iterate_active_interfaces(ar->hw, IEEE80211_IFACE_ITER_NORMAL,
+					    ath10k_ps_iter, &ar_iter);
 
 	if (ar_iter.ret)
 		ath10k_warn("failed to set ps config (%d)\n", ar_iter.ret);
@@ -2840,9 +2839,8 @@ static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
 	ar_iter.ar = ar;
 
 	mutex_lock(&ar->conf_mutex);
-	ieee80211_iterate_active_interfaces_atomic(
-		hw, IEEE80211_IFACE_ITER_NORMAL,
-		ath10k_set_rts_iter, &ar_iter);
+	ieee80211_iterate_active_interfaces(hw, IEEE80211_IFACE_ITER_NORMAL,
+					    ath10k_set_rts_iter, &ar_iter);
 	mutex_unlock(&ar->conf_mutex);
 
 	return ar_iter.ret;
@@ -2881,9 +2879,8 @@ static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
 	ar_iter.ar = ar;
 
 	mutex_lock(&ar->conf_mutex);
-	ieee80211_iterate_active_interfaces_atomic(
-		hw, IEEE80211_IFACE_ITER_NORMAL,
-		ath10k_set_frag_iter, &ar_iter);
+	ieee80211_iterate_active_interfaces(hw, IEEE80211_IFACE_ITER_NORMAL,
+					    ath10k_set_frag_iter, &ar_iter);
 	mutex_unlock(&ar->conf_mutex);
 
 	return ar_iter.ret;
-- 
1.7.9.5



From michal.kazior at tieto.com  Wed Oct  2 07:18:12 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 2 Oct 2013 13:18:12 +0200
Subject: [PATCH] ath10k: fix scheduling while atomic bug on config
In-Reply-To: <1380707467-30387-1-git-send-email-michal.kazior@tieto.com>
References: <1380707467-30387-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <CA+BoTQnQVE_YUrrtfFCeQSj4tmccbA9cG_ZMdHisx4C-mJfqkg@mail.gmail.com>

On 2 October 2013 11:51, Michal Kazior <michal.kazior at tieto.com> wrote:
> Recent WMI/HTC changes introduces this bug because
> now WMI commands can sleep.
>
> Use appropriate interface iteration function.
>
> Reported-By: Kalle Valo <kvalo at qca.qualcomm.com>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

Self NACK.

I've posted this too soon. This patch can lead to deadlocks on
iflist_mtx in some cases.


Micha?


From kvalo at qca.qualcomm.com  Wed Oct  2 09:00:05 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 2 Oct 2013 16:00:05 +0300
Subject: [PATCH] ath10k: fix scheduling while atomic bug on config
In-Reply-To: <CA+BoTQnQVE_YUrrtfFCeQSj4tmccbA9cG_ZMdHisx4C-mJfqkg@mail.gmail.com>
 (Michal Kazior's message of "Wed, 2 Oct 2013 13:18:12 +0200")
References: <1380707467-30387-1-git-send-email-michal.kazior@tieto.com>
 <CA+BoTQnQVE_YUrrtfFCeQSj4tmccbA9cG_ZMdHisx4C-mJfqkg@mail.gmail.com>
Message-ID: <87pprn25gq.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> On 2 October 2013 11:51, Michal Kazior <michal.kazior at tieto.com> wrote:
>> Recent WMI/HTC changes introduces this bug because
>> now WMI commands can sleep.
>>
>> Use appropriate interface iteration function.
>>
>> Reported-By: Kalle Valo <kvalo at qca.qualcomm.com>
>> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
>
> Self NACK.
>
> I've posted this too soon. This patch can lead to deadlocks on
> iflist_mtx in some cases.

Ok, thanks for letting me know. I'll drop the patch from my queue.

-- 
Kalle Valo


From mcgrof at do-not-panic.com  Wed Oct  2 13:44:32 2013
From: mcgrof at do-not-panic.com (Luis R. Rodriguez)
Date: Wed, 2 Oct 2013 10:44:32 -0700
Subject: [PATCH net-next] net:drivers/net: Miscellaneous conversions to
 ETH_ALEN
In-Reply-To: <1380696054.2081.35.camel@joe-AO722>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
Message-ID: <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>

On Tue, Oct 1, 2013 at 11:40 PM, Joe Perches <joe at perches.com> wrote:
> Please include netdev.  (cc'd)
>
>> Joe Perches <joe at perches.com> writes:
>>
>> > Convert the memset/memcpy uses of 6 to ETH_ALEN
>> > where appropriate.
>
>> > Signed-off-by: Joe Perches <joe at perches.com>

I think these sorts of patches are good -- but once applied it'd be
good if we can get the SmPL grammar expressed for it and then have
developers / maintainers regularly doing:

make coccicheck MODE=patch M=path > path-cocci.patch

Unfortunately right now MODE=patch takes about 3 1/2 minutes for
ath9k, MODE=org takes ~10 minutes for ath9k (17 minutes for all of
ath/), and MODE=context takes ~8 minutes on ath9k -- I do believe its
a bit unreasonable to expect patch submitters to use this, but
certainly great practice. Some of the time differences on the reports
can be explained by the fact that some SmPL will only be used for some
modes.

Even though it takes a while right now it'd be great practice to use
coccicheck to prevent these type of changes from going in again,
things that checkpatch.pl won't be able to catch.

  Luis


From joe at perches.com  Wed Oct  2 14:02:49 2013
From: joe at perches.com (Joe Perches)
Date: Wed, 02 Oct 2013 11:02:49 -0700
Subject: [PATCH net-next] net:drivers/net: Miscellaneous conversions to
 ETH_ALEN
In-Reply-To: <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
Message-ID: <1380736969.2081.72.camel@joe-AO722>

On Wed, 2013-10-02 at 10:44 -0700, Luis R. Rodriguez wrote:
> On Tue, Oct 1, 2013 at 11:40 PM, Joe Perches <joe at perches.com> wrote:
> > Please include netdev.  (cc'd)
> >
> >> Joe Perches <joe at perches.com> writes:
> >>
> >> > Convert the memset/memcpy uses of 6 to ETH_ALEN
> >> > where appropriate.
> >
> >> > Signed-off-by: Joe Perches <joe at perches.com>
> 
> I think these sorts of patches are good -- but once applied it'd be
> good if we can get the SmPL grammar expressed for it and then have
> developers / maintainers regularly doing:
> 
> make coccicheck MODE=patch M=path > path-cocci.patch
> 
> Unfortunately right now MODE=patch takes about 3 1/2 minutes for
> ath9k, MODE=org takes ~10 minutes for ath9k (17 minutes for all of
> ath/), and MODE=context takes ~8 minutes on ath9k -- I do believe its
> a bit unreasonable to expect patch submitters to use this, but
> certainly great practice. Some of the time differences on the reports
> can be explained by the fact that some SmPL will only be used for some
> modes.
> 
> Even though it takes a while right now it'd be great practice to use
> coccicheck to prevent these type of changes from going in again,
> things that checkpatch.pl won't be able to catch.

As far as I can tell, it's basically not possible for cocci to
do this conversion.

There are other memcpy/memset uses with size_t = 6 where it's
not a MAC address being copied.

The call site has to be inspected to determine if the copied
to address is used as a MAC address or not.

Maybe if there was some typedef like:

typedef u8 eth_addr_t[ETH_ALEN];

There are a few of these already in use:

$ git grep "typedef.*\[" | grep -P "\[\s*(?:ETH_ALEN|6)\s*\]"
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h:typedef u8 bnx2x_mac_addr_t[ETH_ALEN];
drivers/net/ethernet/brocade/bna/cna.h:typedef struct mac { u8 mac[ETH_ALEN]; } mac_t;
drivers/net/ethernet/via/via-velocity.h:typedef u8 MCAM_ADDR[ETH_ALEN];
drivers/net/usb/kaweth.c:typedef __u8 eth_addr_t[6];
drivers/net/wireless/ray_cs.c:typedef u_char mac_addr[ETH_ALEN];	/* Hardware address */
drivers/staging/vt6655/wmgr.h:typedef unsigned char NDIS_802_11_MAC_ADDRESS[6];
drivers/staging/vt6656/wmgr.h:typedef u8 NDIS_802_11_MAC_ADDRESS[ETH_ALEN];




From davem at davemloft.net  Wed Oct  2 17:05:21 2013
From: davem at davemloft.net (David Miller)
Date: Wed, 02 Oct 2013 17:05:21 -0400 (EDT)
Subject: [PATCH net-next] net:drivers/net: Miscellaneous conversions to
 ETH_ALEN
In-Reply-To: <1380679480.2081.24.camel@joe-AO722>
References: <1380679480.2081.24.camel@joe-AO722>
Message-ID: <20131002.170521.463969346066312216.davem@davemloft.net>

From: Joe Perches <joe at perches.com>
Date: Tue, 01 Oct 2013 19:04:40 -0700

> Convert the memset/memcpy uses of 6 to ETH_ALEN
> where appropriate.
> 
> Also convert some struct definitions and u8 array
> declarations of [6] to ETH_ALEN.
> 
> Signed-off-by: Joe Perches <joe at perches.com>

Looks fine, applied, thanks Joe.


From julia.lawall at lip6.fr  Wed Oct  2 18:38:06 2013
From: julia.lawall at lip6.fr (Julia Lawall)
Date: Thu, 3 Oct 2013 00:38:06 +0200 (CEST)
Subject: [PATCH net-next] net:drivers/net: Miscellaneous conversions to
 ETH_ALEN
In-Reply-To: <1380736969.2081.72.camel@joe-AO722>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
Message-ID: <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>



On Wed, 2 Oct 2013, Joe Perches wrote:

> On Wed, 2013-10-02 at 10:44 -0700, Luis R. Rodriguez wrote:
> > On Tue, Oct 1, 2013 at 11:40 PM, Joe Perches <joe at perches.com> wrote:
> > > Please include netdev.  (cc'd)
> > >
> > >> Joe Perches <joe at perches.com> writes:
> > >>
> > >> > Convert the memset/memcpy uses of 6 to ETH_ALEN
> > >> > where appropriate.
> > >
> > >> > Signed-off-by: Joe Perches <joe at perches.com>
> > 
> > I think these sorts of patches are good -- but once applied it'd be
> > good if we can get the SmPL grammar expressed for it and then have
> > developers / maintainers regularly doing:
> > 
> > make coccicheck MODE=patch M=path > path-cocci.patch
> > 
> > Unfortunately right now MODE=patch takes about 3 1/2 minutes for
> > ath9k, MODE=org takes ~10 minutes for ath9k (17 minutes for all of
> > ath/), and MODE=context takes ~8 minutes on ath9k -- I do believe its
> > a bit unreasonable to expect patch submitters to use this, but
> > certainly great practice. Some of the time differences on the reports
> > can be explained by the fact that some SmPL will only be used for some
> > modes.
> > 
> > Even though it takes a while right now it'd be great practice to use
> > coccicheck to prevent these type of changes from going in again,
> > things that checkpatch.pl won't be able to catch.
> 
> As far as I can tell, it's basically not possible for cocci to
> do this conversion.

I tried looking for memcpys and memsets that do use ETH_ALEN and then 
seeing what non-local functions the affected values flow to.  I then 
marked all of the calls to memcpy and memset that use 6 where an affected 
value flows to one of the functions identified in the first pass.  I get 
40 unique results on Linux 3.10.

The semantic patch is below.  It needs to be cleaned up to not return 
duplicate results.  It needs to be run with the argument --no-show-diff, 
and the result is printed in emacs org mode.

julia

virtual after_start

@initialize:ocaml@

let neighbors = ref []
let local_functions = ref []
let reset = ref false

let do_reset _ =
  if not !reset
  then
    begin
      reset := true;
      let it = new iteration() in
      it#add_virtual_rule After_start;
      it#register()
    end

@script:ocaml depends on !after_start@
@@

local_functions := []

@locl@
identifier f;
@@

f(...) { ... }

@script:ocaml@
f << locl.f;
@@

local_functions := f :: !local_functions

@r depends on !after_start@
identifier f;
expression e,e1,e2;
@@

(
memcpy(e,e1,ETH_ALEN)
|
memcpy(e1,e,ETH_ALEN)
|
memset(e,e1,ETH_ALEN)
)
... when any
    when != e = e2
f(...,e,...)

@script:ocaml@
f << r.f;
@@

if not (List.mem f !local_functions) && not (List.mem f !neighbors)
then begin neighbors := f :: !neighbors; do_reset() end

@r1 depends on !after_start@
identifier f;
expression e,e1,e2;
@@

f(...,e,...)
... when any
    when != e = e2
(
memcpy(e,e1,6)
|
memcpy(e1,e,6)
|
memset(e,e1,6)
)

@script:ocaml@
f << r1.f;
@@

if not (List.mem f !local_functions) && not (List.mem f !neighbors)
then begin neighbors := f :: !neighbors; do_reset() end

// --------------------------------------------------------------------------

@s depends on after_start@
identifier f;
expression e,e1,e2;
position p;
@@

(
memcpy at p(e,e1,6)
|
memcpy at p(e1,e,6)
|
memset at p(e,e1,6)
)
... when any
    when != e = e2
f(...,e,...)

@script:ocaml@
f << s.f;
p << s.p;
@@

if List.mem f !neighbors
then Coccilib.print_main "" p

@s1 depends on after_start@
identifier f;
expression e,e1,e2;
position p;
@@

f(...,e,...)
... when any
    when != e = e2
(
memcpy at p(e,e1,6)
|
memcpy at p(e1,e,6)
|
memset at p(e,e1,6)
)

@script:ocaml@
f << s1.f;
p << s1.p;
@@

if List.mem f !neighbors
then Coccilib.print_main "" p


From joe at perches.com  Wed Oct  2 20:09:14 2013
From: joe at perches.com (Joe Perches)
Date: Wed, 02 Oct 2013 17:09:14 -0700
Subject: [PATCH net-next] net:drivers/net: Miscellaneous conversions to
 ETH_ALEN
In-Reply-To: <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
Message-ID: <1380758954.2081.79.camel@joe-AO722>

On Thu, 2013-10-03 at 00:38 +0200, Julia Lawall wrote:
> 
> 
> On Wed, 2 Oct 2013, Joe Perches wrote:
> 
> > On Wed, 2013-10-02 at 10:44 -0700, Luis R. Rodriguez wrote:
> > > On Tue, Oct 1, 2013 at 11:40 PM, Joe Perches <joe at perches.com> wrote:
> > > > Please include netdev.  (cc'd)
> > > >
> > > >> Joe Perches <joe at perches.com> writes:
> > > >>
> > > >> > Convert the memset/memcpy uses of 6 to ETH_ALEN
> > > >> > where appropriate.
> > > >
> > > >> > Signed-off-by: Joe Perches <joe at perches.com>
> > > 
> > > I think these sorts of patches are good -- but once applied it'd be
> > > good if we can get the SmPL grammar expressed for it and then have
> > > developers / maintainers regularly doing:
> > > 
> > > make coccicheck MODE=patch M=path > path-cocci.patch
> > > 
> > > Unfortunately right now MODE=patch takes about 3 1/2 minutes for
> > > ath9k, MODE=org takes ~10 minutes for ath9k (17 minutes for all of
> > > ath/), and MODE=context takes ~8 minutes on ath9k -- I do believe its
> > > a bit unreasonable to expect patch submitters to use this, but
> > > certainly great practice. Some of the time differences on the reports
> > > can be explained by the fact that some SmPL will only be used for some
> > > modes.
> > > 
> > > Even though it takes a while right now it'd be great practice to use
> > > coccicheck to prevent these type of changes from going in again,
> > > things that checkpatch.pl won't be able to catch.
> > 
> > As far as I can tell, it's basically not possible for cocci to
> > do this conversion.
> 
> I tried looking for memcpys and memsets that do use ETH_ALEN and then 
> seeing what non-local functions the affected values flow to.  I then 
> marked all of the calls to memcpy and memset that use 6 where an affected 
> value flows to one of the functions identified in the first pass.  I get 
> 40 unique results on Linux 3.10.
> 
> The semantic patch is below.  It needs to be cleaned up to not return 
> duplicate results.  It needs to be run with the argument --no-show-diff, 
> and the result is printed in emacs org mode.

This has been running a _long_ time (broken?) on
drivers/net/ethernet/mellanox/mlx4/en_netdev.c

$ spatch --version
spatch version 1.0.0-rc14 without Python support and with PCRE support




From joe at perches.com  Wed Oct  2 20:28:34 2013
From: joe at perches.com (Joe Perches)
Date: Wed, 02 Oct 2013 17:28:34 -0700
Subject: [PATCH net-next] net:drivers/net: Miscellaneous conversions to
 ETH_ALEN
In-Reply-To: <1380758954.2081.79.camel@joe-AO722>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722>
Message-ID: <1380760114.2081.81.camel@joe-AO722>

On Wed, 2013-10-02 at 17:09 -0700, Joe Perches wrote:
> This has been running a _long_ time (broken?) on
> drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> 
> $ spatch --version
> spatch version 1.0.0-rc14 without Python support and with PCRE support

Nope.  Not hung/broken.  Just a _long_ time to run.

HANDLING: drivers/net/ethernet/mellanox/mlx4/en_rx.c
HANDLING: drivers/net/ethernet/mellanox/mlx4/en_netdev.c
Note: processing took  2299.7s: drivers/net/ethernet/mellanox/mlx4/en_netdev.c
HANDLING: drivers/net/ethernet/mellanox/mlx4/port.c




From joe at perches.com  Wed Oct  2 23:31:50 2013
From: joe at perches.com (Joe Perches)
Date: Wed, 02 Oct 2013 20:31:50 -0700
Subject: [PATCH net-next] net:drivers/net: Miscellaneous conversions to
 ETH_ALEN
In-Reply-To: <1380760114.2081.81.camel@joe-AO722>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722> <1380760114.2081.81.camel@joe-AO722>
Message-ID: <1380771110.2081.89.camel@joe-AO722>

On Wed, 2013-10-02 at 17:28 -0700, Joe Perches wrote:
> On Wed, 2013-10-02 at 17:09 -0700, Joe Perches wrote:
> > This has been running a _long_ time (broken?) on
> > drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> > 
> > $ spatch --version
> > spatch version 1.0.0-rc14 without Python support and with PCRE support
> 
> Nope.  Not hung/broken.  Just a _long_ time to run.
> 
> HANDLING: drivers/net/ethernet/mellanox/mlx4/en_rx.c
> HANDLING: drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> Note: processing took  2299.7s: drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> HANDLING: drivers/net/ethernet/mellanox/mlx4/port.c

Hi again Julia:

Oddly, just a few files took > 1000 seconds to run.
Most all the rest were < 10 seconds (no report).
A few were ~100 seconds.

HANDLING: drivers/net/ethernet/mellanox/mlx4/en_netdev.c
Note: processing took  2299.7s: drivers/net/ethernet/mellanox/mlx4/en_netdev.c
[]
HANDLING: drivers/net/wireless/ipw2x00/libipw_rx.c
Note: processing took  5308.0s: drivers/net/wireless/ipw2x00/libipw_rx.c
[]
HANDLING: drivers/net/wireless/hostap/hostap_80211_rx.c
Note: processing took  1336.6s: drivers/net/wireless/hostap/hostap_80211_rx.c

I don't know what causes the delays on these files.

The only output I get for net-next is:

* TODO
[[view:drivers/net/wireless/zd1201.c::face=ovl-face1::linb=331::colb=3::cole=9][ drivers/net/wireless/zd1201.c::331]]
* TODO
[[view:drivers/net/wireless/zd1201.c::face=ovl-face1::linb=332::colb=3::cole=9][ drivers/net/wireless/zd1201.c::332]]
* TODO
[[view:drivers/net/wireless/zd1201.c::face=ovl-face1::linb=332::colb=3::cole=9][ drivers/net/wireless/zd1201.c::332]]
* TODO
[[view:drivers/net/wireless/zd1201.c::face=ovl-face1::linb=332::colb=3::cole=9][ drivers/net/wireless/zd1201.c::332]]
* TODO
[[view:drivers/net/wireless/zd1201.c::face=ovl-face1::linb=333::colb=3::cole=9][ drivers/net/wireless/zd1201.c::333]]
* TODO
[[view:drivers/net/wireless/ath/ath10k/wmi.c::face=ovl-face1::linb=1761::colb=1::cole=7][ drivers/net/wireless/ath/ath10k/wmi.c::1761]]

and the zd1201 conversions would be kind of odd.

Anyway, the ath10k file is a good one to patch.  Thanks.
I'll send a patch separately.



From joe at perches.com  Wed Oct  2 23:39:11 2013
From: joe at perches.com (Joe Perches)
Date: Wed, 02 Oct 2013 20:39:11 -0700
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <1380771110.2081.89.camel@joe-AO722>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722> <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722>
Message-ID: <1380771551.2081.93.camel@joe-AO722>

Use the appropriate define instead of 6.

Signed-off-by: Joe Perches <joe at perches.com>
Noticed-by: Julia Lawall <julia.lawall at lip6.fr> via spatch script

---

 drivers/net/wireless/ath/ath10k/wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index bee88e8..48d44e7 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1758,7 +1758,7 @@ int ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, const u8 *bssid)
 	cmd = (struct wmi_vdev_up_cmd *)skb->data;
 	cmd->vdev_id       = __cpu_to_le32(vdev_id);
 	cmd->vdev_assoc_id = __cpu_to_le32(aid);
-	memcpy(&cmd->vdev_bssid.addr, bssid, 6);
+	memcpy(&cmd->vdev_bssid.addr, bssid, ETH_ALEN);
 
 	ath10k_dbg(ATH10K_DBG_WMI,
 		   "wmi mgmt vdev up id 0x%x assoc id %d bssid %pM\n",




From davem at davemloft.net  Wed Oct  2 23:44:17 2013
From: davem at davemloft.net (David Miller)
Date: Wed, 02 Oct 2013 23:44:17 -0400 (EDT)
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <1380771551.2081.93.camel@joe-AO722>
References: <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722>
 <1380771551.2081.93.camel@joe-AO722>
Message-ID: <20131002.234417.149459627679517962.davem@davemloft.net>

From: Joe Perches <joe at perches.com>
Date: Wed, 02 Oct 2013 20:39:11 -0700

> Use the appropriate define instead of 6.
> 
> Signed-off-by: Joe Perches <joe at perches.com>
> Noticed-by: Julia Lawall <julia.lawall at lip6.fr> via spatch script

Applied, thanks Joe.


From eric.dumazet at gmail.com  Thu Oct  3 00:18:44 2013
From: eric.dumazet at gmail.com (Eric Dumazet)
Date: Wed, 02 Oct 2013 21:18:44 -0700
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <1380771551.2081.93.camel@joe-AO722>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722> <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722> <1380771551.2081.93.camel@joe-AO722>
Message-ID: <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>

On Wed, 2013-10-02 at 20:39 -0700, Joe Perches wrote:
> Use the appropriate define instead of 6.
> 
> Signed-off-by: Joe Perches <joe at perches.com>
> Noticed-by: Julia Lawall <julia.lawall at lip6.fr> via spatch script
> 
> ---
> 
>  drivers/net/wireless/ath/ath10k/wmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
> index bee88e8..48d44e7 100644
> --- a/drivers/net/wireless/ath/ath10k/wmi.c
> +++ b/drivers/net/wireless/ath/ath10k/wmi.c
> @@ -1758,7 +1758,7 @@ int ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, const u8 *bssid)
>  	cmd = (struct wmi_vdev_up_cmd *)skb->data;
>  	cmd->vdev_id       = __cpu_to_le32(vdev_id);
>  	cmd->vdev_assoc_id = __cpu_to_le32(aid);
> -	memcpy(&cmd->vdev_bssid.addr, bssid, 6);
> +	memcpy(&cmd->vdev_bssid.addr, bssid, ETH_ALEN);
>  
>  	ath10k_dbg(ATH10K_DBG_WMI,
>  		   "wmi mgmt vdev up id 0x%x assoc id %d bssid %pM\n",

I don't get it.

Why leaving this then ?

struct wmi_mac_addr {
        union {
                u8 addr[6];
                struct {
                        u32 word0;
                        u32 word1;
                } __packed;
        } __packed;
} __packed;





From kvalo at qca.qualcomm.com  Thu Oct  3 00:34:11 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 3 Oct 2013 07:34:11 +0300
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
 (Eric Dumazet's message of "Wed, 2 Oct 2013 21:18:44 -0700")
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722>
 <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722>
 <1380771551.2081.93.camel@joe-AO722>
 <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
Message-ID: <87fvsjynuk.fsf@kamboji.qca.qualcomm.com>

Eric Dumazet <eric.dumazet at gmail.com> writes:

> On Wed, 2013-10-02 at 20:39 -0700, Joe Perches wrote:
>> Use the appropriate define instead of 6.
>> 
>> Signed-off-by: Joe Perches <joe at perches.com>
>> Noticed-by: Julia Lawall <julia.lawall at lip6.fr> via spatch script
>> 
>> ---
>> 
>>  drivers/net/wireless/ath/ath10k/wmi.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
>> index bee88e8..48d44e7 100644
>> --- a/drivers/net/wireless/ath/ath10k/wmi.c
>> +++ b/drivers/net/wireless/ath/ath10k/wmi.c
>> @@ -1758,7 +1758,7 @@ int ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, const u8 *bssid)
>>  	cmd = (struct wmi_vdev_up_cmd *)skb->data;
>>  	cmd->vdev_id       = __cpu_to_le32(vdev_id);
>>  	cmd->vdev_assoc_id = __cpu_to_le32(aid);
>> -	memcpy(&cmd->vdev_bssid.addr, bssid, 6);
>> +	memcpy(&cmd->vdev_bssid.addr, bssid, ETH_ALEN);
>>  
>>  	ath10k_dbg(ATH10K_DBG_WMI,
>>  		   "wmi mgmt vdev up id 0x%x assoc id %d bssid %pM\n",
>
> I don't get it.
>
> Why leaving this then ?
>
> struct wmi_mac_addr {
>         union {
>                 u8 addr[6];
>                 struct {
>                         u32 word0;
>                         u32 word1;
>                 } __packed;
>         } __packed;
> } __packed;

Do you mean '6' or the union? The 6 can replaced with ETH_ALEN AFAICS.
But the union is needed for aligning the packets as firmware expects
them.

-- 
Kalle Valo


From eric.dumazet at gmail.com  Thu Oct  3 00:44:38 2013
From: eric.dumazet at gmail.com (Eric Dumazet)
Date: Wed, 02 Oct 2013 21:44:38 -0700
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <87fvsjynuk.fsf@kamboji.qca.qualcomm.com>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722> <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722> <1380771551.2081.93.camel@joe-AO722>
 <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
 <87fvsjynuk.fsf@kamboji.qca.qualcomm.com>
Message-ID: <1380775478.19002.139.camel@edumazet-glaptop.roam.corp.google.com>

On Thu, 2013-10-03 at 07:34 +0300, Kalle Valo wrote:

> Do you mean '6' or the union? The 6 can replaced with ETH_ALEN AFAICS.
> But the union is needed for aligning the packets as firmware expects
> them.

I mean the 6, of course, since Joe seems to actively track them, as if
ETH_ALEN could change eventually, you never know.

I am worrying this will take another hundred patches ...

Regarding this union, the __packed attributes seem overkill, no ???




From kvalo at qca.qualcomm.com  Thu Oct  3 00:54:39 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 3 Oct 2013 07:54:39 +0300
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <1380775478.19002.139.camel@edumazet-glaptop.roam.corp.google.com>
 (Eric Dumazet's message of "Wed, 2 Oct 2013 21:44:38 -0700")
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722>
 <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722>
 <1380771551.2081.93.camel@joe-AO722>
 <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
 <87fvsjynuk.fsf@kamboji.qca.qualcomm.com>
 <1380775478.19002.139.camel@edumazet-glaptop.roam.corp.google.com>
Message-ID: <87bo37ymwg.fsf@kamboji.qca.qualcomm.com>

Eric Dumazet <eric.dumazet at gmail.com> writes:

> On Thu, 2013-10-03 at 07:34 +0300, Kalle Valo wrote:
>
>> Do you mean '6' or the union? The 6 can replaced with ETH_ALEN AFAICS.
>> But the union is needed for aligning the packets as firmware expects
>> them.
>
> I mean the 6, of course, since Joe seems to actively track them, as if
> ETH_ALEN could change eventually, you never know.
>
> I am worrying this will take another hundred patches ...

Ah, ok.

> Regarding this union, the __packed attributes seem overkill, no ???

Yeah, they do. This should be enough, right?

struct wmi_mac_addr {
	union {
		u8 addr[6];
		struct {
			u32 word0;
			u32 word1;
		};
	};
} __packed;

-- 
Kalle Valo


From joe at perches.com  Thu Oct  3 00:56:01 2013
From: joe at perches.com (Joe Perches)
Date: Wed, 02 Oct 2013 21:56:01 -0700
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722> <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722> <1380771551.2081.93.camel@joe-AO722>
 <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
Message-ID: <1380776161.2081.99.camel@joe-AO722>

On Wed, 2013-10-02 at 21:18 -0700, Eric Dumazet wrote:
> On Wed, 2013-10-02 at 20:39 -0700, Joe Perches wrote:
> > Use the appropriate define instead of 6.
[]
> I don't get it.
> Why leaving this then ?
> 
> struct wmi_mac_addr {
>         union {
>                 u8 addr[6];
>                 struct {
>                         u32 word0;
>                         u32 word1;
>                 } __packed;
>         } __packed;
> } __packed;

'cause I just did the ones I noticed around the memcpy/memset
grep pattern I used.

$ grep -rP --include=*.[ch] -n "\b(memset|memcpy)\s*\([^,]+,[^,]+,\s*6\s*\)" drivers/net

You're welcome to look for all the [6] uses and convert the
appropriate ones too.  Maybe use that eth_addr_t typedef.

$ git grep -E "\[\s*6\s*\]\s*;" drivers/net/



From joe at perches.com  Thu Oct  3 01:09:54 2013
From: joe at perches.com (Joe Perches)
Date: Wed, 02 Oct 2013 22:09:54 -0700
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <1380775478.19002.139.camel@edumazet-glaptop.roam.corp.google.com>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722> <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722> <1380771551.2081.93.camel@joe-AO722>
 <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
 <87fvsjynuk.fsf@kamboji.qca.qualcomm.com>
 <1380775478.19002.139.camel@edumazet-glaptop.roam.corp.google.com>
Message-ID: <1380776994.2081.101.camel@joe-AO722>

On Wed, 2013-10-02 at 21:44 -0700, Eric Dumazet wrote:
> I mean the 6, of course, since Joe seems to actively track them, as if
> ETH_ALEN could change eventually, you never know.

You're funny Eric.
You know it's just to ease grep pattern matching.




From eric.dumazet at gmail.com  Thu Oct  3 01:24:44 2013
From: eric.dumazet at gmail.com (Eric Dumazet)
Date: Wed, 02 Oct 2013 22:24:44 -0700
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <1380776994.2081.101.camel@joe-AO722>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722> <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722> <1380771551.2081.93.camel@joe-AO722>
 <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
 <87fvsjynuk.fsf@kamboji.qca.qualcomm.com>
 <1380775478.19002.139.camel@edumazet-glaptop.roam.corp.google.com>
 <1380776994.2081.101.camel@joe-AO722>
Message-ID: <1380777884.19002.155.camel@edumazet-glaptop.roam.corp.google.com>

On Wed, 2013-10-02 at 22:09 -0700, Joe Perches wrote:
> On Wed, 2013-10-02 at 21:44 -0700, Eric Dumazet wrote:
> > I mean the 6, of course, since Joe seems to actively track them, as if
> > ETH_ALEN could change eventually, you never know.
> 
> You're funny Eric.
> You know it's just to ease grep pattern matching.

You are not funny if you plan to send 500+ patches for every instance of
6 changed to ETH_ALEN

I am not interested playing these grep games, honestly.

If you patch a driver, try to avoid sending one patch per line, that's
really not necessary, thank you.

If the structure definition uses [6], I see no reason to use ETH_ALEN in
the memset()/memcpy().

How is that funny, I don't know.




From joe at perches.com  Thu Oct  3 01:34:11 2013
From: joe at perches.com (Joe Perches)
Date: Wed, 02 Oct 2013 22:34:11 -0700
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <1380777884.19002.155.camel@edumazet-glaptop.roam.corp.google.com>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722> <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722> <1380771551.2081.93.camel@joe-AO722>
 <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
 <87fvsjynuk.fsf@kamboji.qca.qualcomm.com>
 <1380775478.19002.139.camel@edumazet-glaptop.roam.corp.google.com>
 <1380776994.2081.101.camel@joe-AO722>
 <1380777884.19002.155.camel@edumazet-glaptop.roam.corp.google.com>
Message-ID: <1380778451.2081.103.camel@joe-AO722>

On Wed, 2013-10-02 at 22:24 -0700, Eric Dumazet wrote:
> On Wed, 2013-10-02 at 22:09 -0700, Joe Perches wrote:
> > On Wed, 2013-10-02 at 21:44 -0700, Eric Dumazet wrote:
> > > I mean the 6, of course, since Joe seems to actively track them, as if
> > > ETH_ALEN could change eventually, you never know.
> > 
> > You're funny Eric.
> > You know it's just to ease grep pattern matching.
> 
> You are not funny if you plan to send 500+ patches for every instance of
> 6 changed to ETH_ALEN

You're still funny.

https://lkml.org/lkml/2013/10/1/517

Lighten up though.  It was just a straggler.



From julia.lawall at lip6.fr  Thu Oct  3 01:41:27 2013
From: julia.lawall at lip6.fr (Julia Lawall)
Date: Thu, 3 Oct 2013 07:41:27 +0200 (CEST)
Subject: [PATCH net-next] net:drivers/net: Miscellaneous conversions to
 ETH_ALEN
In-Reply-To: <1380758954.2081.79.camel@joe-AO722>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722> 
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722>
Message-ID: <alpine.DEB.2.02.1310030739030.2006@localhost6.localdomain6>



On Wed, 2 Oct 2013, Joe Perches wrote:

> On Thu, 2013-10-03 at 00:38 +0200, Julia Lawall wrote:
> > 
> > 
> > On Wed, 2 Oct 2013, Joe Perches wrote:
> > 
> > > On Wed, 2013-10-02 at 10:44 -0700, Luis R. Rodriguez wrote:
> > > > On Tue, Oct 1, 2013 at 11:40 PM, Joe Perches <joe at perches.com> wrote:
> > > > > Please include netdev.  (cc'd)
> > > > >
> > > > >> Joe Perches <joe at perches.com> writes:
> > > > >>
> > > > >> > Convert the memset/memcpy uses of 6 to ETH_ALEN
> > > > >> > where appropriate.
> > > > >
> > > > >> > Signed-off-by: Joe Perches <joe at perches.com>
> > > > 
> > > > I think these sorts of patches are good -- but once applied it'd be
> > > > good if we can get the SmPL grammar expressed for it and then have
> > > > developers / maintainers regularly doing:
> > > > 
> > > > make coccicheck MODE=patch M=path > path-cocci.patch
> > > > 
> > > > Unfortunately right now MODE=patch takes about 3 1/2 minutes for
> > > > ath9k, MODE=org takes ~10 minutes for ath9k (17 minutes for all of
> > > > ath/), and MODE=context takes ~8 minutes on ath9k -- I do believe its
> > > > a bit unreasonable to expect patch submitters to use this, but
> > > > certainly great practice. Some of the time differences on the reports
> > > > can be explained by the fact that some SmPL will only be used for some
> > > > modes.
> > > > 
> > > > Even though it takes a while right now it'd be great practice to use
> > > > coccicheck to prevent these type of changes from going in again,
> > > > things that checkpatch.pl won't be able to catch.
> > > 
> > > As far as I can tell, it's basically not possible for cocci to
> > > do this conversion.
> > 
> > I tried looking for memcpys and memsets that do use ETH_ALEN and then 
> > seeing what non-local functions the affected values flow to.  I then 
> > marked all of the calls to memcpy and memset that use 6 where an affected 
> > value flows to one of the functions identified in the first pass.  I get 
> > 40 unique results on Linux 3.10.
> > 
> > The semantic patch is below.  It needs to be cleaned up to not return 
> > duplicate results.  It needs to be run with the argument --no-show-diff, 
> > and the result is printed in emacs org mode.
> 
> This has been running a _long_ time (broken?) on
> drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> 
> $ spatch --version
> spatch version 1.0.0-rc14 without Python support and with PCRE support

Likewise.  I can look at it, but generally I just use a timeout.

Note that you should run it on a whole directory, not on a file at a time, 
so that it can collectthe most possible information on the first pass.

julia


From julia.lawall at lip6.fr  Thu Oct  3 01:43:23 2013
From: julia.lawall at lip6.fr (Julia Lawall)
Date: Thu, 3 Oct 2013 07:43:23 +0200 (CEST)
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722> 
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722> <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722> <1380771551.2081.93.camel@joe-AO722>
 <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
Message-ID: <alpine.DEB.2.02.1310030743040.2006@localhost6.localdomain6>



On Wed, 2 Oct 2013, Eric Dumazet wrote:

> On Wed, 2013-10-02 at 20:39 -0700, Joe Perches wrote:
> > Use the appropriate define instead of 6.
> > 
> > Signed-off-by: Joe Perches <joe at perches.com>
> > Noticed-by: Julia Lawall <julia.lawall at lip6.fr> via spatch script
> > 
> > ---
> > 
> >  drivers/net/wireless/ath/ath10k/wmi.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
> > index bee88e8..48d44e7 100644
> > --- a/drivers/net/wireless/ath/ath10k/wmi.c
> > +++ b/drivers/net/wireless/ath/ath10k/wmi.c
> > @@ -1758,7 +1758,7 @@ int ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, const u8 *bssid)
> >  	cmd = (struct wmi_vdev_up_cmd *)skb->data;
> >  	cmd->vdev_id       = __cpu_to_le32(vdev_id);
> >  	cmd->vdev_assoc_id = __cpu_to_le32(aid);
> > -	memcpy(&cmd->vdev_bssid.addr, bssid, 6);
> > +	memcpy(&cmd->vdev_bssid.addr, bssid, ETH_ALEN);
> >  
> >  	ath10k_dbg(ATH10K_DBG_WMI,
> >  		   "wmi mgmt vdev up id 0x%x assoc id %d bssid %pM\n",
> 
> I don't get it.
> 
> Why leaving this then ?
> 
> struct wmi_mac_addr {
>         union {
>                 u8 addr[6];
>                 struct {
>                         u32 word0;
>                         u32 word1;
>                 } __packed;
>         } __packed;
> } __packed;

Yes, this was step 2...

julia


From julia.lawall at lip6.fr  Thu Oct  3 01:47:49 2013
From: julia.lawall at lip6.fr (Julia Lawall)
Date: Thu, 3 Oct 2013 07:47:49 +0200 (CEST)
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <1380778451.2081.103.camel@joe-AO722>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722> 
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722> <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722> <1380771551.2081.93.camel@joe-AO722>
 <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
 <87fvsjynuk.fsf@kamboji.qca.qualcomm.com>
 <1380775478.19002.139.camel@edumazet-glaptop.roam.corp.google.com>
 <1380776994.2081.101.camel@joe-AO722>
 <1380777884.19002.155.camel@edumazet-glaptop.roam.corp.google.com>
 <1380778451.2081.103.camel@joe-AO722>
Message-ID: <alpine.DEB.2.02.1310030745410.2006@localhost6.localdomain6>



On Wed, 2 Oct 2013, Joe Perches wrote:

> On Wed, 2013-10-02 at 22:24 -0700, Eric Dumazet wrote:
> > On Wed, 2013-10-02 at 22:09 -0700, Joe Perches wrote:
> > > On Wed, 2013-10-02 at 21:44 -0700, Eric Dumazet wrote:
> > > > I mean the 6, of course, since Joe seems to actively track them, as if
> > > > ETH_ALEN could change eventually, you never know.
> > > 
> > > You're funny Eric.
> > > You know it's just to ease grep pattern matching.
> > 
> > You are not funny if you plan to send 500+ patches for every instance of
> > 6 changed to ETH_ALEN
> 
> You're still funny.
> 
> https://lkml.org/lkml/2013/10/1/517
> 
> Lighten up though.  It was just a straggler.

Actually, the few cases that I looked up by hand seemed to use 6 
consistently for the declaration and the memcpy/memset.  So it would be 
nicer to fix them all at once.

At least in drivers/net there are around 40, not 500.

julia


From eric.dumazet at gmail.com  Thu Oct  3 02:00:21 2013
From: eric.dumazet at gmail.com (Eric Dumazet)
Date: Wed, 02 Oct 2013 23:00:21 -0700
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <1380778451.2081.103.camel@joe-AO722>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722> <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722> <1380771551.2081.93.camel@joe-AO722>
 <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
 <87fvsjynuk.fsf@kamboji.qca.qualcomm.com>
 <1380775478.19002.139.camel@edumazet-glaptop.roam.corp.google.com>
 <1380776994.2081.101.camel@joe-AO722>
 <1380777884.19002.155.camel@edumazet-glaptop.roam.corp.google.com>
 <1380778451.2081.103.camel@joe-AO722>
Message-ID: <1380780021.19002.164.camel@edumazet-glaptop.roam.corp.google.com>

On Wed, 2013-10-02 at 22:34 -0700, Joe Perches wrote:

> https://lkml.org/lkml/2013/10/1/517
> 

I had no problem with this one.

Did I say something (funny or not) about it ?

Apparently you mix things and you do not like me commenting or giving a
feedback on a _particular_ patch.

Everything is fine, really, let the fun continue !




From joe at perches.com  Thu Oct  3 02:07:17 2013
From: joe at perches.com (Joe Perches)
Date: Wed, 02 Oct 2013 23:07:17 -0700
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <1380780021.19002.164.camel@edumazet-glaptop.roam.corp.google.com>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722>
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722> <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722> <1380771551.2081.93.camel@joe-AO722>
 <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
 <87fvsjynuk.fsf@kamboji.qca.qualcomm.com>
 <1380775478.19002.139.camel@edumazet-glaptop.roam.corp.google.com>
 <1380776994.2081.101.camel@joe-AO722>
 <1380777884.19002.155.camel@edumazet-glaptop.roam.corp.google.com>
 <1380778451.2081.103.camel@joe-AO722>
 <1380780021.19002.164.camel@edumazet-glaptop.roam.corp.google.com>
Message-ID: <1380780437.2081.106.camel@joe-AO722>

On Wed, 2013-10-02 at 23:00 -0700, Eric Dumazet wrote:
> On Wed, 2013-10-02 at 22:34 -0700, Joe Perches wrote:
> > https://lkml.org/lkml/2013/10/1/517
> I had no problem with this one.
> Did I say something (funny or not) about it ?

Nope, you didn't say anything publicly or
even privately to me.

> Apparently you mix things and you do not like me commenting or giving a
> feedback on a _particular_ patch.

Feedback like expecting 500 individual patches
when you apparently saw one that modified 57 files
with multiple maintainers _is_ pretty funny.

cheers, Joe



From julia.lawall at lip6.fr  Thu Oct  3 02:32:11 2013
From: julia.lawall at lip6.fr (Julia Lawall)
Date: Thu, 3 Oct 2013 08:32:11 +0200 (CEST)
Subject: [PATCH net-next] ath10k: wmi: Convert use of 6 to ETH_ALEN
In-Reply-To: <1380778451.2081.103.camel@joe-AO722>
References: <1380679480.2081.24.camel@joe-AO722>
 <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
 <1380696054.2081.35.camel@joe-AO722>
 <CAB=NE6V3b4+B06hzPjhww52wp1FHho3329cP25=5Cy833bysvg@mail.gmail.com>
 <1380736969.2081.72.camel@joe-AO722> 
 <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6>
 <1380758954.2081.79.camel@joe-AO722> <1380760114.2081.81.camel@joe-AO722>
 <1380771110.2081.89.camel@joe-AO722> <1380771551.2081.93.camel@joe-AO722>
 <1380773924.19002.131.camel@edumazet-glaptop.roam.corp.google.com>
 <87fvsjynuk.fsf@kamboji.qca.qualcomm.com>
 <1380775478.19002.139.camel@edumazet-glaptop.roam.corp.google.com>
 <1380776994.2081.101.camel@joe-AO722>
 <1380777884.19002.155.camel@edumazet-glaptop.roam.corp.google.com>
 <1380778451.2081.103.camel@joe-AO722>
Message-ID: <alpine.DEB.2.02.1310030824570.2006@localhost6.localdomain6>

The following semantic patch fixes the type declarations.  It should be 
run with the argument --recursive-includes for best (but slowest) results.

julia

@@
identifier x;
expression e1;
type T;
@@

T x[
- 6
+ ETH_ALEN
];
... when any
(
memcpy(x,e1,ETH_ALEN)
|
memcpy(e1,x,ETH_ALEN)
|
memset(x,e1,ETH_ALEN)
)

@r@
type T,T1;
identifier x;
@@

T {
...
T1 x[6];
...
};

@s@
r.T *e;
identifier r.x;
expression e1;
@@

(
memcpy(e->x,e1,ETH_ALEN)
|
memcpy(e1,e->x,ETH_ALEN)
|
memset(e->x,e1,ETH_ALEN)
)

@depends on s@
type r.T,r.T1;
identifier r.x;
@@

T {
...
T1 x[
-6
+ ETH_ALEN
 ];
...
};


From michal.kazior at tieto.com  Thu Oct  3 09:09:22 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Thu, 3 Oct 2013 15:09:22 +0200
Subject: [PATCH/RFT 0/3] ath10k: fixes
Message-ID: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>

Hi,

This patchset addresses recently spotted issue
with (yet another) scheduling while atomic bug
(the other being WEP key index setting). This one
is related to hw_config() and powersave settings.
This comes from recent changes I've do to HTC/WMI.
WMI commands can now block so it's illegal to call
them in an atomic context anymore.

ath10k needs to setup some settings per-vdev (i.e.
per-interface) such as powersave, rts, fragmentation.
Until now mac80211 iteration functions were used.
However using non-atomic iteration function variant
doesn't solve the problem as it introduces an
issue with iflist_mtx deadlock in some cases.

I briefly tried to reproduce the issue Kalle
reported but was unsuccessful thus the "/RFT".



Michal Kazior (3):
  ath10k: fix add_interface failure handling
  ath10k: track vif list internally
  ath10k: fix scheduling while atomic config bug

 drivers/net/wireless/ath/ath10k/core.c |    2 +
 drivers/net/wireless/ath/ath10k/core.h |    3 +
 drivers/net/wireless/ath/ath10k/mac.c  |  199 ++++++++++++++++----------------
 3 files changed, 107 insertions(+), 97 deletions(-)

-- 
1.7.9.5



From michal.kazior at tieto.com  Thu Oct  3 09:09:24 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Thu, 3 Oct 2013 15:09:24 +0200
Subject: [PATCH/RFT 2/3] ath10k: track vif list internally
In-Reply-To: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
References: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380805765-31521-3-git-send-email-michal.kazior@tieto.com>

mac80211 interface interations functions have
peculiar locking issues. This patch introduces
internal (to ath10k) vif list that will be used
for vif iteration purposes.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.c |    2 ++
 drivers/net/wireless/ath/ath10k/core.h |    3 +++
 drivers/net/wireless/ath/ath10k/mac.c  |    3 +++
 3 files changed, 8 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 7b5dd09..4d04dc8 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -710,6 +710,7 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
 	mutex_init(&ar->conf_mutex);
 	spin_lock_init(&ar->data_lock);
 
+	INIT_LIST_HEAD(&ar->arvifs);
 	INIT_LIST_HEAD(&ar->peers);
 	init_waitqueue_head(&ar->peer_mapping_wq);
 
@@ -817,6 +818,7 @@ int ath10k_core_start(struct ath10k *ar)
 		goto err_disconnect_htc;
 
 	ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1;
+	INIT_LIST_HEAD(&ar->arvifs);
 
 	return 0;
 
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index ce36daa..de20ac0 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -205,6 +205,8 @@ struct ath10k_peer {
 #define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5*HZ)
 
 struct ath10k_vif {
+	struct list_head list;
+
 	u32 vdev_id;
 	enum wmi_vdev_type vdev_type;
 	enum wmi_vdev_subtype vdev_subtype;
@@ -402,6 +404,7 @@ struct ath10k {
 	/* protects shared structure data */
 	spinlock_t data_lock;
 
+	struct list_head arvifs;
 	struct list_head peers;
 	wait_queue_head_t peer_mapping_wq;
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 7f8b258..292e5cd 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2051,6 +2051,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	}
 
 	ar->free_vdev_map &= ~BIT(arvif->vdev_id);
+	list_add(&arvif->list, &ar->arvifs);
 
 	vdev_param = ar->wmi.vdev_param->def_keyid;
 	ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param,
@@ -2131,6 +2132,7 @@ err_peer_delete:
 err_vdev_delete:
 	ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
 	ar->free_vdev_map &= ~BIT(arvif->vdev_id);
+	list_del(&arvif->list);
 err:
 	mutex_unlock(&ar->conf_mutex);
 	return ret;
@@ -2153,6 +2155,7 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
 	spin_unlock_bh(&ar->data_lock);
 
 	ar->free_vdev_map |= 1 << (arvif->vdev_id);
+	list_del(&arvif->list);
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
 		ret = ath10k_peer_delete(arvif->ar, arvif->vdev_id, vif->addr);
-- 
1.7.9.5



From michal.kazior at tieto.com  Thu Oct  3 09:09:23 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Thu, 3 Oct 2013 15:09:23 +0200
Subject: [PATCH/RFT 1/3] ath10k: fix add_interface failure handling
In-Reply-To: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
References: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380805765-31521-2-git-send-email-michal.kazior@tieto.com>

If something failed along add_interface() setup it
was possible to leak a vdev id, vdev and peer.

This could end up with leaked FW state or FW crash
(assuming add_interface() failure wasn't a result of
a crash).

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   50 ++++++++++++++++++++++++---------
 1 file changed, 37 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 8684e03..7f8b258 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2001,18 +2001,17 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	if ((vif->type == NL80211_IFTYPE_MONITOR) && ar->monitor_present) {
 		ath10k_warn("Only one monitor interface allowed\n");
 		ret = -EBUSY;
-		goto exit;
+		goto err;
 	}
 
 	bit = ffs(ar->free_vdev_map);
 	if (bit == 0) {
 		ret = -EBUSY;
-		goto exit;
+		goto err;
 	}
 
 	arvif->vdev_id = bit - 1;
 	arvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE;
-	ar->free_vdev_map &= ~(1 << arvif->vdev_id);
 
 	if (ar->p2p)
 		arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_DEVICE;
@@ -2048,26 +2047,32 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 				     arvif->vdev_subtype, vif->addr);
 	if (ret) {
 		ath10k_warn("WMI vdev create failed: ret %d\n", ret);
-		goto exit;
+		goto err;
 	}
 
+	ar->free_vdev_map &= ~BIT(arvif->vdev_id);
+
 	vdev_param = ar->wmi.vdev_param->def_keyid;
 	ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param,
 					arvif->def_wep_key_index);
-	if (ret)
+	if (ret) {
 		ath10k_warn("Failed to set default keyid: %d\n", ret);
+		goto err_vdev_delete;
+	}
 
 	vdev_param = ar->wmi.vdev_param->tx_encap_type;
 	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
 					ATH10K_HW_TXRX_NATIVE_WIFI);
-	if (ret)
+	if (ret) {
 		ath10k_warn("Failed to set TX encap: %d\n", ret);
+		goto err_vdev_delete;
+	}
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
 		ret = ath10k_peer_create(ar, arvif->vdev_id, vif->addr);
 		if (ret) {
 			ath10k_warn("Failed to create peer for AP: %d\n", ret);
-			goto exit;
+			goto err_vdev_delete;
 		}
 	}
 
@@ -2076,38 +2081,57 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 		value = WMI_STA_PS_RX_WAKE_POLICY_WAKE;
 		ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
 						  param, value);
-		if (ret)
+		if (ret) {
 			ath10k_warn("Failed to set RX wake policy: %d\n", ret);
+			goto err_peer_delete;
+		}
 
 		param = WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD;
 		value = WMI_STA_PS_TX_WAKE_THRESHOLD_ALWAYS;
 		ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
 						  param, value);
-		if (ret)
+		if (ret) {
 			ath10k_warn("Failed to set TX wake thresh: %d\n", ret);
+			goto err_peer_delete;
+		}
 
 		param = WMI_STA_PS_PARAM_PSPOLL_COUNT;
 		value = WMI_STA_PS_PSPOLL_COUNT_NO_MAX;
 		ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
 						  param, value);
-		if (ret)
+		if (ret) {
 			ath10k_warn("Failed to set PSPOLL count: %d\n", ret);
+			goto err_peer_delete;
+		}
 	}
 
 	ret = ath10k_mac_set_rts(arvif, ar->hw->wiphy->rts_threshold);
-	if (ret)
+	if (ret) {
 		ath10k_warn("failed to set rts threshold for vdev %d (%d)\n",
 			    arvif->vdev_id, ret);
+		goto err_peer_delete;
+	}
 
 	ret = ath10k_mac_set_frag(arvif, ar->hw->wiphy->frag_threshold);
-	if (ret)
+	if (ret) {
 		ath10k_warn("failed to set frag threshold for vdev %d (%d)\n",
 			    arvif->vdev_id, ret);
+		goto err_peer_delete;
+	}
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR)
 		ar->monitor_present = true;
 
-exit:
+	mutex_unlock(&ar->conf_mutex);
+	return 0;
+
+err_peer_delete:
+	if (arvif->vdev_type == WMI_VDEV_TYPE_AP)
+		ath10k_wmi_peer_delete(ar, arvif->vdev_id, vif->addr);
+err_vdev_delete:
+	ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
+	ar->free_vdev_map &= ~BIT(arvif->vdev_id);
+err:
 	mutex_unlock(&ar->conf_mutex);
 	return ret;
 }
-- 
1.7.9.5



From michal.kazior at tieto.com  Thu Oct  3 09:09:25 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Thu, 3 Oct 2013 15:09:25 +0200
Subject: [PATCH/RFT 3/3] ath10k: fix scheduling while atomic config bug
In-Reply-To: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
References: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380805765-31521-4-git-send-email-michal.kazior@tieto.com>

Recent HTC/WMI changes introduced the bug. ath10k
was using _atomic iteration function with
sleepable functions.

mac80211 provides another iteration function but
it cannot be safely called in hw_config() callback
due to local->iflist_mtx being possibly acquired
already.

The patch uses internal vif list for iteration
purposes and removes/refactors no longer necessary
_iter functions.

Reported-By: Kalle Valo <kvalo at qca.qualcomm.com>
Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |  146 ++++++++++++++-------------------
 1 file changed, 62 insertions(+), 84 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 292e5cd..df6f973 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -723,35 +723,30 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif,
 /*
  * Review this when mac80211 gains per-interface powersave support.
  */
-static void ath10k_ps_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
+static int ath10k_mac_vif_setup_ps(struct ath10k_vif *arvif)
 {
-	struct ath10k_generic_iter *ar_iter = data;
-	struct ieee80211_conf *conf = &ar_iter->ar->hw->conf;
-	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
+	struct ath10k *ar = arvif->ar;
+	struct ieee80211_conf *conf = &ar->hw->conf;
 	enum wmi_sta_powersave_param param;
 	enum wmi_sta_ps_mode psmode;
 	int ret;
 
 	lockdep_assert_held(&arvif->ar->conf_mutex);
 
-	if (vif->type != NL80211_IFTYPE_STATION)
-		return;
+	if (arvif->vif->type != NL80211_IFTYPE_STATION)
+		return 0;
 
 	if (conf->flags & IEEE80211_CONF_PS) {
 		psmode = WMI_STA_PS_MODE_ENABLED;
 		param = WMI_STA_PS_PARAM_INACTIVITY_TIME;
 
-		ret = ath10k_wmi_set_sta_ps_param(ar_iter->ar,
-						  arvif->vdev_id,
-						  param,
+		ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param,
 						  conf->dynamic_ps_timeout);
 		if (ret) {
 			ath10k_warn("Failed to set inactivity time for VDEV: %d\n",
 				    arvif->vdev_id);
-			return;
+			return ret;
 		}
-
-		ar_iter->ret = ret;
 	} else {
 		psmode = WMI_STA_PS_MODE_DISABLED;
 	}
@@ -759,11 +754,14 @@ static void ath10k_ps_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
 	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d psmode %s\n",
 		   arvif->vdev_id, psmode ? "enable" : "disable");
 
-	ar_iter->ret = ath10k_wmi_set_psmode(ar_iter->ar, arvif->vdev_id,
-					     psmode);
-	if (ar_iter->ret)
+	ret = ath10k_wmi_set_psmode(ar, arvif->vdev_id, psmode);
+	if (ret) {
 		ath10k_warn("Failed to set PS Mode: %d for VDEV: %d\n",
 			    psmode, arvif->vdev_id);
+		return ret;
+	}
+
+	return 0;
 }
 
 /**********************/
@@ -1919,9 +1917,10 @@ static void ath10k_stop(struct ieee80211_hw *hw)
 	cancel_work_sync(&ar->restart_work);
 }
 
-static void ath10k_config_ps(struct ath10k *ar)
+static int ath10k_config_ps(struct ath10k *ar)
 {
-	struct ath10k_generic_iter ar_iter;
+	struct ath10k_vif *arvif;
+	int ret;
 
 	lockdep_assert_held(&ar->conf_mutex);
 
@@ -1930,17 +1929,17 @@ static void ath10k_config_ps(struct ath10k *ar)
 	 * vdevs at this point we must not iterate over this interface list.
 	 * This setting will be updated upon add_interface(). */
 	if (ar->state == ATH10K_STATE_RESTARTED)
-		return;
-
-	memset(&ar_iter, 0, sizeof(struct ath10k_generic_iter));
-	ar_iter.ar = ar;
+		return 0;
 
-	ieee80211_iterate_active_interfaces_atomic(
-		ar->hw, IEEE80211_IFACE_ITER_NORMAL,
-		ath10k_ps_iter, &ar_iter);
+	list_for_each_entry(arvif, &ar->arvifs, list) {
+		ret = ath10k_mac_vif_setup_ps(arvif);
+		if (ret) {
+			ath10k_warn("could not setup powersave (%d)\n", ret);
+			break;
+		}
+	}
 
-	if (ar_iter.ret)
-		ath10k_warn("failed to set ps config (%d)\n", ar_iter.ret);
+	return ret;
 }
 
 static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
@@ -2834,86 +2833,65 @@ static int ath10k_cancel_remain_on_channel(struct ieee80211_hw *hw)
  * Both RTS and Fragmentation threshold are interface-specific
  * in ath10k, but device-specific in mac80211.
  */
-static void ath10k_set_rts_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
-{
-	struct ath10k_generic_iter *ar_iter = data;
-	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
-	u32 rts = ar_iter->ar->hw->wiphy->rts_threshold;
 
-	lockdep_assert_held(&arvif->ar->conf_mutex);
+static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+{
+	struct ath10k *ar = hw->priv;
+	struct ath10k_vif *arvif;
+	int ret;
 
 	/* During HW reconfiguration mac80211 reports all interfaces that were
 	 * running until reconfiguration was started. Since FW doesn't have any
 	 * vdevs at this point we must not iterate over this interface list.
 	 * This setting will be updated upon add_interface(). */
-	if (ar_iter->ar->state == ATH10K_STATE_RESTARTED)
-		return;
-
-	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d rts_threshold %d\n",
-		   arvif->vdev_id, rts);
-
-	ar_iter->ret = ath10k_mac_set_rts(arvif, rts);
-	if (ar_iter->ret)
-		ath10k_warn("Failed to set RTS threshold for VDEV: %d\n",
-			    arvif->vdev_id);
-}
-
-static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
-{
-	struct ath10k_generic_iter ar_iter;
-	struct ath10k *ar = hw->priv;
-
-	memset(&ar_iter, 0, sizeof(struct ath10k_generic_iter));
-	ar_iter.ar = ar;
+	if (ar->state == ATH10K_STATE_RESTARTED)
+		return 0;
 
 	mutex_lock(&ar->conf_mutex);
-	ieee80211_iterate_active_interfaces_atomic(
-		hw, IEEE80211_IFACE_ITER_NORMAL,
-		ath10k_set_rts_iter, &ar_iter);
+	list_for_each_entry(arvif, &ar->arvifs, list) {
+		ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d rts threshold %d\n",
+			   arvif->vdev_id, value);
+
+		ret = ath10k_mac_set_rts(arvif, value);
+		if (ret) {
+			ath10k_warn("could not set rts threshold for vdev %d (%d)\n",
+				    arvif->vdev_id, ret);
+			break;
+		}
+	}
 	mutex_unlock(&ar->conf_mutex);
 
-	return ar_iter.ret;
+	return ret;
 }
 
-static void ath10k_set_frag_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
+static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
 {
-	struct ath10k_generic_iter *ar_iter = data;
-	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
-	u32 frag = ar_iter->ar->hw->wiphy->frag_threshold;
-
-	lockdep_assert_held(&arvif->ar->conf_mutex);
+	struct ath10k *ar = hw->priv;
+	struct ath10k_vif *arvif;
+	int ret;
 
 	/* During HW reconfiguration mac80211 reports all interfaces that were
 	 * running until reconfiguration was started. Since FW doesn't have any
 	 * vdevs at this point we must not iterate over this interface list.
 	 * This setting will be updated upon add_interface(). */
-	if (ar_iter->ar->state == ATH10K_STATE_RESTARTED)
-		return;
-
-	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d fragmentation_threshold %d\n",
-		   arvif->vdev_id, frag);
-
-	ar_iter->ret = ath10k_mac_set_frag(arvif, frag);
-	if (ar_iter->ret)
-		ath10k_warn("Failed to set frag threshold for VDEV: %d\n",
-			    arvif->vdev_id);
-}
-
-static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
-{
-	struct ath10k_generic_iter ar_iter;
-	struct ath10k *ar = hw->priv;
-
-	memset(&ar_iter, 0, sizeof(struct ath10k_generic_iter));
-	ar_iter.ar = ar;
+	if (ar->state == ATH10K_STATE_RESTARTED)
+		return 0;
 
 	mutex_lock(&ar->conf_mutex);
-	ieee80211_iterate_active_interfaces_atomic(
-		hw, IEEE80211_IFACE_ITER_NORMAL,
-		ath10k_set_frag_iter, &ar_iter);
+	list_for_each_entry(arvif, &ar->arvifs, list) {
+		ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d fragmentation threshold %d\n",
+			   arvif->vdev_id, value);
+
+		ret = ath10k_mac_set_rts(arvif, value);
+		if (ret) {
+			ath10k_warn("could not set fragmentation threshold for vdev %d (%d)\n",
+				    arvif->vdev_id, ret);
+			break;
+		}
+	}
 	mutex_unlock(&ar->conf_mutex);
 
-	return ar_iter.ret;
+	return ret;
 }
 
 static void ath10k_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
-- 
1.7.9.5



From linville at tuxdriver.com  Thu Oct  3 16:17:06 2013
From: linville at tuxdriver.com (John W. Linville)
Date: Thu, 3 Oct 2013 16:17:06 -0400
Subject: Pull request: ath 20131001
In-Reply-To: <87wqlw6fwr.fsf@kamboji.qca.qualcomm.com>
References: <87wqlw6fwr.fsf@kamboji.qca.qualcomm.com>
Message-ID: <20131003201706.GE3142@tuxdriver.com>

On Tue, Oct 01, 2013 at 08:48:36PM +0300, Kalle Valo wrote:
> Hi John,
> 
> here's a bigger pull request including patches applied during the merge
> window. Major changes are:
> 
> * throughput improvements including aligning the RX frames correctly and
>   optimising HTT layer (Michal)
> 
> * remove qca98xx hw1.0 support (Bartosz)
> 
> * add support for firmware version 999.999.0.636 (Michal)
> 
> * firmware htt statistics support (Kalle)
> 
> * fix WEP in AP and IBSS mode (Marek)
> 
> * fix a mutex unlock balance in debugfs file (Shafi)
> 
> And of course there's a lot of smaller fixes and cleanup.
> 
> To avoid the pull request getting too big, I didn't include the latest
> patches from ath.git. I'm planning to send them once you have pulled
> this one. Please let me know if there are any problems.
> 
> Kalle
> 
> 
> The following changes since commit 9d0e2f0772d394060bf3b17cd1f3a35574365103:
> 
>   ath6kl: Fix invalid pointer access on fuzz testing with AP mode (2013-08-07 10:58:59 +0300)
> 
> are available in the git repository at:
> 
>   git://github.com/kvalo/ath.git tags/for-linville-20131001
> 
> for you to fetch changes up to 6e712d427cb0542afdd5220edb6e4f4f8a5b952d:
> 
>   ath10k: replenish HTT RX buffers in a tasklet (2013-09-26 17:22:54 +0300)

Pulling now...

-- 
John W. Linville		Someday the world will need a hero, and you
linville at tuxdriver.com			might be all we have.  Be ready.


From michal.kazior at tieto.com  Fri Oct  4 01:43:41 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 4 Oct 2013 07:43:41 +0200
Subject: [PATCH/RFT v2 0/4] ath10k: fixes
In-Reply-To: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
References: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>

Hi,

This patchset addresses recently spotted issue
with (yet another) scheduling while atomic bug
(the other being WEP key index setting). This one
is related to hw_config() and powersave settings.
This comes from recent changes I've done to
HTC/WMI. WMI commands can block now so it's
illegal to call them in an atomic context anymore.

ath10k needs to setup some settings per-vdev (i.e.
per-interface) such as powersave, rts, fragmentation.
Until now mac80211 iteration functions were used.
However using non-atomic iteration function variant
doesn't solve the problem as it introduces an
issue with iflist_mtx deadlock in some cases.

I briefly tried to reproduce the issue Kalle
reported but was unsuccessful thus the "/RFT".

v2:
 * fix kbuild test robot warning
   (uninitialized `ret`)
 * add patch #4 that removes code that becomes
   unnecessary after patch #3


Michal Kazior (4):
  ath10k: fix add_interface failure handling
  ath10k: track vif list internally
  ath10k: fix scheduling while atomic config bug
  ath10k: remove unnecessary checks

 drivers/net/wireless/ath/ath10k/core.c |    2 +
 drivers/net/wireless/ath/ath10k/core.h |    3 +
 drivers/net/wireless/ath/ath10k/mac.c  |  200 +++++++++++++++-----------------
 3 files changed, 97 insertions(+), 108 deletions(-)

-- 
1.7.9.5



From michal.kazior at tieto.com  Fri Oct  4 01:43:42 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 4 Oct 2013 07:43:42 +0200
Subject: [PATCH/RFT v2 1/4] ath10k: fix add_interface failure handling
In-Reply-To: <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>
References: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
 <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380865425-3791-2-git-send-email-michal.kazior@tieto.com>

If something failed along add_interface() setup it
was possible to leak a vdev id, vdev and peer.

This could end up with leaked FW state or FW crash
(assuming add_interface() failure wasn't a result of
a crash).

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   50 ++++++++++++++++++++++++---------
 1 file changed, 37 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 8684e03..7f8b258 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2001,18 +2001,17 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	if ((vif->type == NL80211_IFTYPE_MONITOR) && ar->monitor_present) {
 		ath10k_warn("Only one monitor interface allowed\n");
 		ret = -EBUSY;
-		goto exit;
+		goto err;
 	}
 
 	bit = ffs(ar->free_vdev_map);
 	if (bit == 0) {
 		ret = -EBUSY;
-		goto exit;
+		goto err;
 	}
 
 	arvif->vdev_id = bit - 1;
 	arvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE;
-	ar->free_vdev_map &= ~(1 << arvif->vdev_id);
 
 	if (ar->p2p)
 		arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_DEVICE;
@@ -2048,26 +2047,32 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 				     arvif->vdev_subtype, vif->addr);
 	if (ret) {
 		ath10k_warn("WMI vdev create failed: ret %d\n", ret);
-		goto exit;
+		goto err;
 	}
 
+	ar->free_vdev_map &= ~BIT(arvif->vdev_id);
+
 	vdev_param = ar->wmi.vdev_param->def_keyid;
 	ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param,
 					arvif->def_wep_key_index);
-	if (ret)
+	if (ret) {
 		ath10k_warn("Failed to set default keyid: %d\n", ret);
+		goto err_vdev_delete;
+	}
 
 	vdev_param = ar->wmi.vdev_param->tx_encap_type;
 	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
 					ATH10K_HW_TXRX_NATIVE_WIFI);
-	if (ret)
+	if (ret) {
 		ath10k_warn("Failed to set TX encap: %d\n", ret);
+		goto err_vdev_delete;
+	}
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
 		ret = ath10k_peer_create(ar, arvif->vdev_id, vif->addr);
 		if (ret) {
 			ath10k_warn("Failed to create peer for AP: %d\n", ret);
-			goto exit;
+			goto err_vdev_delete;
 		}
 	}
 
@@ -2076,38 +2081,57 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 		value = WMI_STA_PS_RX_WAKE_POLICY_WAKE;
 		ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
 						  param, value);
-		if (ret)
+		if (ret) {
 			ath10k_warn("Failed to set RX wake policy: %d\n", ret);
+			goto err_peer_delete;
+		}
 
 		param = WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD;
 		value = WMI_STA_PS_TX_WAKE_THRESHOLD_ALWAYS;
 		ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
 						  param, value);
-		if (ret)
+		if (ret) {
 			ath10k_warn("Failed to set TX wake thresh: %d\n", ret);
+			goto err_peer_delete;
+		}
 
 		param = WMI_STA_PS_PARAM_PSPOLL_COUNT;
 		value = WMI_STA_PS_PSPOLL_COUNT_NO_MAX;
 		ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
 						  param, value);
-		if (ret)
+		if (ret) {
 			ath10k_warn("Failed to set PSPOLL count: %d\n", ret);
+			goto err_peer_delete;
+		}
 	}
 
 	ret = ath10k_mac_set_rts(arvif, ar->hw->wiphy->rts_threshold);
-	if (ret)
+	if (ret) {
 		ath10k_warn("failed to set rts threshold for vdev %d (%d)\n",
 			    arvif->vdev_id, ret);
+		goto err_peer_delete;
+	}
 
 	ret = ath10k_mac_set_frag(arvif, ar->hw->wiphy->frag_threshold);
-	if (ret)
+	if (ret) {
 		ath10k_warn("failed to set frag threshold for vdev %d (%d)\n",
 			    arvif->vdev_id, ret);
+		goto err_peer_delete;
+	}
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR)
 		ar->monitor_present = true;
 
-exit:
+	mutex_unlock(&ar->conf_mutex);
+	return 0;
+
+err_peer_delete:
+	if (arvif->vdev_type == WMI_VDEV_TYPE_AP)
+		ath10k_wmi_peer_delete(ar, arvif->vdev_id, vif->addr);
+err_vdev_delete:
+	ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
+	ar->free_vdev_map &= ~BIT(arvif->vdev_id);
+err:
 	mutex_unlock(&ar->conf_mutex);
 	return ret;
 }
-- 
1.7.9.5



From michal.kazior at tieto.com  Fri Oct  4 01:43:45 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 4 Oct 2013 07:43:45 +0200
Subject: [PATCH/RFT v2 4/4] ath10k: remove unnecessary checks
In-Reply-To: <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>
References: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
 <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380865425-3791-5-git-send-email-michal.kazior@tieto.com>

mac80211 interface iteration functions that were
used originally iterated over interfaces that
weren't re-added to the driver during recovery.

Since internal vif list is now used it's safe to
remove the safe-guard as internal vif list is
based on add/remove_interface function which
guarantees that vdev is created in FW before it is
iterated over.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 583f065..7567db0 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1924,13 +1924,6 @@ static int ath10k_config_ps(struct ath10k *ar)
 
 	lockdep_assert_held(&ar->conf_mutex);
 
-	/* During HW reconfiguration mac80211 reports all interfaces that were
-	 * running until reconfiguration was started. Since FW doesn't have any
-	 * vdevs at this point we must not iterate over this interface list.
-	 * This setting will be updated upon add_interface(). */
-	if (ar->state == ATH10K_STATE_RESTARTED)
-		return 0;
-
 	list_for_each_entry(arvif, &ar->arvifs, list) {
 		ret = ath10k_mac_vif_setup_ps(arvif);
 		if (ret) {
@@ -2840,13 +2833,6 @@ static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
 	struct ath10k_vif *arvif;
 	int ret = 0;
 
-	/* During HW reconfiguration mac80211 reports all interfaces that were
-	 * running until reconfiguration was started. Since FW doesn't have any
-	 * vdevs at this point we must not iterate over this interface list.
-	 * This setting will be updated upon add_interface(). */
-	if (ar->state == ATH10K_STATE_RESTARTED)
-		return 0;
-
 	mutex_lock(&ar->conf_mutex);
 	list_for_each_entry(arvif, &ar->arvifs, list) {
 		ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d rts threshold %d\n",
@@ -2870,13 +2856,6 @@ static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
 	struct ath10k_vif *arvif;
 	int ret = 0;
 
-	/* During HW reconfiguration mac80211 reports all interfaces that were
-	 * running until reconfiguration was started. Since FW doesn't have any
-	 * vdevs at this point we must not iterate over this interface list.
-	 * This setting will be updated upon add_interface(). */
-	if (ar->state == ATH10K_STATE_RESTARTED)
-		return 0;
-
 	mutex_lock(&ar->conf_mutex);
 	list_for_each_entry(arvif, &ar->arvifs, list) {
 		ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d fragmentation threshold %d\n",
-- 
1.7.9.5



From michal.kazior at tieto.com  Fri Oct  4 01:43:43 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 4 Oct 2013 07:43:43 +0200
Subject: [PATCH/RFT v2 2/4] ath10k: track vif list internally
In-Reply-To: <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>
References: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
 <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380865425-3791-3-git-send-email-michal.kazior@tieto.com>

mac80211 interface interations functions have
peculiar locking issues. This patch introduces
internal (to ath10k) vif list that will be used
for vif iteration purposes.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.c |    2 ++
 drivers/net/wireless/ath/ath10k/core.h |    3 +++
 drivers/net/wireless/ath/ath10k/mac.c  |    3 +++
 3 files changed, 8 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 7b5dd09..4d04dc8 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -710,6 +710,7 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
 	mutex_init(&ar->conf_mutex);
 	spin_lock_init(&ar->data_lock);
 
+	INIT_LIST_HEAD(&ar->arvifs);
 	INIT_LIST_HEAD(&ar->peers);
 	init_waitqueue_head(&ar->peer_mapping_wq);
 
@@ -817,6 +818,7 @@ int ath10k_core_start(struct ath10k *ar)
 		goto err_disconnect_htc;
 
 	ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1;
+	INIT_LIST_HEAD(&ar->arvifs);
 
 	return 0;
 
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index ce36daa..de20ac0 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -205,6 +205,8 @@ struct ath10k_peer {
 #define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5*HZ)
 
 struct ath10k_vif {
+	struct list_head list;
+
 	u32 vdev_id;
 	enum wmi_vdev_type vdev_type;
 	enum wmi_vdev_subtype vdev_subtype;
@@ -402,6 +404,7 @@ struct ath10k {
 	/* protects shared structure data */
 	spinlock_t data_lock;
 
+	struct list_head arvifs;
 	struct list_head peers;
 	wait_queue_head_t peer_mapping_wq;
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 7f8b258..292e5cd 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2051,6 +2051,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	}
 
 	ar->free_vdev_map &= ~BIT(arvif->vdev_id);
+	list_add(&arvif->list, &ar->arvifs);
 
 	vdev_param = ar->wmi.vdev_param->def_keyid;
 	ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param,
@@ -2131,6 +2132,7 @@ err_peer_delete:
 err_vdev_delete:
 	ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
 	ar->free_vdev_map &= ~BIT(arvif->vdev_id);
+	list_del(&arvif->list);
 err:
 	mutex_unlock(&ar->conf_mutex);
 	return ret;
@@ -2153,6 +2155,7 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
 	spin_unlock_bh(&ar->data_lock);
 
 	ar->free_vdev_map |= 1 << (arvif->vdev_id);
+	list_del(&arvif->list);
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
 		ret = ath10k_peer_delete(arvif->ar, arvif->vdev_id, vif->addr);
-- 
1.7.9.5



From michal.kazior at tieto.com  Fri Oct  4 01:43:44 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 4 Oct 2013 07:43:44 +0200
Subject: [PATCH/RFT v2 3/4] ath10k: fix scheduling while atomic config bug
In-Reply-To: <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>
References: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
 <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380865425-3791-4-git-send-email-michal.kazior@tieto.com>

Recent HTC/WMI changes introduced the bug. ath10k
was using _atomic iteration function with
sleepable functions.

mac80211 provides another iteration function but
it cannot be safely called in hw_config() callback
due to local->iflist_mtx being possibly acquired
already.

The patch uses internal vif list for iteration
purposes and removes/refactors no longer necessary
_iter functions.

Reported-By: Kalle Valo <kvalo at qca.qualcomm.com>
Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
v2:
 * fix kbuild test robot warning
   (uninitialized `ret`)

 drivers/net/wireless/ath/ath10k/mac.c |  146 ++++++++++++++-------------------
 1 file changed, 62 insertions(+), 84 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 292e5cd..583f065 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -723,35 +723,30 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif,
 /*
  * Review this when mac80211 gains per-interface powersave support.
  */
-static void ath10k_ps_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
+static int ath10k_mac_vif_setup_ps(struct ath10k_vif *arvif)
 {
-	struct ath10k_generic_iter *ar_iter = data;
-	struct ieee80211_conf *conf = &ar_iter->ar->hw->conf;
-	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
+	struct ath10k *ar = arvif->ar;
+	struct ieee80211_conf *conf = &ar->hw->conf;
 	enum wmi_sta_powersave_param param;
 	enum wmi_sta_ps_mode psmode;
 	int ret;
 
 	lockdep_assert_held(&arvif->ar->conf_mutex);
 
-	if (vif->type != NL80211_IFTYPE_STATION)
-		return;
+	if (arvif->vif->type != NL80211_IFTYPE_STATION)
+		return 0;
 
 	if (conf->flags & IEEE80211_CONF_PS) {
 		psmode = WMI_STA_PS_MODE_ENABLED;
 		param = WMI_STA_PS_PARAM_INACTIVITY_TIME;
 
-		ret = ath10k_wmi_set_sta_ps_param(ar_iter->ar,
-						  arvif->vdev_id,
-						  param,
+		ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param,
 						  conf->dynamic_ps_timeout);
 		if (ret) {
 			ath10k_warn("Failed to set inactivity time for VDEV: %d\n",
 				    arvif->vdev_id);
-			return;
+			return ret;
 		}
-
-		ar_iter->ret = ret;
 	} else {
 		psmode = WMI_STA_PS_MODE_DISABLED;
 	}
@@ -759,11 +754,14 @@ static void ath10k_ps_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
 	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d psmode %s\n",
 		   arvif->vdev_id, psmode ? "enable" : "disable");
 
-	ar_iter->ret = ath10k_wmi_set_psmode(ar_iter->ar, arvif->vdev_id,
-					     psmode);
-	if (ar_iter->ret)
+	ret = ath10k_wmi_set_psmode(ar, arvif->vdev_id, psmode);
+	if (ret) {
 		ath10k_warn("Failed to set PS Mode: %d for VDEV: %d\n",
 			    psmode, arvif->vdev_id);
+		return ret;
+	}
+
+	return 0;
 }
 
 /**********************/
@@ -1919,9 +1917,10 @@ static void ath10k_stop(struct ieee80211_hw *hw)
 	cancel_work_sync(&ar->restart_work);
 }
 
-static void ath10k_config_ps(struct ath10k *ar)
+static int ath10k_config_ps(struct ath10k *ar)
 {
-	struct ath10k_generic_iter ar_iter;
+	struct ath10k_vif *arvif;
+	int ret = 0;
 
 	lockdep_assert_held(&ar->conf_mutex);
 
@@ -1930,17 +1929,17 @@ static void ath10k_config_ps(struct ath10k *ar)
 	 * vdevs at this point we must not iterate over this interface list.
 	 * This setting will be updated upon add_interface(). */
 	if (ar->state == ATH10K_STATE_RESTARTED)
-		return;
-
-	memset(&ar_iter, 0, sizeof(struct ath10k_generic_iter));
-	ar_iter.ar = ar;
+		return 0;
 
-	ieee80211_iterate_active_interfaces_atomic(
-		ar->hw, IEEE80211_IFACE_ITER_NORMAL,
-		ath10k_ps_iter, &ar_iter);
+	list_for_each_entry(arvif, &ar->arvifs, list) {
+		ret = ath10k_mac_vif_setup_ps(arvif);
+		if (ret) {
+			ath10k_warn("could not setup powersave (%d)\n", ret);
+			break;
+		}
+	}
 
-	if (ar_iter.ret)
-		ath10k_warn("failed to set ps config (%d)\n", ar_iter.ret);
+	return ret;
 }
 
 static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
@@ -2834,86 +2833,65 @@ static int ath10k_cancel_remain_on_channel(struct ieee80211_hw *hw)
  * Both RTS and Fragmentation threshold are interface-specific
  * in ath10k, but device-specific in mac80211.
  */
-static void ath10k_set_rts_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
-{
-	struct ath10k_generic_iter *ar_iter = data;
-	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
-	u32 rts = ar_iter->ar->hw->wiphy->rts_threshold;
 
-	lockdep_assert_held(&arvif->ar->conf_mutex);
+static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+{
+	struct ath10k *ar = hw->priv;
+	struct ath10k_vif *arvif;
+	int ret = 0;
 
 	/* During HW reconfiguration mac80211 reports all interfaces that were
 	 * running until reconfiguration was started. Since FW doesn't have any
 	 * vdevs at this point we must not iterate over this interface list.
 	 * This setting will be updated upon add_interface(). */
-	if (ar_iter->ar->state == ATH10K_STATE_RESTARTED)
-		return;
-
-	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d rts_threshold %d\n",
-		   arvif->vdev_id, rts);
-
-	ar_iter->ret = ath10k_mac_set_rts(arvif, rts);
-	if (ar_iter->ret)
-		ath10k_warn("Failed to set RTS threshold for VDEV: %d\n",
-			    arvif->vdev_id);
-}
-
-static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
-{
-	struct ath10k_generic_iter ar_iter;
-	struct ath10k *ar = hw->priv;
-
-	memset(&ar_iter, 0, sizeof(struct ath10k_generic_iter));
-	ar_iter.ar = ar;
+	if (ar->state == ATH10K_STATE_RESTARTED)
+		return 0;
 
 	mutex_lock(&ar->conf_mutex);
-	ieee80211_iterate_active_interfaces_atomic(
-		hw, IEEE80211_IFACE_ITER_NORMAL,
-		ath10k_set_rts_iter, &ar_iter);
+	list_for_each_entry(arvif, &ar->arvifs, list) {
+		ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d rts threshold %d\n",
+			   arvif->vdev_id, value);
+
+		ret = ath10k_mac_set_rts(arvif, value);
+		if (ret) {
+			ath10k_warn("could not set rts threshold for vdev %d (%d)\n",
+				    arvif->vdev_id, ret);
+			break;
+		}
+	}
 	mutex_unlock(&ar->conf_mutex);
 
-	return ar_iter.ret;
+	return ret;
 }
 
-static void ath10k_set_frag_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
+static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
 {
-	struct ath10k_generic_iter *ar_iter = data;
-	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
-	u32 frag = ar_iter->ar->hw->wiphy->frag_threshold;
-
-	lockdep_assert_held(&arvif->ar->conf_mutex);
+	struct ath10k *ar = hw->priv;
+	struct ath10k_vif *arvif;
+	int ret = 0;
 
 	/* During HW reconfiguration mac80211 reports all interfaces that were
 	 * running until reconfiguration was started. Since FW doesn't have any
 	 * vdevs at this point we must not iterate over this interface list.
 	 * This setting will be updated upon add_interface(). */
-	if (ar_iter->ar->state == ATH10K_STATE_RESTARTED)
-		return;
-
-	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d fragmentation_threshold %d\n",
-		   arvif->vdev_id, frag);
-
-	ar_iter->ret = ath10k_mac_set_frag(arvif, frag);
-	if (ar_iter->ret)
-		ath10k_warn("Failed to set frag threshold for VDEV: %d\n",
-			    arvif->vdev_id);
-}
-
-static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
-{
-	struct ath10k_generic_iter ar_iter;
-	struct ath10k *ar = hw->priv;
-
-	memset(&ar_iter, 0, sizeof(struct ath10k_generic_iter));
-	ar_iter.ar = ar;
+	if (ar->state == ATH10K_STATE_RESTARTED)
+		return 0;
 
 	mutex_lock(&ar->conf_mutex);
-	ieee80211_iterate_active_interfaces_atomic(
-		hw, IEEE80211_IFACE_ITER_NORMAL,
-		ath10k_set_frag_iter, &ar_iter);
+	list_for_each_entry(arvif, &ar->arvifs, list) {
+		ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d fragmentation threshold %d\n",
+			   arvif->vdev_id, value);
+
+		ret = ath10k_mac_set_rts(arvif, value);
+		if (ret) {
+			ath10k_warn("could not set fragmentation threshold for vdev %d (%d)\n",
+				    arvif->vdev_id, ret);
+			break;
+		}
+	}
 	mutex_unlock(&ar->conf_mutex);
 
-	return ar_iter.ret;
+	return ret;
 }
 
 static void ath10k_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
-- 
1.7.9.5



From michal.kazior at tieto.com  Fri Oct  4 02:13:18 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 4 Oct 2013 08:13:18 +0200
Subject: [PATCH 0/2] ath10k: minor fixes
Message-ID: <1380867200-19714-1-git-send-email-michal.kazior@tieto.com>

Hi,

The patchset fixes a compilation warning and a
memory leak in FW loading code.

Michal Kazior (2):
  ath10k: fix printf format string
  ath10k: fix possible memory leak in new FW loading

 drivers/net/wireless/ath/ath10k/core.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

-- 
1.7.9.5



From michal.kazior at tieto.com  Fri Oct  4 02:13:19 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 4 Oct 2013 08:13:19 +0200
Subject: [PATCH 1/2] ath10k: fix printf format string
In-Reply-To: <1380867200-19714-1-git-send-email-michal.kazior@tieto.com>
References: <1380867200-19714-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380867200-19714-2-git-send-email-michal.kazior@tieto.com>

size_t corresponds to %zu not %d. Compiler was
complaining about it.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 7b5dd09..bf85d34 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -402,7 +402,7 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
 	magic_len = strlen(ATH10K_FIRMWARE_MAGIC) + 1;
 
 	if (len < magic_len) {
-		ath10k_err("firmware image too small to contain magic: %d\n",
+		ath10k_err("firmware image too small to contain magic: %zu\n",
 			   len);
 		return -EINVAL;
 	}
@@ -429,7 +429,7 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
 		data += sizeof(*hdr);
 
 		if (len < ie_len) {
-			ath10k_err("Invalid length for FW IE %d (%d < %d)\n",
+			ath10k_err("Invalid length for FW IE %d (%zu < %zu)\n",
 				   ie_id, len, ie_len);
 			return -EINVAL;
 		}
-- 
1.7.9.5



From michal.kazior at tieto.com  Fri Oct  4 02:13:20 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 4 Oct 2013 08:13:20 +0200
Subject: [PATCH 2/2] ath10k: fix possible memory leak in new FW loading
In-Reply-To: <1380867200-19714-1-git-send-email-michal.kazior@tieto.com>
References: <1380867200-19714-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380867200-19714-3-git-send-email-michal.kazior@tieto.com>

Some failpaths did `return` instead of a `goto`
leaking requested firmware.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index bf85d34..5acb404 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -404,12 +404,14 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
 	if (len < magic_len) {
 		ath10k_err("firmware image too small to contain magic: %zu\n",
 			   len);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err;
 	}
 
 	if (memcmp(data, ATH10K_FIRMWARE_MAGIC, magic_len) != 0) {
 		ath10k_err("Invalid firmware magic\n");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err;
 	}
 
 	/* jump over the padding */
@@ -431,7 +433,8 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
 		if (len < ie_len) {
 			ath10k_err("Invalid length for FW IE %d (%zu < %zu)\n",
 				   ie_id, len, ie_len);
-			return -EINVAL;
+			ret = -EINVAL;
+			goto err;
 		}
 
 		switch (ie_id) {
-- 
1.7.9.5



From kvalo at qca.qualcomm.com  Fri Oct  4 02:37:18 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 4 Oct 2013 09:37:18 +0300
Subject: [PATCH 2/2] ath10k: fix scheduling while atomic bug
In-Reply-To: <CA+BoTQnjG9MnbPsLM-RtAwuGNp_ZAfbvwvR_zg1Ks0ZmUxAtrQ@mail.gmail.com>
 (Michal Kazior's message of "Wed, 2 Oct 2013 07:35:37 +0200")
References: <1380292567-2363-1-git-send-email-michal.kazior@tieto.com>
 <1380292567-2363-3-git-send-email-michal.kazior@tieto.com>
 <8761th6ja6.fsf@kamboji.qca.qualcomm.com>
 <CA+BoTQnjG9MnbPsLM-RtAwuGNp_ZAfbvwvR_zg1Ks0ZmUxAtrQ@mail.gmail.com>
Message-ID: <871u41y21t.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> On 1 October 2013 18:35, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
>> Michal Kazior <michal.kazior at tieto.com> writes:
>>
>>> Recent WMI/HTC changes broke WEP with multiple
>>> keys. If WMI had no HTC TX credits to submit
>>> command for default wep index update it would
>>> trigger a bug.
>>>
>>> This simply moves the wep key index update to a
>>> worker.
>>>
>>> The key update may happen some time after first
>>> frame with a different wep key has been sent (i.e.
>>> some frames will be sent with old key). This was
>>> the case before too as WMI commands were
>>> asynchronous.
>>>
>>> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
>>
>> This looks problematic. Basically you just delay sending the WMI
>> command, but there's no guarantee that we actually have free credits at
>> the time of transmission. So to me it looks like this fixes the issue
>> just by luck.
>
> One thing at a time.
>
> This patch fixes 'scheduling while atomic' bug that was introduced
> with recent HTC/WMI changes.

Ah, that's what you mean with "triggers a bug" in the commit log? Ok,
even though I consider this very ugly I guess it's alright as a short
term fix. But please describe the bug in more detail in the commit log,
at least mention that we are sleeping in an atomic context (or something
like that).


-- 
Kalle Valo


From michal.kazior at tieto.com  Fri Oct  4 04:17:09 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 4 Oct 2013 10:17:09 +0200
Subject: [PATCH v2 1/2] ath10k: Fix bug in max. VHT A-MPDU size
In-Reply-To: <1380874630-14280-1-git-send-email-michal.kazior@tieto.com>
References: <to=1380292567-2363-1-git-send-email-michal.kazior@tieto.com>
 <1380874630-14280-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380874630-14280-2-git-send-email-michal.kazior@tieto.com>

From: Sujith Manoharan <c_manoha at qca.qualcomm.com>

For VHT peers, the maximum A-MPDU size has to be calculated
from the VHT capabilities element and not the HT-cap. The formula
is the same, but a higher value is used in VHT, allowing larger
aggregates to be transmitted.

The patch contains a workaround for some Netgear/Linksys APs that
report Rx A-MPDU factor incorrectly.

Signed-off-by: Sujith Manoharan <c_manoha at qca.qualcomm.com>
Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 8684e03..7e06e75 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1033,14 +1033,26 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar,
 				    struct wmi_peer_assoc_complete_arg *arg)
 {
 	const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
+	u8 ampdu_factor;
 
 	if (!vht_cap->vht_supported)
 		return;
 
 	arg->peer_flags |= WMI_PEER_VHT;
-
 	arg->peer_vht_caps = vht_cap->cap;
 
+	ampdu_factor =
+		(vht_cap->cap & IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK) >>
+		IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT;
+
+	/* Workaround: Some Netgear/Linksys 11ac APs set Rx A-MPDU factor to
+	 * zero in VHT IE. Using it would result in degraded throughput.
+	 * arg->peer_max_mpdu at this point contains HT max_mpdu so keep
+	 * it if VHT max_mpdu is smaller. */
+	arg->peer_max_mpdu = max(arg->peer_max_mpdu,
+				 (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
+					ampdu_factor)) - 1);
+
 	if (sta->bandwidth == IEEE80211_STA_RX_BW_80)
 		arg->peer_flags |= WMI_PEER_80MHZ;
 
-- 
1.7.9.5



From michal.kazior at tieto.com  Fri Oct  4 04:17:08 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 4 Oct 2013 10:17:08 +0200
Subject: [PATCH v2 0/2] ath10k: wep & ampdu fix
In-Reply-To: <to=1380292567-2363-1-git-send-email-michal.kazior@tieto.com>
References: <to=1380292567-2363-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380874630-14280-1-git-send-email-michal.kazior@tieto.com>

Hi,

One throughput fix and one bug fix.

The bug fix addresses my oversight when reworking
HTC/WMI. I haven't seen the error yet but I'm
quite certain this should be fixed.

v2:
 * A-MPDU patch contains a workaround for
   Netgear/Linksys 11ac APs
   (Kalle, can you kindly test this, please?)
 * patchset cover mail title changed to avoid
   confusion (too many patchsets named the same
   way..)


Michal Kazior (1):
  ath10k: fix scheduling while atomic bug

Sujith Manoharan (1):
  ath10k: Fix bug in max. VHT A-MPDU size

 drivers/net/wireless/ath/ath10k/core.h |    4 +-
 drivers/net/wireless/ath/ath10k/mac.c  |   67 +++++++++++++++++++++++---------
 2 files changed, 52 insertions(+), 19 deletions(-)

-- 
1.7.9.5



From michal.kazior at tieto.com  Fri Oct  4 04:17:10 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 4 Oct 2013 10:17:10 +0200
Subject: [PATCH v2 2/2] ath10k: fix scheduling while atomic bug
In-Reply-To: <1380874630-14280-1-git-send-email-michal.kazior@tieto.com>
References: <to=1380292567-2363-1-git-send-email-michal.kazior@tieto.com>
 <1380874630-14280-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1380874630-14280-3-git-send-email-michal.kazior@tieto.com>

Recent WMI/HTC changes made it possible for WMI
commands to sleep (if there's not enough HTC TX
credits to submit a command). TX path is in an
atomic context so calling WMI commands in it is
wrong.

This simply moves WEP key index update to a worker
and fixes the 'scheduling while atomic' bug.

This still leaves multiple WEP key handling laggy,
i.e. some frames may be TXed with an old/different
key (although recipient should still be able to RX
them).

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h |    4 ++-
 drivers/net/wireless/ath/ath10k/mac.c  |   53 ++++++++++++++++++++++----------
 2 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index ce36daa..cef5455 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -215,8 +215,10 @@ struct ath10k_vif {
 	struct ath10k *ar;
 	struct ieee80211_vif *vif;
 
+	struct work_struct wep_key_work;
 	struct ieee80211_key_conf *wep_keys[WMI_MAX_KEY_INDEX + 1];
-	u8 def_wep_key_index;
+	u8 def_wep_key_idx;
+	u8 def_wep_key_newidx;
 
 	u16 tx_seq_no;
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 7e06e75..378d868 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1238,7 +1238,7 @@ static void ath10k_bss_disassoc(struct ieee80211_hw *hw,
 	/* FIXME: why don't we print error if wmi call fails? */
 	ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id);
 
-	arvif->def_wep_key_index = 0;
+	arvif->def_wep_key_idx = 0;
 }
 
 static int ath10k_station_assoc(struct ath10k *ar, struct ath10k_vif *arvif,
@@ -1439,6 +1439,30 @@ static void ath10k_tx_h_qos_workaround(struct ieee80211_hw *hw,
 	skb_pull(skb, IEEE80211_QOS_CTL_LEN);
 }
 
+static void ath10k_tx_wep_key_work(struct work_struct *work)
+{
+	struct ath10k_vif *arvif = container_of(work, struct ath10k_vif,
+						wep_key_work);
+	int ret, keyidx = arvif->def_wep_key_newidx;
+
+	if (arvif->def_wep_key_idx == keyidx)
+		return;
+
+	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d set keyidx %d\n",
+		   arvif->vdev_id, keyidx);
+
+	ret = ath10k_wmi_vdev_set_param(arvif->ar,
+					arvif->vdev_id,
+					arvif->ar->wmi.vdev_param->def_keyid,
+					keyidx);
+	if (ret) {
+		ath10k_warn("could not update wep keyidx (%d)\n", ret);
+		return;
+	}
+
+	arvif->def_wep_key_idx = keyidx;
+}
+
 static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 {
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
@@ -1447,8 +1471,6 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 	struct ath10k *ar = arvif->ar;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 	struct ieee80211_key_conf *key = info->control.hw_key;
-	u32 vdev_param;
-	int ret;
 
 	if (!ieee80211_has_protected(hdr->frame_control))
 		return;
@@ -1460,21 +1482,14 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 	    key->cipher != WLAN_CIPHER_SUITE_WEP104)
 		return;
 
-	if (key->keyidx == arvif->def_wep_key_index)
-		return;
-
-	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d keyidx %d\n",
-		   arvif->vdev_id, key->keyidx);
-
-	vdev_param = ar->wmi.vdev_param->def_keyid;
-	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
-					key->keyidx);
-	if (ret) {
-		ath10k_warn("could not update wep keyidx (%d)\n", ret);
+	if (key->keyidx == arvif->def_wep_key_idx)
 		return;
-	}
 
-	arvif->def_wep_key_index = key->keyidx;
+	/* FIXME: Most likely a few frames will be TXed with an old key. Simply
+	 * queueing frames until key index is updated is not an option because
+	 * sk_buff may need more processing to be done, e.g. offchannel */
+	arvif->def_wep_key_newidx = key->keyidx;
+	ieee80211_queue_work(ar->hw, &arvif->wep_key_work);
 }
 
 static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar, struct sk_buff *skb)
@@ -2010,6 +2025,8 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	arvif->ar = ar;
 	arvif->vif = vif;
 
+	INIT_WORK(&arvif->wep_key_work, ath10k_tx_wep_key_work);
+
 	if ((vif->type == NL80211_IFTYPE_MONITOR) && ar->monitor_present) {
 		ath10k_warn("Only one monitor interface allowed\n");
 		ret = -EBUSY;
@@ -2065,7 +2082,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 
 	vdev_param = ar->wmi.vdev_param->def_keyid;
 	ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param,
-					arvif->def_wep_key_index);
+					arvif->def_wep_key_idx);
 	if (ret)
 		ath10k_warn("Failed to set default keyid: %d\n", ret);
 
@@ -2133,6 +2150,8 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
 
 	mutex_lock(&ar->conf_mutex);
 
+	cancel_work_sync(&arvif->wep_key_work);
+
 	spin_lock_bh(&ar->data_lock);
 	if (arvif->beacon) {
 		dev_kfree_skb_any(arvif->beacon);
-- 
1.7.9.5



From michal.kazior at tieto.com  Fri Oct  4 04:30:28 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 4 Oct 2013 10:30:28 +0200
Subject: [PATCH] ath10k: fix station authorization
Message-ID: <1380875428-20899-1-git-send-email-michal.kazior@tieto.com>

Peer authorization should be delayed until
mac80211 says given station has transitioned into
authorized state.

The state is propagated from mac80211 for both
open and protected networks.

This should prevent data traffic to/from given
station until authorization completes. Until now
it was probably possible for unauthorized traffic
to pass leading to possible security issues.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
I've been keeping this patch in my closet apparently.

Tested briefly and seems there are no regressions.

 drivers/net/wireless/ath/ath10k/mac.c |   27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 8684e03..0175d22 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -781,7 +781,6 @@ static void ath10k_peer_assoc_h_basic(struct ath10k *ar,
 	memcpy(arg->addr, sta->addr, ETH_ALEN);
 	arg->vdev_id = arvif->vdev_id;
 	arg->peer_aid = sta->aid;
-	arg->peer_flags |= WMI_PEER_AUTH;
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_STA)
 		/*
@@ -2603,6 +2602,32 @@ static int ath10k_sta_state(struct ieee80211_hw *hw,
 		if (ret)
 			ath10k_warn("Failed to disassociate station: %pM\n",
 				    sta->addr);
+	} else if (old_state == IEEE80211_STA_ASSOC &&
+		   new_state == IEEE80211_STA_AUTHORIZED) {
+		/*
+		 * Authorization
+		 */
+		ath10k_dbg(ATH10K_DBG_MAC, "mac sta %pM authorized\n",
+			   sta->addr);
+
+		ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr,
+						WMI_PEER_AUTHORIZE, 1);
+		if (ret)
+			ath10k_warn("Failed to authorize station: %pM\n",
+				    sta->addr);
+	} else if (old_state == IEEE80211_STA_AUTHORIZED &&
+		   new_state == IEEE80211_STA_ASSOC) {
+		/*
+		 * De-Authorization
+		 */
+		ath10k_dbg(ATH10K_DBG_MAC, "mac sta %pM de-authorized\n",
+			   sta->addr);
+
+		ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr,
+						WMI_PEER_AUTHORIZE, 0);
+		if (ret)
+			ath10k_warn("Failed to de-authorize station: %pM\n",
+				    sta->addr);
 	}
 
 	mutex_unlock(&ar->conf_mutex);
-- 
1.7.9.5



From kvalo at qca.qualcomm.com  Mon Oct  7 06:38:29 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 7 Oct 2013 13:38:29 +0300
Subject: ath.git master branch rebased
Message-ID: <87bo31v00q.fsf@kamboji.qca.qualcomm.com>

Hi,

the history in ath.git master branch was becoming really messy as always
just merged wireless-testing to it (and wireless-testing is rebased
after a merge window) and to clean up all that I had to rebase the
master branch. Especially be careful when rebasing patches between from
the old master branch to the new one, there might some odd conflicts
happening.

In the future I'm planning to rebase the master branch every time
wireless-testing is rebased, which usually happens after a merge window.
But I'll always send a separate announcement about the rebase.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Mon Oct  7 08:26:36 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 7 Oct 2013 15:26:36 +0300
Subject: [PATCH 1/2] ath10k: advestise 10.X fw support on wmi_attach
In-Reply-To: <1380696532-4147-1-git-send-email-bartosz.markowski@tieto.com>
 (Bartosz Markowski's message of "Wed, 2 Oct 2013 08:48:51 +0200")
References: <1380696532-4147-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <8738oduv0j.fsf@kamboji.qca.qualcomm.com>

Bartosz Markowski <bartosz.markowski at tieto.com> writes:

> Since the WMI API has been added and we can detect from the
> FW IEs what firmware variant we deal with, turn on 10.X support.
>
> Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>

Thanks, both patches applied. For patch 1 I changed the commit log a bit
as we don't really advertise anything to user space:

commit 8acd3c97ff9ea803513c55f89d3f1832481b5b76
Author: Bartosz Markowski <bartosz.markowski at tieto.com>
Date:   Wed Oct 2 08:48:51 2013 +0200

    ath10k: enable 10.x firmware branch support
    
    Since the WMI API has been added and we can detect from the
    FW IEs what firmware variant we deal with, turn on support
    for 10.x firmware branch in ath10k_wmi_attach().
    
    kvalo: improve the commit log
    
    Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
    Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Mon Oct  7 12:31:54 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 7 Oct 2013 19:31:54 +0300
Subject: [PATCH v2 0/2] ath10k: wep & ampdu fix
In-Reply-To: <1380874630-14280-1-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Fri, 4 Oct 2013 10:17:08 +0200")
References: <to=1380292567-2363-1-git-send-email-michal.kazior@tieto.com>
 <1380874630-14280-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <87txgtt539.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> Hi,
>
> One throughput fix and one bug fix.
>
> The bug fix addresses my oversight when reworking
> HTC/WMI. I haven't seen the error yet but I'm
> quite certain this should be fixed.
>
> v2:
>  * A-MPDU patch contains a workaround for
>    Netgear/Linksys 11ac APs
>    (Kalle, can you kindly test this, please?)

I quickly tested patch 1 with D-Link DIR-865L. I didn't notice any
regressions so that part looks good. Though I didn't notice any
improvement either. But as long as there's no regression I'm happy :)

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Mon Oct  7 12:33:35 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 7 Oct 2013 19:33:35 +0300
Subject: [PATCH v2 1/2] ath10k: Fix bug in max. VHT A-MPDU size
In-Reply-To: <1380874630-14280-2-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Fri, 4 Oct 2013 10:17:09 +0200")
References: <to=1380292567-2363-1-git-send-email-michal.kazior@tieto.com>
 <1380874630-14280-1-git-send-email-michal.kazior@tieto.com>
 <1380874630-14280-2-git-send-email-michal.kazior@tieto.com>
Message-ID: <87pprht50g.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> From: Sujith Manoharan <c_manoha at qca.qualcomm.com>
>
> For VHT peers, the maximum A-MPDU size has to be calculated
> from the VHT capabilities element and not the HT-cap. The formula
> is the same, but a higher value is used in VHT, allowing larger
> aggregates to be transmitted.
>
> The patch contains a workaround for some Netgear/Linksys APs that
> report Rx A-MPDU factor incorrectly.
>
> Signed-off-by: Sujith Manoharan <c_manoha at qca.qualcomm.com>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

I see warnings with this patch:

drivers/net/wireless/ath/ath10k/mac.c: In function 'ath10k_peer_assoc_h_vht':
drivers/net/wireless/ath/ath10k/mac.c:1049:179: warning: comparison of distinct pointer types lacks a cast [enabled by default]
drivers/net/wireless/ath/ath10k/mac.c:1049:30: error: incompatible types in comparison expression (different signedness)
drivers/net/wireless/ath/ath10k/mac.c:1042: WARNING: line over 80 characters

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Mon Oct  7 12:35:57 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 7 Oct 2013 19:35:57 +0300
Subject: [PATCH v2 2/2] ath10k: fix scheduling while atomic bug
In-Reply-To: <1380874630-14280-3-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Fri, 4 Oct 2013 10:17:10 +0200")
References: <to=1380292567-2363-1-git-send-email-michal.kazior@tieto.com>
 <1380874630-14280-1-git-send-email-michal.kazior@tieto.com>
 <1380874630-14280-3-git-send-email-michal.kazior@tieto.com>
Message-ID: <87li25t4wi.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> Recent WMI/HTC changes made it possible for WMI
> commands to sleep (if there's not enough HTC TX
> credits to submit a command). TX path is in an
> atomic context so calling WMI commands in it is
> wrong.
>
> This simply moves WEP key index update to a worker
> and fixes the 'scheduling while atomic' bug.
>
> This still leaves multiple WEP key handling laggy,
> i.e. some frames may be TXed with an old/different
> key (although recipient should still be able to RX
> them).
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

I see conflicts with this patch. Can you rebase, please?

-- 
Kalle Valo


From michal.kazior at tieto.com  Mon Oct  7 22:51:56 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Mon,  7 Oct 2013 19:51:56 -0700
Subject: [PATCH v3 0/2] ath10k: wep & ampdu fix
In-Reply-To: <1380874630-14280-1-git-send-email-michal.kazior@tieto.com>
References: <1380874630-14280-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1381200718-16271-1-git-send-email-michal.kazior@tieto.com>

Hi,

One throughput fix and one bug fix.

The bug fix addresses my oversight when reworking
HTC/WMI. I haven't seen the error yet but I'm
quite certain this should be fixed.

v2:
 * A-MPDU patch contains a workaround for
   Netgear/Linksys 11ac APs
 * patchset cover mail title changed to avoid
   confusion (too many patchsets named the same
   way..)

v3:
 * fix lines over 80 chars (Kalle)
 * fix max() cast warning (Kalle)
 * rebase (Kalle)
 * add Tested-by (thanks Kalle!)


Michal Kazior (1):
  ath10k: fix scheduling while atomic bug

Sujith Manoharan (1):
  ath10k: Fix bug in max. VHT A-MPDU size

 drivers/net/wireless/ath/ath10k/core.h |  4 +-
 drivers/net/wireless/ath/ath10k/mac.c  | 68 +++++++++++++++++++++++++---------
 2 files changed, 53 insertions(+), 19 deletions(-)

-- 
1.8.4.rc3



From michal.kazior at tieto.com  Mon Oct  7 22:51:57 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Mon,  7 Oct 2013 19:51:57 -0700
Subject: [PATCH v3 1/2] ath10k: Fix bug in max. VHT A-MPDU size
In-Reply-To: <1381200718-16271-1-git-send-email-michal.kazior@tieto.com>
References: <1380874630-14280-1-git-send-email-michal.kazior@tieto.com>
 <1381200718-16271-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1381200718-16271-2-git-send-email-michal.kazior@tieto.com>

From: Sujith Manoharan <c_manoha at qca.qualcomm.com>

For VHT peers, the maximum A-MPDU size has to be calculated
from the VHT capabilities element and not the HT-cap. The formula
is the same, but a higher value is used in VHT, allowing larger
aggregates to be transmitted.

The patch contains a workaround for some Netgear/Linksys APs that
report Rx A-MPDU factor incorrectly.

Tested-by: Kalle Valo <kvalo at qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha at qca.qualcomm.com>
Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
v3:
 * fix lines over 80 chars (Kalle)
 * fix max() cast warning (Kalle)
 * add Tested-by

 drivers/net/wireless/ath/ath10k/mac.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 4b7c949..049eca2 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1033,14 +1033,27 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar,
 				    struct wmi_peer_assoc_complete_arg *arg)
 {
 	const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
+	u8 ampdu_factor;
 
 	if (!vht_cap->vht_supported)
 		return;
 
 	arg->peer_flags |= WMI_PEER_VHT;
-
 	arg->peer_vht_caps = vht_cap->cap;
 
+
+	ampdu_factor = (vht_cap->cap &
+			IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK) >>
+		       IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT;
+
+	/* Workaround: Some Netgear/Linksys 11ac APs set Rx A-MPDU factor to
+	 * zero in VHT IE. Using it would result in degraded throughput.
+	 * arg->peer_max_mpdu at this point contains HT max_mpdu so keep
+	 * it if VHT max_mpdu is smaller. */
+	arg->peer_max_mpdu = max(arg->peer_max_mpdu,
+				 (1U << (IEEE80211_HT_MAX_AMPDU_FACTOR +
+					ampdu_factor)) - 1);
+
 	if (sta->bandwidth == IEEE80211_STA_RX_BW_80)
 		arg->peer_flags |= WMI_PEER_80MHZ;
 
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Mon Oct  7 22:51:58 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Mon,  7 Oct 2013 19:51:58 -0700
Subject: [PATCH v3 2/2] ath10k: fix scheduling while atomic bug
In-Reply-To: <1381200718-16271-1-git-send-email-michal.kazior@tieto.com>
References: <1380874630-14280-1-git-send-email-michal.kazior@tieto.com>
 <1381200718-16271-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1381200718-16271-3-git-send-email-michal.kazior@tieto.com>

Recent WMI/HTC changes made it possible for WMI
commands to sleep (if there's not enough HTC TX
credits to submit a command). TX path is in an
atomic context so calling WMI commands in it is
wrong.

This simply moves WEP key index update to a worker
and fixes the 'scheduling while atomic' bug.

This still leaves multiple WEP key handling laggy,
i.e. some frames may be TXed with an old/different
key (although recipient should still be able to RX
them).

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h |  4 ++-
 drivers/net/wireless/ath/ath10k/mac.c  | 53 +++++++++++++++++++++++-----------
 2 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index ce36daa..cef5455 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -215,8 +215,10 @@ struct ath10k_vif {
 	struct ath10k *ar;
 	struct ieee80211_vif *vif;
 
+	struct work_struct wep_key_work;
 	struct ieee80211_key_conf *wep_keys[WMI_MAX_KEY_INDEX + 1];
-	u8 def_wep_key_index;
+	u8 def_wep_key_idx;
+	u8 def_wep_key_newidx;
 
 	u16 tx_seq_no;
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 049eca2..498514e 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1239,7 +1239,7 @@ static void ath10k_bss_disassoc(struct ieee80211_hw *hw,
 	/* FIXME: why don't we print error if wmi call fails? */
 	ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id);
 
-	arvif->def_wep_key_index = 0;
+	arvif->def_wep_key_idx = 0;
 }
 
 static int ath10k_station_assoc(struct ath10k *ar, struct ath10k_vif *arvif,
@@ -1467,6 +1467,30 @@ static void ath10k_tx_h_qos_workaround(struct ieee80211_hw *hw,
 	skb_pull(skb, IEEE80211_QOS_CTL_LEN);
 }
 
+static void ath10k_tx_wep_key_work(struct work_struct *work)
+{
+	struct ath10k_vif *arvif = container_of(work, struct ath10k_vif,
+						wep_key_work);
+	int ret, keyidx = arvif->def_wep_key_newidx;
+
+	if (arvif->def_wep_key_idx == keyidx)
+		return;
+
+	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d set keyidx %d\n",
+		   arvif->vdev_id, keyidx);
+
+	ret = ath10k_wmi_vdev_set_param(arvif->ar,
+					arvif->vdev_id,
+					arvif->ar->wmi.vdev_param->def_keyid,
+					keyidx);
+	if (ret) {
+		ath10k_warn("could not update wep keyidx (%d)\n", ret);
+		return;
+	}
+
+	arvif->def_wep_key_idx = keyidx;
+}
+
 static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 {
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
@@ -1475,8 +1499,6 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 	struct ath10k *ar = arvif->ar;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 	struct ieee80211_key_conf *key = info->control.hw_key;
-	u32 vdev_param;
-	int ret;
 
 	if (!ieee80211_has_protected(hdr->frame_control))
 		return;
@@ -1488,21 +1510,14 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 	    key->cipher != WLAN_CIPHER_SUITE_WEP104)
 		return;
 
-	if (key->keyidx == arvif->def_wep_key_index)
-		return;
-
-	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d keyidx %d\n",
-		   arvif->vdev_id, key->keyidx);
-
-	vdev_param = ar->wmi.vdev_param->def_keyid;
-	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
-					key->keyidx);
-	if (ret) {
-		ath10k_warn("could not update wep keyidx (%d)\n", ret);
+	if (key->keyidx == arvif->def_wep_key_idx)
 		return;
-	}
 
-	arvif->def_wep_key_index = key->keyidx;
+	/* FIXME: Most likely a few frames will be TXed with an old key. Simply
+	 * queueing frames until key index is updated is not an option because
+	 * sk_buff may need more processing to be done, e.g. offchannel */
+	arvif->def_wep_key_newidx = key->keyidx;
+	ieee80211_queue_work(ar->hw, &arvif->wep_key_work);
 }
 
 static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar, struct sk_buff *skb)
@@ -2023,6 +2038,8 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	arvif->ar = ar;
 	arvif->vif = vif;
 
+	INIT_WORK(&arvif->wep_key_work, ath10k_tx_wep_key_work);
+
 	if ((vif->type == NL80211_IFTYPE_MONITOR) && ar->monitor_present) {
 		ath10k_warn("Only one monitor interface allowed\n");
 		ret = -EBUSY;
@@ -2078,7 +2095,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 
 	vdev_param = ar->wmi.vdev_param->def_keyid;
 	ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param,
-					arvif->def_wep_key_index);
+					arvif->def_wep_key_idx);
 	if (ret)
 		ath10k_warn("Failed to set default keyid: %d\n", ret);
 
@@ -2146,6 +2163,8 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
 
 	mutex_lock(&ar->conf_mutex);
 
+	cancel_work_sync(&arvif->wep_key_work);
+
 	spin_lock_bh(&ar->data_lock);
 	if (arvif->beacon) {
 		dev_kfree_skb_any(arvif->beacon);
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Mon Oct  7 23:00:36 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Mon,  7 Oct 2013 20:00:36 -0700
Subject: [PATCH] ath10k: fix RX performance when using AP 10.X FW
Message-ID: <1381201236-17035-1-git-send-email-michal.kazior@tieto.com>

Due to oversight AP 10.X support was merged with
Ethernet RX decap mode.

Only Native Wifi RX decap mode guarantees IP
header is properly aligned and avoids sk_buff data
realignment (which is very expensive
performance-wise) in mac80211.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/hw.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index 3fd7b98..8aeb46d 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -123,7 +123,7 @@ enum ath10k_mcast2ucast_mode {
 #define TARGET_10X_RX_CHAIN_MASK		(BIT(0) | BIT(1) | BIT(2))
 #define TARGET_10X_RX_TIMEOUT_LO_PRI		100
 #define TARGET_10X_RX_TIMEOUT_HI_PRI		40
-#define TARGET_10X_RX_DECAP_MODE		ATH10K_HW_TXRX_ETHERNET
+#define TARGET_10X_RX_DECAP_MODE		ATH10K_HW_TXRX_NATIVE_WIFI
 #define TARGET_10X_SCAN_MAX_PENDING_REQS	4
 #define TARGET_10X_BMISS_OFFLOAD_MAX_VDEV	2
 #define TARGET_10X_ROAM_OFFLOAD_MAX_VDEV	2
-- 
1.8.4.rc3



From kvalo at qca.qualcomm.com  Tue Oct  8 01:56:59 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 8 Oct 2013 08:56:59 +0300
Subject: ath10k: ath-next-test branch for testing patches
Message-ID: <87hacstidw.fsf@kamboji.qca.qualcomm.com>

Hi,

I have noticed that Fengguan's build tests are really helpful, his build
bot has found quite a few issues. To make more use of the buildbot I
have been experimenting with ath-next-test branch for running various
tests. So I'm planning to change the ath10k patch flow to this:

1. patch gets posted to the mailing lists

2. patch is immediately applied to ath-next-test

3. waiting two business days for patch being under review (unless the patch
   is urgent)

4. if no comments or warnings, the patch is applied to ath-next branch

5. ath-next is merged to master branch

6. ath-next pull requests are sent once a week (or so)

Thoughts?

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Tue Oct  8 08:23:39 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 8 Oct 2013 15:23:39 +0300
Subject: [PATCH 0/2] ath10k: minor fixes
In-Reply-To: <1380867200-19714-1-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Fri, 4 Oct 2013 08:13:18 +0200")
References: <1380867200-19714-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <87vc18rlx0.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> The patchset fixes a compilation warning and a
> memory leak in FW loading code.
>
> Michal Kazior (2):
>   ath10k: fix printf format string
>   ath10k: fix possible memory leak in new FW loading

Both appplied, thanks for fixing my bugs :)

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Tue Oct  8 08:24:09 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 8 Oct 2013 15:24:09 +0300
Subject: [PATCH] ath10k: fix RX performance when using AP 10.X FW
In-Reply-To: <1381201236-17035-1-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Mon, 7 Oct 2013 20:00:36 -0700")
References: <1381201236-17035-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <87r4bwrlw6.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> Due to oversight AP 10.X support was merged with
> Ethernet RX decap mode.
>
> Only Native Wifi RX decap mode guarantees IP
> header is properly aligned and avoids sk_buff data
> realignment (which is very expensive
> performance-wise) in mac80211.
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

Thanks, applied.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Tue Oct  8 08:54:11 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 8 Oct 2013 15:54:11 +0300
Subject: [PATCH/RFT v2 1/4] ath10k: fix add_interface failure handling
In-Reply-To: <1380865425-3791-2-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Fri, 4 Oct 2013 07:43:42 +0200")
References: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
 <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>
 <1380865425-3791-2-git-send-email-michal.kazior@tieto.com>
Message-ID: <87mwmjsz2k.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> If something failed along add_interface() setup it
> was possible to leak a vdev id, vdev and peer.
>
> This could end up with leaked FW state or FW crash
> (assuming add_interface() failure wasn't a result of
> a crash).
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

Then I apply this patch on top of current ath.git master branch (commit
18fe0b53e76) interface up fails on the managed mode:

$ sudo ip link set wlan1 up
RTNETLINK answers: Invalid argument

Logs don't have anything special (the TX encap error was already
before):

[ 1259.818863] ath10k: MSI-X didn't succeed (1), trying MSI
[ 1259.819298] ath10k_pci 0000:02:00.0: irq 49 for MSI/MSI-X
[ 1259.820055] ath10k: MSI interrupt handling
[ 1260.747877] ath10k: UART prints disabled
[ 1260.828219] ath10k: firmware 10.1.389 booted
[ 1260.837585] ath10k: htt target version 2.1
[ 1260.838498] ath10k: Failed to set TX encap: -22

-- 
Kalle Valo


From michal.kazior at tieto.com  Tue Oct  8 12:49:59 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Tue, 8 Oct 2013 09:49:59 -0700
Subject: [PATCH/RFT v2 1/4] ath10k: fix add_interface failure handling
In-Reply-To: <87mwmjsz2k.fsf@kamboji.qca.qualcomm.com>
References: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
 <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>
 <1380865425-3791-2-git-send-email-michal.kazior@tieto.com>
 <87mwmjsz2k.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CA+BoTQ=qep+rKEyLKrNjNP6K1q+FHKpvkscwXuRMR_45YnRvHA@mail.gmail.com>

On 8 October 2013 05:54, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Michal Kazior <michal.kazior at tieto.com> writes:
>
>> If something failed along add_interface() setup it
>> was possible to leak a vdev id, vdev and peer.
>>
>> This could end up with leaked FW state or FW crash
>> (assuming add_interface() failure wasn't a result of
>> a crash).
>>
>> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
>
> Then I apply this patch on top of current ath.git master branch (commit
> 18fe0b53e76) interface up fails on the managed mode:
>
> $ sudo ip link set wlan1 up
> RTNETLINK answers: Invalid argument
>
> Logs don't have anything special (the TX encap error was already
> before):
>
> [ 1259.818863] ath10k: MSI-X didn't succeed (1), trying MSI
> [ 1259.819298] ath10k_pci 0000:02:00.0: irq 49 for MSI/MSI-X
> [ 1259.820055] ath10k: MSI interrupt handling
> [ 1260.747877] ath10k: UART prints disabled
> [ 1260.828219] ath10k: firmware 10.1.389 booted
> [ 1260.837585] ath10k: htt target version 2.1
> [ 1260.838498] ath10k: Failed to set TX encap: -22

Ah. Right. I've tested this patch with main FW branch which supports
TX encap command. The TX encap issue should be dealth with first.


Micha?


From kvalo at qca.qualcomm.com  Tue Oct  8 14:45:25 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 08 Oct 2013 21:45:25 +0300
Subject: [PATCH] ath10k: fix ath10k_debug_start() locking
Message-ID: <20131008184525.32604.64051.stgit@localhost6.localdomain6>

ath10k_debug_start() was not called with conf_mutex, fix that. Also there was a
deadlock in ath10k_debug_stop(), rename it to ath10k_debug_destroy() and call
it only when the device is destroyed.

Reported-by: Mohammed Shafi Shajakhan <mohammed at qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c  |   12 ++++++++++++
 drivers/net/wireless/ath/ath10k/debug.c |   15 ++++++++++++++-
 drivers/net/wireless/ath/ath10k/debug.h |    5 +++++
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 5acb404..e016f51 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -737,6 +737,8 @@ EXPORT_SYMBOL(ath10k_core_create);
 
 void ath10k_core_destroy(struct ath10k *ar)
 {
+	ath10k_debug_destroy(ar);
+
 	flush_workqueue(ar->workqueue);
 	destroy_workqueue(ar->workqueue);
 
@@ -748,6 +750,8 @@ int ath10k_core_start(struct ath10k *ar)
 {
 	int status;
 
+	lockdep_assert_held(&ar->conf_mutex);
+
 	ath10k_bmi_start(ar);
 
 	if (ath10k_init_configure_target(ar)) {
@@ -836,6 +840,8 @@ EXPORT_SYMBOL(ath10k_core_start);
 
 void ath10k_core_stop(struct ath10k *ar)
 {
+	lockdep_assert_held(&ar->conf_mutex);
+
 	ath10k_debug_stop(ar);
 	ath10k_htc_stop(&ar->htc);
 	ath10k_htt_detach(&ar->htt);
@@ -883,15 +889,21 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
 		return ret;
 	}
 
+	mutex_lock(&ar->conf_mutex);
+
 	ret = ath10k_core_start(ar);
 	if (ret) {
 		ath10k_err("could not init core (%d)\n", ret);
 		ath10k_core_free_firmware_files(ar);
 		ath10k_hif_power_down(ar);
+		mutex_unlock(&ar->conf_mutex);
 		return ret;
 	}
 
 	ath10k_core_stop(ar);
+
+	mutex_unlock(&ar->conf_mutex);
+
 	ath10k_hif_power_down(ar);
 	return 0;
 }
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 59615c7..760ff22 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -618,6 +618,8 @@ int ath10k_debug_start(struct ath10k *ar)
 {
 	int ret;
 
+	lockdep_assert_held(&ar->conf_mutex);
+
 	ret = ath10k_debug_htt_stats_req(ar);
 	if (ret)
 		/* continue normally anyway, this isn't serious */
@@ -628,7 +630,13 @@ int ath10k_debug_start(struct ath10k *ar)
 
 void ath10k_debug_stop(struct ath10k *ar)
 {
-	cancel_delayed_work_sync(&ar->debug.htt_stats_dwork);
+	lockdep_assert_held(&ar->conf_mutex);
+
+	/* Must not use _sync to avoid deadlock, we do that in
+	 * ath10k_debug_destroy(). The check for htt_stats_mask is to avoid
+	 * warning from del_timer(). */
+	if (ar->debug.htt_stats_mask != 0)
+		cancel_delayed_work(&ar->debug.htt_stats_dwork);
 }
 
 int ath10k_debug_create(struct ath10k *ar)
@@ -662,6 +670,11 @@ int ath10k_debug_create(struct ath10k *ar)
 	return 0;
 }
 
+void ath10k_debug_destroy(struct ath10k *ar)
+{
+	cancel_delayed_work_sync(&ar->debug.htt_stats_dwork);
+}
+
 #endif /* CONFIG_ATH10K_DEBUGFS */
 
 #ifdef CONFIG_ATH10K_DEBUG
diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index fa58148..46e640a 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -46,6 +46,7 @@ extern __printf(1, 2) int ath10k_warn(const char *fmt, ...);
 int ath10k_debug_start(struct ath10k *ar);
 void ath10k_debug_stop(struct ath10k *ar);
 int ath10k_debug_create(struct ath10k *ar);
+void ath10k_debug_destroy(struct ath10k *ar);
 void ath10k_debug_read_service_map(struct ath10k *ar,
 				   void *service_map,
 				   size_t map_size);
@@ -67,6 +68,10 @@ static inline int ath10k_debug_create(struct ath10k *ar)
 	return 0;
 }
 
+static inline void ath10k_debug_destroy(struct ath10k *ar)
+{
+}
+
 static inline void ath10k_debug_read_service_map(struct ath10k *ar,
 						 void *service_map,
 						 size_t map_size)



From kvalo at qca.qualcomm.com  Tue Oct  8 14:48:15 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 08 Oct 2013 21:48:15 +0300
Subject: [PATCH] ath10k: remove unneded semicolon from
 ath10k_core_fetch_firmware_api_n()
Message-ID: <20131008184815.3778.52129.stgit@localhost6.localdomain6>

From: Fengguang Wu <fengguang.wu at intel.com>

drivers/net/wireless/ath/ath10k/core.c:507:2-3: Unneeded semicolon

 Removes unneeded semicolon.

Generated by: coccinelle/misc/semicolon.cocci

Signed-off-by: Fengguang Wu <fengguang.wu at intel.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 5acb404..10c519d 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -507,7 +507,7 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
 
 		len -= ie_len;
 		data += ie_len;
-	};
+	}
 
 	if (!ar->firmware_data || !ar->firmware_len) {
 		ath10k_warn("No ATH10K_FW_IE_FW_IMAGE found from %s, skipping\n",



From kvalo at qca.qualcomm.com  Tue Oct  8 14:55:52 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 8 Oct 2013 21:55:52 +0300
Subject: [PATCH] ath10k: fix station authorization
In-Reply-To: <1380875428-20899-1-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Fri, 4 Oct 2013 10:30:28 +0200")
References: <1380875428-20899-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <8761t7sibr.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> Peer authorization should be delayed until
> mac80211 says given station has transitioned into
> authorized state.
>
> The state is propagated from mac80211 for both
> open and protected networks.
>
> This should prevent data traffic to/from given
> station until authorization completes. Until now
> it was probably possible for unauthorized traffic
> to pass leading to possible security issues.
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

Thanks, applied.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Tue Oct  8 14:58:19 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 8 Oct 2013 21:58:19 +0300
Subject: [PATCH v3 0/2] ath10k: wep & ampdu fix
In-Reply-To: <1381200718-16271-1-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Mon, 7 Oct 2013 19:51:56 -0700")
References: <1380874630-14280-1-git-send-email-michal.kazior@tieto.com>
 <1381200718-16271-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <871u3vsi7o.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> Hi,
>
> One throughput fix and one bug fix.
>
> The bug fix addresses my oversight when reworking
> HTC/WMI. I haven't seen the error yet but I'm
> quite certain this should be fixed.
>
> v2:
>  * A-MPDU patch contains a workaround for
>    Netgear/Linksys 11ac APs
>  * patchset cover mail title changed to avoid
>    confusion (too many patchsets named the same
>    way..)
>
> v3:
>  * fix lines over 80 chars (Kalle)
>  * fix max() cast warning (Kalle)
>  * rebase (Kalle)
>  * add Tested-by (thanks Kalle!)
>
>
> Michal Kazior (1):
>   ath10k: fix scheduling while atomic bug

I dropped this patch for now, need to think more about how to handle
this.

> Sujith Manoharan (1):
>   ath10k: Fix bug in max. VHT A-MPDU size

This is applied, thanks.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Tue Oct  8 15:09:52 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 8 Oct 2013 22:09:52 +0300
Subject: [PATCH] ath10k: fix station authorization
In-Reply-To: <8761t7sibr.fsf@kamboji.qca.qualcomm.com> (Kalle Valo's message
 of "Tue, 8 Oct 2013 21:55:52 +0300")
References: <1380875428-20899-1-git-send-email-michal.kazior@tieto.com>
 <8761t7sibr.fsf@kamboji.qca.qualcomm.com>
Message-ID: <87wqlnr33z.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo at qca.qualcomm.com> writes:

> Michal Kazior <michal.kazior at tieto.com> writes:
>
>> Peer authorization should be delayed until
>> mac80211 says given station has transitioned into
>> authorized state.
>>
>> The state is propagated from mac80211 for both
>> open and protected networks.
>>
>> This should prevent data traffic to/from given
>> station until authorization completes. Until now
>> it was probably possible for unauthorized traffic
>> to pass leading to possible security issues.
>>
>> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
>
> Thanks, applied.

Actually I'll take this back. After this patch even ping doesn't work
with D-Link DIR-865L as AP using 10.1.389 firmware. So I have to drop
this patch.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Tue Oct  8 15:16:51 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 8 Oct 2013 22:16:51 +0300
Subject: [PATCH/RFT v2 1/4] ath10k: fix add_interface failure handling
In-Reply-To: <CA+BoTQ=qep+rKEyLKrNjNP6K1q+FHKpvkscwXuRMR_45YnRvHA@mail.gmail.com>
 (Michal Kazior's message of "Tue, 8 Oct 2013 09:49:59 -0700")
References: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
 <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>
 <1380865425-3791-2-git-send-email-michal.kazior@tieto.com>
 <87mwmjsz2k.fsf@kamboji.qca.qualcomm.com>
 <CA+BoTQ=qep+rKEyLKrNjNP6K1q+FHKpvkscwXuRMR_45YnRvHA@mail.gmail.com>
Message-ID: <87siwbr2sc.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> On 8 October 2013 05:54, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
>> Michal Kazior <michal.kazior at tieto.com> writes:
>>
>>> If something failed along add_interface() setup it
>>> was possible to leak a vdev id, vdev and peer.
>>>
>>> This could end up with leaked FW state or FW crash
>>> (assuming add_interface() failure wasn't a result of
>>> a crash).
>>>
>>> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
>>
>> Then I apply this patch on top of current ath.git master branch (commit
>> 18fe0b53e76) interface up fails on the managed mode:
>>
>> $ sudo ip link set wlan1 up
>> RTNETLINK answers: Invalid argument
>>
>> Logs don't have anything special (the TX encap error was already
>> before):
>>
>> [ 1259.818863] ath10k: MSI-X didn't succeed (1), trying MSI
>> [ 1259.819298] ath10k_pci 0000:02:00.0: irq 49 for MSI/MSI-X
>> [ 1259.820055] ath10k: MSI interrupt handling
>> [ 1260.747877] ath10k: UART prints disabled
>> [ 1260.828219] ath10k: firmware 10.1.389 booted
>> [ 1260.837585] ath10k: htt target version 2.1
>> [ 1260.838498] ath10k: Failed to set TX encap: -22
>
> Ah. Right. I've tested this patch with main FW branch which supports
> TX encap command. The TX encap issue should be dealth with first.

What do you mean? Did I miss a patch?

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Tue Oct  8 15:17:30 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 8 Oct 2013 22:17:30 +0300
Subject: [PATCH/RFT v2 0/4] ath10k: fixes
In-Reply-To: <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Fri, 4 Oct 2013 07:43:41 +0200")
References: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
 <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <87ob6zr2r9.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> Hi,
>
> This patchset addresses recently spotted issue
> with (yet another) scheduling while atomic bug
> (the other being WEP key index setting). This one
> is related to hw_config() and powersave settings.
> This comes from recent changes I've done to
> HTC/WMI. WMI commands can block now so it's
> illegal to call them in an atomic context anymore.
>
> ath10k needs to setup some settings per-vdev (i.e.
> per-interface) such as powersave, rts, fragmentation.
> Until now mac80211 iteration functions were used.
> However using non-atomic iteration function variant
> doesn't solve the problem as it introduces an
> issue with iflist_mtx deadlock in some cases.
>
> I briefly tried to reproduce the issue Kalle
> reported but was unsuccessful thus the "/RFT".
>
> v2:
>  * fix kbuild test robot warning
>    (uninitialized `ret`)
>  * add patch #4 that removes code that becomes
>    unnecessary after patch #3
>
>
> Michal Kazior (4):
>   ath10k: fix add_interface failure handling
>   ath10k: track vif list internally
>   ath10k: fix scheduling while atomic config bug
>   ath10k: remove unnecessary checks

Due to problems with patch 1 I'm dropping this patchset for now.

-- 
Kalle Valo


From joe at perches.com  Tue Oct  8 15:28:31 2013
From: joe at perches.com (Joe Perches)
Date: Tue, 08 Oct 2013 12:28:31 -0700
Subject: remove unneeded semicolons
In-Reply-To: <20131008184815.3778.52129.stgit@localhost6.localdomain6>
References: <20131008184815.3778.52129.stgit@localhost6.localdomain6>
Message-ID: <1381260511.2081.250.camel@joe-AO722>

On Tue, 2013-10-08 at 21:48 +0300, Kalle Valo wrote:
> From: Fengguang Wu <fengguang.wu at intel.com>
> 
> drivers/net/wireless/ath/ath10k/core.c:507:2-3: Unneeded semicolon
> 
>  Removes unneeded semicolon.
> 
> Generated by: coccinelle/misc/semicolon.cocci

There are _many_ of these.

With a perl script, basically:
 	    $count += $text =~ s@\b((?:switch|for|while|if)\s*${match_balanced_parentheses}\s*)${match_balanced_braces}\s*;@"$1$3"@egx;

I get:

(there's at least one false positive in
 drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
 where there's a quoted semicolon like "\n;")

 arch/alpha/kernel/osf_sys.c                        |  2 +-
 arch/alpha/kernel/sys_eiger.c                      |  2 +-
 arch/arm/kernel/psci.c                             |  2 +-
 arch/arm/mach-at91/gpio.c                          |  2 +-
 arch/arm/mach-imx/clk-imx6q.c                      |  2 +-
 arch/arm64/kernel/psci.c                           |  2 +-
 arch/cris/arch-v32/drivers/cryptocop.c             |  4 +-
 arch/ia64/kvm/vcpu.c                               |  2 +-
 arch/ia64/kvm/vtlb.c                               |  4 +-
 arch/m68k/sun3/prom/console.c                      | 10 ++--
 arch/mips/netlogic/xlr/fmn.c                       |  2 +-
 arch/mips/oprofile/common.c                        |  2 +-
 arch/powerpc/boot/cuboot-c2k.c                     |  2 +-
 arch/powerpc/kernel/eeh.c                          |  2 +-
 arch/powerpc/kernel/prom_init.c                    |  2 +-
 arch/powerpc/kvm/booke.c                           |  2 +-
 arch/powerpc/platforms/ps3/system-bus.c            |  4 +-
 arch/powerpc/sysdev/tsi108_dev.c                   |  2 +-
 arch/s390/mm/extmem.c                              |  2 +-
 arch/x86/kernel/cpu/perf_event_intel_uncore.c      |  6 +--
 crypto/af_alg.c                                    |  2 +-
 drivers/acpi/acpica/nsalloc.c                      |  2 +-
 drivers/acpi/apei/erst.c                           |  2 +-
 drivers/ata/pata_bf54x.c                           |  2 +-
 drivers/atm/firestream.c                           |  2 +-
 drivers/atm/horizon.c                              |  4 +-
 drivers/block/amiflop.c                            |  4 +-
 drivers/block/drbd/drbd_req.c                      |  2 +-
 drivers/block/sunvdc.c                             |  2 +-
 drivers/bluetooth/bfusb.c                          |  2 +-
 drivers/bluetooth/bt3c_cs.c                        |  2 +-
 drivers/bluetooth/dtl1_cs.c                        |  2 +-
 drivers/char/hw_random/omap-rng.c                  |  2 +-
 drivers/clk/clk.c                                  |  2 +-
 drivers/clk/mvebu/common.c                         |  2 +-
 drivers/clk/samsung/clk-pll.c                      |  2 +-
 drivers/clocksource/metag_generic.c                |  2 +-
 drivers/cpufreq/longhaul.c                         |  2 +-
 drivers/cpufreq/pcc-cpufreq.c                      |  2 +-
 drivers/cpufreq/speedstep-lib.c                    |  2 +-
 drivers/gpu/drm/ast/ast_post.c                     |  4 +-
 drivers/gpu/drm/exynos/exynos_drm_g2d.c            |  2 +-
 drivers/gpu/drm/i915/dvo_ch7xxx.c                  |  2 +-
 drivers/gpu/drm/i915/dvo_ivch.c                    |  2 +-
 drivers/gpu/drm/i915/dvo_ns2501.c                  |  2 +-
 drivers/gpu/drm/i915/dvo_sil164.c                  |  2 +-
 drivers/gpu/drm/i915/dvo_tfp410.c                  |  2 +-
 drivers/gpu/drm/nouveau/core/engine/graph/nv50.c   |  2 +-
 drivers/gpu/drm/radeon/radeon_bios.c               |  2 +-
 drivers/hwmon/adm1026.c                            |  6 +--
 drivers/hwmon/asc7621.c                            | 12 ++---
 drivers/ide/ide-taskfile.c                         |  2 +-
 drivers/infiniband/hw/amso1100/c2_ae.c             |  2 +-
 drivers/infiniband/hw/mthca/mthca_eq.c             |  2 +-
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c           |  6 +--
 drivers/infiniband/hw/ocrdma/ocrdma_main.c         |  2 +-
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c        |  6 +--
 drivers/input/touchscreen/mms114.c                 |  4 +-
 drivers/iommu/fsl_pamu_domain.c                    |  4 +-
 drivers/isdn/hisax/netjet.c                        |  2 +-
 drivers/isdn/hisax/q931.c                          |  2 +-
 drivers/isdn/i4l/isdn_net.c                        |  2 +-
 drivers/isdn/pcbit/drv.c                           |  4 +-
 drivers/media/common/b2c2/flexcop-sram.c           |  6 +--
 drivers/media/dvb-frontends/cx24110.c              |  2 +-
 drivers/media/dvb-frontends/cx24123.c              |  2 +-
 drivers/media/dvb-frontends/tda8083.c              |  4 +-
 drivers/media/i2c/soc_camera/ov9640.c              |  2 +-
 drivers/media/platform/exynos4-is/fimc-isp.c       |  2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c    |  2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c    |  2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c    |  2 +-
 drivers/media/platform/s5p-tv/mixer_grp_layer.c    |  2 +-
 drivers/media/platform/s5p-tv/mixer_vp_layer.c     |  2 +-
 drivers/media/radio/si470x/radio-si470x-common.c   |  2 +-
 drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c   |  2 +-
 drivers/media/v4l2-core/v4l2-ctrls.c               |  2 +-
 drivers/memstick/core/mspro_block.c                |  2 +-
 drivers/memstick/host/jmb38x_ms.c                  |  2 +-
 drivers/memstick/host/tifm_ms.c                    |  2 +-
 drivers/message/i2o/iop.c                          |  2 +-
 drivers/mfd/stmpe.c                                |  2 +-
 drivers/mfd/tps65010.c                             |  2 +-
 drivers/misc/ti-st/st_core.c                       |  2 +-
 drivers/mmc/host/davinci_mmc.c                     |  2 +-
 drivers/mmc/host/vub300.c                          |  6 +--
 drivers/mmc/host/wbsd.c                            |  2 +-
 drivers/mtd/nand/mpc5121_nfc.c                     |  2 +-
 drivers/mtd/ubi/cdev.c                             |  2 +-
 drivers/net/ethernet/mellanox/mlx4/cmd.c           |  2 +-
 drivers/net/ethernet/mellanox/mlx4/eq.c            |  2 +-
 .../net/ethernet/mellanox/mlx4/resource_tracker.c  |  2 +-
 drivers/net/usb/sr9700.c                           |  2 +-
 drivers/net/wireless/ath/ath10k/htt_rx.c           |  2 +-
 drivers/net/wireless/ath/ath6kl/init.c             |  2 +-
 drivers/net/wireless/iwlwifi/mvm/d3.c              |  2 +-
 drivers/net/wireless/iwlwifi/mvm/led.c             |  2 +-
 drivers/net/wireless/iwlwifi/mvm/scan.c            |  2 +-
 drivers/pci/proc.c                                 |  2 +-
 drivers/pci/syscall.c                              |  2 +-
 drivers/pcmcia/db1xxx_ss.c                         |  2 +-
 drivers/pcmcia/m8xx_pcmcia.c                       |  2 +-
 drivers/pinctrl/pinctrl-exynos5440.c               |  2 +-
 drivers/pinctrl/pinctrl-samsung.c                  |  2 +-
 drivers/pinctrl/pinctrl-sunxi.c                    |  2 +-
 drivers/pinctrl/pinctrl-tz1090-pdc.c               |  4 +-
 drivers/pinctrl/pinctrl-tz1090.c                   |  4 +-
 drivers/power/ab8500_charger.c                     |  6 +--
 drivers/power/ab8500_fg.c                          | 14 +++---
 drivers/power/abx500_chargalg.c                    |  2 +-
 drivers/power/reset/vexpress-poweroff.c            |  2 +-
 drivers/regulator/da9063-regulator.c               |  2 +-
 drivers/rpmsg/virtio_rpmsg_bus.c                   |  2 +-
 drivers/rtc/rtc-rs5c372.c                          |  2 +-
 drivers/s390/char/monreader.c                      |  2 +-
 drivers/s390/scsi/zfcp_fsf.c                       |  2 +-
 drivers/sbus/char/openprom.c                       |  2 +-
 drivers/scsi/aha1542.c                             | 24 +++++-----
 drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c        |  2 +-
 drivers/scsi/bfa/bfa_fcs_lport.c                   |  2 +-
 drivers/scsi/bfa/bfa_fcs_rport.c                   |  2 +-
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c                  |  6 +--
 drivers/scsi/fcoe/fcoe.c                           |  6 +--
 drivers/scsi/fcoe/fcoe_sysfs.c                     |  4 +-
 drivers/scsi/fnic/fnic_main.c                      |  2 +-
 drivers/scsi/ibmvscsi/ibmvfc.c                     | 38 +++++++--------
 drivers/scsi/ibmvscsi/ibmvstgt.c                   |  2 +-
 drivers/scsi/ipr.c                                 |  4 +-
 drivers/scsi/nsp32.c                               |  4 +-
 drivers/scsi/pmcraid.c                             |  2 +-
 drivers/scsi/qlogicpti.c                           |  2 +-
 drivers/scsi/scsi_tgt_if.c                         |  2 +-
 drivers/scsi/sgiwd93.c                             |  2 +-
 drivers/scsi/sym53c8xx_2/sym_fw.c                  |  6 +--
 drivers/scsi/ultrastor.c                           |  2 +-
 drivers/staging/iio/adc/ad7291.c                   |  2 +-
 drivers/staging/iio/cdc/ad7150.c                   |  2 +-
 drivers/staging/imx-drm/imx-tve.c                  |  2 +-
 drivers/staging/lustre/lustre/lvfs/lvfs_linux.c    |  2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c    |  2 +-
 drivers/staging/rtl8188eu/core/rtw_recv.c          |  2 +-
 drivers/staging/rtl8188eu/hal/hal_com.c            |  4 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c       |  4 +-
 drivers/target/sbp/sbp_target.c                    |  2 +-
 drivers/tty/nozomi.c                               |  6 +--
 drivers/tty/serial/bfin_uart.c                     |  4 +-
 drivers/tty/serial/ip22zilog.c                     |  2 +-
 drivers/tty/serial/max310x.c                       |  2 +-
 drivers/tty/serial/pmac_zilog.c                    |  2 +-
 drivers/tty/serial/sunsab.c                        |  2 +-
 drivers/tty/serial/sunsu.c                         |  2 +-
 drivers/tty/serial/sunzilog.c                      |  6 +--
 drivers/tty/serial/ucc_uart.c                      |  2 +-
 drivers/usb/core/hcd.c                             |  2 +-
 drivers/usb/core/hub.c                             |  2 +-
 drivers/usb/dwc3/ep0.c                             |  6 +--
 drivers/usb/gadget/composite.c                     |  2 +-
 drivers/usb/gadget/dummy_hcd.c                     |  6 +--
 drivers/usb/gadget/goku_udc.c                      |  2 +-
 drivers/usb/gadget/net2280.c                       |  4 +-
 drivers/usb/gadget/rndis.c                         |  2 +-
 drivers/usb/gadget/tcm_usb_gadget.c                |  4 +-
 drivers/usb/host/ehci-dbg.c                        |  2 +-
 drivers/usb/host/fotg210-hcd.c                     |  2 +-
 drivers/usb/host/fusbh200-hcd.c                    |  2 +-
 drivers/usb/host/isp1362-hcd.c                     |  2 +-
 drivers/usb/host/ohci-dbg.c                        |  2 +-
 drivers/usb/host/sl811-hcd.c                       |  4 +-
 drivers/usb/host/uhci-pci.c                        |  2 +-
 drivers/usb/host/whci/hcd.c                        |  4 +-
 drivers/usb/musb/musb_core.c                       |  2 +-
 drivers/usb/musb/musb_dsps.c                       |  2 +-
 drivers/usb/musb/musb_gadget.c                     |  2 +-
 drivers/usb/musb/musb_host.c                       |  2 +-
 drivers/usb/phy/phy-twl4030-usb.c                  |  2 +-
 drivers/usb/phy/phy-ulpi-viewport.c                |  2 +-
 drivers/usb/wusbcore/cbaf.c                        |  4 +-
 drivers/usb/wusbcore/devconnect.c                  |  2 +-
 drivers/usb/wusbcore/wa-xfer.c                     |  4 +-
 drivers/uwb/i1480/dfu/mac.c                        |  2 +-
 drivers/uwb/ie.c                                   |  2 +-
 drivers/video/cfbimgblt.c                          |  2 +-
 drivers/video/cg14.c                               |  4 +-
 drivers/video/cg6.c                                |  2 +-
 drivers/video/exynos/exynos_mipi_dsi_common.c      |  2 +-
 drivers/video/fsl-diu-fb.c                         |  2 +-
 drivers/video/leo.c                                |  2 +-
 drivers/video/matrox/matroxfb_DAC1064.c            |  4 +-
 drivers/video/matrox/matroxfb_Ti3026.c             |  2 +-
 drivers/video/nvidia/nv_hw.c                       |  2 +-
 drivers/video/omap2/displays-new/panel-dsi-cm.c    |  2 +-
 drivers/video/omap2/dss/dispc.c                    |  2 +-
 drivers/video/omap2/dss/dsi.c                      |  2 +-
 drivers/video/sbuslib.c                            |  2 +-
 drivers/video/sysimgblt.c                          |  2 +-
 drivers/video/tcx.c                                |  4 +-
 drivers/video/vt8500lcdfb.c                        |  2 +-
 drivers/watchdog/riowd.c                           |  2 +-
 fs/9p/vfs_inode.c                                  |  2 +-
 fs/befs/btree.c                                    |  2 +-
 fs/btrfs/print-tree.c                              |  2 +-
 fs/dlm/rcom.c                                      |  2 +-
 fs/gfs2/glops.c                                    |  2 +-
 fs/gfs2/inode.c                                    |  2 +-
 fs/gfs2/recovery.c                                 |  2 +-
 fs/hpfs/buffer.c                                   |  2 +-
 fs/jffs2/wbuf.c                                    |  2 +-
 fs/lockd/clnt4xdr.c                                |  4 +-
 fs/lockd/clntxdr.c                                 |  4 +-
 fs/nfs/nfs2xdr.c                                   | 10 ++--
 fs/nfs/nfs3xdr.c                                   | 56 +++++++++++-----------
 fs/nfs/nfs4proc.c                                  |  2 +-
 fs/nfs/nfs4state.c                                 |  2 +-
 fs/nfs/super.c                                     |  6 +--
 fs/nfsd/nfs4callback.c                             |  2 +-
 fs/nfsd/nfs4state.c                                |  2 +-
 fs/nfsd/nfs4xdr.c                                  |  2 +-
 fs/notify/fanotify/fanotify.c                      |  2 +-
 fs/notify/inotify/inotify_fsnotify.c               |  2 +-
 fs/ntfs/lcnalloc.c                                 |  2 +-
 fs/ntfs/super.c                                    |  4 +-
 fs/ocfs2/cluster/quorum.c                          |  2 +-
 fs/ocfs2/dlmglue.c                                 |  2 +-
 fs/reiserfs/bitmap.c                               |  2 +-
 fs/ubifs/sb.c                                      |  2 +-
 kernel/audit_watch.c                               |  2 +-
 kernel/auditfilter.c                               |  4 +-
 kernel/res_counter.c                               |  2 +-
 kernel/smp.c                                       |  2 +-
 lib/decompress_bunzip2.c                           |  2 +-
 mm/memcontrol.c                                    |  2 +-
 mm/oom_kill.c                                      |  2 +-
 net/sunrpc/auth_gss/auth_gss.c                     |  2 +-
 scripts/conmakehash.c                              |  4 +-
 scripts/dtc/fdtdump.c                              |  2 +-
 security/apparmor/path.c                           |  2 +-
 security/selinux/hooks.c                           |  2 +-
 sound/oss/sb_ess.c                                 |  2 +-
 sound/pci/au88x0/au88x0_pcm.c                      |  2 +-
 sound/soc/atmel/atmel_ssc_dai.c                    |  2 +-
 sound/soc/codecs/ak4641.c                          |  2 +-
 sound/soc/codecs/mc13783.c                         |  2 +-
 sound/soc/codecs/tas5086.c                         |  2 +-
 sound/soc/codecs/twl6040.c                         |  4 +-
 sound/soc/fsl/fsl_spdif.c                          |  4 +-
 sound/soc/tegra/tegra20_i2s.c                      |  6 +--
 sound/soc/tegra/tegra20_spdif.c                    |  6 +--
 sound/soc/tegra/tegra30_ahub.c                     |  4 +-
 sound/soc/tegra/tegra30_i2s.c                      |  4 +-
 tools/lib/traceevent/kbuffer-parse.c               |  2 +-
 tools/perf/builtin-diff.c                          |  2 +-
 tools/perf/builtin-lock.c                          |  2 +-
 tools/perf/tests/code-reading.c                    |  2 +-
 tools/perf/util/trace-event-read.c                 |  2 +-
 tools/power/cpupower/utils/cpupower-info.c         |  2 +-
 tools/power/cpupower/utils/cpupower-set.c          |  2 +-
 .../cpupower/utils/idle_monitor/amd_fam14h_idle.c  |  2 +-
 .../cpupower/utils/idle_monitor/cpuidle_sysfs.c    |  6 +--
 .../cpupower/utils/idle_monitor/hsw_ext_idle.c     |  2 +-
 tools/power/cpupower/utils/idle_monitor/nhm_idle.c |  2 +-
 tools/power/cpupower/utils/idle_monitor/snb_idle.c |  2 +-
 tools/testing/selftests/ipc/msgque.c               |  6 +--
 tools/virtio/virtio-trace/trace-agent-ctl.c        |  2 +-
 263 files changed, 411 insertions(+), 413 deletions(-)

diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 1402fcc..b25c952 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -683,7 +683,7 @@ SYSCALL_DEFINE2(osf_proplist_syscall, enum pl_code, code,
 	default:
 		error = -EOPNOTSUPP;
 		break;
-	};
+	}
 	return error;
 }
 
diff --git a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c
index 79d69d7..d282d77 100644
--- a/arch/alpha/kernel/sys_eiger.c
+++ b/arch/alpha/kernel/sys_eiger.c
@@ -176,7 +176,7 @@ eiger_swizzle(struct pci_dev *dev, u8 *pinp)
 	   case 0x03: bridge_count = 2; break; /* 2 */
 	   case 0x07: bridge_count = 3; break; /* 3 */
 	   case 0x0f: bridge_count = 4; break; /* 4 */
-	};
+	}
 
 	slot = PCI_SLOT(dev->devfn);
 	while (dev->bus->self) {
diff --git a/arch/arm/kernel/psci.c b/arch/arm/kernel/psci.c
index 4693188..4322b0d 100644
--- a/arch/arm/kernel/psci.c
+++ b/arch/arm/kernel/psci.c
@@ -54,7 +54,7 @@ static int psci_to_linux_errno(int errno)
 		return -EINVAL;
 	case PSCI_RET_EPERM:
 		return -EPERM;
-	};
+	}
 
 	return -EINVAL;
 }
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index a5afcf7..393c92a 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -659,7 +659,7 @@ static int at91_gpio_show(struct seq_file *s, void *unused)
 	seq_printf(s, "Pin\t");
 	for (bank = 0; bank < gpio_banks; bank++) {
 		seq_printf(s, "PIO%c\t\t", 'A' + bank);
-	};
+	}
 	seq_printf(s, "\n\n");
 
 	/* print pin status */
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 9181a24..e8bb151 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -305,7 +305,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
 		post_div_table[2].div = 1;
 		video_div_table[1].div = 1;
 		video_div_table[2].div = 1;
-	};
+	}
 
 	/*                   type                               name         parent_name  base     div_mask */
 	clk[pll1_sys]      = imx_clk_pllv3(IMX_PLLV3_SYS,	"pll1_sys",	"osc", base,        0x7f);
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
index 14f73c4..a96b1e2 100644
--- a/arch/arm64/kernel/psci.c
+++ b/arch/arm64/kernel/psci.c
@@ -52,7 +52,7 @@ static int psci_to_linux_errno(int errno)
 		return -EINVAL;
 	case PSCI_RET_EPERM:
 		return -EPERM;
-	};
+	}
 
 	return -EINVAL;
 }
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index 877da19..17a5682c 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -1773,7 +1773,7 @@ static void get_aes_decrypt_key(unsigned char *dec_key, const unsigned  char *ke
 		break;
 	default:
 		panic("stream co-processor: bad aes key length in get_aes_decrypt_key\n");
-	};
+	}
 
 	/* Need to do host byte order correction here since key is byte oriented and the
 	 * kx algorithm is word (u32) oriented. */
@@ -3012,7 +3012,7 @@ static int cryptocop_ioctl_create_session(struct inode *inode, struct file *filp
 		default:
 			DEBUG_API(printk("create session, bad cipher algorithm %d\n", sop.cipher));
 			return -EINVAL;
-		};
+		}
 		DEBUG(printk("setting cipher transform %d\n", ti_cipher.alg));
 		copy_from_user(ti_cipher.key, sop.key, sop.keylen/8);
 		ti_cipher.keylen = sop.keylen;
diff --git a/arch/ia64/kvm/vcpu.c b/arch/ia64/kvm/vcpu.c
index 958815c..fc77c2e 100644
--- a/arch/ia64/kvm/vcpu.c
+++ b/arch/ia64/kvm/vcpu.c
@@ -2026,7 +2026,7 @@ void kvm_emulate(struct kvm_vcpu *vcpu, struct kvm_pt_regs *regs)
 		break;
 	default:
 		break;
-	};
+	}
 	/*Assume all status is NO_FAULT ?*/
 	if (status == IA64_NO_FAULT && cause != EVENT_RFI)
 		vcpu_increment_iip(vcpu);
diff --git a/arch/ia64/kvm/vtlb.c b/arch/ia64/kvm/vtlb.c
index a7869f8..4ab156f 100644
--- a/arch/ia64/kvm/vtlb.c
+++ b/arch/ia64/kvm/vtlb.c
@@ -489,7 +489,7 @@ void thash_purge_all(struct kvm_vcpu *v)
 		head->itir = 0;
 		head->next = 0;
 		head++;
-	};
+	}
 
 	head = vhpt->hash;
 	for (i = 0; i < vhpt->num; i++) {
@@ -498,7 +498,7 @@ void thash_purge_all(struct kvm_vcpu *v)
 		head->itir = 0;
 		head->next = 0;
 		head++;
-	};
+	}
 
 	local_flush_tlb_all();
 }
diff --git a/arch/m68k/sun3/prom/console.c b/arch/m68k/sun3/prom/console.c
index e9236437..f1bf92e 100644
--- a/arch/m68k/sun3/prom/console.c
+++ b/arch/m68k/sun3/prom/console.c
@@ -79,7 +79,7 @@ prom_query_input_device()
 		case PROMDEV_TTYB:	return PROMDEV_ITTYB;
 		default:
 			return PROMDEV_I_UNK;
-		};
+		}
 	case PROM_V3:
 	case PROM_P1275:
 		local_irq_save(flags);
@@ -103,7 +103,7 @@ prom_query_input_device()
 				return PROMDEV_ITTYB;
 		}
 		return PROMDEV_I_UNK;
-	};
+	}
 }
 #endif
 
@@ -125,7 +125,7 @@ prom_query_output_device()
 		case PROMDEV_SCREEN:	return PROMDEV_OSCREEN;
 		case PROMDEV_TTYA:	return PROMDEV_OTTYA;
 		case PROMDEV_TTYB:	return PROMDEV_OTTYB;
-		};
+		}
 		break;
 	case PROM_V2:
 	case PROM_V3:
@@ -160,10 +160,10 @@ prom_query_output_device()
 			switch(*romvec->pv_stdin) {
 			case PROMDEV_TTYA:	return PROMDEV_OTTYA;
 			case PROMDEV_TTYB:	return PROMDEV_OTTYB;
-			};
+			}
 		}
 		break;
-	};
+	}
 	return PROMDEV_O_UNK;
 }
 #endif
diff --git a/arch/mips/netlogic/xlr/fmn.c b/arch/mips/netlogic/xlr/fmn.c
index d428e84..7469243 100644
--- a/arch/mips/netlogic/xlr/fmn.c
+++ b/arch/mips/netlogic/xlr/fmn.c
@@ -103,7 +103,7 @@ static irqreturn_t fmn_message_handler(int irq, void *data)
 				mflags = nlm_cop2_enable_irqsave();
 			}
 		}
-	};
+	}
 	/* Enable message ring intr, to any thread in core */
 	nlm_fmn_setup_intr(irq, (1 << nlm_threads_per_core) - 1);
 	nlm_cop2_disable_irqrestore(mflags);
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c
index 4d1736f..86d9f3f 100644
--- a/arch/mips/oprofile/common.c
+++ b/arch/mips/oprofile/common.c
@@ -99,7 +99,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
 	case CPU_LOONGSON2:
 		lmodel = &op_model_loongson2_ops;
 		break;
-	};
+	}
 
 	if (!lmodel)
 		return -ENODEV;
diff --git a/arch/powerpc/boot/cuboot-c2k.c b/arch/powerpc/boot/cuboot-c2k.c
index e435949..b60032b 100644
--- a/arch/powerpc/boot/cuboot-c2k.c
+++ b/arch/powerpc/boot/cuboot-c2k.c
@@ -116,7 +116,7 @@ static void c2k_bridge_setup(u32 mem_size)
 						cpu->pci<bus> mem0 */
 		out_le32((u32 *)(bridge_base + MV64x60_CPU_BAR_ENABLE),
 			enables);
-	};
+	}
 }
 
 static void c2k_fixups(void)
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 55593ee..431ea4b 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -561,7 +561,7 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state stat
 		break;
 	default:
 		return -EINVAL;
-	};
+	}
 
 	return 0;
 }
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 5fe2842..3ba95a3 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -2701,7 +2701,7 @@ static void __init fixup_device_tree_efika_add_phy(void)
 				" 0x3 encode-int encode+"
 				" s\" interrupts\" property"
 			" finish-device");
-	};
+	}
 
 	/* Check for a PHY device node - if missing then create one and
 	 * give it's phandle to the ethernet node */
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 17722d8..c844ecc 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -621,7 +621,7 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
 
 		kvmppc_set_exit_type(vcpu, EMULATED_MTMSRWE_EXITS);
 		r = 1;
-	};
+	}
 
 	return r;
 }
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index 5606fe3..25150c5 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -614,7 +614,7 @@ static dma_addr_t ps3_ioc0_map_page(struct device *_dev, struct page *page,
 	default:
 		/* not happned */
 		BUG();
-	};
+	}
 	result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size,
 			     &bus_addr, iopte_flag);
 
@@ -772,7 +772,7 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
 		break;
 	default:
 		BUG();
-	};
+	}
 
 	dev->core.of_node = NULL;
 	set_dev_node(&dev->core, 0);
diff --git a/arch/powerpc/sysdev/tsi108_dev.c b/arch/powerpc/sysdev/tsi108_dev.c
index 1fd0717..1f1af12 100644
--- a/arch/powerpc/sysdev/tsi108_dev.c
+++ b/arch/powerpc/sysdev/tsi108_dev.c
@@ -51,7 +51,7 @@ phys_addr_t get_csrbase(void)
 		const void *prop = of_get_property(tsi, "reg", &size);
 		tsi108_csr_base = of_translate_address(tsi, prop);
 		of_node_put(tsi);
-	};
+	}
 	return tsi108_csr_base;
 }
 
diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c
index 519bba7..755c0f4 100644
--- a/arch/s390/mm/extmem.c
+++ b/arch/s390/mm/extmem.c
@@ -158,7 +158,7 @@ dcss_mkname(char *name, char *dcss_name)
 		if (name[i] == '\0')
 			break;
 		dcss_name[i] = toupper(name[i]);
-	};
+	}
 	for (; i < 8; i++)
 		dcss_name[i] = ' ';
 	ASCEBC(dcss_name, 8);
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index 4118f9f..c07309a 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -2365,7 +2365,7 @@ static void nhmex_rbox_alter_er(struct intel_uncore_box *box, struct perf_event
 		/* shift the 0~7 bits to the 8~15 bits */
 		reg1->config <<= 8;
 		break;
-	};
+	}
 }
 
 /*
@@ -2507,7 +2507,7 @@ static int nhmex_rbox_hw_config(struct intel_uncore_box *box, struct perf_event
 		hwc->config |= event->attr.config & (~0ULL << 32);
 		reg2->config = event->attr.config2;
 		break;
-	};
+	}
 	return 0;
 }
 
@@ -2545,7 +2545,7 @@ static void nhmex_rbox_msr_enable_event(struct intel_uncore_box *box, struct per
 		wrmsrl(NHMEX_R_MSR_PORTN_XBR_SET2_MATCH(port), reg1->config);
 		wrmsrl(NHMEX_R_MSR_PORTN_XBR_SET2_MASK(port), reg2->config);
 		break;
-	};
+	}
 
 	wrmsrl(hwc->config_base, NHMEX_PMON_CTL_EN_BIT0 |
 		(hwc->config & NHMEX_R_PMON_CTL_EV_SEL_MASK));
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index ac33d5f..d331ada 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -437,7 +437,7 @@ int af_alg_wait_for_completion(int err, struct af_alg_completion *completion)
 		INIT_COMPLETION(completion->completion);
 		err = completion->err;
 		break;
-	};
+	}
 
 	return err;
 }
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c
index 2437373..9e4dd67 100644
--- a/drivers/acpi/acpica/nsalloc.c
+++ b/drivers/acpi/acpica/nsalloc.c
@@ -316,7 +316,7 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
 		node_to_delete = next_node;
 		next_node = next_node->peer;
 		acpi_ns_delete_node(node_to_delete);
-	};
+	}
 
 	/* Clear the parent's child pointer */
 
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 26311f2..f2cf2e0 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -704,7 +704,7 @@ static int __erst_read_from_storage(u64 record_id, u64 offset)
 			break;
 		if (erst_timedout(&timeout, SPIN_UNIT))
 			return -EIO;
-	};
+	}
 	rc = apei_exec_run(&ctx, ACPI_ERST_GET_COMMAND_STATUS);
 	if (rc)
 		return rc;
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index ba0d8a2..d535ca0 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1678,7 +1678,7 @@ static int __init bfin_atapi_init(void)
 		break;
 	default:
 		bfin_port_info[0].udma_mask = ATA_UDMA5;
-	};
+	}
 
 	return platform_driver_register(&bfin_atapi_driver);
 }
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index b41c948..435790f 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1081,7 +1081,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
 					RC_FLAGS_BFPS_BFP * bfp |
 					RC_FLAGS_RXBM_PSB, 0, 0);
 			break;
-		};
+		}
 		if (IS_FS50 (dev)) {
 			submit_command (dev, &dev->hp_txq, 
 					QE_CMD_REG_WR | QE_CMD_IMM_INQ,
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
index 1dc0519..7081352 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -2579,7 +2579,7 @@ static int hrz_getsockopt (struct atm_vcc * atm_vcc, int level, int optname,
 //	  break;
 	default:
 	  return -ENOPROTOOPT;
-      };
+      }
       break;
   }
   return -EINVAL;
@@ -2598,7 +2598,7 @@ static int hrz_setsockopt (struct atm_vcc * atm_vcc, int level, int optname,
 //	  break;
 	default:
 	  return -ENOPROTOOPT;
-      };
+      }
       break;
   }
   return -EINVAL;
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 4ff85b8..b67f890 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -911,9 +911,7 @@ struct dos_header {
 ;	c = *data++ + crchi;
 ;	crchi = (@ c) >> 8 + crclo;
 ;	crclo = @ c;
-;   }
-;
-; Remember, + is done with EOR, the @ operator is in two tables (high
+;   } Remember, + is done with EOR, the @ operator is in two tables (high
 ; and low byte separately), which is calculated as
 ;
 ;      $1021 * (c & $F0)
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index c24379f..51b4d6a 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -759,7 +759,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
 		start_new_tl_epoch(mdev->tconn);
 		mod_rq_state(req, m, 0, RQ_NET_OK|RQ_NET_DONE);
 		break;
-	};
+	}
 
 	return rv;
 }
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index 5814deb..3c38717 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -519,7 +519,7 @@ static int generic_request(struct vdc_port *port, u8 op, void *buf, int len)
 	case VD_OP_SET_EFI:
 		return -EOPNOTSUPP;
 		break;
-	};
+	}
 
 	map_perm |= LDC_MAP_SHADOW | LDC_MAP_DIRECT | LDC_MAP_IO;
 
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index 995aee9..2c31ef8 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -495,7 +495,7 @@ static int bfusb_send_frame(struct sk_buff *skb)
 	case HCI_SCODATA_PKT:
 		hdev->stat.sco_tx++;
 		break;
-	};
+	}
 
 	/* Prepend skb with frame type */
 	memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index a1aaa3b..8a0f1cc 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -439,7 +439,7 @@ static int bt3c_hci_send_frame(struct sk_buff *skb)
 	case HCI_SCODATA_PKT:
 		hdev->stat.sco_tx++;
 		break;
-	};
+	}
 
 	/* Prepend skb with frame type */
 	memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index 33f3a69..adb6b5a 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -412,7 +412,7 @@ static int dtl1_hci_send_frame(struct sk_buff *skb)
 		break;
 	default:
 		return -EILSEQ;
-	};
+	}
 
 	nsh.zero = 0;
 	nsh.len = skb->len;
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index 9b89ff4..17423bd 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -372,7 +372,7 @@ static int omap_rng_probe(struct platform_device *pdev)
 	if (!priv) {
 		dev_err(&pdev->dev, "could not allocate memory\n");
 		return -ENOMEM;
-	};
+	}
 
 	omap_rng_ops.priv = (unsigned long)priv;
 	platform_set_drvdata(pdev, priv);
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index a004769..c0dd795 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1520,7 +1520,7 @@ static struct clk *__clk_init_parent(struct clk *clk)
 			"%s: multi-parent clocks must implement .get_parent\n",
 			__func__);
 		goto out;
-	};
+	}
 
 	/*
 	 * Do our best to cache parent clocks in clk->parents.  This prevents
diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c
index 25ceccf..e655cf0 100644
--- a/drivers/clk/mvebu/common.c
+++ b/drivers/clk/mvebu/common.c
@@ -77,7 +77,7 @@ void __init mvebu_coreclk_setup(struct device_node *np,
 		clk_data.clks[2+n] = clk_register_fixed_factor(NULL, rclk_name,
 				       cpuclk_name, 0, mult, div);
 		WARN_ON(IS_ERR(clk_data.clks[2+n]));
-	};
+	}
 
 	/* SAR register isn't needed anymore */
 	iounmap(base);
diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
index 529e11d..81e6d2f 100644
--- a/drivers/clk/samsung/clk-pll.c
+++ b/drivers/clk/samsung/clk-pll.c
@@ -375,7 +375,7 @@ static int samsung_pll45xx_set_rate(struct clk_hw *hw, unsigned long drate,
 		break;
 	default:
 		break;
-	};
+	}
 
 	/* Set new configuration. */
 	__raw_writel(con1, pll->con_reg + 0x4);
diff --git a/drivers/clocksource/metag_generic.c b/drivers/clocksource/metag_generic.c
index 9e4db41..b481895 100644
--- a/drivers/clocksource/metag_generic.c
+++ b/drivers/clocksource/metag_generic.c
@@ -72,7 +72,7 @@ static void metag_timer_set_mode(enum clock_event_mode mode,
 	case CLOCK_EVT_MODE_UNUSED:
 		WARN_ON(1);
 		break;
-	};
+	}
 }
 
 static cycle_t metag_clocksource_read(struct clocksource *cs)
diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c
index 4ada1cc..387187e 100644
--- a/drivers/cpufreq/longhaul.c
+++ b/drivers/cpufreq/longhaul.c
@@ -874,7 +874,7 @@ static int longhaul_cpu_init(struct cpufreq_policy *policy)
 	case TYPE_POWERSAVER:
 		printk(KERN_CONT "Powersaver supported.\n");
 		break;
-	};
+	}
 
 	/* Doesn't hurt */
 	longhaul_setup_southbridge();
diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c
index d81c4e5..bad124c 100644
--- a/drivers/cpufreq/pcc-cpufreq.c
+++ b/drivers/cpufreq/pcc-cpufreq.c
@@ -273,7 +273,7 @@ static int pcc_get_offset(int cpu)
 	if (!pccp || pccp->type != ACPI_TYPE_PACKAGE) {
 		ret = -ENODEV;
 		goto out_free;
-	};
+	}
 
 	offset = &(pccp->package.elements[0]);
 	if (!offset || offset->type != ACPI_TYPE_INTEGER) {
diff --git a/drivers/cpufreq/speedstep-lib.c b/drivers/cpufreq/speedstep-lib.c
index 7047821..2a4a04a 100644
--- a/drivers/cpufreq/speedstep-lib.c
+++ b/drivers/cpufreq/speedstep-lib.c
@@ -239,7 +239,7 @@ unsigned int speedstep_get_frequency(enum speedstep_processor processor)
 		return pentium3_get_frequency(processor);
 	default:
 		return 0;
-	};
+	}
 	return 0;
 }
 EXPORT_SYMBOL_GPL(speedstep_get_frequency);
diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
index 977cfb3..df84d1b 100644
--- a/drivers/gpu/drm/ast/ast_post.c
+++ b/drivers/gpu/drm/ast/ast_post.c
@@ -1196,7 +1196,7 @@ static void get_ddr3_info(struct ast_private *ast, struct ast2300_dram_param *pa
 	case AST_DRAM_4Gx16:
 		param->dram_config = 0x133;
 		break;
-	}; /* switch size */
+	} /* switch size */
 
 	switch (param->vram_size) {
 	default:
@@ -1567,7 +1567,7 @@ static void get_ddr2_info(struct ast_private *ast, struct ast2300_dram_param *pa
 	case AST_DRAM_4Gx16:
 		param->dram_config = 0x123;
 		break;
-	}; /* switch size */
+	} /* switch size */
 
 	switch (param->vram_size) {
 	default:
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index 3271fd4..35ddd80 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -605,7 +605,7 @@ static enum g2d_reg_type g2d_get_reg_type(int reg_offset)
 		reg_type = REG_TYPE_NONE;
 		DRM_ERROR("Unknown register offset![%d]\n", reg_offset);
 		break;
-	};
+	}
 
 	return reg_type;
 }
diff --git a/drivers/gpu/drm/i915/dvo_ch7xxx.c b/drivers/gpu/drm/i915/dvo_ch7xxx.c
index af42e94..e638363 100644
--- a/drivers/gpu/drm/i915/dvo_ch7xxx.c
+++ b/drivers/gpu/drm/i915/dvo_ch7xxx.c
@@ -160,7 +160,7 @@ static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
 	if (i2c_transfer(adapter, msgs, 2) == 2) {
 		*ch = in_buf[0];
 		return true;
-	};
+	}
 
 	if (!ch7xxx->quiet) {
 		DRM_DEBUG_KMS("Unable to read register 0x%02x from %s:%02x.\n",
diff --git a/drivers/gpu/drm/i915/dvo_ivch.c b/drivers/gpu/drm/i915/dvo_ivch.c
index baaf65b..c34a2c72 100644
--- a/drivers/gpu/drm/i915/dvo_ivch.c
+++ b/drivers/gpu/drm/i915/dvo_ivch.c
@@ -195,7 +195,7 @@ static bool ivch_read(struct intel_dvo_device *dvo, int addr, uint16_t *data)
 	if (i2c_transfer(adapter, msgs, 3) == 3) {
 		*data = (in_buf[1] << 8) | in_buf[0];
 		return true;
-	};
+	}
 
 	if (!priv->quiet) {
 		DRM_DEBUG_KMS("Unable to read register 0x%02x from "
diff --git a/drivers/gpu/drm/i915/dvo_ns2501.c b/drivers/gpu/drm/i915/dvo_ns2501.c
index c4a255b..30473c9 100644
--- a/drivers/gpu/drm/i915/dvo_ns2501.c
+++ b/drivers/gpu/drm/i915/dvo_ns2501.c
@@ -164,7 +164,7 @@ static bool ns2501_readb(struct intel_dvo_device *dvo, int addr, uint8_t * ch)
 	if (i2c_transfer(adapter, msgs, 2) == 2) {
 		*ch = in_buf[0];
 		return true;
-	};
+	}
 
 	if (!ns->quiet) {
 		DRM_DEBUG_KMS
diff --git a/drivers/gpu/drm/i915/dvo_sil164.c b/drivers/gpu/drm/i915/dvo_sil164.c
index 4debd32..e4fa67a 100644
--- a/drivers/gpu/drm/i915/dvo_sil164.c
+++ b/drivers/gpu/drm/i915/dvo_sil164.c
@@ -93,7 +93,7 @@ static bool sil164_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
 	if (i2c_transfer(adapter, msgs, 2) == 2) {
 		*ch = in_buf[0];
 		return true;
-	};
+	}
 
 	if (!sil->quiet) {
 		DRM_DEBUG_KMS("Unable to read register 0x%02x from %s:%02x.\n",
diff --git a/drivers/gpu/drm/i915/dvo_tfp410.c b/drivers/gpu/drm/i915/dvo_tfp410.c
index e17f1b0..52e6fd0 100644
--- a/drivers/gpu/drm/i915/dvo_tfp410.c
+++ b/drivers/gpu/drm/i915/dvo_tfp410.c
@@ -118,7 +118,7 @@ static bool tfp410_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
 	if (i2c_transfer(adapter, msgs, 2) == 2) {
 		*ch = in_buf[0];
 		return true;
-	};
+	}
 
 	if (!tfp->quiet) {
 		DRM_DEBUG_KMS("Unable to read register 0x%02x from %s:%02x.\n",
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
index 03de517..431d963 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
@@ -850,7 +850,7 @@ nv50_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
 		nv_engine(priv)->sclass = nvaf_graph_sclass;
 		break;
 
-	};
+	}
 
 	/* unfortunate hw bug workaround... */
 	if (nv_device(priv)->chipset != 0x50 &&
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 061b227..aba77d2 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -612,7 +612,7 @@ static bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
 	    vhdr->DeviceID != rdev->pdev->device) {
 		DRM_INFO("ACPI VFCT table is not for this card\n");
 		goto out_unmap;
-	};
+	}
 
 	if (vfct->VBIOSImageOffset + sizeof(VFCT_IMAGE_HEADER) + vhdr->ImageLength > tbl_size) {
 		DRM_ERROR("ACPI VFCT image truncated\n");
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
index 3a6d9ef..3588f72 100644
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -616,7 +616,7 @@ static struct adm1026_data *adm1026_update_device(struct device *dev)
 		data->gpio = gpio;
 
 		data->last_reading = jiffies;
-	}; /* last_reading */
+	} /* last_reading */
 
 	if (!data->valid ||
 	    time_after(jiffies, data->last_config + ADM1026_CONFIG_INTERVAL)) {
@@ -700,7 +700,7 @@ static struct adm1026_data *adm1026_update_device(struct device *dev)
 		}
 
 		data->last_config = jiffies;
-	}; /* last_config */
+	} /* last_config */
 
 	data->valid = 1;
 	mutex_unlock(&data->update_lock);
@@ -1791,7 +1791,7 @@ static int adm1026_detect(struct i2c_client *client,
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
 		/* We need to be able to do byte I/O */
 		return -ENODEV;
-	};
+	}
 
 	/* Now, we do the remaining detection. */
 
diff --git a/drivers/hwmon/asc7621.c b/drivers/hwmon/asc7621.c
index 3ad9d84..8d9f2a0 100644
--- a/drivers/hwmon/asc7621.c
+++ b/drivers/hwmon/asc7621.c
@@ -138,7 +138,7 @@ static inline u8 read_byte(struct i2c_client *client, u8 reg)
 		dev_err(&client->dev,
 			"Unable to read from register 0x%02x.\n", reg);
 		return 0;
-	};
+	}
 	return res & 0xff;
 }
 
@@ -149,7 +149,7 @@ static inline int write_byte(struct i2c_client *client, u8 reg, u8 data)
 		dev_err(&client->dev,
 			"Unable to write value 0x%02x to register 0x%02x.\n",
 			data, reg);
-	};
+	}
 	return res;
 }
 
@@ -1030,7 +1030,7 @@ static struct asc7621_data *asc7621_update_device(struct device *dev)
 			}
 		}
 		data->last_high_reading = jiffies;
-	};			/* last_reading */
+	}			/* last_reading */
 
 	/* Read all the low priority registers. */
 
@@ -1044,7 +1044,7 @@ static struct asc7621_data *asc7621_update_device(struct device *dev)
 			}
 		}
 		data->last_low_reading = jiffies;
-	};			/* last_reading */
+	}			/* last_reading */
 
 	data->valid = 1;
 
@@ -1084,11 +1084,11 @@ static void asc7621_init_client(struct i2c_client *client)
 		dev_err(&client->dev,
 			"Client (%d,0x%02x) config is locked.\n",
 			i2c_adapter_id(client->adapter), client->addr);
-	};
+	}
 	if (!(value & 0x04)) {
 		dev_err(&client->dev, "Client (%d,0x%02x) is not ready.\n",
 			i2c_adapter_id(client->adapter), client->addr);
-	};
+	}
 
 /*
  * Start monitoring
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index dabb88b..fca1f7e 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -161,7 +161,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
 		if ((stat & ATA_BUSY) == 0 || retries-- == 0)
 			break;
 		udelay(10);
-	};
+	}
 
 	if (!OK_STAT(stat, ATA_DRDY, BAD_STAT)) {
 		if (custom && tf->command == ATA_CMD_SET_MULTI) {
diff --git a/drivers/infiniband/hw/amso1100/c2_ae.c b/drivers/infiniband/hw/amso1100/c2_ae.c
index d5d1929..cedda25 100644
--- a/drivers/infiniband/hw/amso1100/c2_ae.c
+++ b/drivers/infiniband/hw/amso1100/c2_ae.c
@@ -141,7 +141,7 @@ static const char *to_qp_state_str(int state)
 		return "C2_QP_STATE_ERROR";
 	default:
 		return "<invalid QP state>";
-	};
+	}
 }
 
 void c2_ae_event(struct c2_dev *c2dev, u32 mq_index)
diff --git a/drivers/infiniband/hw/mthca/mthca_eq.c b/drivers/infiniband/hw/mthca/mthca_eq.c
index 7c9d35f..6902017 100644
--- a/drivers/infiniband/hw/mthca/mthca_eq.c
+++ b/drivers/infiniband/hw/mthca/mthca_eq.c
@@ -357,7 +357,7 @@ static int mthca_eq_int(struct mthca_dev *dev, struct mthca_eq *eq)
 			mthca_warn(dev, "Unhandled event %02x(%02x) on EQ %d\n",
 				   eqe->type, eqe->subtype, eq->eqn);
 			break;
-		};
+		}
 
 		set_eqe_hw(eqe);
 		++eq->cons_index;
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index 4ed8235..50219ab 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -150,7 +150,7 @@ enum ib_qp_state get_ibqp_state(enum ocrdma_qp_state qps)
 		return IB_QPS_SQE;
 	case OCRDMA_QPS_ERR:
 		return IB_QPS_ERR;
-	};
+	}
 	return IB_QPS_ERR;
 }
 
@@ -171,7 +171,7 @@ static enum ocrdma_qp_state get_ocrdma_qp_state(enum ib_qp_state qps)
 		return OCRDMA_QPS_SQE;
 	case IB_QPS_ERR:
 		return OCRDMA_QPS_ERR;
-	};
+	}
 	return OCRDMA_QPS_ERR;
 }
 
@@ -1982,7 +1982,7 @@ int ocrdma_mbx_create_qp(struct ocrdma_qp *qp, struct ib_qp_init_attr *attrs,
 		break;
 	default:
 		return -EINVAL;
-	};
+	}
 
 	cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_CREATE_QP, sizeof(*cmd));
 	if (!cmd)
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index 56e0049..0ce7674 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -531,7 +531,7 @@ static void ocrdma_event_handler(struct ocrdma_dev *dev, u32 event)
 	case BE_DEV_DOWN:
 		ocrdma_close(dev);
 		break;
-	};
+	}
 }
 
 static struct ocrdma_driver ocrdma_drv = {
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 6e982bb..69f1d12 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -141,7 +141,7 @@ static inline void get_link_speed_and_width(struct ocrdma_dev *dev,
 		/* Unsupported */
 		*ib_speed = IB_SPEED_SDR;
 		*ib_width = IB_WIDTH_1X;
-	};
+	}
 }
 
 
@@ -2331,7 +2331,7 @@ static enum ib_wc_status ocrdma_to_ibwc_err(u16 status)
 	default:
 		ibwc_status = IB_WC_GENERAL_ERR;
 		break;
-	};
+	}
 	return ibwc_status;
 }
 
@@ -2370,7 +2370,7 @@ static void ocrdma_update_wc(struct ocrdma_qp *qp, struct ib_wc *ibwc,
 		pr_err("%s() invalid opcode received = 0x%x\n",
 		       __func__, hdr->cw & OCRDMA_WQE_OPCODE_MASK);
 		break;
-	};
+	}
 }
 
 static void ocrdma_set_cqe_status_flushed(struct ocrdma_qp *qp,
diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c
index 1443532..345d91d 100644
--- a/drivers/input/touchscreen/mms114.c
+++ b/drivers/input/touchscreen/mms114.c
@@ -395,12 +395,12 @@ static struct mms114_platform_data *mms114_parse_dt(struct device *dev)
 	if (of_property_read_u32(np, "x-size", &pdata->x_size)) {
 		dev_err(dev, "failed to get x-size property\n");
 		return NULL;
-	};
+	}
 
 	if (of_property_read_u32(np, "y-size", &pdata->y_size)) {
 		dev_err(dev, "failed to get y-size property\n");
 		return NULL;
-	};
+	}
 
 	of_property_read_u32(np, "contact-threshold",
 				&pdata->contact_threshold);
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
index c857c30..bc77425 100644
--- a/drivers/iommu/fsl_pamu_domain.c
+++ b/drivers/iommu/fsl_pamu_domain.c
@@ -860,7 +860,7 @@ static int fsl_pamu_set_domain_attr(struct iommu_domain *domain,
 		pr_debug("Unsupported attribute type\n");
 		ret = -EINVAL;
 		break;
-	};
+	}
 
 	return ret;
 }
@@ -887,7 +887,7 @@ static int fsl_pamu_get_domain_attr(struct iommu_domain *domain,
 		pr_debug("Unsupported attribute type\n");
 		ret = -EINVAL;
 		break;
-	};
+	}
 
 	return ret;
 }
diff --git a/drivers/isdn/hisax/netjet.c b/drivers/isdn/hisax/netjet.c
index 233e432..6912303 100644
--- a/drivers/isdn/hisax/netjet.c
+++ b/drivers/isdn/hisax/netjet.c
@@ -332,7 +332,7 @@ static int make_raw_data_56k(struct BCState *bcs) {
 			bitcnt = 0;
 		}
 		val >>= 1;
-	};
+	}
 	fcs = PPP_INITFCS;
 	for (i = 0; i < bcs->tx_skb->len; i++) {
 		val = bcs->tx_skb->data[i];
diff --git a/drivers/isdn/hisax/q931.c b/drivers/isdn/hisax/q931.c
index af1b020..4dd88a5 100644
--- a/drivers/isdn/hisax/q931.c
+++ b/drivers/isdn/hisax/q931.c
@@ -598,7 +598,7 @@ prcalling(char *dest, u_char *p)
 		dp += prbits(dp, *++p, 8, 8);
 		*dp++ = '\n';
 		l--;
-	};
+	}
 	p++;
 
 	dp += sprintf(dp, "    number digits ");
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 8b98d53..8f5a2bc 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -1857,7 +1857,7 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb)
 				   if (cprot->pops->data_ind) {
 					   cprot->pops->data_ind(cprot, skb);
 					   return;
-				   };
+				   }
 #endif /* CONFIG_ISDN_X25 */
 		printk(KERN_WARNING "%s: unknown encapsulation, dropping\n",
 		       lp->netdev->dev->name);
diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c
index 1eaf622..75f1d4d 100644
--- a/drivers/isdn/pcbit/drv.c
+++ b/drivers/isdn/pcbit/drv.c
@@ -284,7 +284,7 @@ static int pcbit_command(isdn_ctrl *ctl)
 	default:
 		printk(KERN_DEBUG "pcbit_command: unknown command\n");
 		break;
-	};
+	}
 
 	return 0;
 }
@@ -968,7 +968,7 @@ static int pcbit_ioctl(isdn_ctrl *ctl)
 	default:
 		printk("error: unknown ioctl\n");
 		break;
-	};
+	}
 	return 0;
 }
 
diff --git a/drivers/media/common/b2c2/flexcop-sram.c b/drivers/media/common/b2c2/flexcop-sram.c
index f2199e4..185c285 100644
--- a/drivers/media/common/b2c2/flexcop-sram.c
+++ b/drivers/media/common/b2c2/flexcop-sram.c
@@ -85,7 +85,7 @@ static void flexcop_sram_write(struct adapter *adapter, u32 bank, u32 addr, u8 *
 		while (((read_reg_dw(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) {
 			mdelay(1);
 			retries--;
-		};
+		}
 
 		if (retries == 0)
 			printk("%s: SRAM timeout\n", __func__);
@@ -110,7 +110,7 @@ static void flex_sram_read(struct adapter *adapter, u32 bank, u32 addr, u8 *buf,
 		while (((read_reg_dw(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) {
 			mdelay(1);
 			retries--;
-		};
+		}
 
 		if (retries == 0)
 			printk("%s: SRAM timeout\n", __func__);
@@ -122,7 +122,7 @@ static void flex_sram_read(struct adapter *adapter, u32 bank, u32 addr, u8 *buf,
 		while (((read_reg_dw(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) {
 			mdelay(1);
 			retries--;
-		};
+		}
 
 		if (retries == 0)
 			printk("%s: SRAM timeout\n", __func__);
diff --git a/drivers/media/dvb-frontends/cx24110.c b/drivers/media/dvb-frontends/cx24110.c
index 0cd6927..95b981c 100644
--- a/drivers/media/dvb-frontends/cx24110.c
+++ b/drivers/media/dvb-frontends/cx24110.c
@@ -378,7 +378,7 @@ static int cx24110_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag
 		return cx24110_writereg(state,0x76,(cx24110_readreg(state,0x76)&0x3b)|0x40);
 	default:
 		return -EINVAL;
-	};
+	}
 }
 
 static int cx24110_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst)
diff --git a/drivers/media/dvb-frontends/cx24123.c b/drivers/media/dvb-frontends/cx24123.c
index a771da3..72fb583 100644
--- a/drivers/media/dvb-frontends/cx24123.c
+++ b/drivers/media/dvb-frontends/cx24123.c
@@ -739,7 +739,7 @@ static int cx24123_set_voltage(struct dvb_frontend *fe,
 		return 0;
 	default:
 		return -EINVAL;
-	};
+	}
 
 	return 0;
 }
diff --git a/drivers/media/dvb-frontends/tda8083.c b/drivers/media/dvb-frontends/tda8083.c
index 9d08350..69e62f4 100644
--- a/drivers/media/dvb-frontends/tda8083.c
+++ b/drivers/media/dvb-frontends/tda8083.c
@@ -189,7 +189,7 @@ static int tda8083_set_tone (struct tda8083_state* state, fe_sec_tone_mode_t ton
 		return tda8083_writereg (state, 0x29, 0x80);
 	default:
 		return -EINVAL;
-	};
+	}
 }
 
 static int tda8083_set_voltage (struct tda8083_state* state, fe_sec_voltage_t voltage)
@@ -201,7 +201,7 @@ static int tda8083_set_voltage (struct tda8083_state* state, fe_sec_voltage_t vo
 		return tda8083_writereg (state, 0x20, 0x11);
 	default:
 		return -EINVAL;
-	};
+	}
 }
 
 static int tda8083_send_diseqc_burst (struct tda8083_state* state, fe_sec_mini_cmd_t burst)
diff --git a/drivers/media/i2c/soc_camera/ov9640.c b/drivers/media/i2c/soc_camera/ov9640.c
index e968c3f..bc74224 100644
--- a/drivers/media/i2c/soc_camera/ov9640.c
+++ b/drivers/media/i2c/soc_camera/ov9640.c
@@ -371,7 +371,7 @@ static void ov9640_alter_regs(enum v4l2_mbus_pixelcode code,
 		alt->com13	= OV9640_COM13_RGB_AVG;
 		alt->com15	= OV9640_COM15_RGB_565;
 		break;
-	};
+	}
 }
 
 /* Setup registers according to resolution and color encoding */
diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c
index d2e6cba..f3c6136 100644
--- a/drivers/media/platform/exynos4-is/fimc-isp.c
+++ b/drivers/media/platform/exynos4-is/fimc-isp.c
@@ -511,7 +511,7 @@ static int __ctrl_set_metering(struct fimc_is *is, unsigned int value)
 		break;
 	default:
 		return -EINVAL;
-	};
+	}
 
 	__is_set_isp_metering(is, IS_METERING_CONFIG_CMD, val);
 	return 0;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c
index ad4f1df..9a6efd6 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c
@@ -111,7 +111,7 @@ static int s5p_mfc_open_inst_cmd_v5(struct s5p_mfc_ctx *ctx)
 		break;
 	default:
 		h2r_args.arg[0] = S5P_FIMV_CODEC_NONE;
-	};
+	}
 	h2r_args.arg[1] = 0; /* no crc & no pixelcache */
 	h2r_args.arg[2] = ctx->ctx.ofs;
 	h2r_args.arg[3] = ctx->ctx.size;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
index db796c8..ec1a594 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
@@ -113,7 +113,7 @@ static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx)
 		break;
 	default:
 		codec_type = S5P_FIMV_CODEC_NONE_V6;
-	};
+	}
 	mfc_write(dev, codec_type, S5P_FIMV_CODEC_TYPE_V6);
 	mfc_write(dev, ctx->ctx.dma, S5P_FIMV_CONTEXT_MEM_ADDR_V6);
 	mfc_write(dev, ctx->ctx.size, S5P_FIMV_CONTEXT_MEM_SIZE_V6);
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c
index 368582b..58ec7bb 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c
@@ -1582,7 +1582,7 @@ static int s5p_mfc_get_int_reason_v5(struct s5p_mfc_dev *dev)
 		break;
 	default:
 		reason = S5P_MFC_R2H_CMD_EMPTY;
-	};
+	}
 	return reason;
 }
 
diff --git a/drivers/media/platform/s5p-tv/mixer_grp_layer.c b/drivers/media/platform/s5p-tv/mixer_grp_layer.c
index b93a21f..74344c7 100644
--- a/drivers/media/platform/s5p-tv/mixer_grp_layer.c
+++ b/drivers/media/platform/s5p-tv/mixer_grp_layer.c
@@ -226,7 +226,7 @@ static void mxr_graph_fix_geometry(struct mxr_layer *layer,
 			src->width + src->x_offset, 32767);
 		src->full_height = clamp_val(src->full_height,
 			src->height + src->y_offset, 2047);
-	};
+	}
 }
 
 /* PUBLIC API */
diff --git a/drivers/media/platform/s5p-tv/mixer_vp_layer.c b/drivers/media/platform/s5p-tv/mixer_vp_layer.c
index 3d13a63..c9388c4 100644
--- a/drivers/media/platform/s5p-tv/mixer_vp_layer.c
+++ b/drivers/media/platform/s5p-tv/mixer_vp_layer.c
@@ -197,7 +197,7 @@ static void mxr_vp_fix_geometry(struct mxr_layer *layer,
 			ALIGN(src->width + src->x_offset, 8), 8192U);
 		src->full_height = clamp(src->full_height,
 			src->height + src->y_offset, 8192U);
-	};
+	}
 }
 
 /* PUBLIC API */
diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c
index 5c57e5b..4a7a1cc 100644
--- a/drivers/media/radio/si470x/radio-si470x-common.c
+++ b/drivers/media/radio/si470x/radio-si470x-common.c
@@ -254,7 +254,7 @@ static unsigned int si470x_get_step(struct si470x_device *radio)
 	/* 2:  50 kHz */
 	default:
 		return 50 * 16;
-	};
+	}
 }
 
 
diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c b/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c
index 515a9e1..28a64b8 100644
--- a/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c
+++ b/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c
@@ -202,7 +202,7 @@ static int st6422_init(struct sd *sd)
 
 		{ 0x143f, 0x01 },	/* commit settings */
 
-	};
+	}
 
 	for (i = 0; i < ARRAY_SIZE(st6422_bridge_init) && !err; i++) {
 		err = stv06xx_write_bridge(sd, st6422_bridge_init[i][0],
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index c3f0803..df3a67b 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -583,7 +583,7 @@ const s64 const *v4l2_ctrl_get_int_menu(u32 id, u32 *len)
 	default:
 		*len = 0;
 		return NULL;
-	};
+	}
 }
 EXPORT_SYMBOL(v4l2_ctrl_get_int_menu);
 
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index f4176ca..c1d143d 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -280,7 +280,7 @@ static const char *mspro_block_attr_name(unsigned char tag)
 		return "attr_devinfo";
 	default:
 		return NULL;
-	};
+	}
 }
 
 typedef ssize_t (*sysfs_show_t)(struct device *dev,
diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c
index aeabaa5..3895e3a 100644
--- a/drivers/memstick/host/jmb38x_ms.c
+++ b/drivers/memstick/host/jmb38x_ms.c
@@ -755,7 +755,7 @@ static int jmb38x_ms_set_param(struct memstick_host *msh,
 				      clock_delay);
 		host->ifmode = value;
 		break;
-	};
+	}
 	return 0;
 }
 
diff --git a/drivers/memstick/host/tifm_ms.c b/drivers/memstick/host/tifm_ms.c
index 7bafa72..8becb21 100644
--- a/drivers/memstick/host/tifm_ms.c
+++ b/drivers/memstick/host/tifm_ms.c
@@ -533,7 +533,7 @@ static int tifm_ms_set_param(struct memstick_host *msh,
 		} else
 			return -EINVAL;
 		break;
-	};
+	}
 
 	return 0;
 }
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c
index a8c08f3..6a0ecca 100644
--- a/drivers/message/i2o/iop.c
+++ b/drivers/message/i2o/iop.c
@@ -1063,7 +1063,7 @@ struct i2o_controller *i2o_iop_alloc(void)
 	     I2O_MSG_INPOOL_MIN)) {
 		kfree(c);
 		return ERR_PTR(-ENOMEM);
-	};
+	}
 
 	INIT_LIST_HEAD(&c->devices);
 	spin_lock_init(&c->lock);
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
index fff63a4..a1d5942 100644
--- a/drivers/mfd/stmpe.c
+++ b/drivers/mfd/stmpe.c
@@ -706,7 +706,7 @@ static int stmpe1801_reset(struct stmpe *stmpe)
 		if (!(ret & STMPE1801_MSK_SYS_CTRL_RESET))
 			return 0;
 		usleep_range(100, 200);
-	};
+	}
 	return -EIO;
 }
 
diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c
index 743fb52..c881e99 100644
--- a/drivers/mfd/tps65010.c
+++ b/drivers/mfd/tps65010.c
@@ -147,7 +147,7 @@ static void dbg_chgconf(int por, char *buf, size_t len, u8 chgconfig)
 		case 2:		p = 75; break;
 		case 1:		p = 50; break;
 		default:	p = 25; break;
-		}; p; }),
+		} p; }),
 		(chgconfig & TPS_VBUS_CHARGING)
 			? ((chgconfig & TPS_VBUS_500MA) ? 500 : 100)
 			: 0,
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c
index 8d64b68..c619f64 100644
--- a/drivers/misc/ti-st/st_core.c
+++ b/drivers/misc/ti-st/st_core.c
@@ -366,7 +366,7 @@ void st_int_recv(void *disc_data,
 			st_gdata->rx_state = ST_W4_HEADER;
 			st_gdata->rx_count = st_gdata->list[type]->hdr_len;
 			pr_debug("rx_count %ld\n", st_gdata->rx_count);
-		};
+		}
 		ptr++;
 		count--;
 	}
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index e9fa87d..2582997 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -305,7 +305,7 @@ static void mmc_davinci_start_command(struct mmc_davinci_host *host,
 		default:
 			s = ", (R? response)";
 			break;
-		}; s; }));
+		} s; }));
 	host->cmd = cmd;
 
 	switch (mmc_resp_type(cmd)) {
diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
index e9028ad..6dc0bdb 100644
--- a/drivers/mmc/host/vub300.c
+++ b/drivers/mmc/host/vub300.c
@@ -563,7 +563,7 @@ static void add_offloaded_reg(struct vub300_mmc_host *vub300,
 			i += 1;
 			continue;
 		}
-	};
+	}
 	__add_offloaded_reg_to_fifo(vub300, register_access, func);
 }
 
@@ -1374,7 +1374,7 @@ static void download_offload_pseudocode(struct vub300_mmc_host *vub300)
 		l += snprintf(vub300->vub_name + l,
 			      sizeof(vub300->vub_name) - l, "_%04X%04X",
 			      sf->vendor, sf->device);
-	};
+	}
 	snprintf(vub300->vub_name + l, sizeof(vub300->vub_name) - l, ".bin");
 	dev_info(&vub300->udev->dev, "requesting offload firmware %s\n",
 		 vub300->vub_name);
@@ -1895,7 +1895,7 @@ static int satisfy_request_from_offloaded_data(struct vub300_mmc_host *vub300,
 			i += 1;
 			continue;
 		}
-	};
+	}
 	if (vub300->total_offload_count == 0)
 		return 0;
 	else if (vub300->fn[func].offload_count == 0)
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
index e954b77..27821f1 100644
--- a/drivers/mmc/host/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -810,7 +810,7 @@ static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq)
 			cmd->error = -EINVAL;
 
 			goto done;
-		};
+		}
 	}
 
 	/*
diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c
index 3c60a00..be14f61 100644
--- a/drivers/mtd/nand/mpc5121_nfc.c
+++ b/drivers/mtd/nand/mpc5121_nfc.c
@@ -450,7 +450,7 @@ static void mpc5121_nfc_copy_spare(struct mtd_info *mtd, uint offset,
 		buffer += blksize;
 		offset += blksize;
 		size -= blksize;
-	};
+	}
 }
 
 /* Copy data from/to NFC main and spare buffers */
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 8ca49f2..92be3e4 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -924,7 +924,7 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
 		if (!req) {
 			err = -ENOMEM;
 			break;
-		};
+		}
 
 		err = copy_from_user(req, argp, sizeof(struct ubi_rnvol_req));
 		if (err) {
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index ea20182..8d85b97 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -2372,7 +2372,7 @@ int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_stat
 		mlx4_warn(dev, "unknown value for link_state %02x on slave %d port %d\n",
 			  link_state, slave, port);
 		return -EINVAL;
-	};
+	}
 	s_info = &priv->mfunc.master.vf_admin[slave].vport[port];
 	s_info->link_state = link_state;
 
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 0416c5b..cdfc406 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -725,7 +725,7 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq)
 				  !!(eqe->owner & 0x80) ^
 				  !!(eq->cons_index & eq->nent) ? "HW" : "SW");
 			break;
-		};
+		}
 
 		++eq->cons_index;
 		eqes_found = 1;
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index dd68763..dfba79c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -271,7 +271,7 @@ static const char *ResourceType(enum mlx4_resource rt)
 	case RES_FS_RULE: return "RES_FS_RULE";
 	case RES_XRCD: return "RES_XRCD";
 	default: return "Unknown resource type !!!";
-	};
+	}
 }
 
 int mlx4_init_resource_tracker(struct mlx4_dev *dev)
diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c
index 7ec3e0e..184d440 100644
--- a/drivers/net/usb/sr9700.c
+++ b/drivers/net/usb/sr9700.c
@@ -434,7 +434,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
 		usbnet_skb_return(dev, sr_skb);
 
 		skb_pull(skb, len + SR_RX_OVERHEAD);
-	};
+	}
 
 	return 0;
 }
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index e784c40..4910958 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -1201,7 +1201,7 @@ void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb)
 		ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt event: ",
 				skb->data, skb->len);
 		break;
-	};
+	}
 
 	/* Free the indication buffer */
 	dev_kfree_skb_any(skb);
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 4f316bd..343a6e1 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1091,7 +1091,7 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name)
 
 		len -= ie_len;
 		data += ie_len;
-	};
+	}
 
 	ret = 0;
 out:
diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c
index 417639f..412885a 100644
--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
@@ -569,7 +569,7 @@ static void iwl_mvm_build_tcp_packet(struct ieee80211_vif *vif,
 		mask[5] = 0x80; /* match tcp flags */
 		/* leave rest (0 or set for MVM_TCP_RX_WAKE) */
 		break;
-	};
+	}
 
 	*pseudo_hdr_csum = pseudo_hdr_check(ip_tot_len - sizeof(struct iphdr),
 					    pkt->ip.saddr, pkt->ip.daddr);
diff --git a/drivers/net/wireless/iwlwifi/mvm/led.c b/drivers/net/wireless/iwlwifi/mvm/led.c
index 2269a9e..2f66a3e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/led.c
+++ b/drivers/net/wireless/iwlwifi/mvm/led.c
@@ -103,7 +103,7 @@ int iwl_mvm_leds_init(struct iwl_mvm *mvm)
 		return 0;
 	default:
 		return -EINVAL;
-	};
+	}
 
 	mvm->led.name = kasprintf(GFP_KERNEL, "%s-led",
 				   wiphy_name(mvm->hw->wiphy));
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c
index 9a7ab84..96d3e8d 100644
--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
@@ -407,7 +407,7 @@ static bool iwl_mvm_scan_abort_notif(struct iwl_notif_wait_data *notif_wait,
 	default:
 		WARN_ON(1);
 		return false;
-	};
+	}
 }
 
 void iwl_mvm_cancel_scan(struct iwl_mvm *mvm)
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index cdc7836..46d1378 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -222,7 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 	default:
 		ret = -EINVAL;
 		break;
-	};
+	}
 
 	return ret;
 }
diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
index e1c1ec5..24750a1 100644
--- a/drivers/pci/syscall.c
+++ b/drivers/pci/syscall.c
@@ -44,7 +44,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
 	default:
 		err = -EINVAL;
 		goto error;
-	};
+	}
 
 	err = -EIO;
 	if (cfg_ret != PCIBIOS_SUCCESSFUL)
diff --git a/drivers/pcmcia/db1xxx_ss.c b/drivers/pcmcia/db1xxx_ss.c
index a31e69e..631d37b 100644
--- a/drivers/pcmcia/db1xxx_ss.c
+++ b/drivers/pcmcia/db1xxx_ss.c
@@ -441,7 +441,7 @@ static int db1x_pcmcia_socket_probe(struct platform_device *pdev)
 		printk(KERN_INFO "db1xxx-ss: unknown board %d!\n", bid);
 		ret = -ENODEV;
 		goto out0;
-	};
+	}
 
 	/*
 	 * gather resources necessary and optional nice-to-haves to
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index 18c0d8d..840a2c1 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -660,7 +660,7 @@ static int m8xx_get_status(struct pcmcia_socket *sock, unsigned int *value)
 		case 2:
 			*value |= SS_XVCARD;
 			break;	/* NC. GND - x.xV only */
-		};
+		}
 	}
 
 	pr_debug("m8xx_pcmcia: GetStatus(%d) = %#2.2x\n", lsock, *value);
diff --git a/drivers/pinctrl/pinctrl-exynos5440.c b/drivers/pinctrl/pinctrl-exynos5440.c
index 544d469..1041683 100644
--- a/drivers/pinctrl/pinctrl-exynos5440.c
+++ b/drivers/pinctrl/pinctrl-exynos5440.c
@@ -296,7 +296,7 @@ static void exynos5440_dt_free_map(struct pinctrl_dev *pctldev,
 			if (!idx)
 				kfree(map[idx].data.configs.group_or_pin);
 		}
-	};
+	}
 
 	kfree(map);
 }
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c
index 92a9d6c..b5d7703 100644
--- a/drivers/pinctrl/pinctrl-samsung.c
+++ b/drivers/pinctrl/pinctrl-samsung.c
@@ -213,7 +213,7 @@ static void samsung_dt_free_map(struct pinctrl_dev *pctldev,
 			if (!idx)
 				kfree(map[idx].data.configs.group_or_pin);
 		}
-	};
+	}
 
 	kfree(map);
 }
diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c
index 119d2dd..4eb1a7f 100644
--- a/drivers/pinctrl/pinctrl-sunxi.c
+++ b/drivers/pinctrl/pinctrl-sunxi.c
@@ -901,7 +901,7 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)
 		irq_set_chip_and_handler(irqno, &sunxi_pinctrl_irq_chip,
 					 handle_simple_irq);
 		irq_set_chip_data(irqno, pctl);
-	};
+	}
 
 	irq_set_chained_handler(pctl->irq, sunxi_pinctrl_irq_handler);
 	irq_set_handler_data(pctl->irq, pctl);
diff --git a/drivers/pinctrl/pinctrl-tz1090-pdc.c b/drivers/pinctrl/pinctrl-tz1090-pdc.c
index 5bf01c2..bf4b533 100644
--- a/drivers/pinctrl/pinctrl-tz1090-pdc.c
+++ b/drivers/pinctrl/pinctrl-tz1090-pdc.c
@@ -695,7 +695,7 @@ static int tz1090_pdc_pinconf_reg(struct pinctrl_dev *pctldev,
 		break;
 	default:
 		return -ENOTSUPP;
-	};
+	}
 
 	/* Only input bias parameters supported */
 	*reg = REG_GPIO_CONTROL2;
@@ -828,7 +828,7 @@ static int tz1090_pdc_pinconf_group_reg(struct pinctrl_dev *pctldev,
 		break;
 	default:
 		return -ENOTSUPP;
-	};
+	}
 
 	/* Calculate field information */
 	*mask = (BIT(*width) - 1) << *shift;
diff --git a/drivers/pinctrl/pinctrl-tz1090.c b/drivers/pinctrl/pinctrl-tz1090.c
index bc9cd7a..34a5391 100644
--- a/drivers/pinctrl/pinctrl-tz1090.c
+++ b/drivers/pinctrl/pinctrl-tz1090.c
@@ -1719,7 +1719,7 @@ static int tz1090_pinconf_reg(struct pinctrl_dev *pctldev,
 		break;
 	default:
 		return -ENOTSUPP;
-	};
+	}
 
 	/* Only input bias parameters supported */
 	pu = &tz1090_pinconf_pullup[pin];
@@ -1848,7 +1848,7 @@ static int tz1090_pinconf_group_reg(struct pinctrl_dev *pctldev,
 		break;
 	default:
 		return -ENOTSUPP;
-	};
+	}
 
 	/* Calculate field information */
 	*shift = g->slw_bit * *width;
diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c
index a4c4a10..29ca420 100644
--- a/drivers/power/ab8500_charger.c
+++ b/drivers/power/ab8500_charger.c
@@ -785,7 +785,7 @@ static int ab8500_charger_max_usb_curr(struct ab8500_charger *di,
 		di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P05;
 		ret = -ENXIO;
 		break;
-	};
+	}
 
 	di->max_usb_in_curr.set_max = di->max_usb_in_curr.usb_type_max;
 	dev_dbg(di->dev, "USB Type - 0x%02x MaxCurr: %d",
@@ -1075,7 +1075,7 @@ static int ab8500_charger_get_usb_cur(struct ab8500_charger *di)
 		di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P05;
 		ret = -EPERM;
 		break;
-	};
+	}
 	di->max_usb_in_curr.set_max = di->max_usb_in_curr.usb_type_max;
 	return ret;
 }
@@ -2485,7 +2485,7 @@ static void ab8500_charger_usb_state_changed_work(struct work_struct *work)
 
 	default:
 		break;
-	};
+	}
 }
 
 /**
diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c
index 7549707..53b5690 100644
--- a/drivers/power/ab8500_fg.c
+++ b/drivers/power/ab8500_fg.c
@@ -2237,10 +2237,10 @@ static int ab8500_fg_get_ext_psy_data(struct device *dev, void *data)
 						ab8500_fg_update_cap_scalers(di);
 					queue_work(di->fg_wq, &di->fg_work);
 					break;
-				};
+				}
 			default:
 				break;
-			};
+			}
 			break;
 		case POWER_SUPPLY_PROP_TECHNOLOGY:
 			switch (ext->type) {
@@ -2349,7 +2349,7 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di)
 		if (ret) {
 			dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_MAX_TIME_REG\n", __func__);
 			goto out;
-		};
+		}
 
 		ret = abx500_set_register_interruptible(di->dev, AB8500_RTC,
 			AB8505_RTC_PCUT_FLAG_TIME_REG, di->bm->fg_params->pcut_flag_time);
@@ -2357,7 +2357,7 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di)
 		if (ret) {
 			dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_FLAG_TIME_REG\n", __func__);
 			goto out;
-		};
+		}
 
 		ret = abx500_set_register_interruptible(di->dev, AB8500_RTC,
 			AB8505_RTC_PCUT_RESTART_REG, di->bm->fg_params->pcut_max_restart);
@@ -2365,7 +2365,7 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di)
 		if (ret) {
 			dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_RESTART_REG\n", __func__);
 			goto out;
-		};
+		}
 
 		ret = abx500_set_register_interruptible(di->dev, AB8500_RTC,
 			AB8505_RTC_PCUT_DEBOUNCE_REG, di->bm->fg_params->pcut_debounce_time);
@@ -2373,7 +2373,7 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di)
 		if (ret) {
 			dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_DEBOUNCE_REG\n", __func__);
 			goto out;
-		};
+		}
 
 		ret = abx500_set_register_interruptible(di->dev, AB8500_RTC,
 			AB8505_RTC_PCUT_CTL_STATUS_REG, di->bm->fg_params->pcut_enable);
@@ -2381,7 +2381,7 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di)
 		if (ret) {
 			dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_CTL_STATUS_REG\n", __func__);
 			goto out;
-		};
+		}
 	}
 out:
 	return ret;
diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c
index 6d27236..6b44e1a 100644
--- a/drivers/power/abx500_chargalg.c
+++ b/drivers/power/abx500_chargalg.c
@@ -1892,7 +1892,7 @@ static ssize_t abx500_chargalg_en_store(struct abx500_chargalg *di,
 			"Enter 0. Disable AC/USB Charging\n"
 			"1. Enable AC charging\n"
 			"2. Enable USB Charging\n");
-	};
+	}
 	return strlen(buf);
 }
 
diff --git a/drivers/power/reset/vexpress-poweroff.c b/drivers/power/reset/vexpress-poweroff.c
index 476aa49..0a056a6 100644
--- a/drivers/power/reset/vexpress-poweroff.c
+++ b/drivers/power/reset/vexpress-poweroff.c
@@ -118,7 +118,7 @@ static int vexpress_reset_probe(struct platform_device *pdev)
 		arm_pm_restart = vexpress_restart;
 		device_create_file(&pdev->dev, &dev_attr_active);
 		break;
-	};
+	}
 
 	return 0;
 }
diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index b9f2653..b6a0661 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -698,7 +698,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt(
 		rdata->initdata = da9063_matches[i].init_data;
 
 		n++;
-	};
+	}
 
 	*da9063_reg_matches = da9063_matches;
 	return pdata;
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index b6135d4..132aea0 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -861,7 +861,7 @@ static void rpmsg_recv_done(struct virtqueue *rvq)
 		msgs_received++;
 
 		msg = virtqueue_get_buf(rvq, &len);
-	};
+	}
 
 	dev_dbg(dev, "Received %u messages\n", msgs_received);
 
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index ccf54f0..27666cf 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -650,7 +650,7 @@ static int rs5c372_probe(struct i2c_client *client,
 			case rtc_rv5c386:	s = "rv5c386"; break;
 			case rtc_rv5c387a:	s = "rv5c387a"; break;
 			default:		s = "chip"; break;
-			}; s;}),
+			} s;}),
 			rs5c372->time24 ? "24hr" : "am/pm"
 			);
 
diff --git a/drivers/s390/char/monreader.c b/drivers/s390/char/monreader.c
index 0da3ae3..b7d6030 100644
--- a/drivers/s390/char/monreader.c
+++ b/drivers/s390/char/monreader.c
@@ -95,7 +95,7 @@ static void dcss_mkname(char *ascii_name, char *ebcdic_name)
 		if (ascii_name[i] == '\0')
 			break;
 		ebcdic_name[i] = toupper(ascii_name[i]);
-	};
+	}
 	for (; i < 8; i++)
 		ebcdic_name[i] = ' ';
 	ASCEBC(ebcdic_name, 8);
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 0fe8d5d..308d5e4 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -204,7 +204,7 @@ static void zfcp_fsf_status_read_link_down(struct zfcp_fsf_req *req)
 		break;
 	case FSF_STATUS_READ_SUB_FIRMWARE_UPDATE:
 		zfcp_fsf_link_down_info_eval(req, NULL);
-	};
+	}
 }
 
 static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req)
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index 5843288..a598d77 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -654,7 +654,7 @@ static long openprom_ioctl(struct file * file,
 
 	default:
 		return -EINVAL;
-	};
+	}
 }
 
 static long openprom_compat_ioctl(struct file *file, unsigned int cmd,
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 770c48d..203b0a5 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -472,7 +472,7 @@ static void aha1542_intr_handle(struct Scsi_Host *shost)
 			if (needs_restart)
 				aha1542_restart(shost);
 			return;
-		};
+		}
 
 		mbo = (scsi2int(mb[mbi].ccbptr) - (SCSI_BUF_PA(&ccb[0]))) / sizeof(struct ccb);
 		mbistatus = mb[mbi].status;
@@ -552,7 +552,7 @@ static void aha1542_intr_handle(struct Scsi_Host *shost)
 							   far as queuecommand is concerned */
 		my_done(SCtmp);
 		number_serviced++;
-	};
+	}
 }
 
 static int aha1542_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
@@ -732,7 +732,7 @@ static void setup_mailboxes(int bse, struct Scsi_Host *shpnt)
 	for (i = 0; i < AHA1542_MAILBOXES; i++) {
 		mb[i].status = mb[AHA1542_MAILBOXES + i].status = 0;
 		any2scsi(mb[i].ccbptr, SCSI_BUF_PA(&ccb[i]));
-	};
+	}
 	aha1542_intr_reset(bse);	/* reset interrupts, so they don't block */
 	any2scsi((cmd + 2), SCSI_BUF_PA(mb));
 	aha1542_out(bse, cmd, 5);
@@ -752,7 +752,7 @@ static int __init aha1542_getconfig(int base_io, unsigned char *irq_level, unsig
 	i = inb(STATUS(base_io));
 	if (i & DF) {
 		i = inb(DATA(base_io));
-	};
+	}
 	aha1542_out(base_io, inquiry_cmd, 1);
 	aha1542_in(base_io, inquiry_result, 3);
 	WAIT(INTRFLAGS(base_io), INTRMASK, HACC, 0);
@@ -782,7 +782,7 @@ fail:
 	default:
 		printk(KERN_ERR "Unable to determine Adaptec DMA priority.  Disabling board\n");
 		return -1;
-	};
+	}
 	switch (inquiry_result[1]) {
 	case 0x40:
 		*irq_level = 15;
@@ -805,7 +805,7 @@ fail:
 	default:
 		printk(KERN_ERR "Unable to determine Adaptec IRQ level.  Disabling board\n");
 		return -1;
-	};
+	}
 	*scsi_id = inquiry_result[2] & 7;
 	return 0;
 }
@@ -838,7 +838,7 @@ static int __init aha1542_mbenable(int base)
 
 		aha1542_out(base, mbenable_cmd, 3);
 		WAIT(INTRFLAGS(base), INTRMASK, HACC, 0);
-	};
+	}
 	while (0) {
 fail:
 		printk(KERN_ERR "aha1542_mbenable: Mailbox init failed\n");
@@ -856,7 +856,7 @@ static int __init aha1542_query(int base_io, int *transl)
 	i = inb(STATUS(base_io));
 	if (i & DF) {
 		i = inb(DATA(base_io));
-	};
+	}
 	aha1542_out(base_io, inquiry_cmd, 1);
 	aha1542_in(base_io, inquiry_result, 4);
 	WAIT(INTRFLAGS(base_io), INTRMASK, HACC, 0);
@@ -877,7 +877,7 @@ fail:
 	if (inquiry_result[0] == 0x43) {
 		printk(KERN_INFO "aha1542.c: Emulation mode not supported for AHA 174N hardware.\n");
 		return 1;
-	};
+	}
 
 	/* Always call this - boards that do not support extended bios translation
 	   will ignore the command, and we will set the proper default */
@@ -1001,7 +1001,7 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt)
 		case 10:
 			atbt = 0x03;
 			break;
-		};
+		}
 		setup_dmaspeed[0] = atbt;
 	}
 #endif
@@ -1177,7 +1177,7 @@ unregister:
 			scsi_unregister(shpnt);
 			continue;
 
-		};
+		}
 
 	return count;
 }
@@ -1498,7 +1498,7 @@ static int aha1542_old_abort(Scsi_Cmnd * SCpnt)
 				if (HOSTDATA(SCpnt->host)->mb[i].status) {
 					printk(KERN_ERR "OGMB still full - restarting\n");
 					aha1542_out(SCpnt->host->io_port, &ahacmd, 1);
-				};
+				}
 			} else
 				printk(KERN_ERR "Other pending command %s\n",
 				       SCpnt->request->rq_disk ?
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
index 232aff1..24678d5 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
@@ -400,7 +400,7 @@ aic_print_reg_dump_end(FILE *ofile, FILE *dfile,
 		if (num_entries != 0)
 			fprintf(dfile,
 "\n"
-"};\n"
+"}\n"
 "\n");
 
 		fprintf(dfile,
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c
index 2f61a5a..bc9a22f 100644
--- a/drivers/scsi/bfa/bfa_fcs_lport.c
+++ b/drivers/scsi/bfa/bfa_fcs_lport.c
@@ -4330,7 +4330,7 @@ bfa_fcs_lport_ns_sm_online(struct bfa_fcs_lport_ns_s *ns,
 			bfa_sm_set_state(ns,
 				bfa_fcs_lport_ns_sm_sending_gid_ft);
 			bfa_fcs_lport_ns_send_gid_ft(ns, NULL);
-		};
+		}
 		break;
 
 	default:
diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c
index 2035b0d..90fbb00 100644
--- a/drivers/scsi/bfa/bfa_fcs_rport.c
+++ b/drivers/scsi/bfa/bfa_fcs_rport.c
@@ -2461,7 +2461,7 @@ bfa_fcs_rport_hal_online_action(struct bfa_fcs_rport_s *rport)
 		bfa_fcs_itnim_brp_online(rport->itnim);
 		if (!BFA_FCS_PID_IS_WKA(rport->pid))
 			bfa_fcs_rpf_rport_online(rport);
-	};
+	}
 
 	wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port));
 	wwn2str(rpwwn_buf, rport->pwwn);
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 69ac554..2ff684c 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -889,7 +889,7 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
 				 */
 				if (interface->enabled)
 					fcoe_ctlr_link_up(ctlr);
-			};
+			}
 		} else if (fcoe_ctlr_link_down(ctlr)) {
 			switch (cdev->enabled) {
 			case FCOE_CTLR_DISABLED:
@@ -909,7 +909,7 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
 				put_cpu();
 				fcoe_clean_pending_queue(lport);
 				wait_for_upload = 1;
-			};
+			}
 		}
 	}
 	mutex_unlock(&bnx2fc_dev_lock);
@@ -2083,7 +2083,7 @@ static int bnx2fc_ctlr_enabled(struct fcoe_ctlr_device *cdev)
 	case FCOE_CTLR_UNUSED:
 	default:
 		return -ENOTSUPP;
-	};
+	}
 }
 
 enum bnx2fc_create_link_state {
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 07453bb..514a6f3 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -2047,7 +2047,7 @@ static int fcoe_device_notification(struct notifier_block *notifier,
 		case FCOE_CTLR_ENABLED:
 		case FCOE_CTLR_UNUSED:
 			fcoe_ctlr_link_up(ctlr);
-		};
+		}
 	} else if (fcoe_ctlr_link_down(ctlr)) {
 		switch (cdev->enabled) {
 		case FCOE_CTLR_DISABLED:
@@ -2059,7 +2059,7 @@ static int fcoe_device_notification(struct notifier_block *notifier,
 			stats->LinkFailureCount++;
 			put_cpu();
 			fcoe_clean_pending_queue(lport);
-		};
+		}
 	}
 out:
 	return rc;
@@ -2156,7 +2156,7 @@ static int fcoe_ctlr_enabled(struct fcoe_ctlr_device *cdev)
 	case FCOE_CTLR_UNUSED:
 	default:
 		return -ENOTSUPP;
-	};
+	}
 }
 
 /**
diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
index c9382d6..d4ad9e3 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -324,7 +324,7 @@ static ssize_t store_ctlr_mode(struct device *dev,
 	default:
 		LIBFCOE_SYSFS_DBG(ctlr, "Mode change not supported.");
 		return -ENOTSUPP;
-	};
+	}
 }
 
 static FCOE_DEVICE_ATTR(ctlr, mode, S_IRUGO | S_IWUSR,
@@ -350,7 +350,7 @@ static ssize_t store_ctlr_enabled(struct device *dev,
 		break;
 	case FCOE_CTLR_UNUSED:
 		return -ENOTSUPP;
-	};
+	}
 
 	rc = ctlr->f->set_fcoe_ctlr_enabled(ctlr);
 	if (rc)
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index bbf81ea..f232f62 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -422,7 +422,7 @@ static void fnic_notify_timer_start(struct fnic *fnic)
 	default:
 		/* Using intr for notification for INTx/MSI-X */
 		break;
-	};
+	}
 }
 
 static int fnic_dev_wait(struct vnic_dev *vdev,
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 23f5ba5..59f68b1 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -176,7 +176,7 @@ static void ibmvfc_trc_start(struct ibmvfc_event *evt)
 		break;
 	default:
 		break;
-	};
+	}
 }
 
 /**
@@ -215,7 +215,7 @@ static void ibmvfc_trc_end(struct ibmvfc_event *evt)
 	default:
 		break;
 
-	};
+	}
 }
 
 #else
@@ -459,7 +459,7 @@ static int ibmvfc_set_host_state(struct ibmvfc_host *vhost,
 	default:
 		vhost->state = state;
 		break;
-	};
+	}
 
 	return rc;
 }
@@ -495,7 +495,7 @@ static void ibmvfc_set_host_action(struct ibmvfc_host *vhost,
 			break;
 		default:
 			break;
-		};
+		}
 		break;
 	case IBMVFC_HOST_ACTION_TGT_INIT:
 		if (vhost->action == IBMVFC_HOST_ACTION_ALLOC_TGTS)
@@ -510,7 +510,7 @@ static void ibmvfc_set_host_action(struct ibmvfc_host *vhost,
 		default:
 			vhost->action = action;
 			break;
-		};
+		}
 		break;
 	case IBMVFC_HOST_ACTION_LOGO:
 	case IBMVFC_HOST_ACTION_QUERY_TGTS:
@@ -521,7 +521,7 @@ static void ibmvfc_set_host_action(struct ibmvfc_host *vhost,
 	default:
 		vhost->action = action;
 		break;
-	};
+	}
 }
 
 /**
@@ -1593,7 +1593,7 @@ static inline int ibmvfc_host_chkready(struct ibmvfc_host *vhost)
 	case IBMVFC_ACTIVE:
 		result = 0;
 		break;
-	};
+	}
 
 	return result;
 }
@@ -1653,7 +1653,7 @@ static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd,
 		case MSG_ORDERED_TAG:
 			vfc_cmd->iu.pri_task_attr = IBMVFC_ORDERED_TASK;
 			break;
-		};
+		}
 	}
 
 	if (likely(!(rc = ibmvfc_map_sg_data(cmnd, evt, vfc_cmd, vhost->dev))))
@@ -1857,7 +1857,7 @@ static int ibmvfc_bsg_request(struct fc_bsg_job *job)
 		break;
 	default:
 		return -ENOTSUPP;
-	};
+	}
 
 	if (port_id == -1)
 		return -EINVAL;
@@ -2232,7 +2232,7 @@ static int ibmvfc_cancel_all(struct scsi_device *sdev, int type)
 			return 0;
 		default:
 			return -EIO;
-		};
+		}
 	}
 
 	sdev_printk(KERN_INFO, sdev, "Successfully cancelled outstanding commands\n");
@@ -2664,7 +2664,7 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq,
 			vhost->delay_init = 1;
 			__ibmvfc_reset_host(vhost);
 			break;
-		};
+		}
 
 		break;
 	case IBMVFC_AE_LINK_UP:
@@ -2718,7 +2718,7 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq,
 	default:
 		dev_err(vhost->dev, "Unknown async event received: %lld\n", crq->event);
 		break;
-	};
+	}
 }
 
 /**
@@ -3386,7 +3386,7 @@ static void ibmvfc_tgt_prli_done(struct ibmvfc_event *evt)
 			ibmvfc_get_cmd_error(rsp->status, rsp->error),
 			rsp->status, rsp->error, status);
 		break;
-	};
+	}
 
 	kref_put(&tgt->kref, ibmvfc_release_tgt);
 	ibmvfc_free_event(evt);
@@ -3482,7 +3482,7 @@ static void ibmvfc_tgt_plogi_done(struct ibmvfc_event *evt)
 			ibmvfc_get_fc_type(rsp->fc_type), rsp->fc_type,
 			ibmvfc_get_ls_explain(rsp->fc_explain), rsp->fc_explain, status);
 		break;
-	};
+	}
 
 	kref_put(&tgt->kref, ibmvfc_release_tgt);
 	ibmvfc_free_event(evt);
@@ -3553,7 +3553,7 @@ static void ibmvfc_tgt_implicit_logout_done(struct ibmvfc_event *evt)
 	default:
 		tgt_err(tgt, "Implicit Logout failed: rc=0x%02X\n", status);
 		break;
-	};
+	}
 
 	if (vhost->action == IBMVFC_HOST_ACTION_TGT_INIT)
 		ibmvfc_init_tgt(tgt, ibmvfc_tgt_send_plogi);
@@ -3657,7 +3657,7 @@ static void ibmvfc_tgt_adisc_done(struct ibmvfc_event *evt)
 			 ibmvfc_get_fc_type(fc_reason), fc_reason,
 			 ibmvfc_get_ls_explain(fc_explain), fc_explain, status);
 		break;
-	};
+	}
 
 	kref_put(&tgt->kref, ibmvfc_release_tgt);
 	ibmvfc_free_event(evt);
@@ -3869,7 +3869,7 @@ static void ibmvfc_tgt_query_target_done(struct ibmvfc_event *evt)
 			ibmvfc_get_fc_type(rsp->fc_type), rsp->fc_type,
 			ibmvfc_get_gs_explain(rsp->fc_explain), rsp->fc_explain, status);
 		break;
-	};
+	}
 
 	kref_put(&tgt->kref, ibmvfc_release_tgt);
 	ibmvfc_free_event(evt);
@@ -4270,7 +4270,7 @@ static int __ibmvfc_work_to_do(struct ibmvfc_host *vhost)
 	case IBMVFC_HOST_ACTION_REENABLE:
 	default:
 		break;
-	};
+	}
 
 	return 1;
 }
@@ -4498,7 +4498,7 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost)
 		break;
 	default:
 		break;
-	};
+	}
 
 	spin_unlock_irqrestore(vhost->host->host_lock, flags);
 }
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
index bf9eca8..234a307 100644
--- a/drivers/scsi/ibmvscsi/ibmvstgt.c
+++ b/drivers/scsi/ibmvscsi/ibmvstgt.c
@@ -275,7 +275,7 @@ static int ibmvstgt_rdma(struct scsi_cmnd *sc, struct scatterlist *sg, int nsg,
 					return -EIO;
 				}
 			}
-		};
+		}
 
 		rest -= mlen;
 	}
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 36ac1c3..4fda95d 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -1119,7 +1119,7 @@ static void ipr_update_ata_class(struct ipr_resource_entry *res, unsigned int pr
 	default:
 		res->ata_class = ATA_DEV_UNKNOWN;
 		break;
-	};
+	}
 }
 
 /**
@@ -5647,7 +5647,7 @@ static u8 ipr_get_task_attributes(struct scsi_cmnd *scsi_cmd)
 		case MSG_ORDERED_TAG:
 			rc = IPR_FLAGS_LO_ORDERED_TASK;
 			break;
-		};
+		}
 	}
 
 	return rc;
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 0665f9c..da0bec2 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -1260,7 +1260,7 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id)
 				 *   ---> AutoSCSI with MSGOUTreg is processed.
 				 */
 				data->msgout_len = 0;
-			};
+			}
 
 			nsp32_dbg(NSP32_DEBUG_INTR, "MsgOut phase processed");
 		}
@@ -1855,7 +1855,7 @@ static void nsp32_msgout_occur(struct scsi_cmnd *SCpnt)
 
 		nsp32_dbg(NSP32_DEBUG_MSGOUTOCCUR, "bus: 0x%x\n",
 			  nsp32_read1(base, SCSI_BUS_MONITOR));
-	};
+	}
 
 	data->msgout_len = 0;
 
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 1eb7b028..66ebbe1 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -3186,7 +3186,7 @@ static u8 pmcraid_task_attributes(struct scsi_cmnd *scsi_cmd)
 		case MSG_ORDERED_TAG:
 			rc = TASK_TAG_ORDERED;
 			break;
-		};
+		}
 	}
 
 	return rc;
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 6d48d30..96794c4 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -1139,7 +1139,7 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti)
 		case COMMAND_ERROR:
 		case COMMAND_PARAM_ERROR:
 			break;
-		};
+		}
 		sbus_writew(0, qpti->qregs + SBUS_SEMAPHORE);
 	}
 
diff --git a/drivers/scsi/scsi_tgt_if.c b/drivers/scsi/scsi_tgt_if.c
index 6209110..878c96b 100644
--- a/drivers/scsi/scsi_tgt_if.c
+++ b/drivers/scsi/scsi_tgt_if.c
@@ -253,7 +253,7 @@ static ssize_t tgt_write(struct file *file, const char __user * buffer,
 		tgt_ring_idx_inc(ring);
 		event_recv_msg(ev);
 		ev->hdr.status = 0;
-	};
+	}
 
 	return count;
 }
diff --git a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c
index a464d95..50666c5 100644
--- a/drivers/scsi/sgiwd93.c
+++ b/drivers/scsi/sgiwd93.c
@@ -187,7 +187,7 @@ static inline void init_hpc_chain(struct ip22_hostdata *hdata)
 		hcp++;
 		dma += sizeof(struct hpc_chunk);
 		start += sizeof(struct hpc_chunk);
-	};
+	}
 	hcp--;
 	hcp->desc.pnext = hdata->dma;
 }
diff --git a/drivers/scsi/sym53c8xx_2/sym_fw.c b/drivers/scsi/sym53c8xx_2/sym_fw.c
index 190770b..a804179 100644
--- a/drivers/scsi/sym53c8xx_2/sym_fw.c
+++ b/drivers/scsi/sym53c8xx_2/sym_fw.c
@@ -386,7 +386,7 @@ void sym_fw_bind_script(struct sym_hcb *np, u32 *start, int len)
 				sym_name(np), (int) (cur-start));
 			++cur;
 			continue;
-		};
+		}
 
 		/*
 		 *  We use the bogus value 0xf00ff00f ;-)
@@ -494,7 +494,7 @@ void sym_fw_bind_script(struct sym_hcb *np, u32 *start, int len)
 		default:
 			relocs = 0;
 			break;
-		};
+		}
 
 		/*
 		 *  Scriptify:) the opcode.
@@ -550,5 +550,5 @@ void sym_fw_bind_script(struct sym_hcb *np, u32 *start, int len)
 
 			*cur++ = cpu_to_scr(new);
 		}
-	};
+	}
 }
diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c
index 14e0c40..7fafe77 100644
--- a/drivers/scsi/ultrastor.c
+++ b/drivers/scsi/ultrastor.c
@@ -379,7 +379,7 @@ static int ultrastor_14f_detect(struct scsi_host_template * tpnt)
     if(!request_region(PORT_OVERRIDE, 0xc, "ultrastor")) {
       printk("Ultrastor I/O space already in use\n");
       return FALSE;
-    };
+    }
     config.port_address = PORT_OVERRIDE;
 #else
     for (i = 0; i < ARRAY_SIZE(ultrastor_ports_14f); i++) {
diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c
index a2e61c2..61ac167 100644
--- a/drivers/staging/iio/adc/ad7291.c
+++ b/drivers/staging/iio/adc/ad7291.c
@@ -290,7 +290,7 @@ static int ad7291_read_event_value(struct iio_dev *indio_dev,
 		return 0;
 	default:
 		return -EINVAL;
-	};
+	}
 }
 
 static int ad7291_write_event_value(struct iio_dev *indio_dev,
diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index f4a0341..618d820 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -300,7 +300,7 @@ static int ad7150_read_event_value(struct iio_dev *indio_dev,
 
 	default:
 		return -EINVAL;
-	};
+	}
 }
 
 static int ad7150_write_event_value(struct iio_dev *indio_dev,
diff --git a/drivers/staging/imx-drm/imx-tve.c b/drivers/staging/imx-drm/imx-tve.c
index 33d6525..59dd4d5 100644
--- a/drivers/staging/imx-drm/imx-tve.c
+++ b/drivers/staging/imx-drm/imx-tve.c
@@ -696,7 +696,7 @@ static int imx_tve_probe(struct platform_device *pdev)
 	if (val != 0x00100000) {
 		dev_err(&pdev->dev, "configuration register default value indicates this is not a TVEv2\n");
 		return -ENODEV;
-	};
+	}
 
 	/* disable cable detection for VGA mode */
 	ret = regmap_write(tve->regmap, TVE_CD_CONT_REG, 0);
diff --git a/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c b/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c
index 18e1b47..5e10720 100644
--- a/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c
+++ b/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c
@@ -278,7 +278,7 @@ __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
 			break;
 		default:
 			break;
-	};
+	}
 
 	return ret;
 }
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
index 6547f46..316103a 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
@@ -207,7 +207,7 @@ static void enc_pools_release_free_pages(long npages)
 			p_idx++;
 			g_idx = 0;
 		}
-	};
+	}
 
 	/* free unused pools */
 	while (p_idx_max1 < p_idx_max2) {
diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 2011657..40b7290 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -1583,7 +1583,7 @@ _func_enter_;
 
 		pfhdr->attrib.icv_len = pnfhdr->attrib.icv_len;
 		plist = get_next(plist);
-	};
+	}
 
 	/* free the defrag_q queue and return the prframe */
 	rtw_free_recvframe_queue(defrag_q, pfree_recv_queue);
diff --git a/drivers/staging/rtl8188eu/hal/hal_com.c b/drivers/staging/rtl8188eu/hal/hal_com.c
index 829b900..e05a45a 100644
--- a/drivers/staging/rtl8188eu/hal/hal_com.c
+++ b/drivers/staging/rtl8188eu/hal/hal_com.c
@@ -225,7 +225,7 @@ static void two_out_pipe(struct adapter *adapter, bool wifi_cfg)
 
 	if (wifi_cfg) { /* WMM */
 		/* BK, BE, VI, VO, BCN,	CMD, MGT, HIGH, HCCA */
-		/*  0,  1,  0,  1,   0,   0,   0,    0,    0}; */
+		/*  0,  1,  0,  1,   0,   0,   0,    0,    0} */
 		/* 0:H, 1:L */
 
 		pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[1];/* VO */
@@ -261,7 +261,7 @@ static void three_out_pipe(struct adapter *adapter, bool wifi_cfg)
 
 	if (wifi_cfg) {/* for WMM */
 		/* BK, BE, VI, VO, BCN,	CMD, MGT, HIGH, HCCA */
-		/*  1,	2,  1,  0,   0,   0,   0,    0,    0}; */
+		/*  1,	2,  1,  0,   0,   0,   0,    0,    0} */
 		/* 0:H, 1:N, 2:L */
 
 		pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index e068443..68d60aa 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1890,7 +1890,7 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
 	ret = rtl8192_tx(dev, skb);
 	if (ret != 0) {
 		kfree_skb(skb);
-	};
+	}
 
 	if (queue_index != MGNT_QUEUE) {
 		priv->rtllib->stats.tx_bytes += (skb->len -
@@ -1932,7 +1932,7 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		ret = rtl8192_tx(dev, skb);
 		if (ret != 0) {
 			kfree_skb(skb);
-		};
+		}
 	}
 
 
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
index e51b09a..6438371 100644
--- a/drivers/target/sbp/sbp_target.c
+++ b/drivers/target/sbp/sbp_target.c
@@ -1025,7 +1025,7 @@ static void tgt_agent_fetch_work(struct work_struct *work)
 			agent->state = AGENT_STATE_SUSPENDED;
 
 		spin_unlock_bh(&agent->lock);
-	};
+	}
 }
 
 static struct sbp_target_agent *sbp_target_agent_register(
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index d6080c3..cd04293 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -959,7 +959,7 @@ static int receive_flow_control(struct nozomi *dc)
 		dev_err(&dc->pdev->dev,
 			"ERROR: flow control received for non-existing port\n");
 		return 0;
-	};
+	}
 
 	DBG1("0x%04X->0x%04X", *((u16 *)&dc->port[port].ctrl_dl),
 	   *((u16 *)&ctrl_dl));
@@ -1025,7 +1025,7 @@ static enum ctrl_port_type port2ctrl(enum port_type port,
 		dev_err(&dc->pdev->dev,
 			"ERROR: send flow control " \
 			"received for non-existing port\n");
-	};
+	}
 	return CTRL_ERROR;
 }
 
@@ -1805,7 +1805,7 @@ static int ntty_ioctl(struct tty_struct *tty,
 	default:
 		DBG1("ERR: 0x%08X, %d", cmd, cmd);
 		break;
-	};
+	}
 
 	return rval;
 }
diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c
index 3c75e8e..99653e7 100644
--- a/drivers/tty/serial/bfin_uart.c
+++ b/drivers/tty/serial/bfin_uart.c
@@ -680,7 +680,7 @@ static int bfin_serial_startup(struct uart_port *port)
 		default:
 			uart_dma_ch_rx = uart_dma_ch_tx = 0;
 			break;
-		};
+		}
 
 		if (uart_dma_ch_rx &&
 			request_dma(uart_dma_ch_rx, "BFIN_UART_RX") < 0) {
@@ -765,7 +765,7 @@ static void bfin_serial_shutdown(struct uart_port *port)
 		break;
 	default:
 		break;
-	};
+	}
 #endif
 	free_irq(uart->rx_irq, uart);
 	free_irq(uart->tx_irq, uart);
diff --git a/drivers/tty/serial/ip22zilog.c b/drivers/tty/serial/ip22zilog.c
index cb3c81e..1d94205 100644
--- a/drivers/tty/serial/ip22zilog.c
+++ b/drivers/tty/serial/ip22zilog.c
@@ -832,7 +832,7 @@ ip22zilog_convert_to_zs(struct uart_ip22zilog_port *up, unsigned int cflag,
 		up->curregs[5] |= Tx8;
 		up->parity_mask = 0xff;
 		break;
-	};
+	}
 	up->curregs[4] &= ~0x0c;
 	if (cflag & CSTOPB)
 		up->curregs[4] |= SB2;
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index b2e707a..8d71e40 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -690,7 +690,7 @@ static void max310x_handle_tx(struct uart_port *port)
 			max310x_port_write(port, MAX310X_THR_REG,
 					   xmit->buf[xmit->tail]);
 			xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-		};
+		}
 	}
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
index f87f1a0..95917ce 100644
--- a/drivers/tty/serial/pmac_zilog.c
+++ b/drivers/tty/serial/pmac_zilog.c
@@ -1072,7 +1072,7 @@ static void pmz_convert_to_zs(struct uart_pmac_port *uap, unsigned int cflag,
 		uap->curregs[5] |= Tx8;
 		uap->parity_mask = 0xff;
 		break;
-	};
+	}
 	uap->curregs[4] &= ~(SB_MASK);
 	if (cflag & CSTOPB)
 		uap->curregs[4] |= SB2;
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c
index 5d6136b..380fb53 100644
--- a/drivers/tty/serial/sunsab.c
+++ b/drivers/tty/serial/sunsab.c
@@ -894,7 +894,7 @@ static int sunsab_console_setup(struct console *con, char *options)
 	case B115200: baud = 115200; break;
 	case B230400: baud = 230400; break;
 	case B460800: baud = 460800; break;
-	};
+	}
 
 	/*
 	 * Temporary fix.
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index 699cc1b..db79b76 100644
--- a/drivers/tty/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
@@ -522,7 +522,7 @@ static void receive_kbd_ms_chars(struct uart_sunsu_port *up, int is_break)
 				serio_interrupt(&up->serio, ch, 0);
 #endif
 				break;
-			};
+			}
 		}
 	} while (serial_in(up, UART_LSR) & UART_LSR_DR);
 }
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c
index 135a152..45a8c6a 100644
--- a/drivers/tty/serial/sunzilog.c
+++ b/drivers/tty/serial/sunzilog.c
@@ -319,7 +319,7 @@ static void sunzilog_kbdms_receive_chars(struct uart_sunzilog_port *up,
 				serio_interrupt(&up->serio, ch, 0);
 #endif
 			break;
-		};
+		}
 	}
 }
 
@@ -897,7 +897,7 @@ sunzilog_convert_to_zs(struct uart_sunzilog_port *up, unsigned int cflag,
 		up->curregs[R5] |= Tx8;
 		up->parity_mask = 0xff;
 		break;
-	};
+	}
 	up->curregs[R4] &= ~0x0c;
 	if (cflag & CSTOPB)
 		up->curregs[R4] |= SB2;
@@ -1239,7 +1239,7 @@ static int __init sunzilog_console_setup(struct console *con, char *options)
 	default: case B9600: baud = 9600; break;
 	case B19200: baud = 19200; break;
 	case B38400: baud = 38400; break;
-	};
+	}
 
 	brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR);
 
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 8831748..2fd1e17 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -269,7 +269,7 @@ static unsigned int qe_uart_tx_empty(struct uart_port *port)
 			return 1;
 
 		bdp++;
-	};
+	}
 }
 
 /*
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index d6a8d23..b915cac 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1813,7 +1813,7 @@ rescan:
 					s = "-intr"; break;
 				 default:
 			 		s = "-iso"; break;
-				};
+				}
 				s;
 			}));
 		usb_put_urb (urb);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index e6b682c..c95e2fc 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -433,7 +433,7 @@ static void set_port_led(
 			case HUB_LED_OFF: s = "off"; break;
 			case HUB_LED_AUTO: s = "auto"; break;
 			default: s = "??"; break;
-			}; s; }),
+			} s; }),
 			status);
 }
 
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 7fa93f4..95f7649 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -352,7 +352,7 @@ static int dwc3_ep0_handle_status(struct dwc3 *dwc,
 		break;
 	default:
 		return -EINVAL;
-	};
+	}
 
 	response_pkt = (__le16 *) dwc->setup_buf;
 	*response_pkt = cpu_to_le16(usb_status);
@@ -470,7 +470,7 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
 
 	default:
 		return -EINVAL;
-	};
+	}
 
 	return 0;
 }
@@ -709,7 +709,7 @@ static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
 		dev_vdbg(dwc->dev, "Forwarding to gadget driver\n");
 		ret = dwc3_ep0_delegate_req(dwc, ctrl);
 		break;
-	};
+	}
 
 	return ret;
 }
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index d4f0f33..3e7ae70 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -354,7 +354,7 @@ static u8 encode_bMaxPower(enum usb_device_speed speed,
 		return DIV_ROUND_UP(val, 8);
 	default:
 		return DIV_ROUND_UP(val, 2);
-	};
+	}
 }
 
 static int config_buf(struct usb_configuration *config,
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index b8a2376..8f4dae3 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -544,7 +544,7 @@ static int dummy_enable(struct usb_ep *_ep,
 		 default:
 			 val = "ctrl";
 			 break;
-		 }; val; }),
+		 } val; }),
 		max, ep->stream_en ? "enabled" : "disabled");
 
 	/* at this point real hardware should be NAKing transfers
@@ -2271,7 +2271,7 @@ static inline ssize_t show_urb(char *buf, size_t size, struct urb *urb)
 		default:
 			s = "?";
 			break;
-		 }; s; }),
+		 } s; }),
 		ep, ep ? (usb_pipein(urb->pipe) ? "in" : "out") : "",
 		({ char *s; \
 		switch (usb_pipetype(urb->pipe)) { \
@@ -2287,7 +2287,7 @@ static inline ssize_t show_urb(char *buf, size_t size, struct urb *urb)
 		default: \
 			s = "-iso"; \
 			break; \
-		}; s; }),
+		} s; }),
 		urb->actual_length, urb->transfer_buffer_length);
 }
 
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index c64deb9..ef7ba00 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -1165,7 +1165,7 @@ static int udc_proc_read(struct seq_file *m, void *v)
 				s = "invalid"; break;
 			default:
 				s = "?"; break;
-			}; s; }),
+			} s; }),
 			(tmp & EPxSTATUS_TOGGLE) ? "data1" : "data0",
 			(tmp & EPxSTATUS_SUSPEND) ? " suspend" : "",
 			(tmp & EPxSTATUS_FIFO_DISABLE) ? " disable" : "",
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index 0781bff..80d527f 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -129,7 +129,7 @@ static char *type_string (u8 bmAttributes)
 	case USB_ENDPOINT_XFER_BULK:	return "bulk";
 	case USB_ENDPOINT_XFER_ISOC:	return "iso";
 	case USB_ENDPOINT_XFER_INT:	return "intr";
-	};
+	}
 	return "control";
 }
 #endif
@@ -1630,7 +1630,7 @@ static ssize_t queues_show(struct device *_dev, struct device_attribute *attr,
 					val = "intr"; break;
 				 default:
 					val = "iso"; break;
-				 }; val; }),
+				 } val; }),
 				usb_endpoint_maxp (d) & 0x1fff,
 				ep->dma ? "dma" : "pio", ep->fifo_size
 				);
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
index 9575085..a3ad732 100644
--- a/drivers/usb/gadget/rndis.c
+++ b/drivers/usb/gadget/rndis.c
@@ -1068,7 +1068,7 @@ static int rndis_proc_show(struct seq_file *m, void *v)
 				s = "RNDIS_INITIALIZED"; break;
 			 case RNDIS_DATA_INITIALIZED:
 				s = "RNDIS_DATA_INITIALIZED"; break;
-			}; s; }),
+			} s; }),
 			 param->medium,
 			 (param->media_state) ? 0 : param->speed*100,
 			 (param->media_state) ? "disconnected" : "connected",
diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c
index 0ff3339..eccea1d 100644
--- a/drivers/usb/gadget/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/tcm_usb_gadget.c
@@ -472,7 +472,7 @@ static int usbg_bot_setup(struct usb_function *f,
 		bot_enqueue_cmd_cbw(fu);
 		return 0;
 		break;
-	};
+	}
 	return -ENOTSUPP;
 }
 
@@ -617,7 +617,7 @@ static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req)
 
 	default:
 		BUG();
-	};
+	}
 	return;
 
 cleanup:
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index aa5b603..da7d7fc 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -379,7 +379,7 @@ struct debug_buffer {
 		case QH_LOW_SPEED:  tmp = 'l'; break; \
 		case QH_HIGH_SPEED: tmp = 'h'; break; \
 		default: tmp = '?'; break; \
-		}; tmp; })
+		} tmp; })
 
 static inline char token_mark(struct ehci_hcd *ehci, __hc32 token)
 {
diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index fce13bc..55486bd 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -412,7 +412,7 @@ struct debug_buffer {
 			tmp = 'h'; break; \
 		default:		\
 			tmp = '?'; break; \
-		}; tmp; })
+		} tmp; })
 
 static inline char token_mark(struct fotg210_hcd *fotg210, __hc32 token)
 {
diff --git a/drivers/usb/host/fusbh200-hcd.c b/drivers/usb/host/fusbh200-hcd.c
index 299253c..e1c6d85 100644
--- a/drivers/usb/host/fusbh200-hcd.c
+++ b/drivers/usb/host/fusbh200-hcd.c
@@ -402,7 +402,7 @@ struct debug_buffer {
 		case QH_LOW_SPEED:  tmp = 'l'; break; \
 		case QH_HIGH_SPEED: tmp = 'h'; break; \
 		default: tmp = '?'; break; \
-		}; tmp; })
+		} tmp; })
 
 static inline char token_mark(struct fusbh200_hcd *fusbh200, __hc32 token)
 {
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c
index 6f29aba..935a2dd 100644
--- a/drivers/usb/host/isp1362-hcd.c
+++ b/drivers/usb/host/isp1362-hcd.c
@@ -2108,7 +2108,7 @@ static int isp1362_show(struct seq_file *s, void *unused)
 				   default:
 					   s = "?";
 					   break;
-				   };
+				   }
 				   s;}), ep->maxpacket) ;
 		list_for_each_entry(urb, &ep->hep->urb_list, urb_list) {
 			seq_printf(s, "  urb%p, %d/%d\n", urb,
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index 31b81f9..3fca52e 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -17,7 +17,7 @@
 	case PIPE_BULK:		temp = "bulk"; break; \
 	case PIPE_INTERRUPT:	temp = "intr"; break; \
 	default:		temp = "isoc"; break; \
-	}; temp;})
+	} temp;})
 #define pipestring(pipe) edstring(usb_pipetype(pipe))
 
 /* debug| print the main components of an URB
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 5477bf5..79620c3 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1413,7 +1413,7 @@ static int sl811h_show(struct seq_file *s, void *unused)
 			case SL11H_CTL1MASK_SE0: s = " se0/reset"; break;
 			case SL11H_CTL1MASK_K: s = " k/resume"; break;
 			default: s = "j"; break;
-			}; s; }),
+			} s; }),
 			(t & SL11H_CTL1MASK_LSPD) ? " lowspeed" : "",
 			(t & SL11H_CTL1MASK_SUSPEND) ? " suspend" : "");
 
@@ -1446,7 +1446,7 @@ static int sl811h_show(struct seq_file *s, void *unused)
 			case USB_PID_SETUP: s = "setup"; break;
 			case USB_PID_ACK: s = "status"; break;
 			default: s = "?"; break;
-			}; s;}),
+			} s;}),
 			ep->maxpacket,
 			ep->nak_count, ep->error_count);
 		list_for_each_entry (urb, &ep->hep->urb_list, urb_list) {
diff --git a/drivers/usb/host/uhci-pci.c b/drivers/usb/host/uhci-pci.c
index 0f228c4..66edbb2 100644
--- a/drivers/usb/host/uhci-pci.c
+++ b/drivers/usb/host/uhci-pci.c
@@ -178,7 +178,7 @@ static int uhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 		dev_warn(uhci_dev(uhci), "Root hub isn't suspended!\n");
 		rc = -EBUSY;
 		goto done;
-	};
+	}
 
 	/* All PCI host controllers are required to disable IRQ generation
 	 * at the source, so we must turn off PIRQ.
diff --git a/drivers/usb/host/whci/hcd.c b/drivers/usb/host/whci/hcd.c
index ecc88db..1b0888f 100644
--- a/drivers/usb/host/whci/hcd.c
+++ b/drivers/usb/host/whci/hcd.c
@@ -134,7 +134,7 @@ static int whc_urb_enqueue(struct usb_hcd *usb_hcd, struct urb *urb,
 	default:
 		ret = asl_urb_enqueue(whc, urb, mem_flags);
 		break;
-	};
+	}
 
 	return ret;
 }
@@ -160,7 +160,7 @@ static int whc_urb_dequeue(struct usb_hcd *usb_hcd, struct urb *urb, int status)
 	default:
 		ret = asl_urb_dequeue(whc, urb, status);
 		break;
-	};
+	}
 
 	return ret;
 }
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 18e877f..093982a 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -617,7 +617,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 				/* case 3 << MUSB_DEVCTL_VBUS_SHIFT: */
 				default:
 					s = "VALID"; break;
-				}; s; }),
+				} s; }),
 				VBUSERR_RETRY_COUNT - musb->vbuserr_retry,
 				musb->port1_status);
 
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index bd4138d..1a5574c 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -443,7 +443,7 @@ static int get_musb_port_mode(struct device *dev)
 	case USB_DR_MODE_OTG:
 	default:
 		return MUSB_PORT_MODE_DUAL_ROLE;
-	};
+	}
 }
 
 static int dsps_create_musb_pdev(struct dsps_glue *glue,
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index b19ed21..b806698 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1121,7 +1121,7 @@ static int musb_gadget_enable(struct usb_ep *ep,
 			case USB_ENDPOINT_XFER_BULK:	s = "bulk"; break;
 			case USB_ENDPOINT_XFER_INT:	s = "int"; break;
 			default:			s = "iso"; break;
-			}; s; }),
+			} s; }),
 			musb_ep->is_in ? "IN" : "OUT",
 			musb_ep->dma ? "dma, " : "",
 			musb_ep->packet_sz);
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 9a2b8c8..6582a20 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -253,7 +253,7 @@ musb_start_urb(struct musb *musb, int is_in, struct musb_qh *qh)
 			case USB_ENDPOINT_XFER_BULK:	s = "-bulk"; break;
 			case USB_ENDPOINT_XFER_ISOC:	s = "-iso"; break;
 			default:			s = "-intr"; break;
-			}; s; }),
+			} s; }),
 			epnum, buf + offset, len);
 
 	/* Configure endpoint */
diff --git a/drivers/usb/phy/phy-twl4030-usb.c b/drivers/usb/phy/phy-twl4030-usb.c
index 90730c8..2da8b2f 100644
--- a/drivers/usb/phy/phy-twl4030-usb.c
+++ b/drivers/usb/phy/phy-twl4030-usb.c
@@ -337,7 +337,7 @@ static void twl4030_usb_set_mode(struct twl4030_usb *twl, int mode)
 		dev_err(twl->dev, "unsupported T2 transceiver mode %d\n",
 				mode);
 		break;
-	};
+	}
 }
 
 static void twl4030_i2c_access(struct twl4030_usb *twl, int on)
diff --git a/drivers/usb/phy/phy-ulpi-viewport.c b/drivers/usb/phy/phy-ulpi-viewport.c
index 7c22a539..18bb826 100644
--- a/drivers/usb/phy/phy-ulpi-viewport.c
+++ b/drivers/usb/phy/phy-ulpi-viewport.c
@@ -36,7 +36,7 @@ static int ulpi_viewport_wait(void __iomem *view, u32 mask)
 			return 0;
 
 		udelay(1);
-	};
+	}
 
 	return -ETIMEDOUT;
 }
diff --git a/drivers/usb/wusbcore/cbaf.c b/drivers/usb/wusbcore/cbaf.c
index 7f78f30..010f990 100644
--- a/drivers/usb/wusbcore/cbaf.c
+++ b/drivers/usb/wusbcore/cbaf.c
@@ -208,9 +208,9 @@ static int cbaf_check(struct cbaf *cbaf)
 				ar_name = "ASSOCIATE";
 				ar_assoc = 1;
 				break;
-			};
+			}
 			break;
-		};
+		}
 
 		dev_dbg(dev, "Association request #%02u: 0x%04x/%04x "
 			 "(%zu bytes): %s\n",
diff --git a/drivers/usb/wusbcore/devconnect.c b/drivers/usb/wusbcore/devconnect.c
index 33a1278..e538b72 100644
--- a/drivers/usb/wusbcore/devconnect.c
+++ b/drivers/usb/wusbcore/devconnect.c
@@ -973,7 +973,7 @@ int wusb_usb_ncb(struct notifier_block *nb, unsigned long val,
 	default:
 		WARN_ON(1);
 		result = NOTIFY_BAD;
-	};
+	}
 	return result;
 }
 
diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c
index 6ad02f5..8ac7712 100644
--- a/drivers/usb/wusbcore/wa-xfer.c
+++ b/drivers/usb/wusbcore/wa-xfer.c
@@ -429,7 +429,7 @@ static ssize_t __wa_xfer_setup_sizes(struct wa_xfer *xfer,
 		/* never happens */
 		BUG();
 		result = -EINVAL;	/* shut gcc up */
-	};
+	}
 	xfer->is_inbound = urb->pipe & USB_DIR_IN ? 1 : 0;
 	xfer->is_dma = urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP ? 1 : 0;
 	xfer->seg_size = le16_to_cpu(rpipe->descr.wBlocks)
@@ -488,7 +488,7 @@ static void __wa_xfer_setup_hdr0(struct wa_xfer *xfer,
 		printk(KERN_ERR "FIXME: ISOC not implemented\n");
 	default:
 		BUG();
-	};
+	}
 }
 
 /*
diff --git a/drivers/uwb/i1480/dfu/mac.c b/drivers/uwb/i1480/dfu/mac.c
index 6ec14f5..e347981f4 100644
--- a/drivers/uwb/i1480/dfu/mac.c
+++ b/drivers/uwb/i1480/dfu/mac.c
@@ -138,7 +138,7 @@ int fw_hdrs_load(struct i1480 *i1480, struct fw_hdr **phdr,
 		*prev_hdr = hdr;
 		prev_hdr = &hdr->next;
 		hdr_cnt++;
-	};
+	}
 	*prev_hdr = NULL;
 	return 0;
 
diff --git a/drivers/uwb/ie.c b/drivers/uwb/ie.c
index 902b0f2..c1e8c1a 100644
--- a/drivers/uwb/ie.c
+++ b/drivers/uwb/ie.c
@@ -91,7 +91,7 @@ int uwb_ie_dump_hex(const struct uwb_ie_hdr *ies, size_t len,
 			r += scnprintf(buf + r, size - r, " %02x", (unsigned)*d++);
 		if (r < size)
 			buf[r++] = '\n';
-	};
+	}
 
 	return r;
 }
diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c
index baed57d..a2bb276 100644
--- a/drivers/video/cfbimgblt.c
+++ b/drivers/video/cfbimgblt.c
@@ -181,7 +181,7 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info *
 			}
 			shift += bpp;
 			shift &= (32 - 1);
-			if (!l) { l = 8; s++; };
+			if (!l) { l = 8; s++; }
 		}
 
 		/* write trailing bits */
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c
index ed3b889..e220e69 100644
--- a/drivers/video/cg14.c
+++ b/drivers/video/cg14.c
@@ -330,7 +330,7 @@ static int cg14_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
 		default:
 			ret = -ENOSYS;
 			break;
-		};
+		}
 		if (!ret) {
 			sbus_writeb(cur_mode, &regs->mcr);
 			par->mode = mode;
@@ -343,7 +343,7 @@ static int cg14_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
 					  FBTYPE_MDICOLOR, 8,
 					  info->fix.smem_len);
 		break;
-	};
+	}
 
 	return ret;
 }
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c
index 3545dec..f50f61c 100644
--- a/drivers/video/cg6.c
+++ b/drivers/video/cg6.c
@@ -624,7 +624,7 @@ static void cg6_init_fix(struct fb_info *info, int linebytes)
 	default:
 		cg6_cpu_name = "i386";
 		break;
-	};
+	}
 	if (((conf >> CG6_FHC_REV_SHIFT) & CG6_FHC_REV_MASK) >= 11) {
 		if (info->fix.smem_len <= 0x100000)
 			cg6_card_name = "TGX";
diff --git a/drivers/video/exynos/exynos_mipi_dsi_common.c b/drivers/video/exynos/exynos_mipi_dsi_common.c
index 520fc9b..9b32165 100644
--- a/drivers/video/exynos/exynos_mipi_dsi_common.c
+++ b/drivers/video/exynos/exynos_mipi_dsi_common.c
@@ -667,7 +667,7 @@ int exynos_mipi_dsi_init_dsim(struct mipi_dsim_device *dsim)
 	default:
 		dev_info(dsim->dev, "data lane is invalid.\n");
 		return -EINVAL;
-	};
+	}
 
 	exynos_mipi_dsi_sw_reset(dsim);
 	exynos_mipi_dsi_func_reset(dsim);
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index 6dd7225..6c71bb6 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -1102,7 +1102,7 @@ static int fsl_diu_cursor(struct fb_info *info, struct fb_cursor *cursor)
 
 		fsl_diu_load_cursor_image(info, image, bg, fg,
 			cursor->image.width, cursor->image.height);
-	};
+	}
 
 	/*
 	 * Show or hide the cursor.  The cursor data is always stored in the
diff --git a/drivers/video/leo.c b/drivers/video/leo.c
index b17f500..c36f013 100644
--- a/drivers/video/leo.c
+++ b/drivers/video/leo.c
@@ -469,7 +469,7 @@ static void leo_wid_put(struct fb_info *info, struct fb_wid_list *wl)
 
 		default:
 			continue;
-		};
+		}
 		sbus_writel(0x5800 + j, &lx_krn->krn_type);
 		sbus_writel(wi->wi_values[0], &lx_krn->krn_value);
 	}
diff --git a/drivers/video/matrox/matroxfb_DAC1064.c b/drivers/video/matrox/matroxfb_DAC1064.c
index 1717623..a01147f 100644
--- a/drivers/video/matrox/matroxfb_DAC1064.c
+++ b/drivers/video/matrox/matroxfb_DAC1064.c
@@ -494,7 +494,7 @@ static int m1064_compute(void* out, struct my_timming* m) {
 			if (inDAC1064(minfo, M1064_XPIXPLLSTAT) & 0x40)
 				break;
 			udelay(10);
-		};
+		}
 
 		CRITEND
 
@@ -639,7 +639,7 @@ static void MGAG100_progPixClock(const struct matrox_fb_info *minfo, int flags,
 		if (inDAC1064(minfo, M1064_XPIXPLLSTAT) & 0x40)
 			break;
 		udelay(10);
-	};
+	}
 	if (!clk)
 		printk(KERN_ERR "matroxfb: Pixel PLL%c not locked after usual time\n", (reg-M1064_XPIXPLLAM-2)/4 + 'A');
 	selClk = inDAC1064(minfo, M1064_XPIXCLKCTRL) & ~M1064_XPIXCLKCTRL_SRC_MASK;
diff --git a/drivers/video/matrox/matroxfb_Ti3026.c b/drivers/video/matrox/matroxfb_Ti3026.c
index 9a44cec..195ad7c 100644
--- a/drivers/video/matrox/matroxfb_Ti3026.c
+++ b/drivers/video/matrox/matroxfb_Ti3026.c
@@ -473,7 +473,7 @@ static void ti3026_setMCLK(struct matrox_fb_info *minfo, int fout)
 		if (inTi3026(minfo, TVP3026_XPIXPLLDATA) & 0x40)
 			break;
 		udelay(10);
-	};
+	}
 	if (!tmout)
 		printk(KERN_ERR "matroxfb: Temporary pixel PLL not locked after 5 secs\n");
 
diff --git a/drivers/video/nvidia/nv_hw.c b/drivers/video/nvidia/nv_hw.c
index ed20a98..81c80ac 100644
--- a/drivers/video/nvidia/nv_hw.c
+++ b/drivers/video/nvidia/nv_hw.c
@@ -1300,7 +1300,7 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state)
 					break;
 				default:
 					break;
-				};
+				}
 
 				NV_WR32(par->PGRAPH, 0x0b38, 0x2ffff800);
 				NV_WR32(par->PGRAPH, 0x0b3c, 0x00006000);
diff --git a/drivers/video/omap2/displays-new/panel-dsi-cm.c b/drivers/video/omap2/displays-new/panel-dsi-cm.c
index aaaea64..b7baafe 100644
--- a/drivers/video/omap2/displays-new/panel-dsi-cm.c
+++ b/drivers/video/omap2/displays-new/panel-dsi-cm.c
@@ -599,7 +599,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	if (r) {
 		dev_err(&ddata->pdev->dev, "failed to configure DSI pins\n");
 		goto err0;
-	};
+	}
 
 	r = in->ops.dsi->set_config(in, &dsi_config);
 	if (r) {
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 4779750..96a1ea3 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2918,7 +2918,7 @@ static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int hsw,
 		break;
 	default:
 		BUG();
-	};
+	}
 
 	l = dispc_read_reg(DISPC_POL_FREQ(channel));
 	l |= FLD_VAL(onoff, 17, 17);
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index a598b58..b79f2aa 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4066,7 +4066,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 		default:
 			r = -EINVAL;
 			goto err_pix_fmt;
-		};
+		}
 
 		dsi_if_enable(dsidev, false);
 		dsi_vc_enable(dsidev, channel, false);
diff --git a/drivers/video/sbuslib.c b/drivers/video/sbuslib.c
index 296afae..a350209 100644
--- a/drivers/video/sbuslib.c
+++ b/drivers/video/sbuslib.c
@@ -186,7 +186,7 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
 	}
 	default:
 		return -EINVAL;
-	};
+	}
 }
 EXPORT_SYMBOL(sbusfb_ioctl_helper);
 
diff --git a/drivers/video/sysimgblt.c b/drivers/video/sysimgblt.c
index 186c6f6..a4d05b1 100644
--- a/drivers/video/sysimgblt.c
+++ b/drivers/video/sysimgblt.c
@@ -152,7 +152,7 @@ static void slow_imageblit(const struct fb_image *image, struct fb_info *p,
 			}
 			shift += bpp;
 			shift &= (32 - 1);
-			if (!l) { l = 8; s++; };
+			if (!l) { l = 8; s++; }
 		}
 
 		/* write trailing bits */
diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c
index c000852..634f60e 100644
--- a/drivers/video/tcx.c
+++ b/drivers/video/tcx.c
@@ -232,7 +232,7 @@ tcx_blank(int blank, struct fb_info *info)
 
 	case FB_BLANK_POWERDOWN: /* Poweroff */
 		break;
-	};
+	}
 
 	sbus_writel(val, &thc->thc_misc);
 
@@ -434,7 +434,7 @@ static int tcx_probe(struct platform_device *op)
 		default:
 			j = i;
 			break;
-		};
+		}
 		par->mmap_map[i].poff = op->resource[j].start;
 	}
 
diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c
index 897484903..b30e5a4 100644
--- a/drivers/video/vt8500lcdfb.c
+++ b/drivers/video/vt8500lcdfb.c
@@ -365,7 +365,7 @@ static int vt8500lcd_probe(struct platform_device *pdev)
 	if (!fb_mem_virt) {
 		pr_err("%s: Failed to allocate framebuffer\n", __func__);
 		return -ENOMEM;
-	};
+	}
 
 	fbi->fb.fix.smem_start	= fb_mem_phys;
 	fbi->fb.fix.smem_len	= fb_mem_len;
diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c
index 3dd8ed2..c341630 100644
--- a/drivers/watchdog/riowd.c
+++ b/drivers/watchdog/riowd.c
@@ -141,7 +141,7 @@ static long riowd_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 	default:
 		return -EINVAL;
-	};
+	}
 
 	return 0;
 }
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 94de6d1..0573986 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -158,7 +158,7 @@ static umode_t p9mode2unixmode(struct v9fs_session_info *v9ses,
 		default:
 			p9_debug(P9_DEBUG_ERROR, "Unknown special type %c %s\n",
 				 type, stat->extension);
-		};
+		}
 		*rdev = MKDEV(major, minor);
 	} else
 		res |= S_IFREG;
diff --git a/fs/befs/btree.c b/fs/befs/btree.c
index 74e397d..a04aecd 100644
--- a/fs/befs/btree.c
+++ b/fs/befs/btree.c
@@ -499,7 +499,7 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds,
 			   "for key of size %d", bufsize, keylen);
 		brelse(this_node->bh);
 		goto error_alloc;
-	};
+	}
 
 	strncpy(keybuf, keystart, keylen);
 	*value = fs64_to_cpu(sb, valarray[cur_key]);
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
index 0088bed..9328b1e 100644
--- a/fs/btrfs/print-tree.c
+++ b/fs/btrfs/print-tree.c
@@ -305,7 +305,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
 			print_uuid_item(l, btrfs_item_ptr_offset(l, i),
 					btrfs_item_size_nr(l, i));
 			break;
-		};
+		}
 	}
 }
 
diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c
index 9d61947..73d3715 100644
--- a/fs/dlm/rcom.c
+++ b/fs/dlm/rcom.c
@@ -577,7 +577,7 @@ void dlm_receive_rcom(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
 		lock = 1;
 		reply = 1;
 		break;
-	};
+	}
 
 	spin_lock(&ls->ls_recover_lock);
 	status = ls->ls_recover_status;
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index e2e0a90..a58b014 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -320,7 +320,7 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
 		ip->i_inode.i_rdev = MKDEV(be32_to_cpu(str->di_major),
 					   be32_to_cpu(str->di_minor));
 		break;
-	};
+	}
 
 	i_uid_write(&ip->i_inode, be32_to_cpu(str->di_uid));
 	i_gid_write(&ip->i_inode, be32_to_cpu(str->di_gid));
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index ced3257..dbe0346 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1351,7 +1351,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
 			error = -EEXIST;
 		default:
 			goto out_gunlock;
-		};
+		}
 
 		if (odip != ndip) {
 			if (!ndip->i_inode.i_nlink) {
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index 963b2d7..c1530b9 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -482,7 +482,7 @@ void gfs2_recover_func(struct work_struct *work)
 
 		default:
 			goto fail;
-		};
+		}
 
 		error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
 					   LM_FLAG_NOEXP | GL_NOCACHE, &ji_gh);
diff --git a/fs/hpfs/buffer.c b/fs/hpfs/buffer.c
index 4d0a1af..24406c3 100644
--- a/fs/hpfs/buffer.c
+++ b/fs/hpfs/buffer.c
@@ -25,7 +25,7 @@ void hpfs_prefetch_sectors(struct super_block *s, unsigned secno, int n)
 			return;
 		}
 		brelse(bh);
-	};
+	}
 
 	blk_start_plug(&plug);
 	while (n > 0) {
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index a6597d6..bea0487 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -1275,7 +1275,7 @@ int jffs2_dataflash_setup(struct jffs2_sb_info *c) {
 	if ((c->flash_size % c->sector_size) != 0) {
 		c->flash_size = (c->flash_size / c->sector_size) * c->sector_size;
 		pr_warn("flash size adjusted to %dKiB\n", c->flash_size);
-	};
+	}
 
 	c->wbuf_ofs = 0xFFFFFFFF;
 	c->wbuf = kmalloc(c->wbuf_pagesize, GFP_KERNEL);
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c
index 00ec0b9..33ed56b 100644
--- a/fs/lockd/clnt4xdr.c
+++ b/fs/lockd/clnt4xdr.c
@@ -468,7 +468,7 @@ static void nlm4_xdr_enc_res(struct rpc_rqst *req,
  *		struct nlm4_holder holder;
  *	default:
  *		void;
- *	};
+ *	}
  *
  *	struct nlm4_testres {
  *		netobj cookie;
@@ -500,7 +500,7 @@ static void nlm4_xdr_enc_testres(struct rpc_rqst *req,
  *		struct nlm4_holder holder;
  *	default:
  *		void;
- *	};
+ *	}
  *
  *	struct nlm4_testres {
  *		netobj cookie;
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index 9a55797..5629a8e 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -461,7 +461,7 @@ static void nlm_xdr_enc_res(struct rpc_rqst *req,
  *		struct nlm_holder holder;
  *	default:
  *		void;
- *	};
+ *	}
  *
  *	struct nlm_testres {
  *		netobj cookie;
@@ -498,7 +498,7 @@ static void nlm_xdr_enc_testres(struct rpc_rqst *req,
  *		struct nlm_holder holder;
  *	default:
  *		void;
- *	};
+ *	}
  *
  *	struct nlm_testres {
  *		netobj cookie;
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index 62db136..910b1ef 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -479,7 +479,7 @@ out_overflow:
  *		fattr attributes;
  *	default:
  *		void;
- *	};
+ *	}
  */
 static int decode_attrstat(struct xdr_stream *xdr, struct nfs_fattr *result)
 {
@@ -524,7 +524,7 @@ static void encode_diropargs(struct xdr_stream *xdr, const struct nfs_fh *fh,
  *		} diropok;
  *	default:
  *		void;
- *	};
+ *	}
  */
 static int decode_diropok(struct xdr_stream *xdr, struct nfs_diropok *result)
 {
@@ -825,7 +825,7 @@ static int nfs2_xdr_dec_diropres(struct rpc_rqst *req, struct xdr_stream *xdr,
  *		path data;
  *	default:
  *		void;
- *	};
+ *	}
  */
 static int nfs2_xdr_dec_readlinkres(struct rpc_rqst *req,
 				    struct xdr_stream *xdr, void *__unused)
@@ -854,7 +854,7 @@ out_default:
  *		nfsdata data;
  *	default:
  *		void;
- *	};
+ *	}
  */
 static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr,
 				struct nfs_readres *result)
@@ -966,7 +966,7 @@ out_overflow:
  *		} readdirok;
  *	default:
  *		void;
- *	};
+ *	}
  *
  * Read the directory contents into the page cache, but don't
  * touch them.  The actual decoding is done by nfs2_decode_dirent()
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index fa6d721..1809447 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -512,42 +512,42 @@ static __be32 *xdr_decode_nfstime3(__be32 *p, struct timespec *timep)
  *		mode3	mode;
  *	default:
  *		void;
- *	};
+ *	}
  *
  *	union set_uid3 switch (bool set_it) {
  *	case TRUE:
  *		uid3	uid;
  *	default:
  *		void;
- *	};
+ *	}
  *
  *	union set_gid3 switch (bool set_it) {
  *	case TRUE:
  *		gid3	gid;
  *	default:
  *		void;
- *	};
+ *	}
  *
  *	union set_size3 switch (bool set_it) {
  *	case TRUE:
  *		size3	size;
  *	default:
  *		void;
- *	};
+ *	}
  *
  *	union set_atime switch (time_how set_it) {
  *	case SET_TO_CLIENT_TIME:
  *		nfstime3	atime;
  *	default:
  *		void;
- *	};
+ *	}
  *
  *	union set_mtime switch (time_how set_it) {
  *	case SET_TO_CLIENT_TIME:
  *		nfstime3  mtime;
  *	default:
  *		void;
- *	};
+ *	}
  *
  *	struct sattr3 {
  *		set_mode3	mode;
@@ -698,7 +698,7 @@ out_overflow:
  *		fattr3	attributes;
  *	case FALSE:
  *		void;
- *	};
+ *	}
  */
 static int decode_post_op_attr(struct xdr_stream *xdr, struct nfs_fattr *fattr)
 {
@@ -754,7 +754,7 @@ out_overflow:
  *		wcc_attr	attributes;
  *	case FALSE:
  *		void;
- *	};
+ *	}
  *
  * wcc_data
  *
@@ -798,7 +798,7 @@ out:
  *		nfs_fh3  handle;
  *	case FALSE:
  *		void;
- *	};
+ *	}
  */
 static int decode_post_op_fh3(struct xdr_stream *xdr, struct nfs_fh *fh)
 {
@@ -859,7 +859,7 @@ static void nfs3_xdr_enc_getattr3args(struct rpc_rqst *req,
  *		nfstime3  obj_ctime;
  *	case FALSE:
  *		void;
- *	};
+ *	}
  *
  *	struct SETATTR3args {
  *		nfs_fh3		object;
@@ -1029,7 +1029,7 @@ static void nfs3_xdr_enc_write3args(struct rpc_rqst *req,
  *		sattr3       obj_attributes;
  *	case EXCLUSIVE:
  *		createverf3  verf;
- *	};
+ *	}
  *
  *	struct CREATE3args {
  *		diropargs3	where;
@@ -1122,7 +1122,7 @@ static void nfs3_xdr_enc_symlink3args(struct rpc_rqst *req,
  *		sattr3		pipe_attributes;
  *	default:
  *		void;
- *	};
+ *	}
  *
  *	struct MKNOD3args {
  *		diropargs3	where;
@@ -1377,7 +1377,7 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req,
  *		GETATTR3resok  resok;
  *	default:
  *		void;
- *	};
+ *	}
  */
 static int nfs3_xdr_dec_getattr3res(struct rpc_rqst *req,
 				    struct xdr_stream *xdr,
@@ -1414,7 +1414,7 @@ out_default:
  *		SETATTR3resok   resok;
  *	default:
  *		SETATTR3resfail resfail;
- *	};
+ *	}
  */
 static int nfs3_xdr_dec_setattr3res(struct rpc_rqst *req,
 				    struct xdr_stream *xdr,
@@ -1455,7 +1455,7 @@ out_status:
  *		LOOKUP3resok	resok;
  *	default:
  *		LOOKUP3resfail	resfail;
- *	};
+ *	}
  */
 static int nfs3_xdr_dec_lookup3res(struct rpc_rqst *req,
 				   struct xdr_stream *xdr,
@@ -1502,7 +1502,7 @@ out_default:
  *		ACCESS3resok	resok;
  *	default:
  *		ACCESS3resfail	resfail;
- *	};
+ *	}
  */
 static int nfs3_xdr_dec_access3res(struct rpc_rqst *req,
 				   struct xdr_stream *xdr,
@@ -1543,7 +1543,7 @@ out_default:
  *		READLINK3resok	resok;
  *	default:
  *		READLINK3resfail resfail;
- *	};
+ *	}
  */
 static int nfs3_xdr_dec_readlink3res(struct rpc_rqst *req,
 				     struct xdr_stream *xdr,
@@ -1586,7 +1586,7 @@ out_default:
  *		READ3resok	resok;
  *	default:
  *		READ3resfail	resfail;
- *	};
+ *	}
  */
 static int decode_read3resok(struct xdr_stream *xdr,
 			     struct nfs_readres *result)
@@ -1670,7 +1670,7 @@ out_status:
  *		WRITE3resok	resok;
  *	default:
  *		WRITE3resfail	resfail;
- *	};
+ *	}
  */
 static int decode_write3resok(struct xdr_stream *xdr,
 			      struct nfs_writeres *result)
@@ -1735,7 +1735,7 @@ out_status:
  *		CREATE3resok	resok;
  *	default:
  *		CREATE3resfail	resfail;
- *	};
+ *	}
  */
 static int decode_create3resok(struct xdr_stream *xdr,
 			       struct nfs3_diropres *result)
@@ -1797,7 +1797,7 @@ out_default:
  *		REMOVE3resok   resok;
  *	default:
  *		REMOVE3resfail resfail;
- *	};
+ *	}
  */
 static int nfs3_xdr_dec_remove3res(struct rpc_rqst *req,
 				   struct xdr_stream *xdr,
@@ -1838,7 +1838,7 @@ out_status:
  *		RENAME3resok   resok;
  *	default:
  *		RENAME3resfail resfail;
- *	};
+ *	}
  */
 static int nfs3_xdr_dec_rename3res(struct rpc_rqst *req,
 				   struct xdr_stream *xdr,
@@ -1882,7 +1882,7 @@ out_status:
  *		LINK3resok	resok;
  *	default:
  *		LINK3resfail	resfail;
- *	};
+ *	}
  */
 static int nfs3_xdr_dec_link3res(struct rpc_rqst *req, struct xdr_stream *xdr,
 				 struct nfs3_linkres *result)
@@ -2034,7 +2034,7 @@ out_truncated:
  *		READDIR3resok	resok;
  *	default:
  *		READDIR3resfail	resfail;
- *	};
+ *	}
  *
  * Read the directory contents into the page cache, but otherwise
  * don't touch them.  The actual decoding is done by nfs3_decode_entry()
@@ -2107,7 +2107,7 @@ out_default:
  *		FSSTAT3resok	resok;
  *	default:
  *		FSSTAT3resfail	resfail;
- *	};
+ *	}
  */
 static int decode_fsstat3resok(struct xdr_stream *xdr,
 			       struct nfs_fsstat *result)
@@ -2178,7 +2178,7 @@ out_status:
  *		FSINFO3resok	resok;
  *	default:
  *		FSINFO3resfail	resfail;
- *	};
+ *	}
  */
 static int decode_fsinfo3resok(struct xdr_stream *xdr,
 			       struct nfs_fsinfo *result)
@@ -2250,7 +2250,7 @@ out_status:
  *		PATHCONF3resok	resok;
  *	default:
  *		PATHCONF3resfail resfail;
- *	};
+ *	}
  */
 static int decode_pathconf3resok(struct xdr_stream *xdr,
 				 struct nfs_pathconf *result)
@@ -2308,7 +2308,7 @@ out_status:
  *		COMMIT3resok	resok;
  *	default:
  *		COMMIT3resfail	resfail;
- *	};
+ *	}
  */
 static int nfs3_xdr_dec_commit3res(struct rpc_rqst *req,
 				   struct xdr_stream *xdr,
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index d53d678..a252fcf 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5477,7 +5477,7 @@ static void nfs4_handle_setlk_error(struct nfs_server *server, struct nfs4_lock_
 		lsp->ls_seqid.flags &= ~NFS_SEQID_CONFIRMED;
 	case -NFS4ERR_EXPIRED:
 		nfs4_schedule_lease_recovery(server->nfs_client);
-	};
+	}
 }
 
 static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *fl, int recovery_type)
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index cc14cbb..2fe8ea6 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1093,7 +1093,7 @@ static void nfs_increment_seqid(int status, struct nfs_seqid *seqid)
 		case -NFS4ERR_NOFILEHANDLE:
 			/* Non-seqid mutating errors */
 			return;
-	};
+	}
 	/*
 	 * Note: no locking needed as we are guaranteed to be first
 	 * on the sequence list
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index a03b9c6..b6e9f1e 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1506,7 +1506,7 @@ static int nfs_parse_mount_options(char *raw,
 					dfprintk(MOUNT, "NFS:   invalid "
 							"lookupcache argument\n");
 					return 0;
-			};
+			}
 			break;
 		case Opt_fscache_uniq:
 			if (nfs_get_option_str(args, &mnt->fscache_uniq))
@@ -1539,7 +1539,7 @@ static int nfs_parse_mount_options(char *raw,
 				dfprintk(MOUNT, "NFS:	invalid	"
 						"local_lock argument\n");
 				return 0;
-			};
+			}
 			break;
 
 		/*
@@ -2439,7 +2439,7 @@ static void nfs_get_cache_cookie(struct super_block *sb,
 		if (mnt_s->fscache_key) {
 			uniq = mnt_s->fscache_key->key.uniquifier;
 			ulen = mnt_s->fscache_key->key.uniq_len;
-		};
+		}
 	} else
 		return;
 
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 7f05cd1..d266a77 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -392,7 +392,7 @@ static void encode_cb_sequence4args(struct xdr_stream *xdr,
  *		CB_SEQUENCE4resok	csr_resok4;
  *	default:
  *		void;
- *	};
+ *	}
  *
  * Our current back channel implmentation supports a single backchannel
  * with a single slot.
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 0874998..a0535df 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2001,7 +2001,7 @@ static __be32 nfsd4_map_bcts_dir(u32 *dir)
 	case NFS4_CDFC4_BACK_OR_BOTH:
 		*dir = NFS4_CDFC4_BOTH;
 		return nfs_ok;
-	};
+	}
 	return nfserr_inval;
 }
 
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index d9454fe..d1e149d 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1937,7 +1937,7 @@ static u32 nfs4_file_type(umode_t mode)
 	case S_IFREG:	return NF4REG;
 	case S_IFSOCK:	return NF4SOCK;
 	default:	return NF4BAD;
-	};
+	}
 }
 
 static __be32
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index 0c2f912..89876d2 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -32,7 +32,7 @@ static bool should_merge(struct fsnotify_event *old, struct fsnotify_event *new)
 			return true;
 		default:
 			BUG();
-		};
+		}
 	}
 	return false;
 }
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index 4216308..cb55f0d 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -63,7 +63,7 @@ static bool event_compare(struct fsnotify_event *old, struct fsnotify_event *new
 			else if (old->mask & FS_IN_IGNORED)
 				return false;
 			return true;
-		};
+		}
 	}
 	return false;
 }
diff --git a/fs/ntfs/lcnalloc.c b/fs/ntfs/lcnalloc.c
index 1711b71..c6db5d1 100644
--- a/fs/ntfs/lcnalloc.c
+++ b/fs/ntfs/lcnalloc.c
@@ -913,7 +913,7 @@ s64 __ntfs_cluster_free(ntfs_inode *ni, const VCN start_vcn, s64 count,
 		}
 		/* We have freed @to_free real clusters. */
 		real_freed = to_free;
-	};
+	}
 	/* Go to the next run and adjust the number of clusters left to free. */
 	++rl;
 	if (count >= 0)
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 82650d5..30f260b 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -1623,7 +1623,7 @@ read_partial_attrdef_page:
 		memcpy((u8*)vol->attrdef + (index++ << PAGE_CACHE_SHIFT),
 				page_address(page), size);
 		ntfs_unmap_page(page);
-	};
+	}
 	if (size == PAGE_CACHE_SIZE) {
 		size = i_size & ~PAGE_CACHE_MASK;
 		if (size)
@@ -1692,7 +1692,7 @@ read_partial_upcase_page:
 		memcpy((char*)vol->upcase + (index++ << PAGE_CACHE_SHIFT),
 				page_address(page), size);
 		ntfs_unmap_page(page);
-	};
+	}
 	if (size == PAGE_CACHE_SIZE) {
 		size = i_size & ~PAGE_CACHE_MASK;
 		if (size)
diff --git a/fs/ocfs2/cluster/quorum.c b/fs/ocfs2/cluster/quorum.c
index 1ec141e..e6ba7dd 100644
--- a/fs/ocfs2/cluster/quorum.c
+++ b/fs/ocfs2/cluster/quorum.c
@@ -86,7 +86,7 @@ static void o2quo_fence_self(void)
 		       "system by restarting ***\n");
 		emergency_restart();
 		break;
-	};
+	}
 }
 
 /* Indicate that a timeout occurred on a hearbeat region write. The
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 3a44a64..799efed 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -554,7 +554,7 @@ void ocfs2_inode_lock_res_init(struct ocfs2_lock_res *res,
 			mlog_bug_on_msg(1, "type: %d\n", type);
 			ops = NULL; /* thanks, gcc */
 			break;
-	};
+	}
 
 	ocfs2_build_lock_name(type, OCFS2_I(inode)->ip_blkno,
 			      generation, res->l_name);
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index dc9a682..2b7a737 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -562,7 +562,7 @@ int reiserfs_parse_alloc_options(struct super_block *s, char *options)
 		if (!strcmp(this_char, "displacing_new_packing_localities")) {
 			SET_OPTION(displacing_new_packing_localities);
 			continue;
-		};
+		}
 
 		if (!strcmp(this_char, "old_hashed_relocation")) {
 			SET_OPTION(old_hashed_relocation);
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index 4c37607..9d0ce84 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -584,7 +584,7 @@ int ubifs_read_superblock(struct ubifs_info *c)
 		c->key_hash = key_test_hash;
 		c->key_hash_type = UBIFS_KEY_HASH_TEST;
 		break;
-	};
+	}
 
 	c->key_fmt = sup->key_fmt;
 
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
index 22831c4..3031a64 100644
--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
@@ -499,7 +499,7 @@ static int audit_watch_handle_event(struct fsnotify_group *group,
 		BUG();
 		inode = NULL;
 		break;
-	};
+	}
 
 	if (mask & (FS_CREATE|FS_MOVED_TO) && inode)
 		audit_update_watch(parent, dname, inode->i_sb->s_dev, inode->i_ino, 0);
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index f7aee8b..6a3d51f 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -319,7 +319,7 @@ static int audit_field_valid(struct audit_entry *entry, struct audit_field *f)
 		    entry->rule.listnr != AUDIT_FILTER_USER)
 			return -EINVAL;
 		break;
-	};
+	}
 
 	switch(f->type) {
 	default:
@@ -385,7 +385,7 @@ static int audit_field_valid(struct audit_entry *entry, struct audit_field *f)
 		if (f->val > AUDIT_MAX_FIELD_COMPARE)
 			return -EINVAL;
 		break;
-	};
+	}
 	return 0;
 }
 
diff --git a/kernel/res_counter.c b/kernel/res_counter.c
index 4aa8a30..2bd6cae 100644
--- a/kernel/res_counter.c
+++ b/kernel/res_counter.c
@@ -135,7 +135,7 @@ res_counter_member(struct res_counter *counter, int member)
 		return &counter->failcnt;
 	case RES_SOFT_LIMIT:
 		return &counter->soft_limit;
-	};
+	}
 
 	BUG();
 	return NULL;
diff --git a/kernel/smp.c b/kernel/smp.c
index 0564571..f0eff5d 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -71,7 +71,7 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
 		free_percpu(cfd->csd);
 		break;
 #endif
-	};
+	}
 
 	return NOTIFY_OK;
 }
diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c
index 31c5f76..9a45a7f 100644
--- a/lib/decompress_bunzip2.c
+++ b/lib/decompress_bunzip2.c
@@ -384,7 +384,7 @@ static int INIT get_next_block(struct bunzip_data *bd)
 			bd->inbufBits =
 				(bd->inbufBits << 8)|bd->inbuf[bd->inbufPos++];
 			bd->inbufBitCount += 8;
-		};
+		}
 		bd->inbufBitCount -= hufGroup->maxLen;
 		j = (bd->inbufBits >> bd->inbufBitCount)&
 			((1 << hufGroup->maxLen)-1);
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1c52ddb..2e3152a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1798,7 +1798,7 @@ static void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
 				return;
 			case OOM_SCAN_OK:
 				break;
-			};
+			}
 			points = oom_badness(task, memcg, NULL, totalpages);
 			if (points > chosen_points) {
 				if (chosen)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 314e9d2..7439223 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -317,7 +317,7 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
 			return (struct task_struct *)(-1UL);
 		case OOM_SCAN_OK:
 			break;
-		};
+		}
 		points = oom_badness(p, NULL, nodemask, totalpages);
 		if (points > chosen_points) {
 			chosen = p;
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 0846566..27e3bca 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -484,7 +484,7 @@ gss_alloc_msg(struct gss_auth *gss_auth,
 		gss_encode_v0_msg(gss_msg);
 	default:
 		gss_encode_v1_msg(gss_msg, service_name, gss_auth->target_name);
-	};
+	}
 	return gss_msg;
 }
 
diff --git a/scripts/conmakehash.c b/scripts/conmakehash.c
index 263a44d..f7e844d 100644
--- a/scripts/conmakehash.c
+++ b/scripts/conmakehash.c
@@ -262,7 +262,7 @@ u8 dfont_unicount[%d] = \n\
     {
       printf("%3d", unicount[i]);
       if ( i == fontlen-1 )
-        printf("\n};\n");
+        printf("\n}\n");
       else if ( i % 8 == 7 )
         printf(",\n\t");
       else
@@ -282,7 +282,7 @@ u8 dfont_unicount[%d] = \n\
 	}
       printf("0x%04x", unitable[fp0][nent++]);
       if ( i == nuni-1 )
-         printf("\n};\n");
+         printf("\n}\n");
        else if ( i % 8 == 7 )
          printf(",\n\t");
        else
diff --git a/scripts/dtc/fdtdump.c b/scripts/dtc/fdtdump.c
index 207a46d..b09fa01 100644
--- a/scripts/dtc/fdtdump.c
+++ b/scripts/dtc/fdtdump.c
@@ -115,7 +115,7 @@ static void dump_blob(void *blob)
 		if (tag == FDT_END_NODE) {
 			depth--;
 
-			printf("%*s};\n", depth * shift, "");
+			printf("%*s}\n", depth * shift, "");
 			continue;
 		}
 
diff --git a/security/apparmor/path.c b/security/apparmor/path.c
index 35b394a..de45a40 100644
--- a/security/apparmor/path.c
+++ b/security/apparmor/path.c
@@ -102,7 +102,7 @@ static int d_namespace_path(struct path *path, char *buf, int buflen,
 			error = PTR_ERR(res);
 			*name = buf;
 			goto out;
-		};
+		}
 	} else if (!our_mnt(path->mnt))
 		connected = 0;
 
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 5b52310..22b5058 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1044,7 +1044,7 @@ static void selinux_write_opts(struct seq_file *m,
 		default:
 			BUG();
 			return;
-		};
+		}
 		/* we need a comma before each option */
 		seq_putc(m, ',');
 		seq_puts(m, prefix);
diff --git a/sound/oss/sb_ess.c b/sound/oss/sb_ess.c
index c0be085..0e7254b 100644
--- a/sound/oss/sb_ess.c
+++ b/sound/oss/sb_ess.c
@@ -1544,7 +1544,7 @@ static int ess_has_rec_mixer (int submodel)
 		return 1;
 	default:
 		return 0;
-	};
+	}
 };
 
 #ifdef FKS_LOGGING
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c
index b46dc9b..9fb03b4 100644
--- a/sound/pci/au88x0/au88x0_pcm.c
+++ b/sound/pci/au88x0/au88x0_pcm.c
@@ -671,7 +671,7 @@ static int snd_vortex_new_pcm(vortex_t *chip, int idx, int nr)
 			return err;
 		break;
 #endif
-	};
+	}
 
 	if (VORTEX_PCM_TYPE(pcm) == VORTEX_PCM_SPDIF) {
 		for (i = 0; i < ARRAY_SIZE(snd_vortex_mixer_spdif); i++) {
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index bb53dea..8697ced 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -777,7 +777,7 @@ static int asoc_ssc_init(struct device *dev)
 	if (ret) {
 		dev_err(dev, "Could not register PCM: %d\n", ret);
 		goto err_unregister_dai;
-	};
+	}
 
 	return 0;
 
diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c
index 5f9af1f..49cc5f6 100644
--- a/sound/soc/codecs/ak4641.c
+++ b/sound/soc/codecs/ak4641.c
@@ -328,7 +328,7 @@ static int ak4641_i2s_hw_params(struct snd_pcm_substream *substream,
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		ak4641->playback_fs = rate;
 		ak4641_set_deemph(codec);
-	};
+	}
 
 	return 0;
 }
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index ea141e1..1544330 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -382,7 +382,7 @@ static int mc13783_set_tdm_slot_dac(struct snd_soc_dai *dai,
 		break;
 	default:
 		return -EINVAL;
-	};
+	}
 
 	snd_soc_update_bits(codec, MC13783_SSI_NETWORK, mask, val);
 
diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c
index 6d31d88..e29cdb7 100644
--- a/sound/soc/codecs/tas5086.c
+++ b/sound/soc/codecs/tas5086.c
@@ -429,7 +429,7 @@ static int tas5086_hw_params(struct snd_pcm_substream *substream,
 	default:
 		dev_err(codec->dev, "Invalid bit width\n");
 		return -EINVAL;
-	};
+	}
 
 	ret = regmap_write(priv->regmap, TAS5086_SERIAL_DATA_IF, val);
 	if (ret < 0)
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 3c79dbb..35059a2 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -246,7 +246,7 @@ static bool twl6040_is_path_unmuted(struct snd_soc_codec *codec,
 		return priv->dl2_unmuted;
 	default:
 		return 1;
-	};
+	}
 }
 
 /*
@@ -1100,7 +1100,7 @@ static void twl6040_mute_path(struct snd_soc_codec *codec, enum twl6040_dai_id i
 		break;
 	default:
 		break;
-	};
+	}
 }
 
 static int twl6040_digital_mute(struct snd_soc_dai *dai, int mute)
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index 3920c3e..c0fea02 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -963,7 +963,7 @@ static bool fsl_spdif_readable_reg(struct device *dev, unsigned int reg)
 		return true;
 	default:
 		return false;
-	};
+	}
 }
 
 static bool fsl_spdif_writeable_reg(struct device *dev, unsigned int reg)
@@ -982,7 +982,7 @@ static bool fsl_spdif_writeable_reg(struct device *dev, unsigned int reg)
 		return true;
 	default:
 		return false;
-	};
+	}
 }
 
 static const struct regmap_config fsl_spdif_regmap_config = {
diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c
index 52af7f6..364bf6a 100644
--- a/sound/soc/tegra/tegra20_i2s.c
+++ b/sound/soc/tegra/tegra20_i2s.c
@@ -297,7 +297,7 @@ static bool tegra20_i2s_wr_rd_reg(struct device *dev, unsigned int reg)
 		return true;
 	default:
 		return false;
-	};
+	}
 }
 
 static bool tegra20_i2s_volatile_reg(struct device *dev, unsigned int reg)
@@ -310,7 +310,7 @@ static bool tegra20_i2s_volatile_reg(struct device *dev, unsigned int reg)
 		return true;
 	default:
 		return false;
-	};
+	}
 }
 
 static bool tegra20_i2s_precious_reg(struct device *dev, unsigned int reg)
@@ -321,7 +321,7 @@ static bool tegra20_i2s_precious_reg(struct device *dev, unsigned int reg)
 		return true;
 	default:
 		return false;
-	};
+	}
 }
 
 static const struct regmap_config tegra20_i2s_regmap_config = {
diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdif.c
index 551b3c9..08bc693 100644
--- a/sound/soc/tegra/tegra20_spdif.c
+++ b/sound/soc/tegra/tegra20_spdif.c
@@ -213,7 +213,7 @@ static bool tegra20_spdif_wr_rd_reg(struct device *dev, unsigned int reg)
 		return true;
 	default:
 		return false;
-	};
+	}
 }
 
 static bool tegra20_spdif_volatile_reg(struct device *dev, unsigned int reg)
@@ -234,7 +234,7 @@ static bool tegra20_spdif_volatile_reg(struct device *dev, unsigned int reg)
 		return true;
 	default:
 		return false;
-	};
+	}
 }
 
 static bool tegra20_spdif_precious_reg(struct device *dev, unsigned int reg)
@@ -247,7 +247,7 @@ static bool tegra20_spdif_precious_reg(struct device *dev, unsigned int reg)
 		return true;
 	default:
 		return false;
-	};
+	}
 }
 
 static const struct regmap_config tegra20_spdif_regmap_config = {
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
index d554d46..805b1f3 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -346,7 +346,7 @@ static bool tegra30_ahub_apbif_wr_rd_reg(struct device *dev, unsigned int reg)
 		return true;
 	default:
 		break;
-	};
+	}
 
 	if (REG_IN_ARRAY(reg, CHANNEL_CTRL) ||
 	    REG_IN_ARRAY(reg, CHANNEL_CLEAR) ||
@@ -381,7 +381,7 @@ static bool tegra30_ahub_apbif_volatile_reg(struct device *dev,
 		return true;
 	default:
 		break;
-	};
+	}
 
 	if (REG_IN_ARRAY(reg, CHANNEL_CLEAR) ||
 	    REG_IN_ARRAY(reg, CHANNEL_STATUS) ||
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c
index 47565fd04..bd71145 100644
--- a/sound/soc/tegra/tegra30_i2s.c
+++ b/sound/soc/tegra/tegra30_i2s.c
@@ -369,7 +369,7 @@ static bool tegra30_i2s_wr_rd_reg(struct device *dev, unsigned int reg)
 		return true;
 	default:
 		return false;
-	};
+	}
 }
 
 static bool tegra30_i2s_volatile_reg(struct device *dev, unsigned int reg)
@@ -382,7 +382,7 @@ static bool tegra30_i2s_volatile_reg(struct device *dev, unsigned int reg)
 		return true;
 	default:
 		return false;
-	};
+	}
 }
 
 static const struct regmap_config tegra30_i2s_regmap_config = {
diff --git a/tools/lib/traceevent/kbuffer-parse.c b/tools/lib/traceevent/kbuffer-parse.c
index dcc6652..f0172a3 100644
--- a/tools/lib/traceevent/kbuffer-parse.c
+++ b/tools/lib/traceevent/kbuffer-parse.c
@@ -453,7 +453,7 @@ void *kbuffer_translate_data(int swap, void *data, unsigned int *size)
 	case KBUFFER_TYPE_TIME_EXTEND:
 	case KBUFFER_TYPE_TIME_STAMP:
 		return NULL;
-	};
+	}
 
 	*size = length;
 
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index f28799e..c629738 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -837,7 +837,7 @@ hpp__entry_pair(struct hist_entry *he, struct hist_entry *pair,
 
 	default:
 		BUG_ON(1);
-	};
+	}
 }
 
 static void
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index ee33ba2..961775c 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -764,7 +764,7 @@ static void dump_threads(void)
 		t = perf_session__findnew(session, st->tid);
 		pr_info("%10d: %s\n", st->tid, t->comm);
 		node = rb_next(node);
-	};
+	}
 }
 
 static void dump_map(void)
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 6fb781d..5f364f5 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -568,5 +568,5 @@ int test__code_reading(void)
 		return 0;
 	default:
 		return -1;
-	};
+	}
 }
diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index f211227..85860a8 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -94,7 +94,7 @@ static void skip(int size)
 		r = size > BUFSIZ ? BUFSIZ : size;
 		do_read(buf, r);
 		size -= r;
-	};
+	}
 }
 
 static unsigned int read4(struct pevent *pevent)
diff --git a/tools/power/cpupower/utils/cpupower-info.c b/tools/power/cpupower/utils/cpupower-info.c
index 3f68632..2ca338a 100644
--- a/tools/power/cpupower/utils/cpupower-info.c
+++ b/tools/power/cpupower/utils/cpupower-info.c
@@ -69,7 +69,7 @@ int cmd_info(int argc, char **argv)
 		default:
 			print_wrong_arg_exit();
 		}
-	};
+	}
 
 	if (!params.params)
 		params.params = 0x7;
diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c
index dc4de37..12f0e47 100644
--- a/tools/power/cpupower/utils/cpupower-set.c
+++ b/tools/power/cpupower/utils/cpupower-set.c
@@ -91,7 +91,7 @@ int cmd_set(int argc, char **argv)
 		default:
 			print_wrong_arg_exit();
 		}
-	};
+	}
 
 	if (!params.params)
 		print_wrong_arg_exit();
diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
index 2116df9..596e1bc 100644
--- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
+++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
@@ -118,7 +118,7 @@ static int amd_fam14h_get_pci_info(struct cstate *state,
 		break;
 	default:
 		return -1;
-	};
+	}
 	return 0;
 }
 
diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
index bcd22a1..6989f6c 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
+++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
@@ -55,7 +55,7 @@ static int cpuidle_start(void)
 			dprint("CPU %d - State: %d - Val: %llu\n",
 			       cpu, state, previous_count[cpu][state]);
 		}
-	};
+	}
 	return 0;
 }
 
@@ -74,7 +74,7 @@ static int cpuidle_stop(void)
 			dprint("CPU %d - State: %d - Val: %llu\n",
 			       cpu, state, previous_count[cpu][state]);
 		}
-	};
+	}
 	return 0;
 }
 
@@ -156,7 +156,7 @@ static struct cpuidle_monitor *cpuidle_register(void)
 		cpuidle_cstates[num].id = num;
 		cpuidle_cstates[num].get_count_percent =
 			cpuidle_get_count_percent;
-	};
+	}
 
 	/* Free this at program termination */
 	previous_count = malloc(sizeof(long long *) * cpu_count);
diff --git a/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c b/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c
index ebeaba6..0fa489a 100644
--- a/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c
+++ b/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c
@@ -81,7 +81,7 @@ static int hsw_ext_get_count(enum intel_hsw_ext_id id, unsigned long long *val,
 		break;
 	default:
 		return -1;
-	};
+	}
 	if (read_msr(cpu, msr, val))
 		return -1;
 	return 0;
diff --git a/tools/power/cpupower/utils/idle_monitor/nhm_idle.c b/tools/power/cpupower/utils/idle_monitor/nhm_idle.c
index d2a91dd..9f4bdaf 100644
--- a/tools/power/cpupower/utils/idle_monitor/nhm_idle.c
+++ b/tools/power/cpupower/utils/idle_monitor/nhm_idle.c
@@ -92,7 +92,7 @@ static int nhm_get_count(enum intel_nhm_id id, unsigned long long *val,
 		break;
 	default:
 		return -1;
-	};
+	}
 	if (read_msr(cpu, msr, val))
 		return -1;
 
diff --git a/tools/power/cpupower/utils/idle_monitor/snb_idle.c b/tools/power/cpupower/utils/idle_monitor/snb_idle.c
index efc8a69..3dd9da6 100644
--- a/tools/power/cpupower/utils/idle_monitor/snb_idle.c
+++ b/tools/power/cpupower/utils/idle_monitor/snb_idle.c
@@ -78,7 +78,7 @@ static int snb_get_count(enum intel_snb_id id, unsigned long long *val,
 		break;
 	default:
 		return -1;
-	};
+	}
 	if (read_msr(cpu, msr, val))
 		return -1;
 	return 0;
diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
index d664182..2f32f9e 100644
--- a/tools/testing/selftests/ipc/msgque.c
+++ b/tools/testing/selftests/ipc/msgque.c
@@ -65,7 +65,7 @@ int restore_queue(struct msgque_data *msgque)
 			printf("msgsnd failed (%m)\n");
 			ret = -errno;
 			goto destroy;
-		};
+		}
 	}
 	return 0;
 
@@ -176,7 +176,7 @@ int fill_msgque(struct msgque_data *msgque)
 				IPC_NOWAIT) != 0) {
 		printf("First message send failed (%m)\n");
 		return -errno;
-	};
+	}
 
 	msgbuf.mtype = ANOTHER_MSG_TYPE;
 	memcpy(msgbuf.mtext, ANOTHER_TEST_STRING, sizeof(ANOTHER_TEST_STRING));
@@ -184,7 +184,7 @@ int fill_msgque(struct msgque_data *msgque)
 				IPC_NOWAIT) != 0) {
 		printf("Second message send failed (%m)\n");
 		return -errno;
-	};
+	}
 	return 0;
 }
 
diff --git a/tools/virtio/virtio-trace/trace-agent-ctl.c b/tools/virtio/virtio-trace/trace-agent-ctl.c
index a2d0403..b2ca55c 100644
--- a/tools/virtio/virtio-trace/trace-agent-ctl.c
+++ b/tools/virtio/virtio-trace/trace-agent-ctl.c
@@ -77,7 +77,7 @@ static int wait_order(int ctl_fd)
 
 		if (ret)
 			break;
-	};
+	}
 
 	return ret;
 




From bhelgaas at google.com  Tue Oct  8 16:28:40 2013
From: bhelgaas at google.com (Bjorn Helgaas)
Date: Tue, 8 Oct 2013 14:28:40 -0600
Subject: remove unneeded semicolons
In-Reply-To: <1381260511.2081.250.camel@joe-AO722>
References: <20131008184815.3778.52129.stgit@localhost6.localdomain6>
 <1381260511.2081.250.camel@joe-AO722>
Message-ID: <CAErSpo66rdt7F6sem0G0dz7ieRbeJG2P98WNhQBKacF0TWuvFA@mail.gmail.com>

Thanks, Joe.  I picked up the drivers/pci changes below and will merge
them in the v3.13 merge window if nobody else does it first.

Bjorn


diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index cdc7836..46d1378 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -222,7 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file,
unsigned int cmd,
        default:
                ret = -EINVAL;
                break;
-       };
+       }

        return ret;
 }
diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
index e1c1ec5..24750a1 100644
--- a/drivers/pci/syscall.c
+++ b/drivers/pci/syscall.c
@@ -44,7 +44,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus,
unsigned long, dfn,
        default:
                err = -EINVAL;
                goto error;
-       };
+       }

        err = -EIO;
        if (cfg_ret != PCIBIOS_SUCCESSFUL)


From michal.kazior at tieto.com  Tue Oct  8 22:59:06 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Tue, 8 Oct 2013 19:59:06 -0700
Subject: [PATCH/RFT v2 1/4] ath10k: fix add_interface failure handling
In-Reply-To: <87siwbr2sc.fsf@kamboji.qca.qualcomm.com>
References: <1380805765-31521-1-git-send-email-michal.kazior@tieto.com>
 <1380865425-3791-1-git-send-email-michal.kazior@tieto.com>
 <1380865425-3791-2-git-send-email-michal.kazior@tieto.com>
 <87mwmjsz2k.fsf@kamboji.qca.qualcomm.com>
 <CA+BoTQ=qep+rKEyLKrNjNP6K1q+FHKpvkscwXuRMR_45YnRvHA@mail.gmail.com>
 <87siwbr2sc.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CA+BoTQkPRAVz_2mwv7bL4SEBkQ5BT-4mBvBY7vwNadJkfv9o4w@mail.gmail.com>

On 8 October 2013 12:16, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Michal Kazior <michal.kazior at tieto.com> writes:
>
>> On 8 October 2013 05:54, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
>>> Michal Kazior <michal.kazior at tieto.com> writes:
>>>
>>>> If something failed along add_interface() setup it
>>>> was possible to leak a vdev id, vdev and peer.
>>>>
>>>> This could end up with leaked FW state or FW crash
>>>> (assuming add_interface() failure wasn't a result of
>>>> a crash).
>>>>
>>>> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
>>>
>>> Then I apply this patch on top of current ath.git master branch (commit
>>> 18fe0b53e76) interface up fails on the managed mode:
>>>
>>> $ sudo ip link set wlan1 up
>>> RTNETLINK answers: Invalid argument
>>>
>>> Logs don't have anything special (the TX encap error was already
>>> before):
>>>
>>> [ 1259.818863] ath10k: MSI-X didn't succeed (1), trying MSI
>>> [ 1259.819298] ath10k_pci 0000:02:00.0: irq 49 for MSI/MSI-X
>>> [ 1259.820055] ath10k: MSI interrupt handling
>>> [ 1260.747877] ath10k: UART prints disabled
>>> [ 1260.828219] ath10k: firmware 10.1.389 booted
>>> [ 1260.837585] ath10k: htt target version 2.1
>>> [ 1260.838498] ath10k: Failed to set TX encap: -22
>>
>> Ah. Right. I've tested this patch with main FW branch which supports
>> TX encap command. The TX encap issue should be dealth with first.
>
> What do you mean? Did I miss a patch?

You didn't miss any patch.

I think you've already pointed out the TX encap warning in your other email.

It's the TX encap that most likely gets you "invalid argument" when
trying to bring up the interface with my patch as FW 10.1.389 doesn't
support the command.


Micha?


From kvalo at qca.qualcomm.com  Wed Oct  9 10:15:32 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 9 Oct 2013 17:15:32 +0300
Subject: [PATCH] ath10k: fix ath10k_debug_start() locking
In-Reply-To: <20131008184525.32604.64051.stgit@localhost6.localdomain6> (Kalle
 Valo's message of "Tue, 08 Oct 2013 21:45:25 +0300")
References: <20131008184525.32604.64051.stgit@localhost6.localdomain6>
Message-ID: <87k3hmo7i3.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo at qca.qualcomm.com> writes:

> ath10k_debug_start() was not called with conf_mutex, fix that. Also there was a
> deadlock in ath10k_debug_stop(), rename it to ath10k_debug_destroy() and call
> it only when the device is destroyed.
>
> Reported-by: Mohammed Shafi Shajakhan <mohammed at qca.qualcomm.com>
> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>

Applied.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Wed Oct  9 10:17:31 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 9 Oct 2013 17:17:31 +0300
Subject: [PATCH] ath10k: remove unneded semicolon from
 ath10k_core_fetch_firmware_api_n()
In-Reply-To: <20131008184815.3778.52129.stgit@localhost6.localdomain6> (Kalle
 Valo's message of "Tue, 08 Oct 2013 21:48:15 +0300")
References: <20131008184815.3778.52129.stgit@localhost6.localdomain6>
Message-ID: <87fvsao7es.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo at qca.qualcomm.com> writes:

> From: Fengguang Wu <fengguang.wu at intel.com>
>
> drivers/net/wireless/ath/ath10k/core.c:507:2-3: Unneeded semicolon
>
>  Removes unneeded semicolon.
>
> Generated by: coccinelle/misc/semicolon.cocci
>
> Signed-off-by: Fengguang Wu <fengguang.wu at intel.com>
> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>

Applied.

-- 
Kalle Valo


From bartosz.markowski at tieto.com  Mon Oct 14 07:16:21 2013
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Mon, 14 Oct 2013 13:16:21 +0200
Subject: [PATCH] ath10k: do not warn about unsupported vdev param
Message-ID: <1381749381-15459-1-git-send-email-bartosz.markowski@tieto.com>

10.X firmware does not support WMI_VDEV_PARAM_TX_ENCAP_TYPE.
It's a known limitation and we should not warn about this.

Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 049eca2..9c800f8 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2085,7 +2085,9 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	vdev_param = ar->wmi.vdev_param->tx_encap_type;
 	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
 					ATH10K_HW_TXRX_NATIVE_WIFI);
-	if (ret)
+
+	/* 10.X firmware does not support this VDEV parameter. Do not warn */
+	if (ret && !test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features))
 		ath10k_warn("Failed to set TX encap: %d\n", ret);
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
-- 
1.7.10



From kvalo at qca.qualcomm.com  Mon Oct 14 11:46:05 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 14 Oct 2013 18:46:05 +0300
Subject: [PATCH] ath10k: do not warn about unsupported vdev param
In-Reply-To: <1381749381-15459-1-git-send-email-bartosz.markowski@tieto.com>
 (Bartosz Markowski's message of "Mon, 14 Oct 2013 13:16:21 +0200")
References: <1381749381-15459-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <87fvs3etz6.fsf@kamboji.qca.qualcomm.com>

Bartosz Markowski <bartosz.markowski at tieto.com> writes:

> 10.X firmware does not support WMI_VDEV_PARAM_TX_ENCAP_TYPE.
> It's a known limitation and we should not warn about this.
>
> Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
> ---
>  drivers/net/wireless/ath/ath10k/mac.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
> index 049eca2..9c800f8 100644
> --- a/drivers/net/wireless/ath/ath10k/mac.c
> +++ b/drivers/net/wireless/ath/ath10k/mac.c
> @@ -2085,7 +2085,9 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
>  	vdev_param = ar->wmi.vdev_param->tx_encap_type;
>  	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
>  					ATH10K_HW_TXRX_NATIVE_WIFI);
> -	if (ret)
> +
> +	/* 10.X firmware does not support this VDEV parameter. Do not warn */
> +	if (ret && !test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features))
>  		ath10k_warn("Failed to set TX encap: %d\n", ret);

But why call ath10k_wmi_vdev_set_param() even if we know it won't work?
IMHO it's cleaner not to call it at all when ATH10K_FW_FEATURE_WMI_10X
is set.

Or if we want to avoid using ATH10K_FW_FEATURE_WMI_10X we could also
change ath10k_wmi_pdev_set_param() to return -EOPNOTSUPP and check for
that.

-- 
Kalle Valo


From bartosz.markowski at tieto.com  Mon Oct 14 12:06:06 2013
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Mon, 14 Oct 2013 18:06:06 +0200
Subject: [PATCH] ath10k: do not warn about unsupported vdev param
In-Reply-To: <87fvs3etz6.fsf@kamboji.qca.qualcomm.com>
References: <1381749381-15459-1-git-send-email-bartosz.markowski@tieto.com>
 <87fvs3etz6.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CACKGw+HC1goQ_BdAqHkQSFhtSbZuqCLFRZTEJjgUSLQRgQ436A@mail.gmail.com>

On 14 October 2013 17:46, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Bartosz Markowski <bartosz.markowski at tieto.com> writes:
>
>> 10.X firmware does not support WMI_VDEV_PARAM_TX_ENCAP_TYPE.
>> It's a known limitation and we should not warn about this.
>>
>> Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
>> ---
>>  drivers/net/wireless/ath/ath10k/mac.c |    4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
>> index 049eca2..9c800f8 100644
>> --- a/drivers/net/wireless/ath/ath10k/mac.c
>> +++ b/drivers/net/wireless/ath/ath10k/mac.c
>> @@ -2085,7 +2085,9 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
>>       vdev_param = ar->wmi.vdev_param->tx_encap_type;
>>       ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
>>                                       ATH10K_HW_TXRX_NATIVE_WIFI);
>> -     if (ret)
>> +
>> +     /* 10.X firmware does not support this VDEV parameter. Do not warn */
>> +     if (ret && !test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features))
>>               ath10k_warn("Failed to set TX encap: %d\n", ret);
>
> But why call ath10k_wmi_vdev_set_param() even if we know it won't work?
> IMHO it's cleaner not to call it at all when ATH10K_FW_FEATURE_WMI_10X
> is set.

I tend to agree. Intention was to keep things generic and just hide the warning.

> Or if we want to avoid using ATH10K_FW_FEATURE_WMI_10X we could also
> change ath10k_wmi_pdev_set_param() to return -EOPNOTSUPP and check for
> that.

I like the second idea. I will send a v2 patch.

-- 
Bartosz


From bartosz.markowski at tieto.com  Tue Oct 15 03:26:20 2013
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Tue, 15 Oct 2013 09:26:20 +0200
Subject: [PATCH v2] ath10k: do not warn about unsupported vdev param
Message-ID: <1381821980-7966-1-git-send-email-bartosz.markowski@tieto.com>

10.X firmware does not support WMI_VDEV_PARAM_TX_ENCAP_TYPE.
It's a known limitation and we should not warn about this.

Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |    3 ++-
 drivers/net/wireless/ath/ath10k/wmi.c |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 049eca2..97d7111 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2085,7 +2085,8 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	vdev_param = ar->wmi.vdev_param->tx_encap_type;
 	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
 					ATH10K_HW_TXRX_NATIVE_WIFI);
-	if (ret)
+	/* 10.X firmware does not support this VDEV parameter. Do not warn */
+	if (ret && ret != -EOPNOTSUPP)
 		ath10k_warn("Failed to set TX encap: %d\n", ret);
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index f9766fa..fa07388 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2763,7 +2763,7 @@ int ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id,
 		ath10k_dbg(ATH10K_DBG_WMI,
 			   "vdev param %d not supported by firmware\n",
 			    param_id);
-		return -EINVAL;
+		return -EOPNOTSUPP;
 	}
 
 	skb = ath10k_wmi_alloc_skb(sizeof(*cmd));
-- 
1.7.10



From bartosz.markowski at tieto.com  Tue Oct 15 03:55:31 2013
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Tue, 15 Oct 2013 09:55:31 +0200
Subject: [PATCH 1/2] ath10k: rename WMI_CMD_UNDEFINED
Message-ID: <1381823732-10128-1-git-send-email-bartosz.markowski@tieto.com>

Rename WMI_CMD_UNDEFINED to WMI_CMD_UNSUPPORTED. This is more
accurate here. Also return -EOPNOTSUPP instead of -EINVAL in
wmi_cmd_send().

Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |   46 ++++++++++++++++-----------------
 drivers/net/wireless/ath/ath10k/wmi.h |    2 +-
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index f9766fa..ea2669b 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -149,7 +149,7 @@ static struct wmi_cmd_map wmi_10x_cmd_map = {
 	.start_scan_cmdid = WMI_10X_START_SCAN_CMDID,
 	.stop_scan_cmdid = WMI_10X_STOP_SCAN_CMDID,
 	.scan_chan_list_cmdid = WMI_10X_SCAN_CHAN_LIST_CMDID,
-	.scan_sch_prio_tbl_cmdid = WMI_CMD_UNDEFINED,
+	.scan_sch_prio_tbl_cmdid = WMI_CMD_UNSUPPORTED,
 	.pdev_set_regdomain_cmdid = WMI_10X_PDEV_SET_REGDOMAIN_CMDID,
 	.pdev_set_channel_cmdid = WMI_10X_PDEV_SET_CHANNEL_CMDID,
 	.pdev_set_param_cmdid = WMI_10X_PDEV_SET_PARAM_CMDID,
@@ -182,11 +182,11 @@ static struct wmi_cmd_map wmi_10x_cmd_map = {
 	.peer_mcast_group_cmdid = WMI_10X_PEER_MCAST_GROUP_CMDID,
 	.bcn_tx_cmdid = WMI_10X_BCN_TX_CMDID,
 	.pdev_send_bcn_cmdid = WMI_10X_PDEV_SEND_BCN_CMDID,
-	.bcn_tmpl_cmdid = WMI_CMD_UNDEFINED,
+	.bcn_tmpl_cmdid = WMI_CMD_UNSUPPORTED,
 	.bcn_filter_rx_cmdid = WMI_10X_BCN_FILTER_RX_CMDID,
 	.prb_req_filter_rx_cmdid = WMI_10X_PRB_REQ_FILTER_RX_CMDID,
 	.mgmt_tx_cmdid = WMI_10X_MGMT_TX_CMDID,
-	.prb_tmpl_cmdid = WMI_CMD_UNDEFINED,
+	.prb_tmpl_cmdid = WMI_CMD_UNSUPPORTED,
 	.addba_clear_resp_cmdid = WMI_10X_ADDBA_CLEAR_RESP_CMDID,
 	.addba_send_cmdid = WMI_10X_ADDBA_SEND_CMDID,
 	.addba_status_cmdid = WMI_10X_ADDBA_STATUS_CMDID,
@@ -211,9 +211,9 @@ static struct wmi_cmd_map wmi_10x_cmd_map = {
 	.p2p_dev_set_discoverability = WMI_10X_P2P_DEV_SET_DISCOVERABILITY,
 	.p2p_go_set_beacon_ie = WMI_10X_P2P_GO_SET_BEACON_IE,
 	.p2p_go_set_probe_resp_ie = WMI_10X_P2P_GO_SET_PROBE_RESP_IE,
-	.p2p_set_vendor_ie_data_cmdid = WMI_CMD_UNDEFINED,
-	.ap_ps_peer_param_cmdid = WMI_CMD_UNDEFINED,
-	.ap_ps_peer_uapsd_coex_cmdid = WMI_CMD_UNDEFINED,
+	.p2p_set_vendor_ie_data_cmdid = WMI_CMD_UNSUPPORTED,
+	.ap_ps_peer_param_cmdid = WMI_CMD_UNSUPPORTED,
+	.ap_ps_peer_uapsd_coex_cmdid = WMI_CMD_UNSUPPORTED,
 	.peer_rate_retry_sched_cmdid = WMI_10X_PEER_RATE_RETRY_SCHED_CMDID,
 	.wlan_profile_trigger_cmdid = WMI_10X_WLAN_PROFILE_TRIGGER_CMDID,
 	.wlan_profile_set_hist_intvl_cmdid =
@@ -242,25 +242,25 @@ static struct wmi_cmd_map wmi_10x_cmd_map = {
 	.vdev_spectral_scan_enable_cmdid =
 				WMI_10X_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
 	.request_stats_cmdid = WMI_10X_REQUEST_STATS_CMDID,
-	.set_arp_ns_offload_cmdid = WMI_CMD_UNDEFINED,
-	.network_list_offload_config_cmdid = WMI_CMD_UNDEFINED,
-	.gtk_offload_cmdid = WMI_CMD_UNDEFINED,
-	.csa_offload_enable_cmdid = WMI_CMD_UNDEFINED,
-	.csa_offload_chanswitch_cmdid = WMI_CMD_UNDEFINED,
-	.chatter_set_mode_cmdid = WMI_CMD_UNDEFINED,
-	.peer_tid_addba_cmdid = WMI_CMD_UNDEFINED,
-	.peer_tid_delba_cmdid = WMI_CMD_UNDEFINED,
-	.sta_dtim_ps_method_cmdid = WMI_CMD_UNDEFINED,
-	.sta_uapsd_auto_trig_cmdid = WMI_CMD_UNDEFINED,
-	.sta_keepalive_cmd = WMI_CMD_UNDEFINED,
+	.set_arp_ns_offload_cmdid = WMI_CMD_UNSUPPORTED,
+	.network_list_offload_config_cmdid = WMI_CMD_UNSUPPORTED,
+	.gtk_offload_cmdid = WMI_CMD_UNSUPPORTED,
+	.csa_offload_enable_cmdid = WMI_CMD_UNSUPPORTED,
+	.csa_offload_chanswitch_cmdid = WMI_CMD_UNSUPPORTED,
+	.chatter_set_mode_cmdid = WMI_CMD_UNSUPPORTED,
+	.peer_tid_addba_cmdid = WMI_CMD_UNSUPPORTED,
+	.peer_tid_delba_cmdid = WMI_CMD_UNSUPPORTED,
+	.sta_dtim_ps_method_cmdid = WMI_CMD_UNSUPPORTED,
+	.sta_uapsd_auto_trig_cmdid = WMI_CMD_UNSUPPORTED,
+	.sta_keepalive_cmd = WMI_CMD_UNSUPPORTED,
 	.echo_cmdid = WMI_10X_ECHO_CMDID,
 	.pdev_utf_cmdid = WMI_10X_PDEV_UTF_CMDID,
 	.dbglog_cfg_cmdid = WMI_10X_DBGLOG_CFG_CMDID,
 	.pdev_qvit_cmdid = WMI_10X_PDEV_QVIT_CMDID,
-	.pdev_ftm_intg_cmdid = WMI_CMD_UNDEFINED,
-	.vdev_set_keepalive_cmdid = WMI_CMD_UNDEFINED,
-	.vdev_get_keepalive_cmdid = WMI_CMD_UNDEFINED,
-	.force_fw_hang_cmdid = WMI_CMD_UNDEFINED,
+	.pdev_ftm_intg_cmdid = WMI_CMD_UNSUPPORTED,
+	.vdev_set_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
+	.vdev_get_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
+	.force_fw_hang_cmdid = WMI_CMD_UNSUPPORTED,
 	.gpio_config_cmdid = WMI_10X_GPIO_CONFIG_CMDID,
 	.gpio_output_cmdid = WMI_10X_GPIO_OUTPUT_CMDID,
 };
@@ -611,9 +611,9 @@ static void ath10k_wmi_op_ep_tx_credits(struct ath10k *ar)
 static int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb,
 			       u32 cmd_id)
 {
-	int ret = -EINVAL;
+	int ret = -EOPNOTSUPP;
 
-	if (cmd_id == WMI_CMD_UNDEFINED) {
+	if (cmd_id == WMI_CMD_UNSUPPORTED) {
 		ath10k_warn("wmi command %d is not supported by firmware\n",
 			    cmd_id);
 		return ret;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 7692c14..78c991a 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -359,7 +359,7 @@ enum wmi_cmd_group {
 #define WMI_CMD_GRP(grp_id) (((grp_id) << 12) | 0x1)
 #define WMI_EVT_GRP_START_ID(grp_id) (((grp_id) << 12) | 0x1)
 
-#define WMI_CMD_UNDEFINED 0
+#define WMI_CMD_UNSUPPORTED 0
 
 /* Command IDs and command events for MAIN FW. */
 enum wmi_cmd_id {
-- 
1.7.10



From bartosz.markowski at tieto.com  Tue Oct 15 03:55:32 2013
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Tue, 15 Oct 2013 09:55:32 +0200
Subject: [PATCH 2/2] ath10k: return better errno for unsupported pdev params
In-Reply-To: <1381823732-10128-1-git-send-email-bartosz.markowski@tieto.com>
References: <1381823732-10128-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <1381823732-10128-2-git-send-email-bartosz.markowski@tieto.com>

Return -EOPNOTSUPP if given parameter is not supported by firmware.

Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index ea2669b..b28bd2d3 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2119,7 +2119,7 @@ int ath10k_wmi_pdev_set_param(struct ath10k *ar, u32 id, u32 value)
 
 	if (id == WMI_PDEV_PARAM_UNSUPPORTED) {
 		ath10k_warn("pdev param %d not supported by firmware\n", id);
-		return -EINVAL;
+		return -EOPNOTSUPP;
 	}
 
 	skb = ath10k_wmi_alloc_skb(sizeof(*cmd));
-- 
1.7.10



From kvalo at qca.qualcomm.com  Tue Oct 15 12:14:34 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 15 Oct 2013 19:14:34 +0300
Subject: [PATCH 1/7] ath10k: fix scheduling while atomic bug
Message-ID: <20131015161434.21869.51150.stgit@localhost6.localdomain6>

From: Michal Kazior <michal.kazior at tieto.com>

Recent WMI/HTC changes made it possible for WMI
commands to sleep (if there's not enough HTC TX
credits to submit a command). TX path is in an
atomic context so calling WMI commands in it is
wrong.

This simply moves WEP key index update to a worker
and fixes the 'scheduling while atomic' bug.

This still leaves multiple WEP key handling laggy,
i.e. some frames may be TXed with an old/different
key (although recipient should still be able to RX
them).

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.h |    4 ++
 drivers/net/wireless/ath/ath10k/mac.c  |   53 ++++++++++++++++++++++----------
 2 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index ce36daa..cef5455 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -215,8 +215,10 @@ struct ath10k_vif {
 	struct ath10k *ar;
 	struct ieee80211_vif *vif;
 
+	struct work_struct wep_key_work;
 	struct ieee80211_key_conf *wep_keys[WMI_MAX_KEY_INDEX + 1];
-	u8 def_wep_key_index;
+	u8 def_wep_key_idx;
+	u8 def_wep_key_newidx;
 
 	u16 tx_seq_no;
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 97d7111..bc0e17b 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1239,7 +1239,7 @@ static void ath10k_bss_disassoc(struct ieee80211_hw *hw,
 	/* FIXME: why don't we print error if wmi call fails? */
 	ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id);
 
-	arvif->def_wep_key_index = 0;
+	arvif->def_wep_key_idx = 0;
 }
 
 static int ath10k_station_assoc(struct ath10k *ar, struct ath10k_vif *arvif,
@@ -1467,6 +1467,30 @@ static void ath10k_tx_h_qos_workaround(struct ieee80211_hw *hw,
 	skb_pull(skb, IEEE80211_QOS_CTL_LEN);
 }
 
+static void ath10k_tx_wep_key_work(struct work_struct *work)
+{
+	struct ath10k_vif *arvif = container_of(work, struct ath10k_vif,
+						wep_key_work);
+	int ret, keyidx = arvif->def_wep_key_newidx;
+
+	if (arvif->def_wep_key_idx == keyidx)
+		return;
+
+	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d set keyidx %d\n",
+		   arvif->vdev_id, keyidx);
+
+	ret = ath10k_wmi_vdev_set_param(arvif->ar,
+					arvif->vdev_id,
+					arvif->ar->wmi.vdev_param->def_keyid,
+					keyidx);
+	if (ret) {
+		ath10k_warn("could not update wep keyidx (%d)\n", ret);
+		return;
+	}
+
+	arvif->def_wep_key_idx = keyidx;
+}
+
 static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 {
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
@@ -1475,8 +1499,6 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 	struct ath10k *ar = arvif->ar;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 	struct ieee80211_key_conf *key = info->control.hw_key;
-	u32 vdev_param;
-	int ret;
 
 	if (!ieee80211_has_protected(hdr->frame_control))
 		return;
@@ -1488,21 +1510,14 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 	    key->cipher != WLAN_CIPHER_SUITE_WEP104)
 		return;
 
-	if (key->keyidx == arvif->def_wep_key_index)
-		return;
-
-	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d keyidx %d\n",
-		   arvif->vdev_id, key->keyidx);
-
-	vdev_param = ar->wmi.vdev_param->def_keyid;
-	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
-					key->keyidx);
-	if (ret) {
-		ath10k_warn("could not update wep keyidx (%d)\n", ret);
+	if (key->keyidx == arvif->def_wep_key_idx)
 		return;
-	}
 
-	arvif->def_wep_key_index = key->keyidx;
+	/* FIXME: Most likely a few frames will be TXed with an old key. Simply
+	 * queueing frames until key index is updated is not an option because
+	 * sk_buff may need more processing to be done, e.g. offchannel */
+	arvif->def_wep_key_newidx = key->keyidx;
+	ieee80211_queue_work(ar->hw, &arvif->wep_key_work);
 }
 
 static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar, struct sk_buff *skb)
@@ -2023,6 +2038,8 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	arvif->ar = ar;
 	arvif->vif = vif;
 
+	INIT_WORK(&arvif->wep_key_work, ath10k_tx_wep_key_work);
+
 	if ((vif->type == NL80211_IFTYPE_MONITOR) && ar->monitor_present) {
 		ath10k_warn("Only one monitor interface allowed\n");
 		ret = -EBUSY;
@@ -2078,7 +2095,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 
 	vdev_param = ar->wmi.vdev_param->def_keyid;
 	ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param,
-					arvif->def_wep_key_index);
+					arvif->def_wep_key_idx);
 	if (ret)
 		ath10k_warn("Failed to set default keyid: %d\n", ret);
 
@@ -2147,6 +2164,8 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
 
 	mutex_lock(&ar->conf_mutex);
 
+	cancel_work_sync(&arvif->wep_key_work);
+
 	spin_lock_bh(&ar->data_lock);
 	if (arvif->beacon) {
 		dev_kfree_skb_any(arvif->beacon);



From kvalo at qca.qualcomm.com  Tue Oct 15 12:16:11 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 15 Oct 2013 19:16:11 +0300
Subject: [PATCH 1/7] ath10k: fix scheduling while atomic bug
In-Reply-To: <20131015161434.21869.51150.stgit@localhost6.localdomain6> (Kalle
 Valo's message of "Tue, 15 Oct 2013 19:14:34 +0300")
References: <20131015161434.21869.51150.stgit@localhost6.localdomain6>
Message-ID: <87zjqabjck.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo at qca.qualcomm.com> writes:

> From: Michal Kazior <michal.kazior at tieto.com>
>
> Recent WMI/HTC changes made it possible for WMI
> commands to sleep (if there's not enough HTC TX
> credits to submit a command). TX path is in an
> atomic context so calling WMI commands in it is
> wrong.
>
> This simply moves WEP key index update to a worker
> and fixes the 'scheduling while atomic' bug.
>
> This still leaves multiple WEP key handling laggy,
> i.e. some frames may be TXed with an old/different
> key (although recipient should still be able to RX
> them).
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>

Please ignore, I sent this accidentally too early.

-- 
Kalle Valo


From michal.kazior at tieto.com  Tue Oct 15 13:29:49 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Tue, 15 Oct 2013 10:29:49 -0700
Subject: [PATCH 0/7] ath10k: fixes 2013-10-15
Message-ID: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>

Hi,

This is a bunch of fixes I've had queued up for
some time now. I was reluctant to send them
without some additional checks and because some of
the fixes are not ideal. At least we can get a
discussion going if anything raises any serious
concern.


Michal Kazior (7):
  ath10k: prevent starting monitor without a vdev
  ath10k: add sanity checks for monitor management
  ath10k: fix endianess in prints
  ath10k: fix NSS reporting in RX
  ath10k: fix NULL deref upon early FW crash
  ath10k: fix device initialization routine
  ath10k: fix FW crashes on heavy TX on 10.1.389 AP FW

 drivers/net/wireless/ath/ath10k/ce.c     |  11 +++
 drivers/net/wireless/ath/ath10k/core.c   |   3 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c |  11 +--
 drivers/net/wireless/ath/ath10k/hw.h     |   7 ++
 drivers/net/wireless/ath/ath10k/mac.c    |  24 +++++-
 drivers/net/wireless/ath/ath10k/pci.c    | 130 +++++++++++++++++++------------
 drivers/net/wireless/ath/ath10k/txrx.c   |   2 +-
 drivers/net/wireless/ath/ath10k/wmi.c    |  16 ++--
 8 files changed, 134 insertions(+), 70 deletions(-)

-- 
1.8.4.rc3



From michal.kazior at tieto.com  Tue Oct 15 13:29:50 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Tue, 15 Oct 2013 10:29:50 -0700
Subject: [PATCH 1/7] ath10k: prevent starting monitor without a vdev
In-Reply-To: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
References: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1381858196-17000-2-git-send-email-michal.kazior@tieto.com>

This fixes issue with interface bridging.

Linux bridging sets promiscuous mode for all
interfaces that are in a bridge. This translates
to configure_filter() being called in a mac80211
driver.

Before the patch operational interface would be
started and upped again when promiscuous mode was
enabled causing all sorts of strange issues:

 * no HTT RX happening (i.e. no traffic)
 * FW crash upon driver reload/unload

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 049eca2..9f26fcf 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2205,8 +2205,13 @@ static void ath10k_configure_filter(struct ieee80211_hw *hw,
 	*total_flags &= SUPPORTED_FILTERS;
 	ar->filter_flags = *total_flags;
 
+	/* Monitor must not be started if it wasn't created first. Promiscuous
+	 * mode may be started on a non-monitor interface - in such case the monitor
+	 * vdev is not created so starting the monitor makes no sense. Since
+	 * ath10k uses no special RX filters (only BSS filter in STA mode)
+	 * there's no need for any special action here. */
 	if ((ar->filter_flags & FIF_PROMISC_IN_BSS) &&
-	    !ar->monitor_enabled) {
+	    !ar->monitor_enabled && ar->monitor_present) {
 		ath10k_dbg(ATH10K_DBG_MAC, "mac monitor %d start\n",
 			   ar->monitor_vdev_id);
 
@@ -2214,7 +2219,7 @@ static void ath10k_configure_filter(struct ieee80211_hw *hw,
 		if (ret)
 			ath10k_warn("Unable to start monitor mode\n");
 	} else if (!(ar->filter_flags & FIF_PROMISC_IN_BSS) &&
-		   ar->monitor_enabled) {
+		   ar->monitor_enabled && ar->monitor_present) {
 		ath10k_dbg(ATH10K_DBG_MAC, "mac monitor %d stop\n",
 			   ar->monitor_vdev_id);
 
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Tue Oct 15 13:29:51 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Tue, 15 Oct 2013 10:29:51 -0700
Subject: [PATCH 2/7] ath10k: add sanity checks for monitor management
In-Reply-To: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
References: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1381858196-17000-3-git-send-email-michal.kazior@tieto.com>

Add a few checks and warnings to make it easier to
track any kind of monitor vdev mismanagement.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 9f26fcf..1878e8f 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -516,6 +516,11 @@ static int ath10k_monitor_start(struct ath10k *ar, int vdev_id)
 
 	lockdep_assert_held(&ar->conf_mutex);
 
+	if (!ar->monitor_present) {
+		ath10k_warn("mac montor stop -- monitor is not present\n");
+		return -EINVAL;
+	}
+
 	arg.vdev_id = vdev_id;
 	arg.channel.freq = channel->center_freq;
 	arg.channel.band_center_freq1 = ar->hw->conf.chandef.center_freq1;
@@ -566,6 +571,16 @@ static int ath10k_monitor_stop(struct ath10k *ar)
 
 	lockdep_assert_held(&ar->conf_mutex);
 
+	if (!ar->monitor_present) {
+		ath10k_warn("mac montor stop -- monitor is not present\n");
+		return -EINVAL;
+	}
+
+	if (!ar->monitor_enabled) {
+		ath10k_warn("mac montor stop -- monitor is not enabled\n");
+		return -EINVAL;
+	}
+
 	ret = ath10k_wmi_vdev_down(ar, ar->monitor_vdev_id);
 	if (ret)
 		ath10k_warn("Monitor vdev down failed: %d\n", ret);
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Tue Oct 15 13:29:52 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Tue, 15 Oct 2013 10:29:52 -0700
Subject: [PATCH 3/7] ath10k: fix endianess in prints
In-Reply-To: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
References: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1381858196-17000-4-git-send-email-michal.kazior@tieto.com>

This fixes incorrect values being printed on
big-endian hosts.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index f9766fa..8e59887 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2209,7 +2209,7 @@ static int ath10k_wmi_main_cmd_init(struct ath10k *ar)
 	}
 
 	ath10k_dbg(ATH10K_DBG_WMI, "wmi sending %d memory chunks info.\n",
-		   __cpu_to_le32(ar->wmi.num_mem_chunks));
+		   ar->wmi.num_mem_chunks);
 
 	cmd->num_host_mem_chunks = __cpu_to_le32(ar->wmi.num_mem_chunks);
 
@@ -2222,10 +2222,10 @@ static int ath10k_wmi_main_cmd_init(struct ath10k *ar)
 			__cpu_to_le32(ar->wmi.mem_chunks[i].req_id);
 
 		ath10k_dbg(ATH10K_DBG_WMI,
-			   "wmi chunk %d len %d requested, addr 0x%x\n",
+			   "wmi chunk %d len %d requested, addr 0x%llx\n",
 			   i,
-			   cmd->host_mem_chunks[i].size,
-			   cmd->host_mem_chunks[i].ptr);
+			   ar->wmi.mem_chunks[i].len,
+			   (unsigned long long)ar->wmi.mem_chunks[i].paddr);
 	}
 out:
 	memcpy(&cmd->resource_config, &config, sizeof(config));
@@ -2300,7 +2300,7 @@ static int ath10k_wmi_10x_cmd_init(struct ath10k *ar)
 	}
 
 	ath10k_dbg(ATH10K_DBG_WMI, "wmi sending %d memory chunks info.\n",
-		   __cpu_to_le32(ar->wmi.num_mem_chunks));
+		   ar->wmi.num_mem_chunks);
 
 	cmd->num_host_mem_chunks = __cpu_to_le32(ar->wmi.num_mem_chunks);
 
@@ -2313,10 +2313,10 @@ static int ath10k_wmi_10x_cmd_init(struct ath10k *ar)
 			__cpu_to_le32(ar->wmi.mem_chunks[i].req_id);
 
 		ath10k_dbg(ATH10K_DBG_WMI,
-			   "wmi chunk %d len %d requested, addr 0x%x\n",
+			   "wmi chunk %d len %d requested, addr 0x%llx\n",
 			   i,
-			   cmd->host_mem_chunks[i].size,
-			   cmd->host_mem_chunks[i].ptr);
+			   ar->wmi.mem_chunks[i].len,
+			   (unsigned long long)ar->wmi.mem_chunks[i].paddr);
 	}
 out:
 	memcpy(&cmd->resource_config, &config, sizeof(config));
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Tue Oct 15 13:29:53 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Tue, 15 Oct 2013 10:29:53 -0700
Subject: [PATCH 4/7] ath10k: fix NSS reporting in RX
In-Reply-To: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
References: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1381858196-17000-5-git-send-email-michal.kazior@tieto.com>

NSTS values reported in the VHT-SIG-A1 are 0
through 7 but they actually describe number of
streams 1 through 8.

1SS frames were dropped. This patch fixes this.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index 5ae373a..c511f91 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -183,7 +183,7 @@ static void process_rx_rates(struct ath10k *ar, struct htt_rx_info *info,
 		/* VHT-SIG-A1 in info 1, VHT-SIG-A2 in info2
 		   TODO check this */
 		mcs = (info2 >> 4) & 0x0F;
-		nss = (info1 >> 10) & 0x07;
+		nss = ((info1 >> 10) & 0x07) + 1;
 		bw = info1 & 3;
 		sgi = info2 & 1;
 
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Tue Oct 15 13:29:54 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Tue, 15 Oct 2013 10:29:54 -0700
Subject: [PATCH 5/7] ath10k: fix NULL deref upon early FW crash
In-Reply-To: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
References: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1381858196-17000-6-git-send-email-michal.kazior@tieto.com>

If firmware crashes during FW probing it would try
to perform FW recovery which uses mac80211
workqueue before registering to mac80211.

Using internal workqueue solves the problem.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.c | 3 ++-
 drivers/net/wireless/ath/ath10k/pci.c  | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index c5561a9..3f6cbe7 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -664,7 +664,8 @@ static void ath10k_core_restart(struct work_struct *work)
 		ieee80211_restart_hw(ar->hw);
 		break;
 	case ATH10K_STATE_OFF:
-		/* this can happen if driver is being unloaded */
+		/* this can happen if driver is being unloaded
+		 * or if the crash happens during FW probing */
 		ath10k_warn("cannot restart a device that hasn't been started\n");
 		break;
 	case ATH10K_STATE_RESTARTING:
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index f8d59c7..d09f8a2 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -777,7 +777,7 @@ static void ath10k_pci_hif_dump_area(struct ath10k *ar)
 			   reg_dump_values[i + 2],
 			   reg_dump_values[i + 3]);
 
-	ieee80211_queue_work(ar->hw, &ar->restart_work);
+	queue_work(ar->workqueue, &ar->restart_work);
 }
 
 static void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Tue Oct 15 13:29:55 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Tue, 15 Oct 2013 10:29:55 -0700
Subject: [PATCH 6/7] ath10k: fix device initialization routine
In-Reply-To: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
References: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1381858196-17000-7-git-send-email-michal.kazior@tieto.com>

Hardware revision 2 does not support cold reset
correctly. As such it would sometimes lead to host
machine freeze or data bus errors.

The patch introduces warm reset function which is
used instead of the cold reset one. It also moves
the reset before interrupts are being set up to
prevent any kind of spurious interrupts from being
handled.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/hw.h  |   7 ++
 drivers/net/wireless/ath/ath10k/pci.c | 128 +++++++++++++++++++++-------------
 2 files changed, 85 insertions(+), 50 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index 8aeb46d..2032737 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -204,8 +204,11 @@ enum ath10k_mcast2ucast_mode {
 #define WLAN_ANALOG_INTF_PCIE_BASE_ADDRESS	0x0006c000
 #define PCIE_LOCAL_BASE_ADDRESS			0x00080000
 
+#define SOC_RESET_CONTROL_ADDRESS		0x00000000
 #define SOC_RESET_CONTROL_OFFSET		0x00000000
 #define SOC_RESET_CONTROL_SI0_RST_MASK		0x00000001
+#define SOC_RESET_CONTROL_CE_RST_MASK		0x00040000
+#define SOC_RESET_CONTROL_CPU_WARM_RST_MASK	0x00000040
 #define SOC_CPU_CLOCK_OFFSET			0x00000020
 #define SOC_CPU_CLOCK_STANDARD_LSB		0
 #define SOC_CPU_CLOCK_STANDARD_MASK		0x00000003
@@ -215,6 +218,8 @@ enum ath10k_mcast2ucast_mode {
 #define SOC_LPO_CAL_OFFSET			0x000000e0
 #define SOC_LPO_CAL_ENABLE_LSB			20
 #define SOC_LPO_CAL_ENABLE_MASK			0x00100000
+#define SOC_LF_TIMER_CONTROL0_ADDRESS		0x00000050
+#define SOC_LF_TIMER_CONTROL0_ENABLE_MASK	0x00000004
 
 #define SOC_CHIP_ID_ADDRESS			0x000000ec
 #define SOC_CHIP_ID_REV_LSB			8
@@ -269,8 +274,10 @@ enum ath10k_mcast2ucast_mode {
 #define CORE_CTRL_CPU_INTR_MASK			0x00002000
 #define CORE_CTRL_ADDRESS			0x0000
 #define PCIE_INTR_ENABLE_ADDRESS		0x0008
+#define PCIE_INTR_CAUSE_ADDRESS			0x000c
 #define PCIE_INTR_CLR_ADDRESS			0x0014
 #define SCRATCH_3_ADDRESS			0x0030
+#define CPU_INTR_ADDRESS			0x0010
 
 /* Firmware indications to the Host via SCRATCH_3 register. */
 #define FW_INDICATOR_ADDRESS	(SOC_CORE_BASE_ADDRESS + SCRATCH_3_ADDRESS)
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index d09f8a2..14fcfe7 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -52,7 +52,6 @@ static int ath10k_pci_post_rx_pipe(struct ath10k_pci_pipe *pipe_info,
 					     int num);
 static void ath10k_pci_rx_pipe_cleanup(struct ath10k_pci_pipe *pipe_info);
 static void ath10k_pci_stop_ce(struct ath10k *ar);
-static void ath10k_pci_device_reset(struct ath10k *ar);
 static int ath10k_pci_reset_target(struct ath10k *ar);
 static int ath10k_pci_start_intr(struct ath10k *ar);
 static void ath10k_pci_stop_intr(struct ath10k *ar);
@@ -1825,17 +1824,77 @@ static void ath10k_pci_fw_interrupt_handler(struct ath10k *ar)
 	ath10k_pci_sleep(ar);
 }
 
+static int ath10k_pci_warm_reset(struct ath10k *ar)
+{
+	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+	void __iomem *addr;
+	int ret = 0;
+	u32 val;
+
+	ath10k_dbg(ATH10K_DBG_BOOT, "performing warm chip reset\n");
+
+	ret = ath10k_do_pci_wake(ar);
+	if (ret)
+		return ret;
+
+	/* debug */
+	addr = ar_pci->mem + SOC_CORE_BASE_ADDRESS + PCIE_INTR_CAUSE_ADDRESS;
+	ath10k_dbg(ATH10K_DBG_BOOT, "host CPU intr cause: 0x%x\n", ioread32(addr));
+	addr = ar_pci->mem + SOC_CORE_BASE_ADDRESS + CPU_INTR_ADDRESS;
+	ath10k_dbg(ATH10K_DBG_BOOT, "target CPU intr cause: 0x%x\n", ioread32(addr));
+
+	/* disable pending irqs */
+	iowrite32(0, ar_pci->mem + SOC_CORE_BASE_ADDRESS + PCIE_INTR_ENABLE_ADDRESS);
+	iowrite32(~0, ar_pci->mem + SOC_CORE_BASE_ADDRESS + PCIE_INTR_CLR_ADDRESS);
+
+	msleep(100);
+
+	/* clear fw indicator */
+	iowrite32(0, ar_pci->mem + ar_pci->fw_indicator_address);
+
+	/* clear target LF timer interrupts */
+	addr = ar_pci->mem + RTC_SOC_BASE_ADDRESS + SOC_LF_TIMER_CONTROL0_ADDRESS;
+	iowrite32(ioread32(addr) & ~SOC_LF_TIMER_CONTROL0_ENABLE_MASK, addr);
+
+	/* reset CE */
+	addr = ar_pci->mem + RTC_SOC_BASE_ADDRESS + SOC_RESET_CONTROL_ADDRESS;
+	val = ioread32(addr);
+	val |= SOC_RESET_CONTROL_CE_RST_MASK;
+	iowrite32(val, addr);
+	val = ioread32(addr);
+	msleep(10);
+
+	/* unreset CE */
+	val &= ~SOC_RESET_CONTROL_CE_RST_MASK, addr;
+	iowrite32(val, addr);
+	val = ioread32(addr);
+	msleep(10);
+
+	/* debug */
+	addr = ar_pci->mem + SOC_CORE_BASE_ADDRESS + PCIE_INTR_CAUSE_ADDRESS;
+	ath10k_dbg(ATH10K_DBG_BOOT, "host CPU intr cause: 0x%x\n", ioread32(addr));
+	addr = ar_pci->mem + SOC_CORE_BASE_ADDRESS + CPU_INTR_ADDRESS;
+	ath10k_dbg(ATH10K_DBG_BOOT, "target CPU intr cause: 0x%x\n", ioread32(addr));
+
+	/* CPU warm reset */
+	addr = ar_pci->mem + RTC_SOC_BASE_ADDRESS + SOC_RESET_CONTROL_ADDRESS;
+	iowrite32(ioread32(addr) | SOC_RESET_CONTROL_CPU_WARM_RST_MASK, addr);
+
+	ath10k_dbg(ATH10K_DBG_BOOT, "target reset state: 0x%x\n", ioread32(addr));
+
+	msleep(100);
+
+	ath10k_dbg(ATH10K_DBG_BOOT, "warm reset complete\n");
+
+	ath10k_do_pci_sleep(ar);
+	return ret;
+}
+
 static int ath10k_pci_hif_power_up(struct ath10k *ar)
 {
 	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 	int ret;
 
-	ret = ath10k_pci_start_intr(ar);
-	if (ret) {
-		ath10k_err("could not start interrupt handling (%d)\n", ret);
-		goto err;
-	}
-
 	/*
 	 * Bring the target up cleanly.
 	 *
@@ -1845,8 +1904,19 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
 	 * (aux) powered and running. On a subsequent driver load, the Target
 	 * is in an unexpected state. We try to catch that here in order to
 	 * reset the Target and retry the probe.
+	 *
+	 * Only HW v2 supports warm reset. Since ath10k does not support v1
+	 * anymore just forget about cold reset which is broken on v2 for now.
 	 */
-	ath10k_pci_device_reset(ar);
+	ret = ath10k_pci_warm_reset(ar);
+	if (ret)
+		goto err;
+
+	ret = ath10k_pci_start_intr(ar);
+	if (ret) {
+		ath10k_err("could not start interrupt handling (%d)\n", ret);
+		goto err;
+	}
 
 	ret = ath10k_pci_reset_target(ar);
 	if (ret)
@@ -2278,48 +2348,6 @@ static int ath10k_pci_reset_target(struct ath10k *ar)
 	return 0;
 }
 
-static void ath10k_pci_device_reset(struct ath10k *ar)
-{
-	int i;
-	u32 val;
-
-	if (!SOC_GLOBAL_RESET_ADDRESS)
-		return;
-
-	ath10k_pci_reg_write32(ar, PCIE_SOC_WAKE_ADDRESS,
-			       PCIE_SOC_WAKE_V_MASK);
-	for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
-		if (ath10k_pci_target_is_awake(ar))
-			break;
-		msleep(1);
-	}
-
-	/* Put Target, including PCIe, into RESET. */
-	val = ath10k_pci_reg_read32(ar, SOC_GLOBAL_RESET_ADDRESS);
-	val |= 1;
-	ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
-
-	for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
-		if (ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
-					  RTC_STATE_COLD_RESET_MASK)
-			break;
-		msleep(1);
-	}
-
-	/* Pull Target, including PCIe, out of RESET. */
-	val &= ~1;
-	ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
-
-	for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
-		if (!(ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
-					    RTC_STATE_COLD_RESET_MASK))
-			break;
-		msleep(1);
-	}
-
-	ath10k_pci_reg_write32(ar, PCIE_SOC_WAKE_ADDRESS, PCIE_SOC_WAKE_RESET);
-}
-
 static void ath10k_pci_dump_features(struct ath10k_pci *ar_pci)
 {
 	int i;
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Tue Oct 15 13:29:56 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Tue, 15 Oct 2013 10:29:56 -0700
Subject: [PATCH 7/7] ath10k: fix FW crashes on heavy TX on 10.1.389 AP FW
In-Reply-To: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
References: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1381858196-17000-8-git-send-email-michal.kazior@tieto.com>

10.1.389 firmware has some differences in
calculation of number of outstanding HTT TX
completions. This led to FW crashes of 10.1.389
while main firmware branch was unnaffected.

The patch makes sure ath10k doesn't queue up more
MSDUs than it should.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/ce.c     | 11 +++++++++++
 drivers/net/wireless/ath/ath10k/htt_tx.c | 11 ++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index e46951b..d243f28 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -1050,6 +1050,17 @@ struct ath10k_ce_pipe *ath10k_ce_init(struct ath10k *ar,
 	u32 ctrl_addr = ath10k_ce_base_address(ce_id);
 	int ret;
 
+	/*
+	 * Make sure there's enough CE ringbuffer entries for HTT TX to avoid
+	 * additional TX locking checks.
+	 *
+	 * For the lack of a better place do the check here.
+	 */
+	BUILD_BUG_ON(TARGET_NUM_MSDU_DESC >
+		     (CE_HTT_H2T_MSG_SRC_NENTRIES - 1));
+	BUILD_BUG_ON(TARGET_10X_NUM_MSDU_DESC >
+		     (CE_HTT_H2T_MSG_SRC_NENTRIES - 1));
+
 	ret = ath10k_pci_wake(ar);
 	if (ret)
 		return NULL;
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index d9335e9..f1d36d2 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -85,16 +85,13 @@ void ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id)
 
 int ath10k_htt_tx_attach(struct ath10k_htt *htt)
 {
-	u8 pipe;
-
 	spin_lock_init(&htt->tx_lock);
 	init_waitqueue_head(&htt->empty_tx_wq);
 
-	/* At the beginning free queue number should hint us the maximum
-	 * queue length */
-	pipe = htt->ar->htc.endpoint[htt->eid].ul_pipe_id;
-	htt->max_num_pending_tx = ath10k_hif_get_free_queue_number(htt->ar,
-								   pipe);
+	if (test_bit(ATH10K_FW_FEATURE_WMI_10X, htt->ar->fw_features))
+		htt->max_num_pending_tx = TARGET_10X_NUM_MSDU_DESC;
+	else
+		htt->max_num_pending_tx = TARGET_NUM_MSDU_DESC;
 
 	ath10k_dbg(ATH10K_DBG_BOOT, "htt tx max num pending tx %d\n",
 		   htt->max_num_pending_tx);
-- 
1.8.4.rc3



From kvalo at qca.qualcomm.com  Tue Oct 15 14:46:37 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 15 Oct 2013 21:46:37 +0300
Subject: [PATCH 0/7] ath10k: fix WMI atomic usage
Message-ID: <20131015184548.14123.56949.stgit@localhost6.localdomain6>

Some WMI calls were made in atomic contex, these patches fix
those. Please review.

---

Kalle Valo (2):
      ath10k: fix ath10k_bss_assoc() to not sleep in atomic context
      ath10k: add might_sleep() to ath10k_wmi_cmd_send()

Michal Kazior (5):
      ath10k: use workqueue to set WEP TX key
      ath10k: fix add_interface failure handling
      ath10k: track vif list internally
      ath10k: fix scheduling while atomic config bug
      ath10k: remove unnecessary checks


 drivers/net/wireless/ath/ath10k/core.c |    2 
 drivers/net/wireless/ath/ath10k/core.h |    7 +
 drivers/net/wireless/ath/ath10k/mac.c  |  312 +++++++++++++++++---------------
 drivers/net/wireless/ath/ath10k/wmi.c  |    2 
 4 files changed, 178 insertions(+), 145 deletions(-)



From kvalo at qca.qualcomm.com  Tue Oct 15 14:46:44 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 15 Oct 2013 21:46:44 +0300
Subject: [PATCH 1/7] ath10k: use workqueue to set WEP TX key
In-Reply-To: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
References: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
Message-ID: <20131015184644.14123.424.stgit@localhost6.localdomain6>

From: Michal Kazior <michal.kazior at tieto.com>

Recent WMI/HTC changes made it possible for WMI
commands to sleep (if there's not enough HTC TX
credits to submit a command). TX path is in an
atomic context so calling WMI commands in it is
wrong.

This simply moves WEP key index update to a worker
and fixes the 'scheduling while atomic' bug.

This still leaves multiple WEP key handling laggy,
i.e. some frames may be TXed with an old/different
key (although recipient should still be able to RX
them).

kvalo: changed the title

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.h |    4 ++
 drivers/net/wireless/ath/ath10k/mac.c  |   53 ++++++++++++++++++++++----------
 2 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index ce36daa..cef5455 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -215,8 +215,10 @@ struct ath10k_vif {
 	struct ath10k *ar;
 	struct ieee80211_vif *vif;
 
+	struct work_struct wep_key_work;
 	struct ieee80211_key_conf *wep_keys[WMI_MAX_KEY_INDEX + 1];
-	u8 def_wep_key_index;
+	u8 def_wep_key_idx;
+	u8 def_wep_key_newidx;
 
 	u16 tx_seq_no;
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 97d7111..bc0e17b 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1239,7 +1239,7 @@ static void ath10k_bss_disassoc(struct ieee80211_hw *hw,
 	/* FIXME: why don't we print error if wmi call fails? */
 	ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id);
 
-	arvif->def_wep_key_index = 0;
+	arvif->def_wep_key_idx = 0;
 }
 
 static int ath10k_station_assoc(struct ath10k *ar, struct ath10k_vif *arvif,
@@ -1467,6 +1467,30 @@ static void ath10k_tx_h_qos_workaround(struct ieee80211_hw *hw,
 	skb_pull(skb, IEEE80211_QOS_CTL_LEN);
 }
 
+static void ath10k_tx_wep_key_work(struct work_struct *work)
+{
+	struct ath10k_vif *arvif = container_of(work, struct ath10k_vif,
+						wep_key_work);
+	int ret, keyidx = arvif->def_wep_key_newidx;
+
+	if (arvif->def_wep_key_idx == keyidx)
+		return;
+
+	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d set keyidx %d\n",
+		   arvif->vdev_id, keyidx);
+
+	ret = ath10k_wmi_vdev_set_param(arvif->ar,
+					arvif->vdev_id,
+					arvif->ar->wmi.vdev_param->def_keyid,
+					keyidx);
+	if (ret) {
+		ath10k_warn("could not update wep keyidx (%d)\n", ret);
+		return;
+	}
+
+	arvif->def_wep_key_idx = keyidx;
+}
+
 static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 {
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
@@ -1475,8 +1499,6 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 	struct ath10k *ar = arvif->ar;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 	struct ieee80211_key_conf *key = info->control.hw_key;
-	u32 vdev_param;
-	int ret;
 
 	if (!ieee80211_has_protected(hdr->frame_control))
 		return;
@@ -1488,21 +1510,14 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 	    key->cipher != WLAN_CIPHER_SUITE_WEP104)
 		return;
 
-	if (key->keyidx == arvif->def_wep_key_index)
-		return;
-
-	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d keyidx %d\n",
-		   arvif->vdev_id, key->keyidx);
-
-	vdev_param = ar->wmi.vdev_param->def_keyid;
-	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
-					key->keyidx);
-	if (ret) {
-		ath10k_warn("could not update wep keyidx (%d)\n", ret);
+	if (key->keyidx == arvif->def_wep_key_idx)
 		return;
-	}
 
-	arvif->def_wep_key_index = key->keyidx;
+	/* FIXME: Most likely a few frames will be TXed with an old key. Simply
+	 * queueing frames until key index is updated is not an option because
+	 * sk_buff may need more processing to be done, e.g. offchannel */
+	arvif->def_wep_key_newidx = key->keyidx;
+	ieee80211_queue_work(ar->hw, &arvif->wep_key_work);
 }
 
 static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar, struct sk_buff *skb)
@@ -2023,6 +2038,8 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	arvif->ar = ar;
 	arvif->vif = vif;
 
+	INIT_WORK(&arvif->wep_key_work, ath10k_tx_wep_key_work);
+
 	if ((vif->type == NL80211_IFTYPE_MONITOR) && ar->monitor_present) {
 		ath10k_warn("Only one monitor interface allowed\n");
 		ret = -EBUSY;
@@ -2078,7 +2095,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 
 	vdev_param = ar->wmi.vdev_param->def_keyid;
 	ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param,
-					arvif->def_wep_key_index);
+					arvif->def_wep_key_idx);
 	if (ret)
 		ath10k_warn("Failed to set default keyid: %d\n", ret);
 
@@ -2147,6 +2164,8 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
 
 	mutex_lock(&ar->conf_mutex);
 
+	cancel_work_sync(&arvif->wep_key_work);
+
 	spin_lock_bh(&ar->data_lock);
 	if (arvif->beacon) {
 		dev_kfree_skb_any(arvif->beacon);



From kvalo at qca.qualcomm.com  Tue Oct 15 14:46:50 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 15 Oct 2013 21:46:50 +0300
Subject: [PATCH 2/7] ath10k: fix add_interface failure handling
In-Reply-To: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
References: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
Message-ID: <20131015184650.14123.11865.stgit@localhost6.localdomain6>

From: Michal Kazior <michal.kazior at tieto.com>

If something failed along add_interface() setup it
was possible to leak a vdev id, vdev and peer.

This could end up with leaked FW state or FW crash
(assuming add_interface() failure wasn't a result of
a crash).

kvalo: rebased, whitespace fixes

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   53 +++++++++++++++++++++++++--------
 1 file changed, 40 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index bc0e17b..16e55bd 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2043,18 +2043,17 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	if ((vif->type == NL80211_IFTYPE_MONITOR) && ar->monitor_present) {
 		ath10k_warn("Only one monitor interface allowed\n");
 		ret = -EBUSY;
-		goto exit;
+		goto err;
 	}
 
 	bit = ffs(ar->free_vdev_map);
 	if (bit == 0) {
 		ret = -EBUSY;
-		goto exit;
+		goto err;
 	}
 
 	arvif->vdev_id = bit - 1;
 	arvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE;
-	ar->free_vdev_map &= ~(1 << arvif->vdev_id);
 
 	if (ar->p2p)
 		arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_DEVICE;
@@ -2090,27 +2089,33 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 				     arvif->vdev_subtype, vif->addr);
 	if (ret) {
 		ath10k_warn("WMI vdev create failed: ret %d\n", ret);
-		goto exit;
+		goto err;
 	}
 
+	ar->free_vdev_map &= ~BIT(arvif->vdev_id);
+
 	vdev_param = ar->wmi.vdev_param->def_keyid;
 	ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param,
 					arvif->def_wep_key_idx);
-	if (ret)
+	if (ret) {
 		ath10k_warn("Failed to set default keyid: %d\n", ret);
+		goto err_vdev_delete;
+	}
 
 	vdev_param = ar->wmi.vdev_param->tx_encap_type;
 	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
 					ATH10K_HW_TXRX_NATIVE_WIFI);
 	/* 10.X firmware does not support this VDEV parameter. Do not warn */
-	if (ret && ret != -EOPNOTSUPP)
+	if (ret && ret != -EOPNOTSUPP) {
 		ath10k_warn("Failed to set TX encap: %d\n", ret);
+		goto err_vdev_delete;
+	}
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
 		ret = ath10k_peer_create(ar, arvif->vdev_id, vif->addr);
 		if (ret) {
 			ath10k_warn("Failed to create peer for AP: %d\n", ret);
-			goto exit;
+			goto err_vdev_delete;
 		}
 	}
 
@@ -2119,39 +2124,61 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 		value = WMI_STA_PS_RX_WAKE_POLICY_WAKE;
 		ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
 						  param, value);
-		if (ret)
+		if (ret) {
 			ath10k_warn("Failed to set RX wake policy: %d\n", ret);
+			goto err_peer_delete;
+		}
 
 		param = WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD;
 		value = WMI_STA_PS_TX_WAKE_THRESHOLD_ALWAYS;
 		ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
 						  param, value);
-		if (ret)
+		if (ret) {
 			ath10k_warn("Failed to set TX wake thresh: %d\n", ret);
+			goto err_peer_delete;
+		}
 
 		param = WMI_STA_PS_PARAM_PSPOLL_COUNT;
 		value = WMI_STA_PS_PSPOLL_COUNT_NO_MAX;
 		ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id,
 						  param, value);
-		if (ret)
+		if (ret) {
 			ath10k_warn("Failed to set PSPOLL count: %d\n", ret);
+			goto err_peer_delete;
+		}
 	}
 
 	ret = ath10k_mac_set_rts(arvif, ar->hw->wiphy->rts_threshold);
-	if (ret)
+	if (ret) {
 		ath10k_warn("failed to set rts threshold for vdev %d (%d)\n",
 			    arvif->vdev_id, ret);
+		goto err_peer_delete;
+	}
 
 	ret = ath10k_mac_set_frag(arvif, ar->hw->wiphy->frag_threshold);
-	if (ret)
+	if (ret) {
 		ath10k_warn("failed to set frag threshold for vdev %d (%d)\n",
 			    arvif->vdev_id, ret);
+		goto err_peer_delete;
+	}
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR)
 		ar->monitor_present = true;
 
-exit:
 	mutex_unlock(&ar->conf_mutex);
+	return 0;
+
+err_peer_delete:
+	if (arvif->vdev_type == WMI_VDEV_TYPE_AP)
+		ath10k_wmi_peer_delete(ar, arvif->vdev_id, vif->addr);
+
+err_vdev_delete:
+	ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
+	ar->free_vdev_map &= ~BIT(arvif->vdev_id);
+
+err:
+	mutex_unlock(&ar->conf_mutex);
+
 	return ret;
 }
 



From kvalo at qca.qualcomm.com  Tue Oct 15 14:46:56 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 15 Oct 2013 21:46:56 +0300
Subject: [PATCH 3/7] ath10k: track vif list internally
In-Reply-To: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
References: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
Message-ID: <20131015184656.14123.70575.stgit@localhost6.localdomain6>

From: Michal Kazior <michal.kazior at tieto.com>

mac80211 interface interations functions have
peculiar locking issues. This patch introduces
internal (to ath10k) vif list that will be used
for vif iteration purposes.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c |    2 ++
 drivers/net/wireless/ath/ath10k/core.h |    3 +++
 drivers/net/wireless/ath/ath10k/mac.c  |    3 +++
 3 files changed, 8 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index c5561a9..ed51b51 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -713,6 +713,7 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
 	mutex_init(&ar->conf_mutex);
 	spin_lock_init(&ar->data_lock);
 
+	INIT_LIST_HEAD(&ar->arvifs);
 	INIT_LIST_HEAD(&ar->peers);
 	init_waitqueue_head(&ar->peer_mapping_wq);
 
@@ -824,6 +825,7 @@ int ath10k_core_start(struct ath10k *ar)
 		goto err_disconnect_htc;
 
 	ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1;
+	INIT_LIST_HEAD(&ar->arvifs);
 
 	return 0;
 
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index cef5455..0934f76 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -205,6 +205,8 @@ struct ath10k_peer {
 #define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5*HZ)
 
 struct ath10k_vif {
+	struct list_head list;
+
 	u32 vdev_id;
 	enum wmi_vdev_type vdev_type;
 	enum wmi_vdev_subtype vdev_subtype;
@@ -404,6 +406,7 @@ struct ath10k {
 	/* protects shared structure data */
 	spinlock_t data_lock;
 
+	struct list_head arvifs;
 	struct list_head peers;
 	wait_queue_head_t peer_mapping_wq;
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 16e55bd..c8e4180 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2093,6 +2093,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	}
 
 	ar->free_vdev_map &= ~BIT(arvif->vdev_id);
+	list_add(&arvif->list, &ar->arvifs);
 
 	vdev_param = ar->wmi.vdev_param->def_keyid;
 	ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param,
@@ -2175,6 +2176,7 @@ err_peer_delete:
 err_vdev_delete:
 	ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
 	ar->free_vdev_map &= ~BIT(arvif->vdev_id);
+	list_del(&arvif->list);
 
 err:
 	mutex_unlock(&ar->conf_mutex);
@@ -2201,6 +2203,7 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
 	spin_unlock_bh(&ar->data_lock);
 
 	ar->free_vdev_map |= 1 << (arvif->vdev_id);
+	list_del(&arvif->list);
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
 		ret = ath10k_peer_delete(arvif->ar, arvif->vdev_id, vif->addr);



From kvalo at qca.qualcomm.com  Tue Oct 15 14:47:08 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 15 Oct 2013 21:47:08 +0300
Subject: [PATCH 5/7] ath10k: remove unnecessary checks
In-Reply-To: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
References: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
Message-ID: <20131015184708.14123.49715.stgit@localhost6.localdomain6>

From: Michal Kazior <michal.kazior at tieto.com>

mac80211 interface iteration functions that were
used originally iterated over interfaces that
weren't re-added to the driver during recovery.

Since internal vif list is now used it's safe to
remove the safe-guard as internal vif list is
based on add/remove_interface function which
guarantees that vdev is created in FW before it is
iterated over.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index bd42a14..4273eef 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1964,13 +1964,6 @@ static int ath10k_config_ps(struct ath10k *ar)
 
 	lockdep_assert_held(&ar->conf_mutex);
 
-	/* During HW reconfiguration mac80211 reports all interfaces that were
-	 * running until reconfiguration was started. Since FW doesn't have any
-	 * vdevs at this point we must not iterate over this interface list.
-	 * This setting will be updated upon add_interface(). */
-	if (ar->state == ATH10K_STATE_RESTARTED)
-		return 0;
-
 	list_for_each_entry(arvif, &ar->arvifs, list) {
 		ret = ath10k_mac_vif_setup_ps(arvif);
 		if (ret) {
@@ -2888,13 +2881,6 @@ static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
 	struct ath10k_vif *arvif;
 	int ret = 0;
 
-	/* During HW reconfiguration mac80211 reports all interfaces that were
-	 * running until reconfiguration was started. Since FW doesn't have any
-	 * vdevs at this point we must not iterate over this interface list.
-	 * This setting will be updated upon add_interface(). */
-	if (ar->state == ATH10K_STATE_RESTARTED)
-		return 0;
-
 	mutex_lock(&ar->conf_mutex);
 	list_for_each_entry(arvif, &ar->arvifs, list) {
 		ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d rts threshold %d\n",
@@ -2918,13 +2904,6 @@ static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
 	struct ath10k_vif *arvif;
 	int ret = 0;
 
-	/* During HW reconfiguration mac80211 reports all interfaces that were
-	 * running until reconfiguration was started. Since FW doesn't have any
-	 * vdevs at this point we must not iterate over this interface list.
-	 * This setting will be updated upon add_interface(). */
-	if (ar->state == ATH10K_STATE_RESTARTED)
-		return 0;
-
 	mutex_lock(&ar->conf_mutex);
 	list_for_each_entry(arvif, &ar->arvifs, list) {
 		ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d fragmentation threshold %d\n",



From kvalo at qca.qualcomm.com  Tue Oct 15 14:47:02 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 15 Oct 2013 21:47:02 +0300
Subject: [PATCH 4/7] ath10k: fix scheduling while atomic config bug
In-Reply-To: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
References: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
Message-ID: <20131015184702.14123.63521.stgit@localhost6.localdomain6>

From: Michal Kazior <michal.kazior at tieto.com>

Recent HTC/WMI changes introduced the bug. ath10k
was using _atomic iteration function with
sleepable functions.

mac80211 provides another iteration function but
it cannot be safely called in hw_config() callback
due to local->iflist_mtx being possibly acquired
already.

The patch uses internal vif list for iteration
purposes and removes/refactors no longer necessary
_iter functions.

Reported-By: Kalle Valo <kvalo at qca.qualcomm.com>
Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |  146 ++++++++++++++-------------------
 1 file changed, 62 insertions(+), 84 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index c8e4180..bd42a14 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -723,35 +723,30 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif,
 /*
  * Review this when mac80211 gains per-interface powersave support.
  */
-static void ath10k_ps_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
+static int ath10k_mac_vif_setup_ps(struct ath10k_vif *arvif)
 {
-	struct ath10k_generic_iter *ar_iter = data;
-	struct ieee80211_conf *conf = &ar_iter->ar->hw->conf;
-	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
+	struct ath10k *ar = arvif->ar;
+	struct ieee80211_conf *conf = &ar->hw->conf;
 	enum wmi_sta_powersave_param param;
 	enum wmi_sta_ps_mode psmode;
 	int ret;
 
 	lockdep_assert_held(&arvif->ar->conf_mutex);
 
-	if (vif->type != NL80211_IFTYPE_STATION)
-		return;
+	if (arvif->vif->type != NL80211_IFTYPE_STATION)
+		return 0;
 
 	if (conf->flags & IEEE80211_CONF_PS) {
 		psmode = WMI_STA_PS_MODE_ENABLED;
 		param = WMI_STA_PS_PARAM_INACTIVITY_TIME;
 
-		ret = ath10k_wmi_set_sta_ps_param(ar_iter->ar,
-						  arvif->vdev_id,
-						  param,
+		ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param,
 						  conf->dynamic_ps_timeout);
 		if (ret) {
 			ath10k_warn("Failed to set inactivity time for VDEV: %d\n",
 				    arvif->vdev_id);
-			return;
+			return ret;
 		}
-
-		ar_iter->ret = ret;
 	} else {
 		psmode = WMI_STA_PS_MODE_DISABLED;
 	}
@@ -759,11 +754,14 @@ static void ath10k_ps_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
 	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d psmode %s\n",
 		   arvif->vdev_id, psmode ? "enable" : "disable");
 
-	ar_iter->ret = ath10k_wmi_set_psmode(ar_iter->ar, arvif->vdev_id,
-					     psmode);
-	if (ar_iter->ret)
+	ret = ath10k_wmi_set_psmode(ar, arvif->vdev_id, psmode);
+	if (ret) {
 		ath10k_warn("Failed to set PS Mode: %d for VDEV: %d\n",
 			    psmode, arvif->vdev_id);
+		return ret;
+	}
+
+	return 0;
 }
 
 /**********************/
@@ -1959,9 +1957,10 @@ static void ath10k_stop(struct ieee80211_hw *hw)
 	cancel_work_sync(&ar->restart_work);
 }
 
-static void ath10k_config_ps(struct ath10k *ar)
+static int ath10k_config_ps(struct ath10k *ar)
 {
-	struct ath10k_generic_iter ar_iter;
+	struct ath10k_vif *arvif;
+	int ret = 0;
 
 	lockdep_assert_held(&ar->conf_mutex);
 
@@ -1970,17 +1969,17 @@ static void ath10k_config_ps(struct ath10k *ar)
 	 * vdevs at this point we must not iterate over this interface list.
 	 * This setting will be updated upon add_interface(). */
 	if (ar->state == ATH10K_STATE_RESTARTED)
-		return;
-
-	memset(&ar_iter, 0, sizeof(struct ath10k_generic_iter));
-	ar_iter.ar = ar;
+		return 0;
 
-	ieee80211_iterate_active_interfaces_atomic(
-		ar->hw, IEEE80211_IFACE_ITER_NORMAL,
-		ath10k_ps_iter, &ar_iter);
+	list_for_each_entry(arvif, &ar->arvifs, list) {
+		ret = ath10k_mac_vif_setup_ps(arvif);
+		if (ret) {
+			ath10k_warn("could not setup powersave (%d)\n", ret);
+			break;
+		}
+	}
 
-	if (ar_iter.ret)
-		ath10k_warn("failed to set ps config (%d)\n", ar_iter.ret);
+	return ret;
 }
 
 static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
@@ -2882,86 +2881,65 @@ static int ath10k_cancel_remain_on_channel(struct ieee80211_hw *hw)
  * Both RTS and Fragmentation threshold are interface-specific
  * in ath10k, but device-specific in mac80211.
  */
-static void ath10k_set_rts_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
-{
-	struct ath10k_generic_iter *ar_iter = data;
-	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
-	u32 rts = ar_iter->ar->hw->wiphy->rts_threshold;
 
-	lockdep_assert_held(&arvif->ar->conf_mutex);
+static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+{
+	struct ath10k *ar = hw->priv;
+	struct ath10k_vif *arvif;
+	int ret = 0;
 
 	/* During HW reconfiguration mac80211 reports all interfaces that were
 	 * running until reconfiguration was started. Since FW doesn't have any
 	 * vdevs at this point we must not iterate over this interface list.
 	 * This setting will be updated upon add_interface(). */
-	if (ar_iter->ar->state == ATH10K_STATE_RESTARTED)
-		return;
-
-	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d rts_threshold %d\n",
-		   arvif->vdev_id, rts);
-
-	ar_iter->ret = ath10k_mac_set_rts(arvif, rts);
-	if (ar_iter->ret)
-		ath10k_warn("Failed to set RTS threshold for VDEV: %d\n",
-			    arvif->vdev_id);
-}
-
-static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
-{
-	struct ath10k_generic_iter ar_iter;
-	struct ath10k *ar = hw->priv;
-
-	memset(&ar_iter, 0, sizeof(struct ath10k_generic_iter));
-	ar_iter.ar = ar;
+	if (ar->state == ATH10K_STATE_RESTARTED)
+		return 0;
 
 	mutex_lock(&ar->conf_mutex);
-	ieee80211_iterate_active_interfaces_atomic(
-		hw, IEEE80211_IFACE_ITER_NORMAL,
-		ath10k_set_rts_iter, &ar_iter);
+	list_for_each_entry(arvif, &ar->arvifs, list) {
+		ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d rts threshold %d\n",
+			   arvif->vdev_id, value);
+
+		ret = ath10k_mac_set_rts(arvif, value);
+		if (ret) {
+			ath10k_warn("could not set rts threshold for vdev %d (%d)\n",
+				    arvif->vdev_id, ret);
+			break;
+		}
+	}
 	mutex_unlock(&ar->conf_mutex);
 
-	return ar_iter.ret;
+	return ret;
 }
 
-static void ath10k_set_frag_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
+static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
 {
-	struct ath10k_generic_iter *ar_iter = data;
-	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
-	u32 frag = ar_iter->ar->hw->wiphy->frag_threshold;
-
-	lockdep_assert_held(&arvif->ar->conf_mutex);
+	struct ath10k *ar = hw->priv;
+	struct ath10k_vif *arvif;
+	int ret = 0;
 
 	/* During HW reconfiguration mac80211 reports all interfaces that were
 	 * running until reconfiguration was started. Since FW doesn't have any
 	 * vdevs at this point we must not iterate over this interface list.
 	 * This setting will be updated upon add_interface(). */
-	if (ar_iter->ar->state == ATH10K_STATE_RESTARTED)
-		return;
-
-	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d fragmentation_threshold %d\n",
-		   arvif->vdev_id, frag);
-
-	ar_iter->ret = ath10k_mac_set_frag(arvif, frag);
-	if (ar_iter->ret)
-		ath10k_warn("Failed to set frag threshold for VDEV: %d\n",
-			    arvif->vdev_id);
-}
-
-static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
-{
-	struct ath10k_generic_iter ar_iter;
-	struct ath10k *ar = hw->priv;
-
-	memset(&ar_iter, 0, sizeof(struct ath10k_generic_iter));
-	ar_iter.ar = ar;
+	if (ar->state == ATH10K_STATE_RESTARTED)
+		return 0;
 
 	mutex_lock(&ar->conf_mutex);
-	ieee80211_iterate_active_interfaces_atomic(
-		hw, IEEE80211_IFACE_ITER_NORMAL,
-		ath10k_set_frag_iter, &ar_iter);
+	list_for_each_entry(arvif, &ar->arvifs, list) {
+		ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d fragmentation threshold %d\n",
+			   arvif->vdev_id, value);
+
+		ret = ath10k_mac_set_rts(arvif, value);
+		if (ret) {
+			ath10k_warn("could not set fragmentation threshold for vdev %d (%d)\n",
+				    arvif->vdev_id, ret);
+			break;
+		}
+	}
 	mutex_unlock(&ar->conf_mutex);
 
-	return ar_iter.ret;
+	return ret;
 }
 
 static void ath10k_flush(struct ieee80211_hw *hw, u32 queues, bool drop)



From kvalo at qca.qualcomm.com  Tue Oct 15 14:47:14 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 15 Oct 2013 21:47:14 +0300
Subject: [PATCH 6/7] ath10k: fix ath10k_bss_assoc() to not sleep in atomic
 context
In-Reply-To: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
References: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
Message-ID: <20131015184714.14123.32890.stgit@localhost6.localdomain6>

ath10k_bss_assoc() was calling ath10k_peer_assoc(), which can sleep, under
atomic rcu_read_lock() and causing scheduing while atomic errors. Workaround
that by delaying the call to ath10k_wmi_peer_assoc().

Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   56 ++++++++++++++++++++++-----------
 1 file changed, 37 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 4273eef..0b1cc51 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1137,26 +1137,25 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar,
 	WARN_ON(phymode == MODE_UNKNOWN);
 }
 
-static int ath10k_peer_assoc(struct ath10k *ar,
-			     struct ath10k_vif *arvif,
-			     struct ieee80211_sta *sta,
-			     struct ieee80211_bss_conf *bss_conf)
+static int ath10k_peer_assoc_prepare(struct ath10k *ar,
+				     struct ath10k_vif *arvif,
+				     struct ieee80211_sta *sta,
+				     struct ieee80211_bss_conf *bss_conf,
+				     struct wmi_peer_assoc_complete_arg *arg)
 {
-	struct wmi_peer_assoc_complete_arg arg;
-
 	lockdep_assert_held(&ar->conf_mutex);
 
-	memset(&arg, 0, sizeof(struct wmi_peer_assoc_complete_arg));
+	memset(arg, 0, sizeof(*arg));
 
-	ath10k_peer_assoc_h_basic(ar, arvif, sta, bss_conf, &arg);
-	ath10k_peer_assoc_h_crypto(ar, arvif, &arg);
-	ath10k_peer_assoc_h_rates(ar, sta, &arg);
-	ath10k_peer_assoc_h_ht(ar, sta, &arg);
-	ath10k_peer_assoc_h_vht(ar, sta, &arg);
-	ath10k_peer_assoc_h_qos(ar, arvif, sta, bss_conf, &arg);
-	ath10k_peer_assoc_h_phymode(ar, arvif, sta, &arg);
+	ath10k_peer_assoc_h_basic(ar, arvif, sta, bss_conf, arg);
+	ath10k_peer_assoc_h_crypto(ar, arvif, arg);
+	ath10k_peer_assoc_h_rates(ar, sta, arg);
+	ath10k_peer_assoc_h_ht(ar, sta, arg);
+	ath10k_peer_assoc_h_vht(ar, sta, arg);
+	ath10k_peer_assoc_h_qos(ar, arvif, sta, bss_conf, arg);
+	ath10k_peer_assoc_h_phymode(ar, arvif, sta, arg);
 
-	return ath10k_wmi_peer_assoc(ar, &arg);
+	return 0;
 }
 
 /* can be called only in mac80211 callbacks due to `key_count` usage */
@@ -1166,6 +1165,7 @@ static void ath10k_bss_assoc(struct ieee80211_hw *hw,
 {
 	struct ath10k *ar = hw->priv;
 	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
+	struct wmi_peer_assoc_complete_arg peer_arg;
 	struct ieee80211_sta *ap_sta;
 	int ret;
 
@@ -1181,15 +1181,24 @@ static void ath10k_bss_assoc(struct ieee80211_hw *hw,
 		return;
 	}
 
-	ret = ath10k_peer_assoc(ar, arvif, ap_sta, bss_conf);
+	ret = ath10k_peer_assoc_prepare(ar, arvif, ap_sta,
+					bss_conf, &peer_arg);
 	if (ret) {
-		ath10k_warn("Peer assoc failed for %pM\n", bss_conf->bssid);
+		ath10k_warn("Peer assoc prepare failed for %pM\n: %d",
+			    bss_conf->bssid, ret);
 		rcu_read_unlock();
 		return;
 	}
 
 	rcu_read_unlock();
 
+	ret = ath10k_wmi_peer_assoc(ar, &peer_arg);
+	if (ret) {
+		ath10k_warn("Peer assoc failed for %pM\n: %d",
+			    bss_conf->bssid, ret);
+		return;
+	}
+
 	ath10k_dbg(ATH10K_DBG_MAC,
 		   "mac vdev %d up (associated) bssid %pM aid %d\n",
 		   arvif->vdev_id, bss_conf->bssid, bss_conf->aid);
@@ -1243,13 +1252,22 @@ static void ath10k_bss_disassoc(struct ieee80211_hw *hw,
 static int ath10k_station_assoc(struct ath10k *ar, struct ath10k_vif *arvif,
 				struct ieee80211_sta *sta)
 {
+	struct wmi_peer_assoc_complete_arg peer_arg;
 	int ret = 0;
 
 	lockdep_assert_held(&ar->conf_mutex);
 
-	ret = ath10k_peer_assoc(ar, arvif, sta, NULL);
+	ret = ath10k_peer_assoc_prepare(ar, arvif, sta, NULL, &peer_arg);
+	if (ret) {
+		ath10k_warn("WMI peer assoc prepare failed for %pM\n",
+			    sta->addr);
+		return ret;
+	}
+
+	ret = ath10k_wmi_peer_assoc(ar, &peer_arg);
 	if (ret) {
-		ath10k_warn("WMI peer assoc failed for %pM\n", sta->addr);
+		ath10k_warn("Peer assoc failed for STA %pM\n: %d",
+			    sta->addr, ret);
 		return ret;
 	}
 



From kvalo at qca.qualcomm.com  Tue Oct 15 14:47:20 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 15 Oct 2013 21:47:20 +0300
Subject: [PATCH 7/7] ath10k: add might_sleep() to ath10k_wmi_cmd_send()
In-Reply-To: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
References: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
Message-ID: <20131015184719.14123.31321.stgit@localhost6.localdomain6>

ath10k_wmi_cmd_send() will now sleep if there are no credits available.
To make it easier to catch callers in atomic context add might_sleep()
to the function.

Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index d1e513e..77238af 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -613,6 +613,8 @@ static int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb,
 {
 	int ret = -EOPNOTSUPP;
 
+	might_sleep();
+
 	if (cmd_id == WMI_CMD_UNSUPPORTED) {
 		ath10k_warn("wmi command %d is not supported by firmware\n",
 			    cmd_id);



From kvalo at qca.qualcomm.com  Tue Oct 15 14:49:19 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 15 Oct 2013 21:49:19 +0300
Subject: [PATCH 3/7] ath10k: track vif list internally
In-Reply-To: <20131015184656.14123.70575.stgit@localhost6.localdomain6> (Kalle
 Valo's message of "Tue, 15 Oct 2013 21:46:56 +0300")
References: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
 <20131015184656.14123.70575.stgit@localhost6.localdomain6>
Message-ID: <87a9iabc9c.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo at qca.qualcomm.com> writes:

> From: Michal Kazior <michal.kazior at tieto.com>
>
> mac80211 interface interations functions have
> peculiar locking issues. This patch introduces
> internal (to ath10k) vif list that will be used
> for vif iteration purposes.
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>

[...]

> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -713,6 +713,7 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
>  	mutex_init(&ar->conf_mutex);
>  	spin_lock_init(&ar->data_lock);
>  
> +	INIT_LIST_HEAD(&ar->arvifs);
>  	INIT_LIST_HEAD(&ar->peers);
>  	init_waitqueue_head(&ar->peer_mapping_wq);
>  
> @@ -824,6 +825,7 @@ int ath10k_core_start(struct ath10k *ar)
>  		goto err_disconnect_htc;
>  
>  	ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1;
> +	INIT_LIST_HEAD(&ar->arvifs);
>  
>  	return 0;

Michal, why do the INIT_LIST_HEAD() twice? Isn't it enough to do it
core_start()?

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Tue Oct 15 14:55:53 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 15 Oct 2013 21:55:53 +0300
Subject: [PATCH 0/7] ath10k: fixes 2013-10-15
In-Reply-To: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Tue, 15 Oct 2013 10:29:49 -0700")
References: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <8761sybbye.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> This is a bunch of fixes I've had queued up for
> some time now. I was reluctant to send them
> without some additional checks and because some of
> the fixes are not ideal. At least we can get a
> discussion going if anything raises any serious
> concern.
>
>
> Michal Kazior (7):
>   ath10k: prevent starting monitor without a vdev
>   ath10k: add sanity checks for monitor management
>   ath10k: fix endianess in prints
>   ath10k: fix NSS reporting in RX
>   ath10k: fix NULL deref upon early FW crash
>   ath10k: fix device initialization routine
>   ath10k: fix FW crashes on heavy TX on 10.1.389 AP FW

I get few long line warnings:

drivers/net/wireless/ath/ath10k/pci.c:1842: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/pci.c:1844: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/pci.c:1847: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/pci.c:1848: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/pci.c:1856: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/pci.c:1875: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/pci.c:1877: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/pci.c:1883: WARNING: line over 80 characters
drivers/net/wireless/ath/ath10k/mac.c:2284: WARNING: line over 80 characters

-- 
Kalle Valo


From michal.kazior at tieto.com  Tue Oct 15 15:37:42 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Tue, 15 Oct 2013 12:37:42 -0700
Subject: [PATCH 3/7] ath10k: track vif list internally
In-Reply-To: <87a9iabc9c.fsf@kamboji.qca.qualcomm.com>
References: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
 <20131015184656.14123.70575.stgit@localhost6.localdomain6>
 <87a9iabc9c.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CA+BoTQ=CqXN24Y-tb=r_ruUUNR_imcztULnoTScAvScvbPDbdA@mail.gmail.com>

On 15 October 2013 11:49, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Kalle Valo <kvalo at qca.qualcomm.com> writes:
>
>> From: Michal Kazior <michal.kazior at tieto.com>
>>
>> mac80211 interface interations functions have
>> peculiar locking issues. This patch introduces
>> internal (to ath10k) vif list that will be used
>> for vif iteration purposes.
>>
>> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
>> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
>
> [...]
>
>> --- a/drivers/net/wireless/ath/ath10k/core.c
>> +++ b/drivers/net/wireless/ath/ath10k/core.c
>> @@ -713,6 +713,7 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
>>       mutex_init(&ar->conf_mutex);
>>       spin_lock_init(&ar->data_lock);
>>
>> +     INIT_LIST_HEAD(&ar->arvifs);
>>       INIT_LIST_HEAD(&ar->peers);
>>       init_waitqueue_head(&ar->peer_mapping_wq);
>>
>> @@ -824,6 +825,7 @@ int ath10k_core_start(struct ath10k *ar)
>>               goto err_disconnect_htc;
>>
>>       ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1;
>> +     INIT_LIST_HEAD(&ar->arvifs);
>>
>>       return 0;
>
> Michal, why do the INIT_LIST_HEAD() twice? Isn't it enough to do it
> core_start()?

Ah, good point. It's most likely okay to just do it in
ath10k_core_start(). The one in ath10k_core_create() isn't required.


Micha?


From kvalo at qca.qualcomm.com  Wed Oct 16 04:50:42 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 11:50:42 +0300
Subject: [PATCH v2] ath10k: do not warn about unsupported vdev param
In-Reply-To: <1381821980-7966-1-git-send-email-bartosz.markowski@tieto.com>
 (Bartosz Markowski's message of "Tue, 15 Oct 2013 09:26:20 +0200")
References: <1381821980-7966-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <8761sx8uql.fsf@kamboji.qca.qualcomm.com>

Bartosz Markowski <bartosz.markowski at tieto.com> writes:

> 10.X firmware does not support WMI_VDEV_PARAM_TX_ENCAP_TYPE.
> It's a known limitation and we should not warn about this.
>
> Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>

Thanks, applied.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Wed Oct 16 04:52:25 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 11:52:25 +0300
Subject: [PATCH 1/2] ath10k: rename WMI_CMD_UNDEFINED
In-Reply-To: <1381823732-10128-1-git-send-email-bartosz.markowski@tieto.com>
 (Bartosz Markowski's message of "Tue, 15 Oct 2013 09:55:31 +0200")
References: <1381823732-10128-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <871u3l8unq.fsf@kamboji.qca.qualcomm.com>

Bartosz Markowski <bartosz.markowski at tieto.com> writes:

> Rename WMI_CMD_UNDEFINED to WMI_CMD_UNSUPPORTED. This is more
> accurate here. Also return -EOPNOTSUPP instead of -EINVAL in
> wmi_cmd_send().
>
> Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>

Thanks, both patches applied.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Wed Oct 16 05:19:09 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 12:19:09 +0300
Subject: [PATCH 2/7] ath10k: add sanity checks for monitor management
In-Reply-To: <1381858196-17000-3-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Tue, 15 Oct 2013 10:29:51 -0700")
References: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
 <1381858196-17000-3-git-send-email-michal.kazior@tieto.com>
Message-ID: <87siw17euq.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> Add a few checks and warnings to make it easier to
> track any kind of monitor vdev mismanagement.
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

[...]

> +	if (!ar->monitor_present) {
> +		ath10k_warn("mac montor stop -- monitor is not present\n");
> +		return -EINVAL;
> +	}

[...]

> +	if (!ar->monitor_present) {
> +		ath10k_warn("mac montor stop -- monitor is not present\n");
> +		return -EINVAL;
> +	}
> +
> +	if (!ar->monitor_enabled) {
> +		ath10k_warn("mac montor stop -- monitor is not enabled\n");
> +		return -EINVAL;
> +	}

s/montor/monitor/

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Wed Oct 16 08:47:15 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 15:47:15 +0300
Subject: [PATCH 3/7] ath10k: track vif list internally
In-Reply-To: <CA+BoTQ=CqXN24Y-tb=r_ruUUNR_imcztULnoTScAvScvbPDbdA@mail.gmail.com>
 (Michal Kazior's message of "Tue, 15 Oct 2013 12:37:42 -0700")
References: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
 <20131015184656.14123.70575.stgit@localhost6.localdomain6>
 <87a9iabc9c.fsf@kamboji.qca.qualcomm.com>
 <CA+BoTQ=CqXN24Y-tb=r_ruUUNR_imcztULnoTScAvScvbPDbdA@mail.gmail.com>
Message-ID: <87k3hd757w.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> On 15 October 2013 11:49, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
>> Kalle Valo <kvalo at qca.qualcomm.com> writes:
>>
>>> From: Michal Kazior <michal.kazior at tieto.com>
>>>
>>> mac80211 interface interations functions have
>>> peculiar locking issues. This patch introduces
>>> internal (to ath10k) vif list that will be used
>>> for vif iteration purposes.
>>>
>>> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
>>> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
>>
>> [...]
>>
>> Michal, why do the INIT_LIST_HEAD() twice? Isn't it enough to do it
>> core_start()?
>
> Ah, good point. It's most likely okay to just do it in
> ath10k_core_start(). The one in ath10k_core_create() isn't required.

Ok, I removed the one from ath10k_core_create() before I commited this.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Wed Oct 16 08:48:42 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 15:48:42 +0300
Subject: [PATCH 0/7] ath10k: fix WMI atomic usage
In-Reply-To: <20131015184548.14123.56949.stgit@localhost6.localdomain6> (Kalle
 Valo's message of "Tue, 15 Oct 2013 21:46:37 +0300")
References: <20131015184548.14123.56949.stgit@localhost6.localdomain6>
Message-ID: <87fvs1755h.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo at qca.qualcomm.com> writes:

> Some WMI calls were made in atomic contex, these patches fix
> those. Please review.
>
> ---
>
> Kalle Valo (2):
>       ath10k: fix ath10k_bss_assoc() to not sleep in atomic context
>       ath10k: add might_sleep() to ath10k_wmi_cmd_send()
>
> Michal Kazior (5):
>       ath10k: use workqueue to set WEP TX key
>       ath10k: fix add_interface failure handling
>       ath10k: track vif list internally
>       ath10k: fix scheduling while atomic config bug
>       ath10k: remove unnecessary checks

All patches applied.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Wed Oct 16 08:56:22 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 15:56:22 +0300
Subject: [PATCH 0/7] ath10k: fixes 2013-10-15
In-Reply-To: <8761sybbye.fsf@kamboji.qca.qualcomm.com> (Kalle Valo's message
 of "Tue, 15 Oct 2013 21:55:53 +0300")
References: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
 <8761sybbye.fsf@kamboji.qca.qualcomm.com>
Message-ID: <87bo2p74sp.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo at qca.qualcomm.com> writes:

> Michal Kazior <michal.kazior at tieto.com> writes:
>
>> This is a bunch of fixes I've had queued up for
>> some time now. I was reluctant to send them
>> without some additional checks and because some of
>> the fixes are not ideal. At least we can get a
>> discussion going if anything raises any serious
>> concern.
>>
>>
>> Michal Kazior (7):
>>   ath10k: prevent starting monitor without a vdev
>>   ath10k: add sanity checks for monitor management
>>   ath10k: fix endianess in prints
>>   ath10k: fix NSS reporting in RX
>>   ath10k: fix NULL deref upon early FW crash
>>   ath10k: fix device initialization routine
>>   ath10k: fix FW crashes on heavy TX on 10.1.389 AP FW
>
> I get few long line warnings:
>
> drivers/net/wireless/ath/ath10k/pci.c:1842: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/pci.c:1844: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/pci.c:1847: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/pci.c:1848: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/pci.c:1856: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/pci.c:1875: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/pci.c:1877: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/pci.c:1883: WARNING: line over 80 characters
> drivers/net/wireless/ath/ath10k/mac.c:2284: WARNING: line over 80 characters

Michal, if it's ok for you I'll submit v2 of this patchset. I'll fix the
long line warnings and also I do small cleanup to the warm reset code.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Wed Oct 16 09:31:42 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 16:31:42 +0300
Subject: [PATCH 6/7] ath10k: fix device initialization routine
In-Reply-To: <1381858196-17000-7-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Tue, 15 Oct 2013 10:29:55 -0700")
References: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
 <1381858196-17000-7-git-send-email-michal.kazior@tieto.com>
Message-ID: <877gdd735t.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> Hardware revision 2 does not support cold reset
> correctly. As such it would sometimes lead to host
> machine freeze or data bus errors.
>
> The patch introduces warm reset function which is
> used instead of the cold reset one. It also moves
> the reset before interrupts are being set up to
> prevent any kind of spurious interrupts from being
> handled.
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

[...]

> +	/* reset CE */
> +	addr = ar_pci->mem + RTC_SOC_BASE_ADDRESS + SOC_RESET_CONTROL_ADDRESS;
> +	val = ioread32(addr);
> +	val |= SOC_RESET_CONTROL_CE_RST_MASK;
> +	iowrite32(val, addr);
> +	val = ioread32(addr);
> +	msleep(10);
> +
> +	/* unreset CE */
> +	val &= ~SOC_RESET_CONTROL_CE_RST_MASK, addr;
> +	iowrite32(val, addr);

This looks wrong, I assume it was supposed to be this:

val &= ~SOC_RESET_CONTROL_CE_RST_MASK;

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Wed Oct 16 09:45:35 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 16:45:35 +0300
Subject: [PATCH v2 0/8] ath10k: fixes 2013-10-15
Message-ID: <20131016134503.25095.8044.stgit@localhost6.localdomain6>

This is Michal's patchset which he said:

  This is a bunch of fixes I've had queued up for
  some time now. I was reluctant to send them without some additional checks
  and because some of the fixes are not ideal. At least we can get a discussion
  going if anything raises any serious concern.

For v2 I added one patch myself, modified "ath10k: fix device initialization
routine" to use ath10k_pci_write32() style of wrappers and fixed long line warnings
from checkpatch.

---

Kalle Valo (1):
      ath10k: implement ath10k_pci_soc_read/write32()

Michal Kazior (7):
      ath10k: prevent starting monitor without a vdev
      ath10k: add sanity checks for monitor management
      ath10k: fix endianess in prints
      ath10k: fix NSS reporting in RX
      ath10k: fix NULL deref upon early FW crash
      ath10k: fix device initialization routine
      ath10k: fix FW crashes on heavy TX on 10.1.389 AP FW


 drivers/net/wireless/ath/ath10k/ce.c     |   11 ++
 drivers/net/wireless/ath/ath10k/core.c   |    3 -
 drivers/net/wireless/ath/ath10k/htt_tx.c |   11 +-
 drivers/net/wireless/ath/ath10k/hw.h     |    7 ++
 drivers/net/wireless/ath/ath10k/mac.c    |   25 +++++-
 drivers/net/wireless/ath/ath10k/pci.c    |  135 ++++++++++++++++++------------
 drivers/net/wireless/ath/ath10k/pci.h    |   20 ++++
 drivers/net/wireless/ath/ath10k/txrx.c   |    2 
 drivers/net/wireless/ath/ath10k/wmi.c    |   16 ++--
 9 files changed, 158 insertions(+), 72 deletions(-)



From kvalo at qca.qualcomm.com  Wed Oct 16 09:45:41 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 16:45:41 +0300
Subject: [PATCH v2 1/8] ath10k: prevent starting monitor without a vdev
In-Reply-To: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
Message-ID: <20131016134541.25095.59430.stgit@localhost6.localdomain6>

From: Michal Kazior <michal.kazior at tieto.com>

This fixes issue with interface bridging.

Linux bridging sets promiscuous mode for all
interfaces that are in a bridge. This translates
to configure_filter() being called in a mac80211
driver.

Before the patch operational interface would be
started and upped again when promiscuous mode was
enabled causing all sorts of strange issues:

 * no HTT RX happening (i.e. no traffic)
 * FW crash upon driver reload/unload

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 0b1cc51..527343d 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2265,8 +2265,14 @@ static void ath10k_configure_filter(struct ieee80211_hw *hw,
 	*total_flags &= SUPPORTED_FILTERS;
 	ar->filter_flags = *total_flags;
 
+	/* Monitor must not be started if it wasn't created first.
+	 * Promiscuous mode may be started on a non-monitor interface - in
+	 * such case the monitor vdev is not created so starting the
+	 * monitor makes no sense. Since ath10k uses no special RX filters
+	 * (only BSS filter in STA mode) there's no need for any special
+	 * action here. */
 	if ((ar->filter_flags & FIF_PROMISC_IN_BSS) &&
-	    !ar->monitor_enabled) {
+	    !ar->monitor_enabled && ar->monitor_present) {
 		ath10k_dbg(ATH10K_DBG_MAC, "mac monitor %d start\n",
 			   ar->monitor_vdev_id);
 
@@ -2274,7 +2280,7 @@ static void ath10k_configure_filter(struct ieee80211_hw *hw,
 		if (ret)
 			ath10k_warn("Unable to start monitor mode\n");
 	} else if (!(ar->filter_flags & FIF_PROMISC_IN_BSS) &&
-		   ar->monitor_enabled) {
+		   ar->monitor_enabled && ar->monitor_present) {
 		ath10k_dbg(ATH10K_DBG_MAC, "mac monitor %d stop\n",
 			   ar->monitor_vdev_id);
 



From kvalo at qca.qualcomm.com  Wed Oct 16 09:45:48 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 16:45:48 +0300
Subject: [PATCH v2 2/8] ath10k: add sanity checks for monitor management
In-Reply-To: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
Message-ID: <20131016134548.25095.6014.stgit@localhost6.localdomain6>

From: Michal Kazior <michal.kazior at tieto.com>

Add a few checks and warnings to make it easier to
track any kind of monitor vdev mismanagement.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 527343d..da23c3f 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -516,6 +516,11 @@ static int ath10k_monitor_start(struct ath10k *ar, int vdev_id)
 
 	lockdep_assert_held(&ar->conf_mutex);
 
+	if (!ar->monitor_present) {
+		ath10k_warn("mac montor stop -- monitor is not present\n");
+		return -EINVAL;
+	}
+
 	arg.vdev_id = vdev_id;
 	arg.channel.freq = channel->center_freq;
 	arg.channel.band_center_freq1 = ar->hw->conf.chandef.center_freq1;
@@ -566,6 +571,16 @@ static int ath10k_monitor_stop(struct ath10k *ar)
 
 	lockdep_assert_held(&ar->conf_mutex);
 
+	if (!ar->monitor_present) {
+		ath10k_warn("mac montor stop -- monitor is not present\n");
+		return -EINVAL;
+	}
+
+	if (!ar->monitor_enabled) {
+		ath10k_warn("mac montor stop -- monitor is not enabled\n");
+		return -EINVAL;
+	}
+
 	ret = ath10k_wmi_vdev_down(ar, ar->monitor_vdev_id);
 	if (ret)
 		ath10k_warn("Monitor vdev down failed: %d\n", ret);



From kvalo at qca.qualcomm.com  Wed Oct 16 09:45:53 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 16:45:53 +0300
Subject: [PATCH v2 3/8] ath10k: fix endianess in prints
In-Reply-To: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
Message-ID: <20131016134553.25095.84407.stgit@localhost6.localdomain6>

From: Michal Kazior <michal.kazior at tieto.com>

This fixes incorrect values being printed on
big-endian hosts.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 77238af..a796d0b 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2211,7 +2211,7 @@ static int ath10k_wmi_main_cmd_init(struct ath10k *ar)
 	}
 
 	ath10k_dbg(ATH10K_DBG_WMI, "wmi sending %d memory chunks info.\n",
-		   __cpu_to_le32(ar->wmi.num_mem_chunks));
+		   ar->wmi.num_mem_chunks);
 
 	cmd->num_host_mem_chunks = __cpu_to_le32(ar->wmi.num_mem_chunks);
 
@@ -2224,10 +2224,10 @@ static int ath10k_wmi_main_cmd_init(struct ath10k *ar)
 			__cpu_to_le32(ar->wmi.mem_chunks[i].req_id);
 
 		ath10k_dbg(ATH10K_DBG_WMI,
-			   "wmi chunk %d len %d requested, addr 0x%x\n",
+			   "wmi chunk %d len %d requested, addr 0x%llx\n",
 			   i,
-			   cmd->host_mem_chunks[i].size,
-			   cmd->host_mem_chunks[i].ptr);
+			   ar->wmi.mem_chunks[i].len,
+			   (unsigned long long)ar->wmi.mem_chunks[i].paddr);
 	}
 out:
 	memcpy(&cmd->resource_config, &config, sizeof(config));
@@ -2302,7 +2302,7 @@ static int ath10k_wmi_10x_cmd_init(struct ath10k *ar)
 	}
 
 	ath10k_dbg(ATH10K_DBG_WMI, "wmi sending %d memory chunks info.\n",
-		   __cpu_to_le32(ar->wmi.num_mem_chunks));
+		   ar->wmi.num_mem_chunks);
 
 	cmd->num_host_mem_chunks = __cpu_to_le32(ar->wmi.num_mem_chunks);
 
@@ -2315,10 +2315,10 @@ static int ath10k_wmi_10x_cmd_init(struct ath10k *ar)
 			__cpu_to_le32(ar->wmi.mem_chunks[i].req_id);
 
 		ath10k_dbg(ATH10K_DBG_WMI,
-			   "wmi chunk %d len %d requested, addr 0x%x\n",
+			   "wmi chunk %d len %d requested, addr 0x%llx\n",
 			   i,
-			   cmd->host_mem_chunks[i].size,
-			   cmd->host_mem_chunks[i].ptr);
+			   ar->wmi.mem_chunks[i].len,
+			   (unsigned long long)ar->wmi.mem_chunks[i].paddr);
 	}
 out:
 	memcpy(&cmd->resource_config, &config, sizeof(config));



From kvalo at qca.qualcomm.com  Wed Oct 16 09:45:59 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 16:45:59 +0300
Subject: [PATCH v2 4/8] ath10k: fix NSS reporting in RX
In-Reply-To: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
Message-ID: <20131016134559.25095.62038.stgit@localhost6.localdomain6>

From: Michal Kazior <michal.kazior at tieto.com>

NSTS values reported in the VHT-SIG-A1 are 0
through 7 but they actually describe number of
streams 1 through 8.

1SS frames were dropped. This patch fixes this.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/txrx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index 5ae373a..c511f91 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -183,7 +183,7 @@ static void process_rx_rates(struct ath10k *ar, struct htt_rx_info *info,
 		/* VHT-SIG-A1 in info 1, VHT-SIG-A2 in info2
 		   TODO check this */
 		mcs = (info2 >> 4) & 0x0F;
-		nss = (info1 >> 10) & 0x07;
+		nss = ((info1 >> 10) & 0x07) + 1;
 		bw = info1 & 3;
 		sgi = info2 & 1;
 



From kvalo at qca.qualcomm.com  Wed Oct 16 09:46:05 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 16:46:05 +0300
Subject: [PATCH v2 5/8] ath10k: fix NULL deref upon early FW crash
In-Reply-To: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
Message-ID: <20131016134605.25095.65863.stgit@localhost6.localdomain6>

From: Michal Kazior <michal.kazior at tieto.com>

If firmware crashes during FW probing it would try
to perform FW recovery which uses mac80211
workqueue before registering to mac80211.

Using internal workqueue solves the problem.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c |    3 ++-
 drivers/net/wireless/ath/ath10k/pci.c  |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 1129994..2a360ca 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -664,7 +664,8 @@ static void ath10k_core_restart(struct work_struct *work)
 		ieee80211_restart_hw(ar->hw);
 		break;
 	case ATH10K_STATE_OFF:
-		/* this can happen if driver is being unloaded */
+		/* this can happen if driver is being unloaded
+		 * or if the crash happens during FW probing */
 		ath10k_warn("cannot restart a device that hasn't been started\n");
 		break;
 	case ATH10K_STATE_RESTARTING:
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index f8d59c7..d09f8a2 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -777,7 +777,7 @@ static void ath10k_pci_hif_dump_area(struct ath10k *ar)
 			   reg_dump_values[i + 2],
 			   reg_dump_values[i + 3]);
 
-	ieee80211_queue_work(ar->hw, &ar->restart_work);
+	queue_work(ar->workqueue, &ar->restart_work);
 }
 
 static void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,



From kvalo at qca.qualcomm.com  Wed Oct 16 09:46:11 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 16:46:11 +0300
Subject: [PATCH v2 6/8] ath10k: implement ath10k_pci_soc_read/write32()
In-Reply-To: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
Message-ID: <20131016134611.25095.80204.stgit@localhost6.localdomain6>

To make it easier to access SOC registers. No functional
changes.

Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/pci.c |    3 +--
 drivers/net/wireless/ath/ath10k/pci.h |   10 ++++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index d09f8a2..5c78383 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2454,8 +2454,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
 		return ret;
 	}
 
-	chip_id = ath10k_pci_read32(ar,
-				    RTC_SOC_BASE_ADDRESS + SOC_CHIP_ID_ADDRESS);
+	chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
 
 	ath10k_do_pci_sleep(ar);
 
diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h
index 52fb7b9..a304c33 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -318,6 +318,16 @@ static inline u32 ath10k_pci_read32(struct ath10k *ar, u32 offset)
 	return ioread32(ar_pci->mem + offset);
 }
 
+static inline u32 ath10k_pci_soc_read32(struct ath10k *ar, u32 addr)
+{
+	return ath10k_pci_read32(ar, RTC_SOC_BASE_ADDRESS + addr);
+}
+
+static inline void ath10k_pci_soc_write32(struct ath10k *ar, u32 addr, u32 val)
+{
+	ath10k_pci_write32(ar, RTC_SOC_BASE_ADDRESS + addr, val);
+}
+
 int ath10k_do_pci_wake(struct ath10k *ar);
 void ath10k_do_pci_sleep(struct ath10k *ar);
 



From kvalo at qca.qualcomm.com  Wed Oct 16 09:46:18 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 16:46:18 +0300
Subject: [PATCH v2 7/8] ath10k: fix device initialization routine
In-Reply-To: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
Message-ID: <20131016134617.25095.10581.stgit@localhost6.localdomain6>

From: Michal Kazior <michal.kazior at tieto.com>

Hardware revision 2 does not support cold reset
correctly. As such it would sometimes lead to host
machine freeze or data bus errors.

The patch introduces warm reset function which is
used instead of the cold reset one. It also moves
the reset before interrupts are being set up to
prevent any kind of spurious interrupts from being
handled.

kvalo: use ath10k_pci_write32() style wrappers, fix long
lines

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/hw.h  |    7 ++
 drivers/net/wireless/ath/ath10k/pci.c |  130 ++++++++++++++++++++-------------
 drivers/net/wireless/ath/ath10k/pci.h |   10 +++
 3 files changed, 97 insertions(+), 50 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index 8aeb46d..2032737 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -204,8 +204,11 @@ enum ath10k_mcast2ucast_mode {
 #define WLAN_ANALOG_INTF_PCIE_BASE_ADDRESS	0x0006c000
 #define PCIE_LOCAL_BASE_ADDRESS			0x00080000
 
+#define SOC_RESET_CONTROL_ADDRESS		0x00000000
 #define SOC_RESET_CONTROL_OFFSET		0x00000000
 #define SOC_RESET_CONTROL_SI0_RST_MASK		0x00000001
+#define SOC_RESET_CONTROL_CE_RST_MASK		0x00040000
+#define SOC_RESET_CONTROL_CPU_WARM_RST_MASK	0x00000040
 #define SOC_CPU_CLOCK_OFFSET			0x00000020
 #define SOC_CPU_CLOCK_STANDARD_LSB		0
 #define SOC_CPU_CLOCK_STANDARD_MASK		0x00000003
@@ -215,6 +218,8 @@ enum ath10k_mcast2ucast_mode {
 #define SOC_LPO_CAL_OFFSET			0x000000e0
 #define SOC_LPO_CAL_ENABLE_LSB			20
 #define SOC_LPO_CAL_ENABLE_MASK			0x00100000
+#define SOC_LF_TIMER_CONTROL0_ADDRESS		0x00000050
+#define SOC_LF_TIMER_CONTROL0_ENABLE_MASK	0x00000004
 
 #define SOC_CHIP_ID_ADDRESS			0x000000ec
 #define SOC_CHIP_ID_REV_LSB			8
@@ -269,8 +274,10 @@ enum ath10k_mcast2ucast_mode {
 #define CORE_CTRL_CPU_INTR_MASK			0x00002000
 #define CORE_CTRL_ADDRESS			0x0000
 #define PCIE_INTR_ENABLE_ADDRESS		0x0008
+#define PCIE_INTR_CAUSE_ADDRESS			0x000c
 #define PCIE_INTR_CLR_ADDRESS			0x0014
 #define SCRATCH_3_ADDRESS			0x0030
+#define CPU_INTR_ADDRESS			0x0010
 
 /* Firmware indications to the Host via SCRATCH_3 register. */
 #define FW_INDICATOR_ADDRESS	(SOC_CORE_BASE_ADDRESS + SCRATCH_3_ADDRESS)
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 5c78383..1e9cfcc9 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -52,7 +52,6 @@ static int ath10k_pci_post_rx_pipe(struct ath10k_pci_pipe *pipe_info,
 					     int num);
 static void ath10k_pci_rx_pipe_cleanup(struct ath10k_pci_pipe *pipe_info);
 static void ath10k_pci_stop_ce(struct ath10k *ar);
-static void ath10k_pci_device_reset(struct ath10k *ar);
 static int ath10k_pci_reset_target(struct ath10k *ar);
 static int ath10k_pci_start_intr(struct ath10k *ar);
 static void ath10k_pci_stop_intr(struct ath10k *ar);
@@ -1825,16 +1824,78 @@ static void ath10k_pci_fw_interrupt_handler(struct ath10k *ar)
 	ath10k_pci_sleep(ar);
 }
 
-static int ath10k_pci_hif_power_up(struct ath10k *ar)
+static int ath10k_pci_warm_reset(struct ath10k *ar)
 {
 	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 	int ret;
+	u32 val;
 
-	ret = ath10k_pci_start_intr(ar);
-	if (ret) {
-		ath10k_err("could not start interrupt handling (%d)\n", ret);
-		goto err;
-	}
+	ath10k_dbg(ATH10K_DBG_BOOT, "performing warm chip reset\n");
+
+	ret = ath10k_do_pci_wake(ar);
+	if (ret)
+		return ret;
+
+	ath10k_dbg(ATH10K_DBG_BOOT,
+		   "pci intr cause 0x%08x cpu intr 0x%08x (before)\n",
+		   ath10k_pci_core_read32(ar, PCIE_INTR_CAUSE_ADDRESS),
+		   ath10k_pci_core_read32(ar, CPU_INTR_ADDRESS));
+
+	/* disable pending irqs */
+	ath10k_pci_core_write32(ar, PCIE_INTR_ENABLE_ADDRESS, 0);
+	ath10k_pci_core_write32(ar, PCIE_INTR_CLR_ADDRESS, ~0);
+
+	msleep(100);
+
+	/* clear fw indicator */
+	ath10k_pci_write32(ar, ar_pci->fw_indicator_address, 0);
+
+	/* clear target LF timer interrupts */
+	val = ath10k_pci_soc_read32(ar, SOC_LF_TIMER_CONTROL0_ADDRESS);
+	ath10k_pci_soc_write32(ar, SOC_LF_TIMER_CONTROL0_ADDRESS,
+			       val & ~SOC_LF_TIMER_CONTROL0_ENABLE_MASK);
+
+	/* reset CE */
+	val = ath10k_pci_soc_read32(ar, SOC_RESET_CONTROL_ADDRESS);
+	val |= SOC_RESET_CONTROL_CE_RST_MASK;
+	ath10k_pci_soc_write32(ar, SOC_RESET_CONTROL_ADDRESS, val);
+	val = ath10k_pci_soc_read32(ar, SOC_RESET_CONTROL_ADDRESS);
+
+	msleep(10);
+
+	/* unreset CE */
+	val &= ~SOC_RESET_CONTROL_CE_RST_MASK;
+	ath10k_pci_soc_write32(ar, SOC_RESET_CONTROL_ADDRESS, val);
+	val = ath10k_pci_soc_read32(ar, SOC_RESET_CONTROL_ADDRESS);
+
+	msleep(10);
+
+	ath10k_dbg(ATH10K_DBG_BOOT,
+		   "pci intr cause 0x%08x cpu intr 0x%08x (after)\n",
+		   ath10k_pci_core_read32(ar, PCIE_INTR_CAUSE_ADDRESS),
+		   ath10k_pci_core_read32(ar, CPU_INTR_ADDRESS));
+
+	/* CPU warm reset */
+	val = ath10k_pci_soc_read32(ar, SOC_RESET_CONTROL_ADDRESS);
+	ath10k_pci_soc_write32(ar, SOC_RESET_CONTROL_ADDRESS,
+			       val | SOC_RESET_CONTROL_CPU_WARM_RST_MASK);
+
+	ath10k_dbg(ATH10K_DBG_BOOT, "soc reset control 0x%08x\n",
+		   ath10k_pci_soc_read32(ar, SOC_RESET_CONTROL_ADDRESS));
+
+	msleep(100);
+
+	ath10k_dbg(ATH10K_DBG_BOOT, "warm reset complete\n");
+
+	ath10k_do_pci_sleep(ar);
+
+	return ret;
+}
+
+static int ath10k_pci_hif_power_up(struct ath10k *ar)
+{
+	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+	int ret;
 
 	/*
 	 * Bring the target up cleanly.
@@ -1845,8 +1906,19 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
 	 * (aux) powered and running. On a subsequent driver load, the Target
 	 * is in an unexpected state. We try to catch that here in order to
 	 * reset the Target and retry the probe.
+	 *
+	 * Only HW v2 supports warm reset. Since ath10k does not support v1
+	 * anymore just forget about cold reset which is broken on v2 for now.
 	 */
-	ath10k_pci_device_reset(ar);
+	ret = ath10k_pci_warm_reset(ar);
+	if (ret)
+		goto err;
+
+	ret = ath10k_pci_start_intr(ar);
+	if (ret) {
+		ath10k_err("could not start interrupt handling (%d)\n", ret);
+		goto err;
+	}
 
 	ret = ath10k_pci_reset_target(ar);
 	if (ret)
@@ -2278,48 +2350,6 @@ static int ath10k_pci_reset_target(struct ath10k *ar)
 	return 0;
 }
 
-static void ath10k_pci_device_reset(struct ath10k *ar)
-{
-	int i;
-	u32 val;
-
-	if (!SOC_GLOBAL_RESET_ADDRESS)
-		return;
-
-	ath10k_pci_reg_write32(ar, PCIE_SOC_WAKE_ADDRESS,
-			       PCIE_SOC_WAKE_V_MASK);
-	for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
-		if (ath10k_pci_target_is_awake(ar))
-			break;
-		msleep(1);
-	}
-
-	/* Put Target, including PCIe, into RESET. */
-	val = ath10k_pci_reg_read32(ar, SOC_GLOBAL_RESET_ADDRESS);
-	val |= 1;
-	ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
-
-	for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
-		if (ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
-					  RTC_STATE_COLD_RESET_MASK)
-			break;
-		msleep(1);
-	}
-
-	/* Pull Target, including PCIe, out of RESET. */
-	val &= ~1;
-	ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
-
-	for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
-		if (!(ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
-					    RTC_STATE_COLD_RESET_MASK))
-			break;
-		msleep(1);
-	}
-
-	ath10k_pci_reg_write32(ar, PCIE_SOC_WAKE_ADDRESS, PCIE_SOC_WAKE_RESET);
-}
-
 static void ath10k_pci_dump_features(struct ath10k_pci *ar_pci)
 {
 	int i;
diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h
index a304c33..28e8ca2 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -328,6 +328,16 @@ static inline void ath10k_pci_soc_write32(struct ath10k *ar, u32 addr, u32 val)
 	ath10k_pci_write32(ar, RTC_SOC_BASE_ADDRESS + addr, val);
 }
 
+static inline u32 ath10k_pci_core_read32(struct ath10k *ar, u32 addr)
+{
+	return ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS + addr);
+}
+
+static inline void ath10k_pci_core_write32(struct ath10k *ar, u32 addr, u32 val)
+{
+	ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS + addr, val);
+}
+
 int ath10k_do_pci_wake(struct ath10k *ar);
 void ath10k_do_pci_sleep(struct ath10k *ar);
 



From kvalo at qca.qualcomm.com  Wed Oct 16 09:46:24 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 16:46:24 +0300
Subject: [PATCH v2 8/8] ath10k: fix FW crashes on heavy TX on 10.1.389 AP FW
In-Reply-To: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
Message-ID: <20131016134624.25095.63772.stgit@localhost6.localdomain6>

From: Michal Kazior <michal.kazior at tieto.com>

10.1.389 firmware has some differences in
calculation of number of outstanding HTT TX
completions. This led to FW crashes of 10.1.389
while main firmware branch was unnaffected.

The patch makes sure ath10k doesn't queue up more
MSDUs than it should.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/ce.c     |   11 +++++++++++
 drivers/net/wireless/ath/ath10k/htt_tx.c |   11 ++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index e46951b..d243f28 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -1050,6 +1050,17 @@ struct ath10k_ce_pipe *ath10k_ce_init(struct ath10k *ar,
 	u32 ctrl_addr = ath10k_ce_base_address(ce_id);
 	int ret;
 
+	/*
+	 * Make sure there's enough CE ringbuffer entries for HTT TX to avoid
+	 * additional TX locking checks.
+	 *
+	 * For the lack of a better place do the check here.
+	 */
+	BUILD_BUG_ON(TARGET_NUM_MSDU_DESC >
+		     (CE_HTT_H2T_MSG_SRC_NENTRIES - 1));
+	BUILD_BUG_ON(TARGET_10X_NUM_MSDU_DESC >
+		     (CE_HTT_H2T_MSG_SRC_NENTRIES - 1));
+
 	ret = ath10k_pci_wake(ar);
 	if (ret)
 		return NULL;
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index d9335e9..f1d36d2 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -85,16 +85,13 @@ void ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id)
 
 int ath10k_htt_tx_attach(struct ath10k_htt *htt)
 {
-	u8 pipe;
-
 	spin_lock_init(&htt->tx_lock);
 	init_waitqueue_head(&htt->empty_tx_wq);
 
-	/* At the beginning free queue number should hint us the maximum
-	 * queue length */
-	pipe = htt->ar->htc.endpoint[htt->eid].ul_pipe_id;
-	htt->max_num_pending_tx = ath10k_hif_get_free_queue_number(htt->ar,
-								   pipe);
+	if (test_bit(ATH10K_FW_FEATURE_WMI_10X, htt->ar->fw_features))
+		htt->max_num_pending_tx = TARGET_10X_NUM_MSDU_DESC;
+	else
+		htt->max_num_pending_tx = TARGET_NUM_MSDU_DESC;
 
 	ath10k_dbg(ATH10K_DBG_BOOT, "htt tx max num pending tx %d\n",
 		   htt->max_num_pending_tx);



From michal.kazior at tieto.com  Wed Oct 16 10:05:56 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 16 Oct 2013 07:05:56 -0700
Subject: [PATCH 0/7] ath10k: fixes 2013-10-15
In-Reply-To: <87bo2p74sp.fsf@kamboji.qca.qualcomm.com>
References: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
 <8761sybbye.fsf@kamboji.qca.qualcomm.com>
 <87bo2p74sp.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CA+BoTQ=wpEWF3sWavKSfKy4s6qW097amCt_VqbapZg-ECWOE=g@mail.gmail.com>

On 16 October 2013 05:56, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Kalle Valo <kvalo at qca.qualcomm.com> writes:
>
>> Michal Kazior <michal.kazior at tieto.com> writes:
>>
>>> This is a bunch of fixes I've had queued up for
>>> some time now. I was reluctant to send them
>>> without some additional checks and because some of
>>> the fixes are not ideal. At least we can get a
>>> discussion going if anything raises any serious
>>> concern.
>>>
>>>
>>> Michal Kazior (7):
>>>   ath10k: prevent starting monitor without a vdev
>>>   ath10k: add sanity checks for monitor management
>>>   ath10k: fix endianess in prints
>>>   ath10k: fix NSS reporting in RX
>>>   ath10k: fix NULL deref upon early FW crash
>>>   ath10k: fix device initialization routine
>>>   ath10k: fix FW crashes on heavy TX on 10.1.389 AP FW
>>
>> I get few long line warnings:
>>
>> drivers/net/wireless/ath/ath10k/pci.c:1842: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/pci.c:1844: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/pci.c:1847: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/pci.c:1848: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/pci.c:1856: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/pci.c:1875: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/pci.c:1877: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/pci.c:1883: WARNING: line over 80 characters
>> drivers/net/wireless/ath/ath10k/mac.c:2284: WARNING: line over 80 characters
>
> Michal, if it's ok for you I'll submit v2 of this patchset. I'll fix the
> long line warnings and also I do small cleanup to the warm reset code.

I am totally okay with this. Thank you for your trouble.


Mica?


From kvalo at qca.qualcomm.com  Wed Oct 16 10:18:15 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 17:18:15 +0300
Subject: [PATCH 0/7] ath10k: fixes 2013-10-15
In-Reply-To: <CA+BoTQ=wpEWF3sWavKSfKy4s6qW097amCt_VqbapZg-ECWOE=g@mail.gmail.com>
 (Michal Kazior's message of "Wed, 16 Oct 2013 07:05:56 -0700")
References: <1381858196-17000-1-git-send-email-michal.kazior@tieto.com>
 <8761sybbye.fsf@kamboji.qca.qualcomm.com>
 <87bo2p74sp.fsf@kamboji.qca.qualcomm.com>
 <CA+BoTQ=wpEWF3sWavKSfKy4s6qW097amCt_VqbapZg-ECWOE=g@mail.gmail.com>
Message-ID: <8738o17108.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> On 16 October 2013 05:56, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
>> Kalle Valo <kvalo at qca.qualcomm.com> writes:
>>
>> Michal, if it's ok for you I'll submit v2 of this patchset. I'll fix the
>> long line warnings and also I do small cleanup to the warm reset code.
>
> I am totally okay with this. Thank you for your trouble.

As you can see, I changed the warm reset code quite a lot. If you have
time, please review that carefully.

-- 
Kalle Valo


From michal.kazior at tieto.com  Wed Oct 16 11:38:43 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 16 Oct 2013 08:38:43 -0700
Subject: [PATCH v2 6/8] ath10k: implement ath10k_pci_soc_read/write32()
In-Reply-To: <20131016134611.25095.80204.stgit@localhost6.localdomain6>
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
 <20131016134611.25095.80204.stgit@localhost6.localdomain6>
Message-ID: <CA+BoTQmP14xuXP=D4mEsJiWOXvtg0iJ4=BmUb=89QgA_AX5edA@mail.gmail.com>

On 16 October 2013 06:46, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> To make it easier to access SOC registers. No functional
> changes.
>
> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
> ---
>  drivers/net/wireless/ath/ath10k/pci.c |    3 +--
>  drivers/net/wireless/ath/ath10k/pci.h |   10 ++++++++++
>  2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
> index d09f8a2..5c78383 100644
> --- a/drivers/net/wireless/ath/ath10k/pci.c
> +++ b/drivers/net/wireless/ath/ath10k/pci.c
> @@ -2454,8 +2454,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
>                 return ret;
>         }
>
> -       chip_id = ath10k_pci_read32(ar,
> -                                   RTC_SOC_BASE_ADDRESS + SOC_CHIP_ID_ADDRESS);
> +       chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
>
>         ath10k_do_pci_sleep(ar);
>
> diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h
> index 52fb7b9..a304c33 100644
> --- a/drivers/net/wireless/ath/ath10k/pci.h
> +++ b/drivers/net/wireless/ath/ath10k/pci.h
> @@ -318,6 +318,16 @@ static inline u32 ath10k_pci_read32(struct ath10k *ar, u32 offset)
>         return ioread32(ar_pci->mem + offset);
>  }
>
> +static inline u32 ath10k_pci_soc_read32(struct ath10k *ar, u32 addr)
> +{
> +       return ath10k_pci_read32(ar, RTC_SOC_BASE_ADDRESS + addr);
> +}
> +
> +static inline void ath10k_pci_soc_write32(struct ath10k *ar, u32 addr, u32 val)
> +{
> +       ath10k_pci_write32(ar, RTC_SOC_BASE_ADDRESS + addr, val);
> +}
> +

I'm not entirely sure about this. There are a couple of soc address
groups (RTC_SOC, RTC_WMAC, SOC_PCIE, SOC_CORE, ..).

I'd rather use just raw ioread/iowrite than have all those wrappers. I
think the reason for having ath10k_pci_{read,write}32 was the HW v1
workaround. Do we really need to keep it?


Micha?


From michal.kazior at tieto.com  Wed Oct 16 11:44:32 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 16 Oct 2013 08:44:32 -0700
Subject: [PATCH v2 7/8] ath10k: fix device initialization routine
In-Reply-To: <20131016134617.25095.10581.stgit@localhost6.localdomain6>
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
 <20131016134617.25095.10581.stgit@localhost6.localdomain6>
Message-ID: <CA+BoTQkqkuf-=a4giyJHeYdXZ2T3deU7nmuQOxpFcKSzWjGb3Q@mail.gmail.com>

On 16 October 2013 06:46, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> From: Michal Kazior <michal.kazior at tieto.com>
>
> Hardware revision 2 does not support cold reset
> correctly. As such it would sometimes lead to host
> machine freeze or data bus errors.
>
> The patch introduces warm reset function which is
> used instead of the cold reset one. It also moves
> the reset before interrupts are being set up to
> prevent any kind of spurious interrupts from being
> handled.
>
> kvalo: use ath10k_pci_write32() style wrappers, fix long
> lines
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
> ---

[...]

> @@ -1825,16 +1824,78 @@ static void ath10k_pci_fw_interrupt_handler(struct ath10k *ar)
>         ath10k_pci_sleep(ar);
>  }
>
> -static int ath10k_pci_hif_power_up(struct ath10k *ar)
> +static int ath10k_pci_warm_reset(struct ath10k *ar)
>  {
>         struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
>         int ret;
> +       u32 val;
>
> -       ret = ath10k_pci_start_intr(ar);
> -       if (ret) {
> -               ath10k_err("could not start interrupt handling (%d)\n", ret);
> -               goto err;
> -       }
> +       ath10k_dbg(ATH10K_DBG_BOOT, "performing warm chip reset\n");
> +
> +       ret = ath10k_do_pci_wake(ar);
> +       if (ret)
> +               return ret;
> +
> +       ath10k_dbg(ATH10K_DBG_BOOT,
> +                  "pci intr cause 0x%08x cpu intr 0x%08x (before)\n",
> +                  ath10k_pci_core_read32(ar, PCIE_INTR_CAUSE_ADDRESS),
> +                  ath10k_pci_core_read32(ar, CPU_INTR_ADDRESS));
> +
> +       /* disable pending irqs */
> +       ath10k_pci_core_write32(ar, PCIE_INTR_ENABLE_ADDRESS, 0);
> +       ath10k_pci_core_write32(ar, PCIE_INTR_CLR_ADDRESS, ~0);

These use SOC_CORE_BASE_ADDRESS as the suffix, not the RTC_SOC_BASE_ADDRESS.


> +       ath10k_dbg(ATH10K_DBG_BOOT,
> +                  "pci intr cause 0x%08x cpu intr 0x%08x (after)\n",
> +                  ath10k_pci_core_read32(ar, PCIE_INTR_CAUSE_ADDRESS),
> +                  ath10k_pci_core_read32(ar, CPU_INTR_ADDRESS));

Ditto. These are in SOC_CORE_BASE_ADDRESS group.


Micha?


From kvalo at qca.qualcomm.com  Wed Oct 16 11:55:50 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 18:55:50 +0300
Subject: [PATCH v2 6/8] ath10k: implement ath10k_pci_soc_read/write32()
In-Reply-To: <CA+BoTQmP14xuXP=D4mEsJiWOXvtg0iJ4=BmUb=89QgA_AX5edA@mail.gmail.com>
 (Michal Kazior's message of "Wed, 16 Oct 2013 08:38:43 -0700")
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
 <20131016134611.25095.80204.stgit@localhost6.localdomain6>
 <CA+BoTQmP14xuXP=D4mEsJiWOXvtg0iJ4=BmUb=89QgA_AX5edA@mail.gmail.com>
Message-ID: <87txgh5hx5.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> On 16 October 2013 06:46, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
>> To make it easier to access SOC registers. No functional
>> changes.
>>
>> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
>> ---
>>  drivers/net/wireless/ath/ath10k/pci.c |    3 +--
>>  drivers/net/wireless/ath/ath10k/pci.h |   10 ++++++++++
>>  2 files changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
>> index d09f8a2..5c78383 100644
>> --- a/drivers/net/wireless/ath/ath10k/pci.c
>> +++ b/drivers/net/wireless/ath/ath10k/pci.c
>> @@ -2454,8 +2454,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
>>                 return ret;
>>         }
>>
>> -       chip_id = ath10k_pci_read32(ar,
>> -                                   RTC_SOC_BASE_ADDRESS + SOC_CHIP_ID_ADDRESS);
>> +       chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
>>
>>         ath10k_do_pci_sleep(ar);
>>
>> diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h
>> index 52fb7b9..a304c33 100644
>> --- a/drivers/net/wireless/ath/ath10k/pci.h
>> +++ b/drivers/net/wireless/ath/ath10k/pci.h
>> @@ -318,6 +318,16 @@ static inline u32 ath10k_pci_read32(struct ath10k *ar, u32 offset)
>>         return ioread32(ar_pci->mem + offset);
>>  }
>>
>> +static inline u32 ath10k_pci_soc_read32(struct ath10k *ar, u32 addr)
>> +{
>> +       return ath10k_pci_read32(ar, RTC_SOC_BASE_ADDRESS + addr);
>> +}
>> +
>> +static inline void ath10k_pci_soc_write32(struct ath10k *ar, u32 addr, u32 val)
>> +{
>> +       ath10k_pci_write32(ar, RTC_SOC_BASE_ADDRESS + addr, val);
>> +}
>> +
>
> I'm not entirely sure about this. There are a couple of soc address
> groups (RTC_SOC, RTC_WMAC, SOC_PCIE, SOC_CORE, ..).

And then we can have different functions for each group.

> I'd rather use just raw ioread/iowrite than have all those wrappers.

Well, I again would prefer to have clean interfaces instead of doing
address arithmetic in every call :)

> I think the reason for having ath10k_pci_{read,write}32 was the HW v1
> workaround.

No, it was also to make the code simple.

> Do we really need to keep it?

In my opinion yes. What is the negative side of keeping them? Why don't
you like these wrappers?

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Wed Oct 16 11:57:20 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 18:57:20 +0300
Subject: [PATCH v2 7/8] ath10k: fix device initialization routine
In-Reply-To: <CA+BoTQkqkuf-=a4giyJHeYdXZ2T3deU7nmuQOxpFcKSzWjGb3Q@mail.gmail.com>
 (Michal Kazior's message of "Wed, 16 Oct 2013 08:44:32 -0700")
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
 <20131016134617.25095.10581.stgit@localhost6.localdomain6>
 <CA+BoTQkqkuf-=a4giyJHeYdXZ2T3deU7nmuQOxpFcKSzWjGb3Q@mail.gmail.com>
Message-ID: <87ppr55hun.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

>> +       /* disable pending irqs */
>> +       ath10k_pci_core_write32(ar, PCIE_INTR_ENABLE_ADDRESS, 0);
>> +       ath10k_pci_core_write32(ar, PCIE_INTR_CLR_ADDRESS, ~0);
>
> These use SOC_CORE_BASE_ADDRESS as the suffix, not the RTC_SOC_BASE_ADDRESS.

But I am using SOC_CORE_BASE_ADDRESS, right?

static inline u32 ath10k_pci_core_read32(struct ath10k *ar, u32 addr)
{
	return ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS + addr);
}

static inline void ath10k_pci_core_write32(struct ath10k *ar, u32 addr, u32 val)
{
	ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS + addr, val);
}

-- 
Kalle Valo


From michal.kazior at tieto.com  Wed Oct 16 12:01:52 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 16 Oct 2013 09:01:52 -0700
Subject: [PATCH v2 7/8] ath10k: fix device initialization routine
In-Reply-To: <87ppr55hun.fsf@kamboji.qca.qualcomm.com>
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
 <20131016134617.25095.10581.stgit@localhost6.localdomain6>
 <CA+BoTQkqkuf-=a4giyJHeYdXZ2T3deU7nmuQOxpFcKSzWjGb3Q@mail.gmail.com>
 <87ppr55hun.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CA+BoTQ=9cEwB7PY8VMGv1SmEPsH6WGmDEBgujmo9G=Cby82uyg@mail.gmail.com>

On 16 October 2013 08:57, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Michal Kazior <michal.kazior at tieto.com> writes:
>
>>> +       /* disable pending irqs */
>>> +       ath10k_pci_core_write32(ar, PCIE_INTR_ENABLE_ADDRESS, 0);
>>> +       ath10k_pci_core_write32(ar, PCIE_INTR_CLR_ADDRESS, ~0);
>>
>> These use SOC_CORE_BASE_ADDRESS as the suffix, not the RTC_SOC_BASE_ADDRESS.
>
> But I am using SOC_CORE_BASE_ADDRESS, right?

Ah, right. Sorry. My eyesight failed me :) Those function names seem a
little confusing (_core_ for SOC_CORE and _soc_ for RTC_SOC)


Micha?


From greearb at candelatech.com  Wed Oct 16 12:00:30 2013
From: greearb at candelatech.com (Ben Greear)
Date: Wed, 16 Oct 2013 09:00:30 -0700
Subject: Fwd: ath10k related kernel crash in wireless-testing (3.12.0-rc3-wl+)
In-Reply-To: <52588F0C.3000009@candelatech.com>
References: <52588F0C.3000009@candelatech.com>
Message-ID: <525EB81E.5060305@candelatech.com>

I sent this to the wrong list the first time.

Do you know if this is already addressed?  If not, I'll see if I can
find a fix.

Thanks,
Ben


-------- Original Message --------
Subject: ath10k related kernel crash in wireless-testing (3.12.0-rc3-wl+)
Date: Fri, 11 Oct 2013 16:51:40 -0700
From: Ben Greear <greearb at candelatech.com>
Organization: Candela Technologies
To: ath9k-devel at lists.ath9k.org <ath9k-devel at venema.h4ckr.net>
CC: linux-wireless at vger.kernel.org <linux-wireless at vger.kernel.org>

My kernel is lightly patched, no patches to ath10k.

Looks like something is not checking a NULL pointer, but I did
not dig into the code.  I'm not actually running any traffic on
the ath10k device.


ath10k: Completion buffers are full
ath10k: Completion buffers are full
ath10k: MSI-X interrupt handling (8 intrs)
e1000e: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
ath10k: UART prints disabled
ath10k: firmware 1.0.0.636 booted
ath10k: htt target version 2.1

...

ath10k: Completion buffers are full
ath10k: Completion buffers are full
IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
8021q: adding VLAN 0 to HW filter on device eth1
IPv6: ADDRCONF(NETDEV_UP): sta0: link is not ready
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
IPv6: ADDRCONF(NETDEV_UP): sta0: link is not ready
IPv6: ADDRCONF(NETDEV_UP): sta0: link is not ready
ath10k: MSI-X interrupt handling (8 intrs)
ath10k: Unable to wakeup target
ath10k: target took longer 5000 us to wake up (awake count 1)
ath10k: Failed to get pcie state addr: -16
ath10k: early firmware event indicated
BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
IP: [<ffffffffa06ae46c>] ath10k_ce_completed_send_next+0x47/0x122 [ath10k_pci]
PGD d1f5b067 PUD d9c1c067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: rpcsec_gss_krb5 auth_rpcgss oid_registry nfsv4 nfs fscache nf_nat_ipv4 nf_nat 8021q ga]
CPU: 1 PID: 17 Comm: ksoftirqd/1 Tainted: G         C   3.12.0-rc3-wl+ #10
Hardware name: To be filled by O.E.M. To be filled by O.E.M./HURONRIVER, BIOS 4.6.5 05/02/2012
task: ffff8802160fdd80 ti: ffff880216306000 task.ti: ffff880216306000
RIP: 0010:[<ffffffffa06ae46c>]  [<ffffffffa06ae46c>] ath10k_ce_completed_send_next+0x47/0x122 [ath10k_pci]
RSP: 0018:ffff880216307c98  EFLAGS: 00010246
RAX: 0000000000005b5b RBX: ffff88020bfbfc50 RCX: 0000000000057400
RDX: ffff88020c7e5f20 RSI: ffff880216307d10 RDI: ffff88020bfbfc48
RBP: ffff880216307cf8 R08: ffff880216307d1c R09: ffff8800d967d438
R10: ffff88021fa92ff0 R11: 0000000000000001 R12: ffff880216307d10
R13: ffff880216307d24 R14: ffff880216307d20 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff88021fa80000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000004 CR3: 00000000d1c76000 CR4: 00000000000407e0
Stack:
  ffff880216307cc8 ffff8802160fdde8 ffff88021fa92ff0 ffff880216307d1c
  ffff88020bfbfc48 ffff88021fa92ff0 ffff880216307d08 ffff88020c7e5f20
  ffff88020bfbf800 0000000000000000 ffff88020bfbfc48 0000000000057430
Call Trace:
  [<ffffffffa06ab568>] ath10k_pci_bmi_send_done+0x1d/0x32 [ath10k_pci]
  [<ffffffff810a4915>] ? local_bh_enable_ip+0x9/0xb
  [<ffffffff8158e801>] ? _raw_spin_unlock_bh+0x1f/0x21
  [<ffffffffa06ae357>] ath10k_ce_per_engine_service+0xab/0xea [ath10k_pci]
  [<ffffffffa06ab3b4>] ath10k_pci_ce_tasklet+0x15/0x17 [ath10k_pci]
  [<ffffffff810a3e3e>] tasklet_action+0x78/0xc6
  [<ffffffff810a463c>] __do_softirq+0xc4/0x19d
  [<ffffffff810a4738>] run_ksoftirqd+0x23/0x42
  [<ffffffff810c0ea3>] smpboot_thread_fn+0x21e/0x223
  [<ffffffff810c0c85>] ? smpboot_create_threads+0x61/0x61
  [<ffffffff810ba54d>] kthread+0xb0/0xb8
  [<ffffffff810ba49d>] ? kthread_freezable_should_stop+0x5b/0x5b
  [<ffffffff815939cc>] ret_from_fork+0x7c/0xb0
  [<ffffffff810ba49d>] ? kthread_freezable_should_stop+0x5b/0x5b
Code: 38 4c 89 45 b8 48 8b 07 48 8b 80 a0 01 00 00 48 05 48 04 00 00 48 89 c7 48 89 45 c0 e8 b6 07 ee e0
RIP  [<ffffffffa06ae46c>] ath10k_ce_completed_send_next+0x47/0x122 [ath10k_pci]
  RSP <ffff880216307c98>
CR2: 0000000000000004
---[ end trace 6b10a0163cca0cc3 ]---

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com





From kvalo at qca.qualcomm.com  Wed Oct 16 12:23:49 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 16 Oct 2013 19:23:49 +0300
Subject: Fwd: ath10k related kernel crash in wireless-testing
 (3.12.0-rc3-wl+)
In-Reply-To: <525EB81E.5060305@candelatech.com> (Ben Greear's message of "Wed, 
 16 Oct 2013 09:00:30 -0700")
References: <52588F0C.3000009@candelatech.com>
 <525EB81E.5060305@candelatech.com>
Message-ID: <87li1t5gmi.fsf@kamboji.qca.qualcomm.com>

Ben Greear <greearb at candelatech.com> writes:

> I sent this to the wrong list the first time.
>
> Do you know if this is already addressed?  If not, I'll see if I can
> find a fix.

[...]

> ath10k: MSI-X interrupt handling (8 intrs)
> ath10k: Unable to wakeup target
> ath10k: target took longer 5000 us to wake up (awake count 1)
> ath10k: Failed to get pcie state addr: -16
> ath10k: early firmware event indicated
> BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
> IP: [<ffffffffa06ae46c>] ath10k_ce_completed_send_next+0x47/0x122
> [ath10k_pci]

I think there are two bugs here:

1) Cold reset doesn't always work, Michal has a patch for that. That's
   why the wakeup fails:

http://lists.infradead.org/pipermail/ath10k/2013-October/000638.html

2) We enable interrupts too early and if wakeup fails and we get a
   spurious interrupt ath10k crashes. We don't have a fix for this yet.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Thu Oct 17 01:33:07 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 17 Oct 2013 08:33:07 +0300
Subject: [PATCH v2 7/8] ath10k: fix device initialization routine
In-Reply-To: <CA+BoTQ=9cEwB7PY8VMGv1SmEPsH6WGmDEBgujmo9G=Cby82uyg@mail.gmail.com>
 (Michal Kazior's message of "Wed, 16 Oct 2013 09:01:52 -0700")
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
 <20131016134617.25095.10581.stgit@localhost6.localdomain6>
 <CA+BoTQkqkuf-=a4giyJHeYdXZ2T3deU7nmuQOxpFcKSzWjGb3Q@mail.gmail.com>
 <87ppr55hun.fsf@kamboji.qca.qualcomm.com>
 <CA+BoTQ=9cEwB7PY8VMGv1SmEPsH6WGmDEBgujmo9G=Cby82uyg@mail.gmail.com>
Message-ID: <87zjq84g30.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> On 16 October 2013 08:57, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
>> Michal Kazior <michal.kazior at tieto.com> writes:
>>
>>>> +       /* disable pending irqs */
>>>> +       ath10k_pci_core_write32(ar, PCIE_INTR_ENABLE_ADDRESS, 0);
>>>> +       ath10k_pci_core_write32(ar, PCIE_INTR_CLR_ADDRESS, ~0);
>>>
>>> These use SOC_CORE_BASE_ADDRESS as the suffix, not the RTC_SOC_BASE_ADDRESS.
>>
>> But I am using SOC_CORE_BASE_ADDRESS, right?
>
> Ah, right. Sorry. My eyesight failed me :) Those function names seem a
> little confusing (_core_ for SOC_CORE and _soc_ for RTC_SOC)

Yeah, I agree. I didn't research what RTC_SOC stands for, I just assumed
it contains registers for controlling the whole SOC state. That's why I
used "_soc_" here. And CORE registers control just one part of SOC.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Thu Oct 17 04:36:15 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 17 Oct 2013 11:36:15 +0300
Subject: [PATCH] ath10k: add error handling to ath10k_pci_wait()
Message-ID: <20131017083615.31028.25088.stgit@localhost6.localdomain6>

ath10k_pci_wait() didn't notify any errors to callers, it
just printed a warning so add proper error handling.

Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/pci.c |   28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 1e9cfcc9..92759cd 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -525,15 +525,19 @@ static bool ath10k_pci_target_is_awake(struct ath10k *ar)
 	return (RTC_STATE_V_GET(val) == RTC_STATE_V_ON);
 }
 
-static void ath10k_pci_wait(struct ath10k *ar)
+static int ath10k_pci_wait(struct ath10k *ar)
 {
 	int n = 100;
 
 	while (n-- && !ath10k_pci_target_is_awake(ar))
 		msleep(10);
 
-	if (n < 0)
+	if (n < 0) {
 		ath10k_warn("Unable to wakeup target\n");
+		return -ETIMEDOUT;
+	}
+
+	return 0;
 }
 
 int ath10k_do_pci_wake(struct ath10k *ar)
@@ -2227,7 +2231,13 @@ static int ath10k_pci_start_intr_legacy(struct ath10k *ar)
 		  ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
 		  PCIE_SOC_WAKE_ADDRESS);
 
-	ath10k_pci_wait(ar);
+	ret = ath10k_pci_wait(ar);
+	if (ret) {
+		ath10k_warn("Failed to enable legacy interrupt, target did not wake up: %d\n",
+			    ret);
+		free_irq(ar_pci->pdev->irq, ar);
+		return ret;
+	}
 
 	/*
 	 * A potential race occurs here: The CORE_BASE write
@@ -2290,6 +2300,10 @@ static int ath10k_pci_start_intr(struct ath10k *ar)
 	}
 
 	ret = ath10k_pci_start_intr_legacy(ar);
+	if (ret) {
+		ath10k_warn("Failed to start legacy interrupts: %d\n", ret);
+		return ret;
+	}
 
 exit:
 	ar_pci->num_msi_intrs = num;
@@ -2315,13 +2329,19 @@ static int ath10k_pci_reset_target(struct ath10k *ar)
 {
 	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 	int wait_limit = 300; /* 3 sec */
+	int ret;
 
 	/* Wait for Target to finish initialization before we proceed. */
 	iowrite32(PCIE_SOC_WAKE_V_MASK,
 		  ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
 		  PCIE_SOC_WAKE_ADDRESS);
 
-	ath10k_pci_wait(ar);
+	ret = ath10k_pci_wait(ar);
+	if (ret) {
+		ath10k_warn("Failed to reset target, target did not wake up: %d\n",
+			    ret);
+		return ret;
+	}
 
 	while (wait_limit-- &&
 	       !(ioread32(ar_pci->mem + FW_INDICATOR_ADDRESS) &



From kvalo at qca.qualcomm.com  Thu Oct 17 04:43:13 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 17 Oct 2013 11:43:13 +0300
Subject: Fwd: ath10k related kernel crash in wireless-testing
 (3.12.0-rc3-wl+)
In-Reply-To: <87li1t5gmi.fsf@kamboji.qca.qualcomm.com> (Kalle Valo's message
 of "Wed, 16 Oct 2013 19:23:49 +0300")
References: <52588F0C.3000009@candelatech.com>
 <525EB81E.5060305@candelatech.com>
 <87li1t5gmi.fsf@kamboji.qca.qualcomm.com>
Message-ID: <87r4bk2spq.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo at qca.qualcomm.com> writes:

> Ben Greear <greearb at candelatech.com> writes:
>
>> I sent this to the wrong list the first time.
>>
>> Do you know if this is already addressed?  If not, I'll see if I can
>> find a fix.
>
> [...]
>
>> ath10k: MSI-X interrupt handling (8 intrs)
>> ath10k: Unable to wakeup target
>> ath10k: target took longer 5000 us to wake up (awake count 1)
>> ath10k: Failed to get pcie state addr: -16
>> ath10k: early firmware event indicated
>> BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
>> IP: [<ffffffffa06ae46c>] ath10k_ce_completed_send_next+0x47/0x122
>> [ath10k_pci]
>
> I think there are two bugs here:
>
> 1) Cold reset doesn't always work, Michal has a patch for that. That's
>    why the wakeup fails:
>
> http://lists.infradead.org/pipermail/ath10k/2013-October/000638.html
>
> 2) We enable interrupts too early and if wakeup fails and we get a
>    spurious interrupt ath10k crashes. We don't have a fix for this yet.

I tried to look how to enable interrupts only after everything is
properly initialised in ath10k, but didn't find any quick way to do
that. I guess one ugly way to workaround this race is to add a state
variable which is checked in the interrupt handler.

Does anyone else have any other ideas?

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Thu Oct 17 05:06:33 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 17 Oct 2013 12:06:33 +0300
Subject: Pull request: ath 20131017
Message-ID: <87mwm82rmu.fsf@kamboji.qca.qualcomm.com>

Hi John,

here's a pull request for ath6kl and ath10k. Notable changes:

Bartosz added support to ath10k for our 10.x AP firmware branch, which
gives us AP specific features and fixes. We still support the main
firmware branch as well just like before, ath10k detects runtime what
firmware is used. Unfortunately the firmware interface in 10.x branch is
somewhat different so there was quite a lot of changes in ath10k for
this.

Michal and Sujith did some performance improvements in ath10k. Vladimir
fixed a compiler warning and Fengguang removed an extra semicolon.

Please let me know if there are any problems.

Kalle

The following changes since commit 6e712d427cb0542afdd5220edb6e4f4f8a5b952d:

  ath10k: replenish HTT RX buffers in a tasklet (2013-09-26 17:22:54 +0300)

are available in the git repository at:

  git://github.com/kvalo/ath.git for-linville

for you to fetch changes up to 56b84287d14aa74823a9c290d0c5839d38365110:

  ath10k: add might_sleep() to ath10k_wmi_cmd_send() (2013-10-16 15:44:47 +0300)

----------------------------------------------------------------
Bartosz Markowski (18):
      ath10k: introduce dynamic WMI structures
      ath10k: add wmi_10x_<cmd/event> definitions
      ath10k: warn if give WMI command is not supported
      ath10k: implement WMI events handling frame for both firmwares
      ath10k: split ath10k_wmi_service_ready_event_rx
      ath10k: drop the fw versioning sanity check
      ath10k: implement host memory chunks
      ath10k: bring back the WMI path for mgmt frames
      ath10k: split wmi_cmd_init path
      ath10k: add TARGET values for 10.x firmware
      ath10k: introduce dynamic vdev parameters
      ath10k: introduce dynamic pdev parameters
      ath10k: handle FW API differences for scan structures
      ath10k: enable 10.x firmware branch support
      ath10k: extend the max_scan time
      ath10k: do not warn about unsupported vdev param
      ath10k: rename WMI_CMD_UNDEFINED
      ath10k: return better errno for unsupported pdev params

Fengguang Wu (1):
      ath10k: remove unneded semicolon from ath10k_core_fetch_firmware_api_n()

Kalle Valo (6):
      ath10k: rename board_data in struct ath10k
      ath10k: store separate pointers for firmware data
      ath10k: implement firmware IE container support
      ath10k: fix ath10k_debug_start() locking
      ath10k: fix ath10k_bss_assoc() to not sleep in atomic context
      ath10k: add might_sleep() to ath10k_wmi_cmd_send()

Marek Puzyniak (1):
      ath10k: make monitor vdev down before stoping it

Michal Kazior (12):
      ath10k: split tid calculation from tx function
      ath10k: split vdev_id calculation from tx function
      ath10k: remove ce_sendlist_send
      ath10k: remove num_sends_allowed
      ath10k: fix printf format string
      ath10k: fix possible memory leak in new FW loading
      ath10k: fix RX performance when using AP 10.X FW
      ath10k: use workqueue to set WEP TX key
      ath10k: fix add_interface failure handling
      ath10k: track vif list internally
      ath10k: fix scheduling while atomic config bug
      ath10k: remove unnecessary checks

Sujith Manoharan (1):
      ath10k: Fix bug in max. VHT A-MPDU size

Vladimir Murzin (1):
      ath6kl: fix compilation warning in ath6kl_htc_pipe_conn_service

 drivers/net/wireless/ath/ath10k/ce.c     |   35 +-
 drivers/net/wireless/ath/ath10k/ce.h     |   16 +-
 drivers/net/wireless/ath/ath10k/core.c   |  285 ++++++--
 drivers/net/wireless/ath/ath10k/core.h   |   47 +-
 drivers/net/wireless/ath/ath10k/debug.c  |   15 +-
 drivers/net/wireless/ath/ath10k/debug.h  |    5 +
 drivers/net/wireless/ath/ath10k/htt_tx.c |    4 +-
 drivers/net/wireless/ath/ath10k/hw.h     |   56 +-
 drivers/net/wireless/ath/ath10k/mac.c    |  512 ++++++++------
 drivers/net/wireless/ath/ath10k/mac.h    |    2 +
 drivers/net/wireless/ath/ath10k/pci.c    |   25 +-
 drivers/net/wireless/ath/ath10k/pci.h    |    3 -
 drivers/net/wireless/ath/ath10k/wmi.c    | 1087 ++++++++++++++++++++++++++++--
 drivers/net/wireless/ath/ath10k/wmi.h    |  968 +++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath6kl/htc.h    |    2 +-
 15 files changed, 2674 insertions(+), 388 deletions(-)


From michal.kazior at tieto.com  Thu Oct 17 10:24:07 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Thu, 17 Oct 2013 07:24:07 -0700
Subject: [PATCH] ath10k: add error handling to ath10k_pci_wait()
In-Reply-To: <20131017083615.31028.25088.stgit@localhost6.localdomain6>
References: <20131017083615.31028.25088.stgit@localhost6.localdomain6>
Message-ID: <CA+BoTQ=x+KJxXtcdMYKEGGjfF3oryTXgA2N+4OAa+6fcSAK4uw@mail.gmail.com>

On 17 October 2013 01:36, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> ath10k_pci_wait() didn't notify any errors to callers, it
> just printed a warning so add proper error handling.
>
> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
> ---
>  drivers/net/wireless/ath/ath10k/pci.c |   28 ++++++++++++++++++++++++----
>  1 file changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
> index 1e9cfcc9..92759cd 100644
> --- a/drivers/net/wireless/ath/ath10k/pci.c
> +++ b/drivers/net/wireless/ath/ath10k/pci.c
> @@ -525,15 +525,19 @@ static bool ath10k_pci_target_is_awake(struct ath10k *ar)
>         return (RTC_STATE_V_GET(val) == RTC_STATE_V_ON);
>  }
>
> -static void ath10k_pci_wait(struct ath10k *ar)
> +static int ath10k_pci_wait(struct ath10k *ar)
>  {
>         int n = 100;
>
>         while (n-- && !ath10k_pci_target_is_awake(ar))
>                 msleep(10);
>
> -       if (n < 0)
> +       if (n < 0) {
>                 ath10k_warn("Unable to wakeup target\n");
> +               return -ETIMEDOUT;
> +       }
> +
> +       return 0;
>  }
>
>  int ath10k_do_pci_wake(struct ath10k *ar)
> @@ -2227,7 +2231,13 @@ static int ath10k_pci_start_intr_legacy(struct ath10k *ar)
>                   ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
>                   PCIE_SOC_WAKE_ADDRESS);
>
> -       ath10k_pci_wait(ar);
> +       ret = ath10k_pci_wait(ar);
> +       if (ret) {
> +               ath10k_warn("Failed to enable legacy interrupt, target did not wake up: %d\n",
> +                           ret);
> +               free_irq(ar_pci->pdev->irq, ar);
> +               return ret;
> +       }

I think we could actually use ath10k_do_pci_wake/sleep() here (see
above iowrite). It does basically the same thing - sets the wake
register and waits until HW wakes up. I think ath10k_pci_wait() could
even go away.


>
>         /*
>          * A potential race occurs here: The CORE_BASE write
> @@ -2290,6 +2300,10 @@ static int ath10k_pci_start_intr(struct ath10k *ar)
>         }
>
>         ret = ath10k_pci_start_intr_legacy(ar);
> +       if (ret) {
> +               ath10k_warn("Failed to start legacy interrupts: %d\n", ret);
> +               return ret;
> +       }
>
>  exit:
>         ar_pci->num_msi_intrs = num;
> @@ -2315,13 +2329,19 @@ static int ath10k_pci_reset_target(struct ath10k *ar)
>  {
>         struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
>         int wait_limit = 300; /* 3 sec */
> +       int ret;
>
>         /* Wait for Target to finish initialization before we proceed. */
>         iowrite32(PCIE_SOC_WAKE_V_MASK,
>                   ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
>                   PCIE_SOC_WAKE_ADDRESS);
>
> -       ath10k_pci_wait(ar);
> +       ret = ath10k_pci_wait(ar);
> +       if (ret) {
> +               ath10k_warn("Failed to reset target, target did not wake up: %d\n",
> +                           ret);
> +               return ret;
> +       }

Ditto.


Micha?


From kvalo at qca.qualcomm.com  Thu Oct 17 10:27:22 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 17 Oct 2013 17:27:22 +0300
Subject: [PATCH] ath10k: add error handling to ath10k_pci_wait()
In-Reply-To: <CA+BoTQ=x+KJxXtcdMYKEGGjfF3oryTXgA2N+4OAa+6fcSAK4uw@mail.gmail.com>
 (Michal Kazior's message of "Thu, 17 Oct 2013 07:24:07 -0700")
References: <20131017083615.31028.25088.stgit@localhost6.localdomain6>
 <CA+BoTQ=x+KJxXtcdMYKEGGjfF3oryTXgA2N+4OAa+6fcSAK4uw@mail.gmail.com>
Message-ID: <87a9i82cs5.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> On 17 October 2013 01:36, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
>> ath10k_pci_wait() didn't notify any errors to callers, it
>> just printed a warning so add proper error handling.
>>
>> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>

[...]

>> @@ -2227,7 +2231,13 @@ static int ath10k_pci_start_intr_legacy(struct ath10k *ar)
>>                   ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
>>                   PCIE_SOC_WAKE_ADDRESS);
>>
>> -       ath10k_pci_wait(ar);
>> +       ret = ath10k_pci_wait(ar);
>> +       if (ret) {
>> +               ath10k_warn("Failed to enable legacy interrupt, target did not wake up: %d\n",
>> +                           ret);
>> +               free_irq(ar_pci->pdev->irq, ar);
>> +               return ret;
>> +       }
>
> I think we could actually use ath10k_do_pci_wake/sleep() here (see
> above iowrite). It does basically the same thing - sets the wake
> register and waits until HW wakes up. I think ath10k_pci_wait() could
> even go away.

That would be nice, I'll take a look. Thanks for the review.

-- 
Kalle Valo


From michal.kazior at tieto.com  Thu Oct 17 18:58:04 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Thu, 17 Oct 2013 15:58:04 -0700
Subject: Fwd: ath10k related kernel crash in wireless-testing
 (3.12.0-rc3-wl+)
In-Reply-To: <87r4bk2spq.fsf@kamboji.qca.qualcomm.com>
References: <52588F0C.3000009@candelatech.com>
 <525EB81E.5060305@candelatech.com>
 <87li1t5gmi.fsf@kamboji.qca.qualcomm.com>
 <87r4bk2spq.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CA+BoTQkbqvrcEQSkkHyYi0J1_Pa4yTC5Pk=CtKbd4_uOO3pBDg@mail.gmail.com>

On 17 October 2013 01:43, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Kalle Valo <kvalo at qca.qualcomm.com> writes:
>
>> Ben Greear <greearb at candelatech.com> writes:
>>
>>> I sent this to the wrong list the first time.
>>>
>>> Do you know if this is already addressed?  If not, I'll see if I can
>>> find a fix.
>>
>> [...]
>>
>>> ath10k: MSI-X interrupt handling (8 intrs)
>>> ath10k: Unable to wakeup target
>>> ath10k: target took longer 5000 us to wake up (awake count 1)
>>> ath10k: Failed to get pcie state addr: -16
>>> ath10k: early firmware event indicated
>>> BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
>>> IP: [<ffffffffa06ae46c>] ath10k_ce_completed_send_next+0x47/0x122
>>> [ath10k_pci]

Hmm.. if BMI handlers are set then must've been CE is allocated
earlier. I'm suspecting this is because ath10k_pci_ce_deinit() gets
called on ath10k_pci_power_up() failpath before interrupts are
disabled/hanlders unregistered.

In that case the solution is to fix the failpath in
ath10k_pci_power_up(). Disabling interrupts or moving
ath10k_pci_ce_deinit() before the very return statement in
ath10k_pci_hif_power_up()'s failpath should suffice. It should be safe
to call ath10k_pci_ce_deinit() without calling to
ath10k_pci_ce_init().


Micha?


From kvalo at qca.qualcomm.com  Fri Oct 18 02:29:27 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 18 Oct 2013 09:29:27 +0300
Subject: Fwd: ath10k related kernel crash in wireless-testing
 (3.12.0-rc3-wl+)
In-Reply-To: <CA+BoTQkbqvrcEQSkkHyYi0J1_Pa4yTC5Pk=CtKbd4_uOO3pBDg@mail.gmail.com>
 (Michal Kazior's message of "Thu, 17 Oct 2013 15:58:04 -0700")
References: <52588F0C.3000009@candelatech.com>
 <525EB81E.5060305@candelatech.com>
 <87li1t5gmi.fsf@kamboji.qca.qualcomm.com>
 <87r4bk2spq.fsf@kamboji.qca.qualcomm.com>
 <CA+BoTQkbqvrcEQSkkHyYi0J1_Pa4yTC5Pk=CtKbd4_uOO3pBDg@mail.gmail.com>
Message-ID: <87txgfytvc.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> On 17 October 2013 01:43, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
>> Kalle Valo <kvalo at qca.qualcomm.com> writes:
>>
>>> Ben Greear <greearb at candelatech.com> writes:
>>>
>>>> I sent this to the wrong list the first time.
>>>>
>>>> Do you know if this is already addressed?  If not, I'll see if I can
>>>> find a fix.
>>>
>>> [...]
>>>
>>>> ath10k: MSI-X interrupt handling (8 intrs)
>>>> ath10k: Unable to wakeup target
>>>> ath10k: target took longer 5000 us to wake up (awake count 1)
>>>> ath10k: Failed to get pcie state addr: -16
>>>> ath10k: early firmware event indicated
>>>> BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
>>>> IP: [<ffffffffa06ae46c>] ath10k_ce_completed_send_next+0x47/0x122
>>>> [ath10k_pci]
>
> Hmm.. if BMI handlers are set then must've been CE is allocated
> earlier. I'm suspecting this is because ath10k_pci_ce_deinit() gets
> called on ath10k_pci_power_up() failpath before interrupts are
> disabled/hanlders unregistered.
>
> In that case the solution is to fix the failpath in
> ath10k_pci_power_up(). Disabling interrupts or moving
> ath10k_pci_ce_deinit() before the very return statement in
> ath10k_pci_hif_power_up()'s failpath should suffice. It should be safe
> to call ath10k_pci_ce_deinit() without calling to
> ath10k_pci_ce_init().

But doesn't that will still leave the race of having interrupts enabled
but tasklet handler not properly initialised? I think the right fix is
to first initialise everything and only then enable interrupts.

-- 
Kalle Valo


From bartosz.markowski at tieto.com  Fri Oct 18 06:07:57 2013
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Fri, 18 Oct 2013 12:07:57 +0200
Subject: [PATCH 1/2] ath10k: remove P2P from supported interface modes for
 10.X FW
Message-ID: <1382090878-22216-1-git-send-email-bartosz.markowski@tieto.com>

FW 10.X does not support P2P, stop advertising it to mac80211.

Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   44 +++++++++++++++++++++++++++------
 1 file changed, 37 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 0b1cc51..af046c4 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3249,6 +3249,17 @@ static const struct ieee80211_iface_limit ath10k_if_limits[] = {
 	},
 };
 
+static const struct ieee80211_iface_limit ath10k_10x_if_limits[] = {
+	{
+	.max	= 8,
+	.types	= BIT(NL80211_IFTYPE_STATION)
+	},
+	{
+	.max	= 7,
+	.types	= BIT(NL80211_IFTYPE_AP)
+	},
+};
+
 static const struct ieee80211_iface_combination ath10k_if_comb = {
 	.limits = ath10k_if_limits,
 	.n_limits = ARRAY_SIZE(ath10k_if_limits),
@@ -3257,6 +3268,14 @@ static const struct ieee80211_iface_combination ath10k_if_comb = {
 	.beacon_int_infra_match = true,
 };
 
+static const struct ieee80211_iface_combination ath10k_10x_if_comb = {
+	.limits = ath10k_10x_if_limits,
+	.n_limits = ARRAY_SIZE(ath10k_10x_if_limits),
+	.max_interfaces = 8,
+	.num_different_channels = 1,
+	.beacon_int_infra_match = true,
+};
+
 static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
 {
 	struct ieee80211_sta_vht_cap vht_cap = {0};
@@ -3430,12 +3449,19 @@ int ath10k_mac_register(struct ath10k *ar)
 		ar->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = band;
 	}
 
-	ar->hw->wiphy->interface_modes =
-		BIT(NL80211_IFTYPE_STATION) |
-		BIT(NL80211_IFTYPE_ADHOC) |
-		BIT(NL80211_IFTYPE_AP) |
-		BIT(NL80211_IFTYPE_P2P_CLIENT) |
-		BIT(NL80211_IFTYPE_P2P_GO);
+	/* 10.x firmware does not support P2P */
+	if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features))
+		ar->hw->wiphy->interface_modes =
+			BIT(NL80211_IFTYPE_STATION) |
+			BIT(NL80211_IFTYPE_ADHOC) |
+			BIT(NL80211_IFTYPE_AP);
+	else
+		ar->hw->wiphy->interface_modes =
+			BIT(NL80211_IFTYPE_STATION) |
+			BIT(NL80211_IFTYPE_ADHOC) |
+			BIT(NL80211_IFTYPE_AP) |
+			BIT(NL80211_IFTYPE_P2P_CLIENT) |
+			BIT(NL80211_IFTYPE_P2P_GO);
 
 	ar->hw->flags = IEEE80211_HW_SIGNAL_DBM |
 			IEEE80211_HW_SUPPORTS_PS |
@@ -3478,7 +3504,11 @@ int ath10k_mac_register(struct ath10k *ar)
 	 */
 	ar->hw->queues = 4;
 
-	ar->hw->wiphy->iface_combinations = &ath10k_if_comb;
+	if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features))
+		ar->hw->wiphy->iface_combinations = &ath10k_10x_if_comb;
+	else
+		ar->hw->wiphy->iface_combinations = &ath10k_if_comb;
+
 	ar->hw->wiphy->n_iface_combinations = 1;
 
 	ar->hw->netdev_features = NETIF_F_HW_CSUM;
-- 
1.7.10



From bartosz.markowski at tieto.com  Fri Oct 18 06:07:58 2013
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Fri, 18 Oct 2013 12:07:58 +0200
Subject: [PATCH 2/2] ath10k: extend number of AP interfaces for 10.X firmware
In-Reply-To: <1382090878-22216-1-git-send-email-bartosz.markowski@tieto.com>
References: <1382090878-22216-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <1382090878-22216-2-git-send-email-bartosz.markowski@tieto.com>

This firmware can support up to 8 AP interfaces.

Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index af046c4..dc65dcd 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3255,7 +3255,7 @@ static const struct ieee80211_iface_limit ath10k_10x_if_limits[] = {
 	.types	= BIT(NL80211_IFTYPE_STATION)
 	},
 	{
-	.max	= 7,
+	.max	= 8,
 	.types	= BIT(NL80211_IFTYPE_AP)
 	},
 };
-- 
1.7.10



From michal.kazior at tieto.com  Fri Oct 18 11:41:16 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 18 Oct 2013 08:41:16 -0700
Subject: Fwd: ath10k related kernel crash in wireless-testing
 (3.12.0-rc3-wl+)
In-Reply-To: <87txgfytvc.fsf@kamboji.qca.qualcomm.com>
References: <52588F0C.3000009@candelatech.com>
 <525EB81E.5060305@candelatech.com>
 <87li1t5gmi.fsf@kamboji.qca.qualcomm.com>
 <87r4bk2spq.fsf@kamboji.qca.qualcomm.com>
 <CA+BoTQkbqvrcEQSkkHyYi0J1_Pa4yTC5Pk=CtKbd4_uOO3pBDg@mail.gmail.com>
 <87txgfytvc.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CA+BoTQmTMHkELHmO3hK6zcMyyy0OoatkKkxc+OdM_HnDQ2tCQQ@mail.gmail.com>

On 17 October 2013 23:29, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Michal Kazior <michal.kazior at tieto.com> writes:
>
>> On 17 October 2013 01:43, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
>>> Kalle Valo <kvalo at qca.qualcomm.com> writes:
>>>
>>>> Ben Greear <greearb at candelatech.com> writes:
>>>>
>>>>> I sent this to the wrong list the first time.
>>>>>
>>>>> Do you know if this is already addressed?  If not, I'll see if I can
>>>>> find a fix.
>>>>
>>>> [...]
>>>>
>>>>> ath10k: MSI-X interrupt handling (8 intrs)
>>>>> ath10k: Unable to wakeup target
>>>>> ath10k: target took longer 5000 us to wake up (awake count 1)
>>>>> ath10k: Failed to get pcie state addr: -16
>>>>> ath10k: early firmware event indicated
>>>>> BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
>>>>> IP: [<ffffffffa06ae46c>] ath10k_ce_completed_send_next+0x47/0x122
>>>>> [ath10k_pci]
>>
>> Hmm.. if BMI handlers are set then must've been CE is allocated
>> earlier. I'm suspecting this is because ath10k_pci_ce_deinit() gets
>> called on ath10k_pci_power_up() failpath before interrupts are
>> disabled/hanlders unregistered.
>>
>> In that case the solution is to fix the failpath in
>> ath10k_pci_power_up(). Disabling interrupts or moving
>> ath10k_pci_ce_deinit() before the very return statement in
>> ath10k_pci_hif_power_up()'s failpath should suffice. It should be safe
>> to call ath10k_pci_ce_deinit() without calling to
>> ath10k_pci_ce_init().
>
> But doesn't that will still leave the race of having interrupts enabled
> but tasklet handler not properly initialised? I think the right fix is
> to first initialise everything and only then enable interrupts.

Yes. It would still leave that case broken.


Micha?


From linville at tuxdriver.com  Fri Oct 18 13:57:33 2013
From: linville at tuxdriver.com (John W. Linville)
Date: Fri, 18 Oct 2013 13:57:33 -0400
Subject: Pull request: ath 20131017
In-Reply-To: <87mwm82rmu.fsf@kamboji.qca.qualcomm.com>
References: <87mwm82rmu.fsf@kamboji.qca.qualcomm.com>
Message-ID: <20131018175732.GD28130@tuxdriver.com>

On Thu, Oct 17, 2013 at 12:06:33PM +0300, Kalle Valo wrote:
> Hi John,
> 
> here's a pull request for ath6kl and ath10k. Notable changes:
> 
> Bartosz added support to ath10k for our 10.x AP firmware branch, which
> gives us AP specific features and fixes. We still support the main
> firmware branch as well just like before, ath10k detects runtime what
> firmware is used. Unfortunately the firmware interface in 10.x branch is
> somewhat different so there was quite a lot of changes in ath10k for
> this.
> 
> Michal and Sujith did some performance improvements in ath10k. Vladimir
> fixed a compiler warning and Fengguang removed an extra semicolon.
> 
> Please let me know if there are any problems.
> 
> Kalle
> 
> The following changes since commit 6e712d427cb0542afdd5220edb6e4f4f8a5b952d:
> 
>   ath10k: replenish HTT RX buffers in a tasklet (2013-09-26 17:22:54 +0300)
> 
> are available in the git repository at:
> 
>   git://github.com/kvalo/ath.git for-linville
> 
> for you to fetch changes up to 56b84287d14aa74823a9c290d0c5839d38365110:
> 
>   ath10k: add might_sleep() to ath10k_wmi_cmd_send() (2013-10-16 15:44:47 +0300)

Pulling now...

-- 
John W. Linville		Someday the world will need a hero, and you
linville at tuxdriver.com			might be all we have.  Be ready.


From kvalo at qca.qualcomm.com  Mon Oct 21 02:30:06 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 21 Oct 2013 09:30:06 +0300
Subject: [PATCH 1/2] ath10k: remove P2P from supported interface modes for
 10.X FW
In-Reply-To: <1382090878-22216-1-git-send-email-bartosz.markowski@tieto.com>
 (Bartosz Markowski's message of "Fri, 18 Oct 2013 12:07:57 +0200")
References: <1382090878-22216-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <87mwm3uoep.fsf@kamboji.qca.qualcomm.com>

Bartosz Markowski <bartosz.markowski at tieto.com> writes:

> FW 10.X does not support P2P, stop advertising it to mac80211.
>
> Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>

[...]

> @@ -3478,7 +3504,11 @@ int ath10k_mac_register(struct ath10k *ar)
>  	 */
>  	ar->hw->queues = 4;
>  
> -	ar->hw->wiphy->iface_combinations = &ath10k_if_comb;
> +	if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features))
> +		ar->hw->wiphy->iface_combinations = &ath10k_10x_if_comb;
> +	else
> +		ar->hw->wiphy->iface_combinations = &ath10k_if_comb;

I think it would be better to have a separate feature flag for this,
like NO_P2P or something like that. Just in case we want to disable P2P
in other firmware branches.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Mon Oct 21 02:31:08 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 21 Oct 2013 09:31:08 +0300
Subject: [PATCH 2/2] ath10k: extend number of AP interfaces for 10.X
 firmware
In-Reply-To: <1382090878-22216-2-git-send-email-bartosz.markowski@tieto.com>
 (Bartosz Markowski's message of "Fri, 18 Oct 2013 12:07:58 +0200")
References: <1382090878-22216-1-git-send-email-bartosz.markowski@tieto.com>
 <1382090878-22216-2-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <87iowruocz.fsf@kamboji.qca.qualcomm.com>

Bartosz Markowski <bartosz.markowski at tieto.com> writes:

> This firmware can support up to 8 AP interfaces.
>
> Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
> ---
>  drivers/net/wireless/ath/ath10k/mac.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
> index af046c4..dc65dcd 100644
> --- a/drivers/net/wireless/ath/ath10k/mac.c
> +++ b/drivers/net/wireless/ath/ath10k/mac.c
> @@ -3255,7 +3255,7 @@ static const struct ieee80211_iface_limit ath10k_10x_if_limits[] = {
>  	.types	= BIT(NL80211_IFTYPE_STATION)
>  	},
>  	{
> -	.max	= 7,
> +	.max	= 8,
>  	.types	= BIT(NL80211_IFTYPE_AP)
>  	},
>  };

Why only with 10.x firmware branch? Doesn't the main branch support 8
interfaces?

-- 
Kalle Valo


From bartosz.markowski at tieto.com  Mon Oct 21 02:51:47 2013
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Mon, 21 Oct 2013 08:51:47 +0200
Subject: [PATCH 2/2] ath10k: extend number of AP interfaces for 10.X
 firmware
In-Reply-To: <87iowruocz.fsf@kamboji.qca.qualcomm.com>
References: <1382090878-22216-1-git-send-email-bartosz.markowski@tieto.com>
 <1382090878-22216-2-git-send-email-bartosz.markowski@tieto.com>
 <87iowruocz.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CACKGw+EKg_5FQMvGPHxpvgt9wukyU5HD1jx++WkyYNLA3bBFSg@mail.gmail.com>

On 21 October 2013 08:31, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Bartosz Markowski <bartosz.markowski at tieto.com> writes:
>
>> This firmware can support up to 8 AP interfaces.
>>
>> Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
>> ---
>>  drivers/net/wireless/ath/ath10k/mac.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
>> index af046c4..dc65dcd 100644
>> --- a/drivers/net/wireless/ath/ath10k/mac.c
>> +++ b/drivers/net/wireless/ath/ath10k/mac.c
>> @@ -3255,7 +3255,7 @@ static const struct ieee80211_iface_limit ath10k_10x_if_limits[] = {
>>       .types  = BIT(NL80211_IFTYPE_STATION)
>>       },
>>       {
>> -     .max    = 7,
>> +     .max    = 8,
>>       .types  = BIT(NL80211_IFTYPE_AP)
>>       },
>>  };
>
> Why only with 10.x firmware branch? Doesn't the main branch support 8
> interfaces?

With .636 there's a firmware crash when we try to create interface 8 (ap mode).

-- 
Bartosz


From bartosz.markowski at tieto.com  Mon Oct 21 02:52:54 2013
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Mon, 21 Oct 2013 08:52:54 +0200
Subject: [PATCH 1/2] ath10k: remove P2P from supported interface modes for
 10.X FW
In-Reply-To: <87mwm3uoep.fsf@kamboji.qca.qualcomm.com>
References: <1382090878-22216-1-git-send-email-bartosz.markowski@tieto.com>
 <87mwm3uoep.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CACKGw+GgYwu-oQ12LjPm3FLKQ5PDG+KUVgoEM=KGH8q+SWvmBQ@mail.gmail.com>

On 21 October 2013 08:30, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Bartosz Markowski <bartosz.markowski at tieto.com> writes:
>
>> FW 10.X does not support P2P, stop advertising it to mac80211.
>>
>> Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
>
> [...]
>
>> @@ -3478,7 +3504,11 @@ int ath10k_mac_register(struct ath10k *ar)
>>        */
>>       ar->hw->queues = 4;
>>
>> -     ar->hw->wiphy->iface_combinations = &ath10k_if_comb;
>> +     if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features))
>> +             ar->hw->wiphy->iface_combinations = &ath10k_10x_if_comb;
>> +     else
>> +             ar->hw->wiphy->iface_combinations = &ath10k_if_comb;
>
> I think it would be better to have a separate feature flag for this,
> like NO_P2P or something like that. Just in case we want to disable P2P
> in other firmware branches.

Make sense. I will change this.


-- 
Bartosz


From kvalo at qca.qualcomm.com  Mon Oct 21 10:00:32 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 21 Oct 2013 17:00:32 +0300
Subject: Fwd: ath10k related kernel crash in wireless-testing
 (3.12.0-rc3-wl+)
In-Reply-To: <87li1t5gmi.fsf@kamboji.qca.qualcomm.com> (Kalle Valo's message
 of "Wed, 16 Oct 2013 19:23:49 +0300")
References: <52588F0C.3000009@candelatech.com>
 <525EB81E.5060305@candelatech.com>
 <87li1t5gmi.fsf@kamboji.qca.qualcomm.com>
Message-ID: <87fvruu3jz.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo at qca.qualcomm.com> writes:

> Ben Greear <greearb at candelatech.com> writes:
>
>> I sent this to the wrong list the first time.
>>
>> Do you know if this is already addressed?  If not, I'll see if I can
>> find a fix.
>
> [...]
>
>> ath10k: MSI-X interrupt handling (8 intrs)
>> ath10k: Unable to wakeup target
>> ath10k: target took longer 5000 us to wake up (awake count 1)
>> ath10k: Failed to get pcie state addr: -16
>> ath10k: early firmware event indicated
>> BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
>> IP: [<ffffffffa06ae46c>] ath10k_ce_completed_send_next+0x47/0x122
>> [ath10k_pci]
>
> I think there are two bugs here:
>
> 1) Cold reset doesn't always work, Michal has a patch for that. That's
>    why the wakeup fails:
>
> http://lists.infradead.org/pipermail/ath10k/2013-October/000638.html
>
> 2) We enable interrupts too early and if wakeup fails and we get a
>    spurious interrupt ath10k crashes. We don't have a fix for this yet.

I was able to reproduce your crash and it seems that my patch "ath10k:
add error handling to ath10k_pci_wait()" fixes the crash. But it's not
an ultimate solution, it's just bandaid for the issue:

[ 3200.447601] ath10k: MSI-X didn't succeed (1), trying MSI
[ 3200.447898] ath10k_pci 0000:02:00.0: irq 49 for MSI/MSI-X
[ 3200.449101] ath10k: MSI interrupt handling
[ 3201.620679] ath10k: Unable to wakeup target
[ 3201.620754] ath10k: Failed to reset target, target did not wake up: -110
[ 3201.621111] ath10k: early firmware event indicated
[ 3201.621624] ath10k: could not start pci hif (-110)
[ 3201.621691] ath10k: could not probe fw (-110)
[ 3201.621750] ath10k: could not register driver core (-110)

We are working on fixing the wakeup issue, doing just warm reset helps
but there are other problems with that. Need to investigate more.

And we need to fix the interrupt race properly at some point, I added a
todo entry for this:

http://wireless.kernel.org/en/users/Drivers/ath10k/todo

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Mon Oct 21 10:15:27 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 21 Oct 2013 17:15:27 +0300
Subject: [PATCH v2 0/8] ath10k: fixes 2013-10-15
In-Reply-To: <20131016134503.25095.8044.stgit@localhost6.localdomain6> (Kalle
 Valo's message of "Wed, 16 Oct 2013 16:45:35 +0300")
References: <20131016134503.25095.8044.stgit@localhost6.localdomain6>
Message-ID: <8738nuu2v4.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo at qca.qualcomm.com> writes:

> This is Michal's patchset which he said:
>
>   This is a bunch of fixes I've had queued up for
>   some time now. I was reluctant to send them without some additional checks
>   and because some of the fixes are not ideal. At least we can get a discussion
>   going if anything raises any serious concern.
>
> For v2 I added one patch myself, modified "ath10k: fix device initialization
> routine" to use ath10k_pci_write32() style of wrappers and fixed long line warnings
> from checkpatch.
>
> ---
>
> Kalle Valo (1):
>       ath10k: implement ath10k_pci_soc_read/write32()
>
> Michal Kazior (7):
>       ath10k: prevent starting monitor without a vdev
>       ath10k: add sanity checks for monitor management
>       ath10k: fix endianess in prints
>       ath10k: fix NSS reporting in RX
>       ath10k: fix NULL deref upon early FW crash
>       ath10k: fix FW crashes on heavy TX on 10.1.389 AP FW

These patches applied.

>       ath10k: fix device initialization routine

I dropped this patch for now, because of some of the warm reset issues.
We need to investigate more.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Mon Oct 21 10:19:02 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 21 Oct 2013 17:19:02 +0300
Subject: [PATCH] ath10k: add error handling to ath10k_pci_wait()
In-Reply-To: <20131017083615.31028.25088.stgit@localhost6.localdomain6> (Kalle
 Valo's message of "Thu, 17 Oct 2013 11:36:15 +0300")
References: <20131017083615.31028.25088.stgit@localhost6.localdomain6>
Message-ID: <87vc0qso4p.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo at qca.qualcomm.com> writes:

> ath10k_pci_wait() didn't notify any errors to callers, it
> just printed a warning so add proper error handling.
>
> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>

Applied, I just changed the commit log to this:

commit f3782744c9b50edf94d28e37a937ff84f267dfab
Author: Kalle Valo <kvalo at qca.qualcomm.com>
Date:   Thu Oct 17 11:36:15 2013 +0300

    ath10k: add error handling to ath10k_pci_wait()
    
    ath10k_pci_wait() didn't notify any errors to callers, it
    just printed a warning so add proper error handling. This fixes
    a crash Ben reported:
    
    ath10k: MSI-X interrupt handling (8 intrs)
    ath10k: Unable to wakeup target
    ath10k: target took longer 5000 us to wake up (awake count 1)
    ath10k: Failed to get pcie state addr: -16
    ath10k: early firmware event indicated
    BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
    IP: [<ffffffffa06ae46c>] ath10k_ce_completed_send_next+0x47/0x122 [ath10k_pci]
    
    Reported-by: Ben Greear <greearb at candelatech.com>
    Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>

-- 
Kalle Valo


From greearb at candelatech.com  Mon Oct 21 11:59:58 2013
From: greearb at candelatech.com (Ben Greear)
Date: Mon, 21 Oct 2013 08:59:58 -0700
Subject: Fwd: ath10k related kernel crash in wireless-testing
 (3.12.0-rc3-wl+)
In-Reply-To: <87fvruu3jz.fsf@kamboji.qca.qualcomm.com>
References: <52588F0C.3000009@candelatech.com>
 <525EB81E.5060305@candelatech.com> <87li1t5gmi.fsf@kamboji.qca.qualcomm.com>
 <87fvruu3jz.fsf@kamboji.qca.qualcomm.com>
Message-ID: <52654F7E.3080606@candelatech.com>

On 10/21/2013 07:00 AM, Kalle Valo wrote:
> Kalle Valo <kvalo at qca.qualcomm.com> writes:
> 
>> Ben Greear <greearb at candelatech.com> writes:
>>
>>> I sent this to the wrong list the first time.
>>>
>>> Do you know if this is already addressed?  If not, I'll see if I can
>>> find a fix.
>>
>> [...]
>>
>>> ath10k: MSI-X interrupt handling (8 intrs)
>>> ath10k: Unable to wakeup target
>>> ath10k: target took longer 5000 us to wake up (awake count 1)
>>> ath10k: Failed to get pcie state addr: -16
>>> ath10k: early firmware event indicated
>>> BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
>>> IP: [<ffffffffa06ae46c>] ath10k_ce_completed_send_next+0x47/0x122
>>> [ath10k_pci]
>>
>> I think there are two bugs here:
>>
>> 1) Cold reset doesn't always work, Michal has a patch for that. That's
>>    why the wakeup fails:
>>
>> http://lists.infradead.org/pipermail/ath10k/2013-October/000638.html
>>
>> 2) We enable interrupts too early and if wakeup fails and we get a
>>    spurious interrupt ath10k crashes. We don't have a fix for this yet.
> 
> I was able to reproduce your crash and it seems that my patch "ath10k:
> add error handling to ath10k_pci_wait()" fixes the crash. But it's not
> an ultimate solution, it's just bandaid for the issue:
> 
> [ 3200.447601] ath10k: MSI-X didn't succeed (1), trying MSI
> [ 3200.447898] ath10k_pci 0000:02:00.0: irq 49 for MSI/MSI-X
> [ 3200.449101] ath10k: MSI interrupt handling
> [ 3201.620679] ath10k: Unable to wakeup target
> [ 3201.620754] ath10k: Failed to reset target, target did not wake up: -110
> [ 3201.621111] ath10k: early firmware event indicated
> [ 3201.621624] ath10k: could not start pci hif (-110)
> [ 3201.621691] ath10k: could not probe fw (-110)
> [ 3201.621750] ath10k: could not register driver core (-110)
> 
> We are working on fixing the wakeup issue, doing just warm reset helps
> but there are other problems with that. Need to investigate more.
> 
> And we need to fix the interrupt race properly at some point, I added a
> todo entry for this:
> 
> http://wireless.kernel.org/en/users/Drivers/ath10k/todo

Thanks.  Is this the proper repository to develop/test against?

git://github.com/kvalo/ath.git

('master' branch)?


Thanks,
Ben


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From kvalo at qca.qualcomm.com  Mon Oct 21 12:46:31 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 21 Oct 2013 19:46:31 +0300
Subject: Fwd: ath10k related kernel crash in wireless-testing
 (3.12.0-rc3-wl+)
In-Reply-To: <52654F7E.3080606@candelatech.com> (Ben Greear's message of "Mon, 
 21 Oct 2013 08:59:58 -0700")
References: <52588F0C.3000009@candelatech.com>
 <525EB81E.5060305@candelatech.com>
 <87li1t5gmi.fsf@kamboji.qca.qualcomm.com>
 <87fvruu3jz.fsf@kamboji.qca.qualcomm.com>
 <52654F7E.3080606@candelatech.com>
Message-ID: <87ob6ishaw.fsf@kamboji.qca.qualcomm.com>

Ben Greear <greearb at candelatech.com> writes:

>> We are working on fixing the wakeup issue, doing just warm reset helps
>> but there are other problems with that. Need to investigate more.
>> 
>> And we need to fix the interrupt race properly at some point, I added a
>> todo entry for this:
>> 
>> http://wireless.kernel.org/en/users/Drivers/ath10k/todo
>
> Thanks.  Is this the proper repository to develop/test against?
>
> git://github.com/kvalo/ath.git
>
> ('master' branch)?

Yes. The master branch is basically no more than 2 weeks old
wireless-testing plus latest ath10k/ath6kl patches.

-- 
Kalle Valo


From greearb at candelatech.com  Mon Oct 21 18:07:07 2013
From: greearb at candelatech.com (Ben Greear)
Date: Mon, 21 Oct 2013 15:07:07 -0700
Subject: README for the ath10k firmware repository?
Message-ID: <5265A58B.8000403@candelatech.com>

I noticed some new firmware images were added to the ath10k firmware
repository ( https://github.com/kvalo/ath10k-firmware.git).

Could someone that knows add a small README that describes what firmware
does what?

For instance, I was thinking that maybe I should rename firmware-2.bin
to firmware.bin on the host machine in order to use it..but that makes
my system not boot.

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Mon Oct 21 20:16:22 2013
From: greearb at candelatech.com (Ben Greear)
Date: Mon, 21 Oct 2013 17:16:22 -0700
Subject: Kernel panic in today's 'ath' tree.
Message-ID: <5265C3D6.8090301@candelatech.com>

I had pulled this tree down earlier today (8250e5b5151eb332c344969dc234752bb4e331a6).
This happened on restart of my app, which will be restarting supplicant, etc.

I think I hit it earlier too, but didn't have console logging enabled then.


(gdb) l *(ath10k_pci_ce_send_done+0xd3)
0x1261 is in ath10k_pci_ce_send_done (/mnt/sda/home/greearb/git/ath/drivers/net/wireless/ath/ath10k/pci.c:630).
625		void *transfer_context;
626		u32 ce_data;
627		unsigned int nbytes;
628		unsigned int transfer_id;
629	
630		while (ath10k_ce_completed_send_next(ce_state, &transfer_context,
631						     &ce_data, &nbytes,
632						     &transfer_id) == 0) {
633			compl = get_free_compl(pipe_info);
634			if (!compl)
(gdb)


wlan2: deauthenticating from 00:03:83:3d:30:aa by local choice (reason=3)
ath10k: tx not flushed
ath10k: tx not flushed
cfg80211: Calling CRDA to update world regulatory domain
cfg80211: World regulatory domain updated:
cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: Calling CRDA for country: US
cfg80211: Regulatory domain changed to country: US
cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 1700 mBm)
cfg80211:   (5250000 KHz - 5330000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5490000 KHz - 5600000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5650000 KHz - 5710000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 3000 mBm)
cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm)
ath10k: Completion buffers are full
IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
8021q: adding VLAN 0 to HW filter on device eth1
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
e1000e: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
ath10k: MSI-X interrupt handling (8 intrs)
ath10k: UART prints disabled
ath10k: firmware 999.999.0.636 booted
ath10k: htt target version 2.1
IPv6: ADDRCONF(NETDEV_UP): wlan2: link is not ready
ath10k: Completion buffers are full
ath10k: Completion buffers are full
ath10k: MSI-X interrupt handling (8 intrs)
ath10k: UART prints disabled
ath10k: firmware 999.999.0.636 booted
ath10k: htt target version 2.1
IPv6: ADDRCONF(NETDEV_UP): wlan2: link is not ready
wlan2: authenticate with 00:03:83:3d:30:aa
wlan2: direct probe to 00:03:83:3d:30:aa (try 1/3)
wlan2: send auth to 00:03:83:3d:30:aa (try 2/3)
wlan2: authenticated
wlan2: associate with 00:03:83:3d:30:aa (try 1/3)
wlan2: RX AssocResp from 00:03:83:3d:30:aa (capab=0x1 status=0 aid=1)
IPv6: ADDRCONF(NETDEV_CHANGE): wlan2: link becomes ready
wlan2: associated
wlan2: deauthenticating from 00:03:83:3d:30:aa by local choice (reason=3)
cfg80211: Calling CRDA to update world regulatory domain
cfg80211: World regulatory domain updated:
cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: Calling CRDA for country: US
ath10k: Completion buffers are full
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [<ffffffffa0631334>] ath10k_ce_completed_send_next+0x48/0x10d [ath10k_pci]
PGD d7f27067 PUD d9c6c067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: rpcsec_gss_krb5 auth_rpcgss oid_registry nfsv4 nfs fscache nf_nat_ipv4 nf_nat veth 8021q]
CPU: 3 PID: 5730 Comm: wpa_supplicant Tainted: G        WC   3.12.0-rc5-wl+ #1
Hardware name: To be filled by O.E.M. To be filled by O.E.M./HURONRIVER, BIOS 4.6.5 05/02/2012
task: ffff8802109d8000 ti: ffff8800d7f02000 task.ti: ffff8800d7f02000
RIP: 0010:[<ffffffffa0631334>]  [<ffffffffa0631334>] ath10k_ce_completed_send_next+0x48/0x10d [ath10k_pci]
RSP: 0018:ffff88021fb83df8  EFLAGS: 00010246
RAX: 0000000000000d0d RBX: ffff88021597e510 RCX: ffff88021fb83e88
RDX: 0000000000058400 RSI: ffff88021fb83e90 RDI: ffff88021597e408
RBP: ffff88021fb83e58 R08: ffff88021fb83e8c R09: ffff8800d7f03fd8
R10: 0000000000000000 R11: ffff8800cf4a61f8 R12: ffff880215579720
R13: ffff88021fb83e90 R14: 0000000000000000 R15: ffff88021fb83e84
FS:  00007f9d64722740(0000) GS:ffff88021fb80000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000008 CR3: 00000000d97bf000 CR4: 00000000000407e0
Stack:
 ffff88021fb83e28 ffff88021fb83e00 ffff88021fb83e8c ffff88021fb83e88
 0000000000000003 ffff88021597e408 ffff88021fb83e58 ffff880215579720
 ffff88021597e000 ffff88021597e510 ffff880215579720 ffff88021597e248
Call Trace:
 <IRQ>
 [<ffffffffa062f23d>] ath10k_pci_ce_send_done+0xd3/0xef [ath10k_pci]
 [<ffffffff810e00ff>] ? timekeeping_get_ns.constprop.10+0x12/0x38
 [<ffffffff810a1670>] ? _local_bh_enable_ip.isra.15+0x1e/0x9b
 [<ffffffffa0631473>] ath10k_ce_per_engine_service+0x7a/0xab [ath10k_pci]
 [<ffffffffa062e24a>] ath10k_pci_ce_tasklet+0x15/0x17 [ath10k_pci]
 [<ffffffff810a1600>] tasklet_action+0x7b/0xcd
 [<ffffffff810a17d7>] __do_softirq+0xbb/0x175
 [<ffffffff81108fbb>] ? arch_local_irq_save+0x15/0x1b
 [<ffffffff81572bdc>] call_softirq+0x1c/0x30
 <EOI>
 [<ffffffff8100c089>] do_softirq+0x40/0x7f
 [<ffffffff810a16bf>] _local_bh_enable_ip.isra.15+0x6d/0x9b
 [<ffffffff810a16f6>] local_bh_enable_ip+0x9/0xb
 [<ffffffff8156cc30>] _raw_spin_unlock_bh+0x1f/0x21
 [<ffffffffa050b0a1>] spin_unlock_bh+0x9/0xb [ath10k_core]
 [<ffffffffa050eb75>] ath10k_halt+0xe1/0xed [ath10k_core]
 [<ffffffffa050ebb7>] ath10k_stop+0x36/0x79 [ath10k_core]
 [<ffffffffa03b4580>] ieee80211_stop_device+0x44/0x6f [mac80211]
 [<ffffffffa03a238d>] ieee80211_do_stop+0x5c5/0x61d [mac80211]
 [<ffffffff810a1670>] ? _local_bh_enable_ip.isra.15+0x1e/0x9b
 [<ffffffff810a16f6>] ? local_bh_enable_ip+0x9/0xb
 [<ffffffff8156cc30>] ? _raw_spin_unlock_bh+0x1f/0x21
 [<ffffffff814d78a2>] ? dev_deactivate_many+0x105/0x148
 [<ffffffffa03a23fa>] ieee80211_stop+0x15/0x19 [mac80211]
 [<ffffffff814bb4c0>] __dev_close_many+0x7c/0xa0
 [<ffffffff814bb523>] __dev_close+0x3f/0x5e
 [<ffffffff8156cc30>] ? _raw_spin_unlock_bh+0x1f/0x21
 [<ffffffff814c110a>] __dev_change_flags+0xa6/0x129
 [<ffffffff814c120d>] dev_change_flags+0x1a/0x4f
 [<ffffffff8151d388>] devinet_ioctl+0x239/0x53f
 [<ffffffff814bba30>] ? dev_get_by_name_rcu+0x34/0x56
 [<ffffffff8151ddec>] inet_ioctl+0x87/0xa4
 [<ffffffff814aa42e>] sock_do_ioctl+0x22/0x41
 [<ffffffff814aa859>] sock_ioctl+0x1fe/0x20b
 [<ffffffff8117481d>] vfs_ioctl+0x21/0x34
 [<ffffffff81175076>] do_vfs_ioctl+0x3b8/0x3fb
 [<ffffffff8117cb0b>] ? fget_light+0x39/0x99
 [<ffffffff8117510b>] SyS_ioctl+0x52/0x7f
 [<ffffffff810e070e>] ? current_kernel_time+0xd/0x31
 [<ffffffff815716bd>] system_call_fastpath+0x1a/0x1f
Code: 48 89 4d b8 4c 89 45 b0 48 8b 80 a0 01 00 00 48 05 08 04 00 00 48 89 c7 48 89 45 c8 e8 df f8 ff ff 4c
RIP  [<ffffffffa0631334>] ath10k_ce_completed_send_next+0x48/0x10d [ath10k_pci]
 RSP <ffff88021fb83df8>
CR2: 0000000000000008
---[ end trace b61c38f55596de5a ]---
Kernel panic - not syncing: Fatal exception in interrupt


Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Tue Oct 22 12:50:26 2013
From: greearb at candelatech.com (Ben Greear)
Date: Tue, 22 Oct 2013 09:50:26 -0700
Subject: Firmware crash and kernel crash when associating second STA to same
 AP.
Message-ID: <5266ACD2.7080204@candelatech.com>

I didn't really expect this to work yet, but for the record, here is
what happens when you create a second station and ask it to associate
to the same AP as the first station.

It looks like the ath10k crash is similar or same to the other
problem I saw on station restart.  I am going to see if I can
figure out how to at least mitigate this crash as it is going
to make debugging the firmware even more difficult.

If anyone has any hints on how to figure out where the
firmware crashed based on the dump below, please let me know
(privately, if that seems appropriate).


Last login: Mon Oct 21 17:16:51 from 192.168.100.236
[root at ct523-9292 ~]# IPv6: ADDRCONF(NETDEV_UP): sta300: link is not ready
sta300: authenticate with 00:03:83:3d:30:aa
ath10k: Failed to add peer: 00:03:83:3d:30:aa for VDEV: 1
ath10k: vdev setup failed -110
sta300: send auth to 00:03:83:3d:30:aa (try 1/3)
ath10k: firmware crashed!
ath10k: hardware name qca988x hw2.0 version 0x4100016c
ath10k: firmware version: 1.0.0.636
ath10k: target register Dump Location: 0x00401930
ath10k: target Register Dump
ath10k: [00]: 0x4100016C 0x00000000 0x0098B7DA 0x00000000
ath10k: [04]: 0x00000000 0x00000000 0x00000000 0x00000000
ath10k: [08]: 0x00000000 0x00000000 0x00000000 0x00000000
ath10k: [12]: 0x00000000 0x00000000 0x00000000 0x00000000
ath10k: [16]: 0x00000000 0x00000000 0x00000000 0x0098B7DA
ath10k: [20]: 0x00000000 0x00401930 0x00000000 0x00000000
ath10k: [24]: 0x00000000 0x00000000 0x00000000 0x00000000
ath10k: [28]: 0x00000000 0x00000000 0x00000000 0x00000000
ath10k: [32]: 0x00000000 0x00000000 0x00000000 0x00000000
ath10k: [36]: 0x00000000 0x00000000 0x00000000 0x00000000
ath10k: [40]: 0x00000000 0x00000000 0x00000000 0x00000000
ath10k: [44]: 0x00000000 0x00000000 0x00000000 0x00000000
ath10k: [48]: 0x00000000 0x00000000 0x00000000 0x00000000
ath10k: [52]: 0x00000000 0x00000000 0x00000000 0x00000000
ath10k: [56]: 0x00000000 0x00000000 0x00000000 0x00000000
ath10k: Completion buffers are full
ieee80211 wiphy2: Hardware restart was requested
ath10k: tx failed (-108). dropping packet.
sta300: send auth to 00:03:83:3d:30:aa (try 2/3)
ath10k: MSI-X interrupt handling (8 intrs)
sta300: send auth to 00:03:83:3d:30:aa (try 3/3)
sta300: authentication with 00:03:83:3d:30:aa timed out
ath10k: Target stalled
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [<ffffffffa04af334>] ath10k_ce_completed_send_next+0x48/0x10d [ath10k_pci]
PGD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: rpcsec_gss_krb5 auth_rpcgss oid_registry nfsv4 nfs fscache nf_nat_ipv4 nf_nat veth 8021q]
CPU: 2 PID: 23 Comm: ksoftirqd/2 Tainted: G        WC   3.12.0-rc5-wl+ #1
Hardware name: To be filled by O.E.M. To be filled by O.E.M./HURONRIVER, BIOS 4.6.5 05/02/2012
task: ffff8802163a0000 ti: ffff88021639e000 task.ti: ffff88021639e000
RIP: 0010:[<ffffffffa04af334>]  [<ffffffffa04af334>] ath10k_ce_completed_send_next+0x48/0x10d [ath10k_pci]
RSP: 0018:ffff88021639fc88  EFLAGS: 00010246
RAX: 0000000000006363 RBX: ffff880215a3d410 RCX: ffff88021639fd18
RDX: 0000000000057400 RSI: ffff88021639fd20 RDI: ffff880215a3d408
RBP: ffff88021639fce8 R08: ffff88021639fd1c R09: ffff88020c463fd8
R10: 000000000000b5cf R11: 000000000000b5cf R12: ffff88020d6fd720
R13: ffff88021639fd20 R14: 0000000000000000 R15: ffff88021639fd14
FS:  0000000000000000(0000) GS:ffff88021fb00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000008 CR3: 0000000001a0d000 CR4: 00000000000407e0
Stack:
 ffff88021639fcd8 ffffffff810bd4df ffff88021639fd1c ffff88021639fd18
 0000000000000000 ffff880215a3d408 ffff88021639fce8 ffff88020d6fd720
 ffff880215a3d000 ffff880215a3d410 ffff88020d6fd720 ffff880215a3d0a8
Call Trace:
 [<ffffffff810bd4df>] ? __wake_up_common+0x49/0x80
 [<ffffffffa04ad23d>] ath10k_pci_ce_send_done+0xd3/0xef [ath10k_pci]
 [<ffffffff810a1670>] ? _local_bh_enable_ip.isra.15+0x1e/0x9b
 [<ffffffffa04af473>] ath10k_ce_per_engine_service+0x7a/0xab [ath10k_pci]
 [<ffffffffa04ac24a>] ath10k_pci_ce_tasklet+0x15/0x17 [ath10k_pci]
 [<ffffffff810a1600>] tasklet_action+0x7b/0xcd
 [<ffffffff810a17d7>] __do_softirq+0xbb/0x175
 [<ffffffff810a18af>] run_ksoftirqd+0x1e/0x3b
 [<ffffffff810bcfa9>] smpboot_thread_fn+0x1f9/0x217
 [<ffffffff810bcdb0>] ? test_ti_thread_flag.constprop.3+0x11/0x11
 [<ffffffff810bcdb0>] ? test_ti_thread_flag.constprop.3+0x11/0x11
 [<ffffffff810b6a8e>] kthread+0x88/0x90
 [<ffffffff810b6a06>] ? __kthread_parkme+0x60/0x60
 [<ffffffff8157160c>] ret_from_fork+0x7c/0xb0
 [<ffffffff810b6a06>] ? __kthread_parkme+0x60/0x60
Code: 48 89 4d b8 4c 89 45 b0 48 8b 80 a0 01 00 00 48 05 08 04 00 00 48 89 c7 48 89 45 c8 e8 df f8 ff ff 4c
RIP  [<ffffffffa04af334>] ath10k_ce_completed_send_next+0x48/0x10d [ath10k_pci]
 RSP <ffff88021639fc88>
CR2: 0000000000000008
---[ end trace decd329ee4470646 ]---
Kernel panic - not syncing: Fatal exception in interrupt
drm_kms_helper: panic occurred, switching back to text console

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Tue Oct 22 13:12:36 2013
From: greearb at candelatech.com (Ben Greear)
Date: Tue, 22 Oct 2013 10:12:36 -0700
Subject: DMAR faults?
Message-ID: <5266B204.8030901@candelatech.com>

Any idea what this means?  The 05:00.0 is the ath10k device...

ath10k_pci 0000:05:00.0: BAR 0: assigned [mem 0xf4400000-0xf45fffff 64bit]
ath10k: MSI-X interrupt handling (8 intrs)
dmar: DRHD: handling fault status reg 3
dmar: DMAR:[DMA Write] Request device [05:00.0] fault addr ffe46000
DMAR:[fault reason 02] Present bit in context entry is clear
ath10k: Hardware name qca988x hw2.0 version 0x4100016c
ath10k: UART prints disabled
ath10k: firmware 999.999.0.636 booted
ath10k: htt target version 2.1
ath10k: Completion buffers are full

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Tue Oct 22 14:25:37 2013
From: greearb at candelatech.com (Ben Greear)
Date: Tue, 22 Oct 2013 11:25:37 -0700
Subject: ath10k hits warning in sta_info.c:839.
Message-ID: <5266C321.7000103@candelatech.com>

Kernel is stock 'ath' tree, with small printk to debug an ath10k
crash.

This is FYI for now...will be looking at other ath10k crash bugs
before digging into this tone.

Setup is 2 stations trying to associate to same AP, which causes
endless failures and firmware crashes.  Good for chasing bugs :)


DMAR:[fault reason 05] PTE Write access is not set
dmar: DRHD: handling fault status reg 3
dmar: DMAR:[DMA Write] Request device [05:00.0] fault addr ffd52000
DMAR:[fault reason 05] PTE Write access is not set
dmar: DRHD: handling fault status reg 3
dmar: DMAR:[DMA Write] Request device [05:00.0] fault addr ffd52000
DMAR:[fault reason 05] PTE Write access is not set

sta300: authentication with 00:03:83:3d:30:aa timed out
[root at ct523-9292 ~]# ath10k: Failed to delete peer: 00:03:83:3d:30:aa for VDEV: 1
ath10k: WMI vdev stop failed: ret -108
------------[ cut here ]------------
WARNING: CPU: 1 PID: 6 at /mnt/sda/home/greearb/git/ath/net/mac80211/sta_info.c:839 __sta_info_destroy+0x12)
Modules linked in: nf_nat_ipv4 nf_nat veth 8021q garp stp mrp llc macvlan pktgen lockd f71882fg coretemp hw]
CPU: 1 PID: 6 Comm: kworker/u8:0 Tainted: G        WC   3.12.0-rc5-wl+ #1
Hardware name: To be filled by O.E.M. To be filled by O.E.M./HURONRIVER, BIOS 4.6.5 05/02/2012
Workqueue: phy0 ieee80211_iface_work [mac80211]
 0000000000000009 ffff8802160d3c28 ffffffff81566b46 ffff88021fa8ec78
 0000000000000000 ffff8802160d3c68 ffffffff8109e0a2 ffff8802160d3c78
 ffffffffa03ceff2 ffff880215b63800 ffff8800d81505c0 ffff88020dc647c0
Call Trace:
 [<ffffffff81566b46>] dump_stack+0x55/0x86
 [<ffffffff8109e0a2>] warn_slowpath_common+0x77/0x91
 [<ffffffffa03ceff2>] ? __sta_info_destroy+0x122/0x1d6 [mac80211]
 [<ffffffff8109e0d1>] warn_slowpath_null+0x15/0x17
dmar: DRHD: handling fault status reg 3
dmar: DMAR:[DMA Write] Request device [05:00.0] fault addr ffd51000
DMAR:[fault reason 05] PTE Write access is not set
dmar: DRHD: handling fault status reg 3
dmar: DMAR:[DMA Write] Request device [05:00.0] fault addr ffd51000
DMAR:[fault reason 05] PTE Write access is not set
 [<ffffffffa03ceff2>] __sta_info_destroy+0x122/0x1d6 [mac80211]
 [<ffffffffa03cf27a>] sta_info_destroy_addr+0x37/0x59 [mac80211]
 [<ffffffffa03edbcc>] ieee80211_destroy_auth_data+0x2a/0x8c [mac80211]
 [<ffffffffa03f1543>] ieee80211_sta_work+0x159/0xb2c [mac80211]
 [<ffffffffa03ea936>] ? ieee80211_wake_queues_by_reason+0x78/0x87 [mac80211]
 [<ffffffff8156cc88>] ? _raw_spin_unlock_irqrestore+0x27/0x32
 [<ffffffffa03d86bf>] ieee80211_iface_work+0x29f/0x2c2 [mac80211]
 [<ffffffffa03edc3b>] ? sdata_unlock+0xd/0xf [mac80211]
 [<ffffffff810afdc1>] ? pwq_activate_delayed_work+0x23/0x31
 [<ffffffff810b1846>] process_one_work+0x162/0x217
 [<ffffffff810b1cbb>] worker_thread+0x12e/0x1fb
 [<ffffffff810b1b8d>] ? rescuer_thread+0x268/0x268
 [<ffffffff810b6a8e>] kthread+0x88/0x90
 [<ffffffff810b6a06>] ? __kthread_parkme+0x60/0x60
 [<ffffffff8157160c>] ret_from_fork+0x7c/0xb0
 [<ffffffff810b6a06>] ? __kthread_parkme+0x60/0x60
---[ end trace 402f96cbcf4a3d3e ]---
sta300: deauthenticating from 00:03:83:3d:30:aa by local choice (reason=3)
ath10k: MSI-X interrupt handling (8 intrs)
ath10k: UART prints disabled
ath10k: firmware 999.999.0.636 booted
ath10k: htt target version 2.1
ath10k: device successfully recovered
ath10k: firmware crashed!



-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Tue Oct 22 17:01:04 2013
From: greearb at candelatech.com (Ben Greear)
Date: Tue, 22 Oct 2013 14:01:04 -0700
Subject: Another crash related to list corruption.
Message-ID: <5266E790.5010809@candelatech.com>

I'm going to re-build the kernel with list debugging and other
debugging stuff, maybe catch this problem more easily.


(gdb) l *(ath10k_remove_interface+0x9f)
0x289a is in ath10k_remove_interface (/mnt/sda/home/greearb/git/ath/include/linux/list.h:88).
83	 * This is only for internal list manipulation where we know
84	 * the prev/next entries already!
85	 */
86	static inline void __list_del(struct list_head * prev, struct list_head * next)
87	{
88		next->prev = prev;
89		prev->next = next;
90	}
91	
92	/**
(gdb)


ath10k: Failed to set erp slot for VDEV: 0
ath10k: Failed to set preamble for VDEV: 0
ath10k: Peer assoc failed for 00:03:83:3d:30:aa
: -11ath10k: device is wedged, will not restart

ath10k: Failed to set beacon interval for VDEV: 0
ath10k: Failed to set CTS prot for VDEV: 0
ath10k: Failed to set erp slot for VDEV: 0
ath10k: Failed to set preamble for VDEV: 0
ath10k: tx failed (-70). dropping packet.
ath10k: tx failed (-70). dropping packet.
sta300: deauthenticating from 00:03:83:3d:30:aa by local choice (reason=3)
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [<ffffffffa053589a>] ath10k_remove_interface+0x9f/0x1e4 [ath10k_core]
PGD d52cd067 PUD d94be067 PMD 0
Oops: 0002 [#1] PREEMPT SMP
Modules linked in: nf_nat_ipv4 nf_nat veth 8021q garp stp mrp llc macvlan pktgen lockd f71882fg coretemp hw]
CPU: 3 PID: 2544 Comm: ip Tainted: G        WC   3.12.0-rc5-wl+ #1
Hardware name: To be filled by O.E.M. To be filled by O.E.M./HURONRIVER, BIOS 4.6.5 05/02/2012
task: ffff88021578dd80 ti: ffff8800d95dc000 task.ti: ffff8800d95dc000
RIP: 0010:[<ffffffffa053589a>]  [<ffffffffa053589a>] ath10k_remove_interface+0x9f/0x1e4 [ath10k_core]
RSP: 0018:ffff8800d95dd618  EFLAGS: 00010206
RAX: 0000000000000000 RBX: ffff88020dc65168 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000fffffffe0 RDI: ffffffffa05330a1
RBP: ffff8800d95dd658 R08: 0000000000000020 R09: dead000000100100
R10: dead000000100100 R11: dead000000100100 R12: ffff8800d8151720
R13: ffff8800d8152348 R14: ffff8800d8152320 R15: dead000000200200
FS:  00007f35e80a0740(0000) GS:ffff88021fb80000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000008 CR3: 00000000cfe85000 CR4: 00000000000407e0
Stack:
 ffff8800d95dd628 ffffffff8156cc88 ffff8800d95dd658 ffff88020dc647c0
 ffff8800d81505c0 0000000000000000 0000000000001001 ffff8800d81506e0
 ffff8800d95dd678 ffffffffa03d7bf3 ffff8800d81505c0 ffff88020dc647c0
Call Trace:
 [<ffffffff8156cc88>] ? _raw_spin_unlock_irqrestore+0x27/0x32
 [<ffffffffa03d7bf3>] drv_remove_interface+0x2a/0x36 [mac80211]
 [<ffffffffa03d9371>] ieee80211_do_stop+0x5a9/0x61d [mac80211]
 [<ffffffff810a1670>] ? _local_bh_enable_ip.isra.15+0x1e/0x9b
 [<ffffffff810a16f6>] ? local_bh_enable_ip+0x9/0xb
 [<ffffffff8156cc30>] ? _raw_spin_unlock_bh+0x1f/0x21
 [<ffffffff814d78a2>] ? dev_deactivate_many+0x105/0x148
 [<ffffffffa03d93fa>] ieee80211_stop+0x15/0x19 [mac80211]
 [<ffffffff814bb4c0>] __dev_close_many+0x7c/0xa0
 [<ffffffff814bb523>] __dev_close+0x3f/0x5e
 [<ffffffff8156cc30>] ? _raw_spin_unlock_bh+0x1f/0x21
 [<ffffffff814c110a>] __dev_change_flags+0xa6/0x129
 [<ffffffff814c120d>] dev_change_flags+0x1a/0x4f
 [<ffffffff814ca18f>] do_setlink+0x2d0/0x78c
 [<ffffffff814ccb68>] rtnl_newlink+0x248/0x465
 [<ffffffff814cc9e4>] ? rtnl_newlink+0xc4/0x465
 [<ffffffff8114370d>] ? anon_vma_alloc+0x15/0x26
 [<ffffffff814cc90d>] rtnetlink_rcv_msg+0x186/0x199
 [<ffffffff8115ca80>] ? __kmalloc_node_track_caller+0xb0/0x11a
 [<ffffffff811314b2>] ? zone_page_state_add+0x2a/0x2f
 [<ffffffff814b38da>] ? __alloc_skb+0x7f/0x1a6
 [<ffffffff811324bb>] ? __inc_zone_state+0x45/0x4f
 [<ffffffff814cc787>] ? __rtnl_unlock+0x12/0x12
 [<ffffffff814e15e3>] netlink_rcv_skb+0x3e/0x8c
 [<ffffffff814c9ae8>] rtnetlink_rcv+0x21/0x28
 [<ffffffff814e0dc3>] netlink_unicast+0xb0/0x131
 [<ffffffff814e13e2>] netlink_sendmsg+0x59e/0x5e4
 [<ffffffff814a9dd0>] __sock_sendmsg_nosec+0x25/0x27
 [<ffffffff814ac523>] sock_sendmsg+0x5a/0x7b
 [<ffffffff8111e022>] ? unlock_page+0x1f/0x23
 [<ffffffff814acc1d>] ? move_addr_to_kernel+0x35/0x62
 [<ffffffff814b6439>] ? verify_iovec+0x4b/0x9e
 [<ffffffff814acb5b>] ___sys_sendmsg+0x200/0x28d
 [<ffffffff814a9f0e>] ? sock_destroy_inode+0x2b/0x2f
 [<ffffffff8115b071>] ? kmem_cache_free+0x77/0xd5
 [<ffffffff81177325>] ? __d_free+0x4b/0x50
 [<ffffffff8156fad4>] ? __do_page_fault+0x338/0x3cf
 [<ffffffff8117ea1a>] ? mntput+0x28/0x2a
 [<ffffffff81167fe1>] ? __fput+0x19a/0x1ba
 [<ffffffff8117cb0b>] ? fget_light+0x39/0x99
 [<ffffffff814ad3fc>] __sys_sendmsg+0x3d/0x5b
 [<ffffffff814ad427>] SyS_sendmsg+0xd/0x19
 [<ffffffff815716bd>] system_call_fastpath+0x1a/0x1f
Code: 28 01 00 00 b8 01 00 00 00 49 bb 00 01 10 00 00 00 ad de d3 e0 41 09 84 24 48 0b 00 00 48 8b 93 18 01
RIP  [<ffffffffa053589a>] ath10k_remove_interface+0x9f/0x1e4 [ath10k_core]
 RSP <ffff8800d95dd618>
CR2: 0000000000000008
---[ end trace 402f96cbcf4a3d3f ]---

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Tue Oct 22 17:54:14 2013
From: greearb at candelatech.com (greearb at candelatech.com)
Date: Tue, 22 Oct 2013 14:54:14 -0700
Subject: [PATCH] ath10k:  Initialize list-head on vif creation.
Message-ID: <1382478854-5233-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb at candelatech.com>

If the creation fails, this keeps us from crashing later when
trying to do a list_del(arvif->list).

Signed-off-by: Ben Greear <greearb at candelatech.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index da23c3f..908e90d 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2064,6 +2064,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	arvif->vif = vif;
 
 	INIT_WORK(&arvif->wep_key_work, ath10k_tx_wep_key_work);
+	INIT_LIST_HEAD(&arvif->list);
 
 	if ((vif->type == NL80211_IFTYPE_MONITOR) && ar->monitor_present) {
 		ath10k_warn("Only one monitor interface allowed\n");
-- 
1.7.11.7



From greearb at candelatech.com  Tue Oct 22 18:22:37 2013
From: greearb at candelatech.com (Ben Greear)
Date: Tue, 22 Oct 2013 15:22:37 -0700
Subject: ath10k hits warning in sta_info.c:839.
In-Reply-To: <5266C321.7000103@candelatech.com>
References: <5266C321.7000103@candelatech.com>
Message-ID: <5266FAAD.3010800@candelatech.com>

On 10/22/2013 11:25 AM, Ben Greear wrote:
> Kernel is stock 'ath' tree, with small printk to debug an ath10k
> crash.
> 
> This is FYI for now...will be looking at other ath10k crash bugs
> before digging into this tone.
> 
> Setup is 2 stations trying to associate to same AP, which causes
> endless failures and firmware crashes.  Good for chasing bugs :)
> 
> 
> DMAR:[fault reason 05] PTE Write access is not set
> dmar: DRHD: handling fault status reg 3
> dmar: DMAR:[DMA Write] Request device [05:00.0] fault addr ffd52000
> DMAR:[fault reason 05] PTE Write access is not set
> dmar: DRHD: handling fault status reg 3
> dmar: DMAR:[DMA Write] Request device [05:00.0] fault addr ffd52000
> DMAR:[fault reason 05] PTE Write access is not set
> 
> sta300: authentication with 00:03:83:3d:30:aa timed out
> [root at ct523-9292 ~]# ath10k: Failed to delete peer: 00:03:83:3d:30:aa for VDEV: 1
> ath10k: WMI vdev stop failed: ret -108

> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 6 at /mnt/sda/home/greearb/git/ath/net/mac80211/sta_info.c:839 __sta_info_destroy+0x12)
> Modules linked in: nf_nat_ipv4 nf_nat veth 8021q garp stp mrp llc macvlan pktgen lockd f71882fg coretemp hw]

I think this may be a result of whatever bug or limitation
caused the firmware to error and/or crash when adding a second
station VIF and trying to associate it to the same AP.

Probably not a problem with the rest of the wifi stacks.

Thanks,
Ben


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From michal.kazior at tieto.com  Wed Oct 23 03:42:16 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 23 Oct 2013 09:42:16 +0200
Subject: ath10k hits warning in sta_info.c:839.
In-Reply-To: <5266FAAD.3010800@candelatech.com>
References: <5266C321.7000103@candelatech.com>
 <5266FAAD.3010800@candelatech.com>
Message-ID: <CA+BoTQmomxywSjUB9nrniMT+HeZeBD=L3m2K8c=m6ehGcSp7eQ@mail.gmail.com>

On 23 October 2013 00:22, Ben Greear <greearb at candelatech.com> wrote:
> On 10/22/2013 11:25 AM, Ben Greear wrote:
>> Kernel is stock 'ath' tree, with small printk to debug an ath10k
>> crash.
>>
>> This is FYI for now...will be looking at other ath10k crash bugs
>> before digging into this tone.
>>
>> Setup is 2 stations trying to associate to same AP, which causes
>> endless failures and firmware crashes.  Good for chasing bugs :)
>>
>>
>> DMAR:[fault reason 05] PTE Write access is not set
>> dmar: DRHD: handling fault status reg 3
>> dmar: DMAR:[DMA Write] Request device [05:00.0] fault addr ffd52000
>> DMAR:[fault reason 05] PTE Write access is not set
>> dmar: DRHD: handling fault status reg 3
>> dmar: DMAR:[DMA Write] Request device [05:00.0] fault addr ffd52000
>> DMAR:[fault reason 05] PTE Write access is not set
>>
>> sta300: authentication with 00:03:83:3d:30:aa timed out
>> [root at ct523-9292 ~]# ath10k: Failed to delete peer: 00:03:83:3d:30:aa for VDEV: 1
>> ath10k: WMI vdev stop failed: ret -108
>
>> ------------[ cut here ]------------
>> WARNING: CPU: 1 PID: 6 at /mnt/sda/home/greearb/git/ath/net/mac80211/sta_info.c:839 __sta_info_destroy+0x12)
>> Modules linked in: nf_nat_ipv4 nf_nat veth 8021q garp stp mrp llc macvlan pktgen lockd f71882fg coretemp hw]
>
> I think this may be a result of whatever bug or limitation
> caused the firmware to error and/or crash when adding a second
> station VIF and trying to associate it to the same AP.
>
> Probably not a problem with the rest of the wifi stacks.

Yup. This originates from the firmware limitation. It's unable to
handle two peer nodes with same mac addr on different vdevs. That's
why it's impossible to associate 2 (or more) station interfaces to the
same BSS.


Micha?


From michal.kazior at tieto.com  Wed Oct 23 07:02:12 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 23 Oct 2013 04:02:12 -0700
Subject: [PATCH 0/3] ath10k: tx power fixes
Message-ID: <1382526135-3215-1-git-send-email-michal.kazior@tieto.com>

Hi,

This patchset fixes power units used in ath10k and
also make it respect (user) configurable tx power.


Michal Kazior (3):
  ath10k: setup min channel power to a reasonable value
  ath10k: use proper tx power unit
  ath10k: respect power_level values

 drivers/net/wireless/ath/ath10k/mac.c | 44 +++++++++++++++++++++++++----------
 drivers/net/wireless/ath/ath10k/wmi.h |  3 ++-
 2 files changed, 34 insertions(+), 13 deletions(-)

-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 23 07:02:14 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 23 Oct 2013 04:02:14 -0700
Subject: [PATCH 2/3] ath10k: use proper tx power unit
In-Reply-To: <1382526135-3215-1-git-send-email-michal.kazior@tieto.com>
References: <1382526135-3215-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1382526135-3215-3-git-send-email-michal.kazior@tieto.com>

It was previously thought that FW expects tx power
in quarters of dBm.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 18 +++++++++---------
 drivers/net/wireless/ath/ath10k/wmi.h |  3 ++-
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 35d5d3a..1d91201 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -451,9 +451,9 @@ static int ath10k_vdev_start(struct ath10k_vif *arvif)
 	arg.channel.mode = chan_to_phymode(&conf->chandef);
 
 	arg.channel.min_power = 0;
-	arg.channel.max_power = channel->max_power * 4;
-	arg.channel.max_reg_power = channel->max_reg_power * 4;
-	arg.channel.max_antenna_gain = channel->max_antenna_gain;
+	arg.channel.max_power = channel->max_power * 2;
+	arg.channel.max_reg_power = channel->max_reg_power * 2;
+	arg.channel.max_antenna_gain = channel->max_antenna_gain * 2;
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
 		arg.ssid = arvif->u.ap.ssid;
@@ -530,9 +530,9 @@ static int ath10k_monitor_start(struct ath10k *ar, int vdev_id)
 	arg.channel.mode = chan_to_phymode(&ar->hw->conf.chandef);
 
 	arg.channel.min_power = 0;
-	arg.channel.max_power = channel->max_power * 4;
-	arg.channel.max_reg_power = channel->max_reg_power * 4;
-	arg.channel.max_antenna_gain = channel->max_antenna_gain;
+	arg.channel.max_power = channel->max_power * 2;
+	arg.channel.max_reg_power = channel->max_reg_power * 2;
+	arg.channel.max_antenna_gain = channel->max_antenna_gain * 2;
 
 	ret = ath10k_wmi_vdev_start(ar, &arg);
 	if (ret) {
@@ -1376,9 +1376,9 @@ static int ath10k_update_channel_list(struct ath10k *ar)
 
 			ch->freq = channel->center_freq;
 			ch->min_power = 0;
-			ch->max_power = channel->max_power * 4;
-			ch->max_reg_power = channel->max_reg_power * 4;
-			ch->max_antenna_gain = channel->max_antenna_gain;
+			ch->max_power = channel->max_power * 2;
+			ch->max_reg_power = channel->max_reg_power * 2;
+			ch->max_antenna_gain = channel->max_antenna_gain * 2;
 			ch->reg_class_id = 0; /* FIXME */
 
 			/* FIXME: why use only legacy modes, why not any
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 78c991a..81e33a7 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -893,6 +893,7 @@ struct wmi_channel {
 	union {
 		__le32 reginfo0;
 		struct {
+			/* note: power unit is 0.5 dBm */
 			u8 min_power;
 			u8 max_power;
 			u8 reg_power;
@@ -915,7 +916,7 @@ struct wmi_channel_arg {
 	bool allow_ht;
 	bool allow_vht;
 	bool ht40plus;
-	/* note: power unit is 1/4th of dBm */
+	/* note: power unit is 0.5 dBm */
 	u32 min_power;
 	u32 max_power;
 	u32 max_reg_power;
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 23 07:02:15 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 23 Oct 2013 04:02:15 -0700
Subject: [PATCH 3/3] ath10k: respect power_level values
In-Reply-To: <1382526135-3215-1-git-send-email-michal.kazior@tieto.com>
References: <1382526135-3215-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1382526135-3215-4-git-send-email-michal.kazior@tieto.com>

This allows txpower limits other than regulatory
to be applied (e.g. user txpower limit provided
via iw/nl80211).

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 1d91201..643518d 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2013,6 +2013,7 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
 	struct ath10k *ar = hw->priv;
 	struct ieee80211_conf *conf = &hw->conf;
 	int ret = 0;
+	u32 param;
 
 	mutex_lock(&ar->conf_mutex);
 
@@ -2024,6 +2025,25 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
 		spin_unlock_bh(&ar->data_lock);
 	}
 
+	if (changed & IEEE80211_CONF_CHANGE_POWER) {
+		ath10k_dbg(ATH10K_DBG_MAC, "mac config power %d\n",
+			   hw->conf.power_level);
+
+		param = ar->wmi.pdev_param->txpower_limit2g;
+		ret = ath10k_wmi_pdev_set_param(ar, param,
+						hw->conf.power_level * 2);
+		if (ret)
+			ath10k_warn("mac failed to set 2g txpower %d (%d)\n",
+				    hw->conf.power_level, ret);
+
+		param = ar->wmi.pdev_param->txpower_limit5g;
+		ret = ath10k_wmi_pdev_set_param(ar, param,
+						hw->conf.power_level * 2);
+		if (ret)
+			ath10k_warn("mac failed to set 5g txpower %d (%d)\n",
+				    hw->conf.power_level, ret);
+	}
+
 	if (changed & IEEE80211_CONF_CHANGE_PS)
 		ath10k_config_ps(ar);
 
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 23 07:02:13 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 23 Oct 2013 04:02:13 -0700
Subject: [PATCH 1/3] ath10k: setup min channel power to a reasonable value
In-Reply-To: <1382526135-3215-1-git-send-email-michal.kazior@tieto.com>
References: <1382526135-3215-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1382526135-3215-2-git-send-email-michal.kazior@tieto.com>

This will be needed for proper support of (user)
configurable tx power level.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index da23c3f..35d5d3a 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -450,7 +450,7 @@ static int ath10k_vdev_start(struct ath10k_vif *arvif)
 
 	arg.channel.mode = chan_to_phymode(&conf->chandef);
 
-	arg.channel.min_power = channel->max_power * 3;
+	arg.channel.min_power = 0;
 	arg.channel.max_power = channel->max_power * 4;
 	arg.channel.max_reg_power = channel->max_reg_power * 4;
 	arg.channel.max_antenna_gain = channel->max_antenna_gain;
@@ -529,7 +529,7 @@ static int ath10k_monitor_start(struct ath10k *ar, int vdev_id)
 	   don't have any vifs? */
 	arg.channel.mode = chan_to_phymode(&ar->hw->conf.chandef);
 
-	arg.channel.min_power = channel->max_power * 3;
+	arg.channel.min_power = 0;
 	arg.channel.max_power = channel->max_power * 4;
 	arg.channel.max_reg_power = channel->max_reg_power * 4;
 	arg.channel.max_antenna_gain = channel->max_antenna_gain;
@@ -1375,7 +1375,7 @@ static int ath10k_update_channel_list(struct ath10k *ar)
 			ch->passive = passive;
 
 			ch->freq = channel->center_freq;
-			ch->min_power = channel->max_power * 3;
+			ch->min_power = 0;
 			ch->max_power = channel->max_power * 4;
 			ch->max_reg_power = channel->max_reg_power * 4;
 			ch->max_antenna_gain = channel->max_antenna_gain;
-- 
1.8.4.rc3



From greearb at candelatech.com  Wed Oct 23 18:31:47 2013
From: greearb at candelatech.com (greearb at candelatech.com)
Date: Wed, 23 Oct 2013 15:31:47 -0700
Subject: [PATCH] ath10k:  Log firmware debug prints and dbg logs.
Message-ID: <1382567507-19154-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb at candelatech.com>

This should aid in debugging firmware issues on standard
NIC hardware that does not have a serial port.

Signed-off-by: Ben Greear <greearb at candelatech.com>
---

NOTE:  This requires a previous patch sent privately to kvalo.

 drivers/net/wireless/ath/ath10k/debug.h |  1 +
 drivers/net/wireless/ath/ath10k/wmi.c   | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index 845c661..807bf03 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -33,6 +33,7 @@ enum ath10k_debug_mask {
 	ATH10K_DBG_MGMT		= 0x00000100,
 	ATH10K_DBG_DATA		= 0x00000200,
 	ATH10K_DBG_BMI		= 0x00000400,
+	ATH10K_DBG_FIRMWARE	= 0x00000800,
 	ATH10K_DBG_ANY		= 0xffffffff,
 };
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index a796d0b..34cff8b 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1046,7 +1046,12 @@ static void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb)
 
 static void ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb)
 {
-	ath10k_dbg(ATH10K_DBG_WMI, "WMI_DEBUG_MESG_EVENTID\n");
+	u32 *m = (u32 *)(skb->data);
+	ath10k_dbg(ATH10K_DBG_WMI, "WMI_DEBUG_MESG_EVENTID, dropped: %i\n",
+		   m[0]);
+	/* Format is dropped-count(u32) [message buffer]. */
+	if (ath10k_debug_mask & ATH10K_DBG_FIRMWARE)
+		ath10k_dbg_print_fw_dbg_buffer((u8 *)(&(m[1])), skb->len - 4);
 }
 
 static void ath10k_wmi_event_update_stats(struct ath10k *ar,
@@ -1402,7 +1407,10 @@ static void ath10k_wmi_event_profile_match(struct ath10k *ar,
 static void ath10k_wmi_event_debug_print(struct ath10k *ar,
 				  struct sk_buff *skb)
 {
+	struct wmi_debug_mesg_event *ev;
+	ev = (struct wmi_debug_mesg_event *)(skb->data);
 	ath10k_dbg(ATH10K_DBG_WMI, "WMI_DEBUG_PRINT_EVENTID\n");
+	ath10k_dbg(ATH10K_DBG_FIRMWARE, "%s\n", ev->bufp);
 }
 
 static void ath10k_wmi_event_pdev_qvit(struct ath10k *ar, struct sk_buff *skb)
-- 
1.7.11.7



From greearb at candelatech.com  Wed Oct 23 19:28:33 2013
From: greearb at candelatech.com (Ben Greear)
Date: Wed, 23 Oct 2013 16:28:33 -0700
Subject: ath10k hits warning in sta_info.c:839.
In-Reply-To: <CA+BoTQmomxywSjUB9nrniMT+HeZeBD=L3m2K8c=m6ehGcSp7eQ@mail.gmail.com>
References: <5266C321.7000103@candelatech.com>
 <5266FAAD.3010800@candelatech.com>
 <CA+BoTQmomxywSjUB9nrniMT+HeZeBD=L3m2K8c=m6ehGcSp7eQ@mail.gmail.com>
Message-ID: <52685BA1.5020801@candelatech.com>

On 10/23/2013 12:42 AM, Michal Kazior wrote:

> Yup. This originates from the firmware limitation. It's unable to
> handle two peer nodes with same mac addr on different vdevs. That's
> why it's impossible to associate 2 (or more) station interfaces to the
> same BSS.

I'm hoping to fix that soon.  From what I can tell, the firmware is actually
crashing, not just asserting.  I can find the 'program counter' in the firmware
crash dump, but I am still working on how to get some sort of stack trace
or source code location out of that.

In case it helps someone else, I believe the register dump lines:

ath10k: target Register Dump
ath10k: [00]: 0x4100016C 0x00000000 0x0098B7DA 0x00000000

decode as:  Target, Line (if assert), ProgramCounter(PC), bad-virtual-addr


Thanks,
Ben


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From kvalo at qca.qualcomm.com  Thu Oct 24 01:05:14 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 24 Oct 2013 08:05:14 +0300
Subject: [PATCH] ath10k:  Log firmware debug prints and dbg logs.
In-Reply-To: <1382567507-19154-1-git-send-email-greearb@candelatech.com>
 (greearb@candelatech.com's message of "Wed, 23 Oct 2013 15:31:47
 -0700")
References: <1382567507-19154-1-git-send-email-greearb@candelatech.com>
Message-ID: <87y55jjm2d.fsf@kamboji.qca.qualcomm.com>

<greearb at candelatech.com> writes:

> From: Ben Greear <greearb at candelatech.com>
>
> This should aid in debugging firmware issues on standard
> NIC hardware that does not have a serial port.
>
> Signed-off-by: Ben Greear <greearb at candelatech.com>

I have been working on using a tracepoint for this. That way we can do
this in user space.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Thu Oct 24 01:36:25 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 24 Oct 2013 08:36:25 +0300
Subject: [PATCH] ath10k:  Initialize list-head on vif creation.
In-Reply-To: <1382478854-5233-1-git-send-email-greearb@candelatech.com>
 (greearb@candelatech.com's message of "Tue, 22 Oct 2013 14:54:14
 -0700")
References: <1382478854-5233-1-git-send-email-greearb@candelatech.com>
Message-ID: <87ppqvjkme.fsf@kamboji.qca.qualcomm.com>

greearb at candelatech.com writes:

> From: Ben Greear <greearb at candelatech.com>
>
> If the creation fails, this keeps us from crashing later when
> trying to do a list_del(arvif->list).
>
> Signed-off-by: Ben Greear <greearb at candelatech.com>

Thanks, applied.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Thu Oct 24 01:43:28 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 24 Oct 2013 08:43:28 +0300
Subject: [PATCH 0/3] ath10k: tx power fixes
In-Reply-To: <1382526135-3215-1-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Wed, 23 Oct 2013 04:02:12 -0700")
References: <1382526135-3215-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <87iownjkan.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> Hi,
>
> This patchset fixes power units used in ath10k and
> also make it respect (user) configurable tx power.
>
>
> Michal Kazior (3):
>   ath10k: setup min channel power to a reasonable value
>   ath10k: use proper tx power unit
>   ath10k: respect power_level values

Thanks, all patches applied.

-- 
Kalle Valo


From greearb at candelatech.com  Thu Oct 24 14:26:06 2013
From: greearb at candelatech.com (greearb at candelatech.com)
Date: Thu, 24 Oct 2013 11:26:06 -0700
Subject: [PATCH] ath10k:  Fix un-initialized debug objects.
Message-ID: <1382639166-25698-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb at candelatech.com>

If the 'ar' registration fails early, the debug
objects were not initialized, and trouble ensued when
the object was later destroyed and the un-initialized
objects were accessed.

ath10k: Unable to wakeup target
ath10k: Failed to reset target, target did not wake up: -110
ath10k: early firmware event indicated
ath10k: could not start pci hif (-110)
ath10k: could not probe fw (-110)
ath10k: could not register driver core (-110)
------------[ cut here ]------------
WARNING: CPU: 0 PID: 11760 at /mnt/sda/home/greearb/git/ath/lib/debugobjects.c:260 debug_print_object+0x7c/)
ODEBUG: assert_init not available (active state 0) object type: timer_list hint: stub_timer+0x0/0x17
Modules linked in: ath10k_pci(+) ath10k_core ath5k ath9k ath9k_common ath9k_hw nfsv3 nfs_acl nfs fscache nf]
CPU: 0 PID: 11760 Comm: modprobe Tainted: G        WC   3.12.0-rc5-wl+ #2
Hardware name: To be filled by O.E.M. To be filled by O.E.M./HURONRIVER, BIOS 4.6.5 05/02/2012
 0000000000000009 ffff88020b2db8d8 ffffffff8158a1af 0000000000000006
 ffff88020b2db928 ffff88020b2db918 ffffffff8109f45e ffff88020b2db948
 ffffffff812c3274 ffff88020b2db9d0 ffffffff81a41030 ffffffff81822095
Call Trace:
 [<ffffffff8158a1af>] dump_stack+0x55/0x86
 [<ffffffff8109f45e>] warn_slowpath_common+0x77/0x91
 [<ffffffff812c3274>] ? debug_print_object+0x7c/0x8d
 [<ffffffff8109f50c>] warn_slowpath_fmt+0x41/0x43
 [<ffffffff812c3274>] debug_print_object+0x7c/0x8d
 [<ffffffff810a8324>] ? timer_debug_hint+0xa/0xa
 [<ffffffff812c3a4c>] debug_object_assert_init+0x95/0xb1
 [<ffffffff810a8fe2>] del_timer+0x1a/0x5f
 [<ffffffff810eca6d>] ? trace_hardirqs_off_caller+0x37/0xa6
 [<ffffffff810b48eb>] try_to_grab_pending+0x4c/0x141
 [<ffffffff810b4b12>] __cancel_work_timer+0x22/0xbf
 [<ffffffff810b4bbd>] cancel_delayed_work_sync+0xe/0x10
 [<ffffffffa095823e>] ath10k_debug_destroy+0x10/0x12 [ath10k_core]
 [<ffffffffa0958a25>] ath10k_core_destroy+0xf/0x33 [ath10k_core]
 [<ffffffffa0975b4d>] ath10k_pci_probe+0x2ef/0x326 [ath10k_pci]
 [<ffffffff812e2f6d>] local_pci_probe+0x39/0x61
 [<ffffffff813a0723>] ? driver_probe_device+0x2f9/0x2f9
 [<ffffffff812e3195>] pci_device_probe+0xba/0xe0
 [<ffffffff813a054f>] driver_probe_device+0x125/0x2f9
 [<ffffffff813a0723>] ? driver_probe_device+0x2f9/0x2f9
 [<ffffffff813a0771>] __driver_attach+0x4e/0x6f
 [<ffffffff8139e847>] bus_for_each_dev+0x5a/0x8c
 [<ffffffff8139fee8>] driver_attach+0x19/0x1b
 [<ffffffff8139fb1d>] bus_add_driver+0x113/0x263
 [<ffffffff813a0d61>] driver_register+0x87/0xbe
 [<ffffffff812e2605>] __pci_register_driver+0x5c/0x60
 [<ffffffffa097c000>] ? 0xffffffffa097bfff
 [<ffffffffa097c021>] ath10k_pci_init+0x21/0x3e [ath10k_pci]
 [<ffffffff81128bce>] ? jump_label_lock+0x12/0x14
 [<ffffffffa097c000>] ? 0xffffffffa097bfff
 [<ffffffff810020d9>] do_one_initcall+0x9f/0x132
 [<ffffffff81128bce>] ? jump_label_lock+0x12/0x14
 [<ffffffff810be655>] ? __blocking_notifier_call_chain+0x4c/0x5a
 [<ffffffff810f977d>] load_module+0x1beb/0x1efe
 [<ffffffff810f68b9>] ? mod_kobject_put+0x78/0x78
 [<ffffffff810f9b5c>] SyS_init_module+0xcc/0xdb
 [<ffffffff815967fd>] system_call_fastpath+0x1a/0x1f
---[ end trace 67d86d1d06d553fa ]---

Signed-off-by: Ben Greear <greearb at candelatech.com>
---
 drivers/net/wireless/ath/ath10k/core.c  |  2 ++
 drivers/net/wireless/ath/ath10k/debug.c | 13 ++++++++-----
 drivers/net/wireless/ath/ath10k/debug.h |  6 ++++++
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 2a360ca..282c187 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -728,6 +728,8 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
 
 	INIT_WORK(&ar->restart_work, ath10k_core_restart);
 
+	ath10k_debug_init(ar);
+
 	return ar;
 
 err_wq:
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index e4ab546..aac5227 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -639,6 +639,14 @@ void ath10k_debug_stop(struct ath10k *ar)
 		cancel_delayed_work(&ar->debug.htt_stats_dwork);
 }
 
+
+void ath10k_debug_init(struct ath10k *ar)
+{
+	INIT_DELAYED_WORK(&ar->debug.htt_stats_dwork,
+			  ath10k_debug_htt_stats_dwork);
+	init_completion(&ar->debug.event_stats_compl);
+}
+
 int ath10k_debug_create(struct ath10k *ar)
 {
 	ar->debug.debugfs_phy = debugfs_create_dir("ath10k",
@@ -647,11 +655,6 @@ int ath10k_debug_create(struct ath10k *ar)
 	if (!ar->debug.debugfs_phy)
 		return -ENOMEM;
 
-	INIT_DELAYED_WORK(&ar->debug.htt_stats_dwork,
-			  ath10k_debug_htt_stats_dwork);
-
-	init_completion(&ar->debug.event_stats_compl);
-
 	debugfs_create_file("fw_stats", S_IRUSR, ar->debug.debugfs_phy, ar,
 			    &fops_fw_stats);
 
diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index 807bf03..3c12d44 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -47,6 +47,7 @@ extern __printf(1, 2) int ath10k_warn(const char *fmt, ...);
 int ath10k_debug_start(struct ath10k *ar);
 void ath10k_debug_stop(struct ath10k *ar);
 int ath10k_debug_create(struct ath10k *ar);
+void ath10k_debug_init(struct ath10k *ar);
 void ath10k_debug_destroy(struct ath10k *ar);
 void ath10k_debug_read_service_map(struct ath10k *ar,
 				   void *service_map,
@@ -69,6 +70,11 @@ static inline int ath10k_debug_create(struct ath10k *ar)
 	return 0;
 }
 
+static inline void ath10k_debug_init(struct ath10k *ar)
+{
+	return;
+}
+
 static inline void ath10k_debug_destroy(struct ath10k *ar)
 {
 }
-- 
1.7.11.7



From kvalo at qca.qualcomm.com  Fri Oct 25 03:49:02 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 25 Oct 2013 10:49:02 +0300
Subject: [PATCH] ath10k:  Fix un-initialized debug objects.
In-Reply-To: <1382639166-25698-1-git-send-email-greearb@candelatech.com>
 (greearb@candelatech.com's message of "Thu, 24 Oct 2013 11:26:06
 -0700")
References: <1382639166-25698-1-git-send-email-greearb@candelatech.com>
Message-ID: <871u39iydt.fsf@kamboji.qca.qualcomm.com>

greearb at candelatech.com writes:

> From: Ben Greear <greearb at candelatech.com>
>
> If the 'ar' registration fails early, the debug
> objects were not initialized, and trouble ensued when
> the object was later destroyed and the un-initialized
> objects were accessed.
>
> ath10k: Unable to wakeup target
> ath10k: Failed to reset target, target did not wake up: -110
> ath10k: early firmware event indicated
> ath10k: could not start pci hif (-110)
> ath10k: could not probe fw (-110)
> ath10k: could not register driver core (-110)
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 11760 at /mnt/sda/home/greearb/git/ath/lib/debugobjects.c:260 debug_print_object+0x7c/)
> ODEBUG: assert_init not available (active state 0) object type: timer_list hint: stub_timer+0x0/0x17
> Modules linked in: ath10k_pci(+) ath10k_core ath5k ath9k ath9k_common ath9k_hw nfsv3 nfs_acl nfs fscache nf]
> CPU: 0 PID: 11760 Comm: modprobe Tainted: G        WC   3.12.0-rc5-wl+ #2
> Hardware name: To be filled by O.E.M. To be filled by O.E.M./HURONRIVER, BIOS 4.6.5 05/02/2012
>  0000000000000009 ffff88020b2db8d8 ffffffff8158a1af 0000000000000006
>  ffff88020b2db928 ffff88020b2db918 ffffffff8109f45e ffff88020b2db948
>  ffffffff812c3274 ffff88020b2db9d0 ffffffff81a41030 ffffffff81822095
> Call Trace:
>  [<ffffffff8158a1af>] dump_stack+0x55/0x86
>  [<ffffffff8109f45e>] warn_slowpath_common+0x77/0x91
>  [<ffffffff812c3274>] ? debug_print_object+0x7c/0x8d
>  [<ffffffff8109f50c>] warn_slowpath_fmt+0x41/0x43
>  [<ffffffff812c3274>] debug_print_object+0x7c/0x8d
>  [<ffffffff810a8324>] ? timer_debug_hint+0xa/0xa
>  [<ffffffff812c3a4c>] debug_object_assert_init+0x95/0xb1
>  [<ffffffff810a8fe2>] del_timer+0x1a/0x5f
>  [<ffffffff810eca6d>] ? trace_hardirqs_off_caller+0x37/0xa6
>  [<ffffffff810b48eb>] try_to_grab_pending+0x4c/0x141
>  [<ffffffff810b4b12>] __cancel_work_timer+0x22/0xbf
>  [<ffffffff810b4bbd>] cancel_delayed_work_sync+0xe/0x10
>  [<ffffffffa095823e>] ath10k_debug_destroy+0x10/0x12 [ath10k_core]
>  [<ffffffffa0958a25>] ath10k_core_destroy+0xf/0x33 [ath10k_core]
>  [<ffffffffa0975b4d>] ath10k_pci_probe+0x2ef/0x326 [ath10k_pci]
>  [<ffffffff812e2f6d>] local_pci_probe+0x39/0x61
>  [<ffffffff813a0723>] ? driver_probe_device+0x2f9/0x2f9
>  [<ffffffff812e3195>] pci_device_probe+0xba/0xe0
>  [<ffffffff813a054f>] driver_probe_device+0x125/0x2f9
>  [<ffffffff813a0723>] ? driver_probe_device+0x2f9/0x2f9
>  [<ffffffff813a0771>] __driver_attach+0x4e/0x6f
>  [<ffffffff8139e847>] bus_for_each_dev+0x5a/0x8c
>  [<ffffffff8139fee8>] driver_attach+0x19/0x1b
>  [<ffffffff8139fb1d>] bus_add_driver+0x113/0x263
>  [<ffffffff813a0d61>] driver_register+0x87/0xbe
>  [<ffffffff812e2605>] __pci_register_driver+0x5c/0x60
>  [<ffffffffa097c000>] ? 0xffffffffa097bfff
>  [<ffffffffa097c021>] ath10k_pci_init+0x21/0x3e [ath10k_pci]
>  [<ffffffff81128bce>] ? jump_label_lock+0x12/0x14
>  [<ffffffffa097c000>] ? 0xffffffffa097bfff
>  [<ffffffff810020d9>] do_one_initcall+0x9f/0x132
>  [<ffffffff81128bce>] ? jump_label_lock+0x12/0x14
>  [<ffffffff810be655>] ? __blocking_notifier_call_chain+0x4c/0x5a
>  [<ffffffff810f977d>] load_module+0x1beb/0x1efe
>  [<ffffffff810f68b9>] ? mod_kobject_put+0x78/0x78
>  [<ffffffff810f9b5c>] SyS_init_module+0xcc/0xdb
>  [<ffffffff815967fd>] system_call_fastpath+0x1a/0x1f
> ---[ end trace 67d86d1d06d553fa ]---
>
> Signed-off-by: Ben Greear <greearb at candelatech.com>
> ---
>  drivers/net/wireless/ath/ath10k/core.c  |  2 ++
>  drivers/net/wireless/ath/ath10k/debug.c | 13 ++++++++-----
>  drivers/net/wireless/ath/ath10k/debug.h |  6 ++++++
>  3 files changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
> index 2a360ca..282c187 100644
> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -728,6 +728,8 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
>  
>  	INIT_WORK(&ar->restart_work, ath10k_core_restart);
>  
> +	ath10k_debug_init(ar);

For symmetry would it make more sense to move ath10k_debug_destroy() to
ath10k_core_unregister()? That way we could avoid adding a new function.

-- 
Kalle Valo


From greearb at candelatech.com  Fri Oct 25 10:59:46 2013
From: greearb at candelatech.com (Ben Greear)
Date: Fri, 25 Oct 2013 07:59:46 -0700
Subject: [PATCH] ath10k:  Fix un-initialized debug objects.
In-Reply-To: <871u39iydt.fsf@kamboji.qca.qualcomm.com>
References: <1382639166-25698-1-git-send-email-greearb@candelatech.com>
 <871u39iydt.fsf@kamboji.qca.qualcomm.com>
Message-ID: <526A8762.9050009@candelatech.com>

On 10/25/2013 12:49 AM, Kalle Valo wrote:
> greearb at candelatech.com writes:

>>   	INIT_WORK(&ar->restart_work, ath10k_core_restart);
>>
>> +	ath10k_debug_init(ar);
>
> For symmetry would it make more sense to move ath10k_debug_destroy() to
> ath10k_core_unregister()? That way we could avoid adding a new function.
>

In my opinion, you should initialize such things as early as possible
so you don't have to worry so much about the various error cases leaving
things un-initialized.  I believe my patch accomplished that.

What new function are you planning to avoid?

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Fri Oct 25 15:00:53 2013
From: greearb at candelatech.com (Ben Greear)
Date: Fri, 25 Oct 2013 12:00:53 -0700
Subject: Bug related to ath10k_pci_ce_tasklet and null src_ring.
Message-ID: <526ABFE5.5040208@candelatech.com>

I see this crash occasionally (I made it a BUG_ON, but it will crash
in upstream code while de-referencing the NULL)

Here is console log with some extra debugging in it.  Maybe the only
problem is that we just need to fix the ath10k_ce_completed_send_next_nolock
to check for null src_ring before deferencing it?  I see other code
doing something similar and returning -EIO in the ath10k_ce_cancel_send_next
method.

Or, perhaps we need to stop/cancel the tasklet that calls the
ath10k_ce_completed_send_next_nolock before it can access the stale src_ring?



ath10k: ce_deinit, ce_state: ffff8800d92c9888  src_ring: ffff88020d708b68
ath10k: ce_deinit, ce_state: ffff8800d92c98c8  src_ring:           (null)
ath10k: ce_deinit, ce_state: ffff8800d92c9908  src_ring:           (null)
ath10k: ce_deinit, ce_state: ffff8800d92c9948  src_ring: ffff88020ac9b138
ath10k: ce_deinit, ce_state: ffff8800d92c9988  src_ring: ffff88020fad8000
ath10k: ce_deinit, ce_state: ffff8800d92c99c8  src_ring:           (null)
ath10k: ce_deinit, ce_state: ffff8800d92c9a08  src_ring:           (null)
ath10k: ce_deinit, ce_state: ffff8800d92c9a48  src_ring: ffff8800cf1f3a80
cfg80211: Regulatory domain changed to country: US
cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 1700 mBm)
cfg80211:   (5250000 KHz - 5330000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5490000 KHz - 5600000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5650000 KHz - 5710000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 3000 mBm)
cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm)
ath10k: MSI-X interrupt handling (8 intrs)
ath10k: Target stalled
ath10k: send_next_nolock:  src_ring:           (null)  ce_state: ffff8800d92c9888
------------[ cut here ]------------
kernel BUG at /mnt/sda/home/greearb/git/linux.ath/drivers/net/wireless/ath/ath10k/ce.c:561!
invalid opcode: 0000 [#1] PREEMPT SMP
Modules linked in: ath10k_pci ath10k_core ath5k ath9k ath9k_common ath9k_hw nfsv3 nfs_acl nfs fscache nf_na]
CPU: 2 PID: 23 Comm: ksoftirqd/2 Tainted: G        WC   3.12.0-rc5-wl+ #2
Hardware name: To be filled by O.E.M. To be filled by O.E.M./HURONRIVER, BIOS 4.6.5 05/02/2012
task: ffff880215d4c280 ti: ffff880215d52000 task.ti: ffff880215d52000
RIP: 0010:[<ffffffffa09fe57f>]  [<ffffffffa09fe57f>] ath10k_ce_completed_send_next+0x87/0x158 [ath10k_pci]
RSP: 0018:ffff880215d53c28  EFLAGS: 00010292
RAX: 0000000000000051 RBX: ffff8800d92c9888 RCX: 0000000000000002
RDX: 0000000000000002 RSI: ffff880215d4c998 RDI: 0000000000000246
RBP: ffff880215d53c88 R08: 0000000000000002 R09: 0000000000000000
R10: 0000000000000000 R11: ffffffffa09ea944 R12: ffff880215d53cc0
R13: 0000000000000000 R14: ffff880215d53cb8 R15: ffff880215d53cb4
FS:  0000000000000000(0000) GS:ffff88021fb00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000005a3150 CR3: 000000020b3d5000 CR4: 00000000000407e0
Stack:
 0000000000000246 ffff8800d92c9850 ffff880215d53cbc ffff880215d4c280
 ffff8800d92c9850 ffff8800d92c9850 0000000000057430 ffff880211d92280
 ffff8800d92c9290 ffff8800d92c9888 ffff880211d92280 ffff8800d92c9370
Call Trace:
 [<ffffffffa09fc296>] ath10k_pci_ce_send_done+0xd6/0xf2 [ath10k_pci]
 [<ffffffff810a2d0d>] ? _local_bh_enable_ip+0xc0/0xe9
 [<ffffffff810a2d3f>] ? local_bh_enable_ip+0x9/0xb
 [<ffffffffa09fe6ca>] ath10k_ce_per_engine_service+0x7a/0xab [ath10k_pci]
 [<ffffffffa09fb249>] ath10k_pci_ce_tasklet+0x15/0x17 [ath10k_pci]
 [<ffffffff810a2bed>] tasklet_action+0x88/0xe8
 [<ffffffff810c1b4b>] ? finish_task_switch+0x3a/0xdd
 [<ffffffff810a2eb8>] __do_softirq+0xc9/0x18e
 [<ffffffff810a2fa0>] run_ksoftirqd+0x23/0x5c
 [<ffffffff810c0a5b>] smpboot_thread_fn+0x1f9/0x217
 [<ffffffff810c0862>] ? test_ti_thread_flag.constprop.3+0x11/0x11
 [<ffffffff810c0862>] ? test_ti_thread_flag.constprop.3+0x11/0x11
 [<ffffffff810b9d61>] kthread+0x9d/0xa5
 [<ffffffff815916e3>] ? _raw_spin_unlock_irq+0x29/0x54
 [<ffffffff810b9cc4>] ? __kthread_parkme+0x60/0x60
 [<ffffffff8159674c>] ret_from_fork+0x7c/0xb0
 [<ffffffff810b9cc4>] ? __kthread_parkme+0x60/0x60
Code: a0 31 c0 e8 1e 7a b8 e0 0f 0b 4c 8b 6b 30 49 81 fd 9f 0f 00 00 77 16 48 89 da 4c 89 ee 48 c7 c7 b6 ff
RIP  [<ffffffffa09fe57f>] ath10k_ce_completed_send_next+0x87/0x158 [ath10k_pci]
 RSP <ffff880215d53c28>
---[ end trace 390a55020fb495f1 ]---

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From kvalo at qca.qualcomm.com  Fri Oct 25 23:58:33 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Sat, 26 Oct 2013 06:58:33 +0300
Subject: [PATCH] ath10k:  Fix un-initialized debug objects.
In-Reply-To: <526A8762.9050009@candelatech.com> (Ben Greear's message of "Fri, 
 25 Oct 2013 07:59:46 -0700")
References: <1382639166-25698-1-git-send-email-greearb@candelatech.com>
 <871u39iydt.fsf@kamboji.qca.qualcomm.com>
 <526A8762.9050009@candelatech.com>
Message-ID: <877gd0fzti.fsf@kamboji.qca.qualcomm.com>

Ben Greear <greearb at candelatech.com> writes:

> On 10/25/2013 12:49 AM, Kalle Valo wrote:
>> greearb at candelatech.com writes:
>
>>>   	INIT_WORK(&ar->restart_work, ath10k_core_restart);
>>>
>>> +	ath10k_debug_init(ar);
>>
>> For symmetry would it make more sense to move ath10k_debug_destroy() to
>> ath10k_core_unregister()? That way we could avoid adding a new function.
>>
>
> In my opinion, you should initialize such things as early as possible
> so you don't have to worry so much about the various error cases leaving
> things un-initialized.  I believe my patch accomplished that.

Well, I again like symmetry and simplicity.

> What new function are you planning to avoid?

I would prefer not to create ath10k_debug_init().

What I was trying to suggest is this, I think it should fix the bug you
are seeing:

--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -738,8 +738,6 @@ EXPORT_SYMBOL(ath10k_core_create);
 
 void ath10k_core_destroy(struct ath10k *ar)
 {
-       ath10k_debug_destroy(ar);
-
        flush_workqueue(ar->workqueue);
        destroy_workqueue(ar->workqueue);
 
@@ -986,6 +984,8 @@ void ath10k_core_unregister(struct ath10k *ar)
        ath10k_mac_unregister(ar);
 
        ath10k_core_free_firmware_files(ar);
+
+       ath10k_debug_destroy(ar);
 }
 EXPORT_SYMBOL(ath10k_core_unregister);

-- 
Kalle Valo


From greearb at candelatech.com  Sat Oct 26 00:35:10 2013
From: greearb at candelatech.com (Ben Greear)
Date: Fri, 25 Oct 2013 21:35:10 -0700
Subject: [PATCH] ath10k:  Fix un-initialized debug objects.
In-Reply-To: <877gd0fzti.fsf@kamboji.qca.qualcomm.com>
References: <1382639166-25698-1-git-send-email-greearb@candelatech.com>
 <871u39iydt.fsf@kamboji.qca.qualcomm.com> <526A8762.9050009@candelatech.com>
 <877gd0fzti.fsf@kamboji.qca.qualcomm.com>
Message-ID: <526B467E.1060607@candelatech.com>

On 10/25/2013 08:58 PM, Kalle Valo wrote:
> Ben Greear <greearb at candelatech.com> writes:
>
>> On 10/25/2013 12:49 AM, Kalle Valo wrote:
>>> greearb at candelatech.com writes:
>>
>>>>    	INIT_WORK(&ar->restart_work, ath10k_core_restart);
>>>>
>>>> +	ath10k_debug_init(ar);
>>>
>>> For symmetry would it make more sense to move ath10k_debug_destroy() to
>>> ath10k_core_unregister()? That way we could avoid adding a new function.
>>>
>>
>> In my opinion, you should initialize such things as early as possible
>> so you don't have to worry so much about the various error cases leaving
>> things un-initialized.  I believe my patch accomplished that.
>
> Well, I again like symmetry and simplicity.
>
>> What new function are you planning to avoid?
>
> I would prefer not to create ath10k_debug_init().
>
> What I was trying to suggest is this, I think it should fix the bug you
> are seeing:

I don't think so.  The problem is that the init logic can fail before
the debug logic is ever initialized, so any cleanup that attempts to
access the debug logic can blow up.

All my patch does is ensure the debug related members are always initialized,
and so can be cleaned up later without problem.

Maybe your patch fixes something else though, I haven't investigated that
part of the code in detail yet.

Thanks,
Ben


>
> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -738,8 +738,6 @@ EXPORT_SYMBOL(ath10k_core_create);
>
>   void ath10k_core_destroy(struct ath10k *ar)
>   {
> -       ath10k_debug_destroy(ar);
> -
>          flush_workqueue(ar->workqueue);
>          destroy_workqueue(ar->workqueue);
>
> @@ -986,6 +984,8 @@ void ath10k_core_unregister(struct ath10k *ar)
>          ath10k_mac_unregister(ar);
>
>          ath10k_core_free_firmware_files(ar);
> +
> +       ath10k_debug_destroy(ar);
>   }
>   EXPORT_SYMBOL(ath10k_core_unregister);
>


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From phil.moora at gmail.com  Sun Oct 27 01:42:28 2013
From: phil.moora at gmail.com (Phil Moora)
Date: Sat, 26 Oct 2013 22:42:28 -0700
Subject: 80 MHz support
Message-ID: <CAPqRyK90OeJi_UVGV6V2SLFK0KZvc3Y9GkFgrOaNQYRNWeOMGA@mail.gmail.com>

Hello all,

Does ath10k provide 80 MHz channel support? I am using Compex
WLE900N5-18 miniPCIe (hw2) on latest ath10k-master branch. Everything
works fine but I can not make the card work on 80 MHz channel width.

I am trying to connect to a 80 MHz AP, but my card remains in 40 MHz.
Throughput tests reveal that it is indeed in 40 MHz.

Any suggestions? Any changes required to unlock 80 MHz?


From bartosz.markowski at tieto.com  Sun Oct 27 03:36:34 2013
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Sun, 27 Oct 2013 08:36:34 +0100
Subject: 80 MHz support
In-Reply-To: <CAPqRyK90OeJi_UVGV6V2SLFK0KZvc3Y9GkFgrOaNQYRNWeOMGA@mail.gmail.com>
References: <CAPqRyK90OeJi_UVGV6V2SLFK0KZvc3Y9GkFgrOaNQYRNWeOMGA@mail.gmail.com>
Message-ID: <CACKGw+FE7YnqaxuSQY=GLm7chYHcEn+L5Lr_jv6uGUSRReYBbg@mail.gmail.com>

On 27 October 2013 06:42, Phil Moora <phil.moora at gmail.com> wrote:
> Hello all,
>
> Does ath10k provide 80 MHz channel support? I am using Compex
> WLE900N5-18 miniPCIe (hw2) on latest ath10k-master branch. Everything
> works fine but I can not make the card work on 80 MHz channel width.

Yes, it does.

> I am trying to connect to a 80 MHz AP, but my card remains in 40 MHz.
> Throughput tests reveal that it is indeed in 40 MHz.
>
> Any suggestions? Any changes required to unlock 80 MHz?

Please check your regulatory domain settings.
An option may be to use custom db.txt (CONFIG_CFG80211_INTERNAL_REGDB)

--Bartosz


From bartosz.markowski at tieto.com  Sun Oct 27 06:23:56 2013
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Sun, 27 Oct 2013 11:23:56 +0100
Subject: 80 MHz support
In-Reply-To: <CACKGw+FE7YnqaxuSQY=GLm7chYHcEn+L5Lr_jv6uGUSRReYBbg@mail.gmail.com>
References: <CAPqRyK90OeJi_UVGV6V2SLFK0KZvc3Y9GkFgrOaNQYRNWeOMGA@mail.gmail.com>
 <CACKGw+FE7YnqaxuSQY=GLm7chYHcEn+L5Lr_jv6uGUSRReYBbg@mail.gmail.com>
Message-ID: <CACKGw+FPXvqApQ20WZmnyYRGiEWkaWZ4VK7-qmbeOnsC1WXy5g@mail.gmail.com>

On 27 October 2013 08:36, Bartosz Markowski <bartosz.markowski at tieto.com> wrote:
> On 27 October 2013 06:42, Phil Moora <phil.moora at gmail.com> wrote:
>> Hello all,
>>
>> Does ath10k provide 80 MHz channel support? I am using Compex
>> WLE900N5-18 miniPCIe (hw2) on latest ath10k-master branch. Everything
>> works fine but I can not make the card work on 80 MHz channel width.
>
> Yes, it does.
>
>> I am trying to connect to a 80 MHz AP, but my card remains in 40 MHz.
>> Throughput tests reveal that it is indeed in 40 MHz.
>>
>> Any suggestions? Any changes required to unlock 80 MHz?
>
> Please check your regulatory domain settings.
> An option may be to use custom db.txt (CONFIG_CFG80211_INTERNAL_REGDB)

VHT80 regdb changes are already availabe here:
http://git.kernel.org/cgit/linux/kernel/git/linville/wireless-regdb.git.
If your problem with 80MHz channels is due to outdated regdb, it's
better to fetch the latest from there.

-- 
Bartosz


From michal.kazior at tieto.com  Mon Oct 28 02:18:12 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Mon, 28 Oct 2013 07:18:12 +0100
Subject: [PATCH 0/2] ath10k: memory leak fixes
Message-ID: <1382941094-3291-1-git-send-email-michal.kazior@tieto.com>

Michal Kazior (2):
  ath10k: plug memory leak in wmi mgmt tx worker
  ath10k: plug memory leak on beacon tx

 drivers/net/wireless/ath/ath10k/mac.c |  4 +++-
 drivers/net/wireless/ath/ath10k/wmi.c | 11 +++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

-- 
1.8.4.rc3



From michal.kazior at tieto.com  Mon Oct 28 02:18:14 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Mon, 28 Oct 2013 07:18:14 +0100
Subject: [PATCH 2/2] ath10k: plug memory leak on beacon tx
In-Reply-To: <1382941094-3291-1-git-send-email-michal.kazior@tieto.com>
References: <1382941094-3291-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1382941094-3291-3-git-send-email-michal.kazior@tieto.com>

If beacon tx command failed the wmi command buffer
was not freed. This led to OOM in the long run.
This became aparent when stress testing
multi-BSSID.

Reported-By: Tomasz Skapski <tomasz.skapski at tieto.com>
Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 8db9db2..f79f17c 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -3092,6 +3092,7 @@ int ath10k_wmi_beacon_send_nowait(struct ath10k *ar,
 {
 	struct wmi_bcn_tx_cmd *cmd;
 	struct sk_buff *skb;
+	int ret;
 
 	skb = ath10k_wmi_alloc_skb(sizeof(*cmd) + arg->bcn_len);
 	if (!skb)
@@ -3104,7 +3105,11 @@ int ath10k_wmi_beacon_send_nowait(struct ath10k *ar,
 	cmd->hdr.bcn_len  = __cpu_to_le32(arg->bcn_len);
 	memcpy(cmd->bcn, arg->bcn, arg->bcn_len);
 
-	return ath10k_wmi_cmd_send_nowait(ar, skb, ar->wmi.cmd->bcn_tx_cmdid);
+	ret = ath10k_wmi_cmd_send_nowait(ar, skb, ar->wmi.cmd->bcn_tx_cmdid);
+	if (ret)
+		dev_kfree_skb(skb);
+
+	return ret;
 }
 
 static void ath10k_wmi_pdev_set_wmm_param(struct wmi_wmm_params *params,
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Mon Oct 28 02:18:13 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Mon, 28 Oct 2013 07:18:13 +0100
Subject: [PATCH 1/2] ath10k: plug memory leak in wmi mgmt tx worker
In-Reply-To: <1382941094-3291-1-git-send-email-michal.kazior@tieto.com>
References: <1382941094-3291-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1382941094-3291-2-git-send-email-michal.kazior@tieto.com>

sk_buff was not freed in some cases. The patch
unifies the msdu freeing.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 4 +++-
 drivers/net/wireless/ath/ath10k/wmi.c | 4 +---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index bbb0efa..f45eca0 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1729,8 +1729,10 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work)
 			break;
 
 		ret = ath10k_wmi_mgmt_tx(ar, skb);
-		if (ret)
+		if (ret) {
 			ath10k_warn("wmi mgmt_tx failed (%d)\n", ret);
+			ieee80211_free_txskb(ar->hw, skb);
+		}
 	}
 }
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index a796d0b..8db9db2 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -674,10 +674,8 @@ int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *skb)
 
 	/* Send the management frame buffer to the target */
 	ret = ath10k_wmi_cmd_send(ar, wmi_skb, ar->wmi.cmd->mgmt_tx_cmdid);
-	if (ret) {
-		dev_kfree_skb_any(skb);
+	if (ret)
 		return ret;
-	}
 
 	/* TODO: report tx status to mac80211 - temporary just ACK */
 	info->flags |= IEEE80211_TX_STAT_ACK;
-- 
1.8.4.rc3



From kvalo at qca.qualcomm.com  Mon Oct 28 05:03:37 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 28 Oct 2013 11:03:37 +0200
Subject: README for the ath10k firmware repository?
In-Reply-To: <5265A58B.8000403@candelatech.com> (Ben Greear's message of "Mon, 
 21 Oct 2013 15:07:07 -0700")
References: <5265A58B.8000403@candelatech.com>
Message-ID: <87a9htephy.fsf@kamboji.qca.qualcomm.com>

Ben Greear <greearb at candelatech.com> writes:

> I noticed some new firmware images were added to the ath10k firmware
> repository ( https://github.com/kvalo/ath10k-firmware.git).
>
> Could someone that knows add a small README that describes what firmware
> does what?

I added a small readme and wrote a bit more information to the wiki:

https://github.com/kvalo/ath10k-firmware
http://wireless.kernel.org/en/users/Drivers/ath10k/firmware

Do those help?

> For instance, I was thinking that maybe I should rename firmware-2.bin
> to firmware.bin on the host machine in order to use it..but that makes
> my system not boot.

You should not rename the files, except firmware-2.bin-10.1.389 ->
firmware-2.bin.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Mon Oct 28 05:21:13 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 28 Oct 2013 11:21:13 +0200
Subject: DMAR faults?
In-Reply-To: <5266B204.8030901@candelatech.com> (Ben Greear's message of "Tue, 
 22 Oct 2013 10:12:36 -0700")
References: <5266B204.8030901@candelatech.com>
Message-ID: <8761sheoom.fsf@kamboji.qca.qualcomm.com>

Ben Greear <greearb at candelatech.com> writes:

> Any idea what this means?  The 05:00.0 is the ath10k device...
>
> ath10k_pci 0000:05:00.0: BAR 0: assigned [mem 0xf4400000-0xf45fffff 64bit]
> ath10k: MSI-X interrupt handling (8 intrs)
> dmar: DRHD: handling fault status reg 3
> dmar: DMAR:[DMA Write] Request device [05:00.0] fault addr ffe46000
> DMAR:[fault reason 02] Present bit in context entry is clear

I guess you have iommu enabled? I think that means ath10k device tried
to write to a memory area which was not mapped by the driver.

> ath10k: Hardware name qca988x hw2.0 version 0x4100016c
> ath10k: UART prints disabled
> ath10k: firmware 999.999.0.636 booted
> ath10k: htt target version 2.1
> ath10k: Completion buffers are full

Timestamps would be really useful. How fast did you get that completion
buffers are full message?

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Mon Oct 28 05:23:31 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 28 Oct 2013 11:23:31 +0200
Subject: ath10k hits warning in sta_info.c:839.
In-Reply-To: <CA+BoTQmomxywSjUB9nrniMT+HeZeBD=L3m2K8c=m6ehGcSp7eQ@mail.gmail.com>
 (Michal Kazior's message of "Wed, 23 Oct 2013 09:42:16 +0200")
References: <5266C321.7000103@candelatech.com>
 <5266FAAD.3010800@candelatech.com>
 <CA+BoTQmomxywSjUB9nrniMT+HeZeBD=L3m2K8c=m6ehGcSp7eQ@mail.gmail.com>
Message-ID: <871u35eoks.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> On 23 October 2013 00:22, Ben Greear <greearb at candelatech.com> wrote:
>> On 10/22/2013 11:25 AM, Ben Greear wrote:
>>> Kernel is stock 'ath' tree, with small printk to debug an ath10k
>>> crash.
>>>
>>> This is FYI for now...will be looking at other ath10k crash bugs
>>> before digging into this tone.
>>>
>>> Setup is 2 stations trying to associate to same AP, which causes
>>> endless failures and firmware crashes.  Good for chasing bugs :)
>>>
>>>
>>> DMAR:[fault reason 05] PTE Write access is not set
>>> dmar: DRHD: handling fault status reg 3
>>> dmar: DMAR:[DMA Write] Request device [05:00.0] fault addr ffd52000
>>> DMAR:[fault reason 05] PTE Write access is not set
>>> dmar: DRHD: handling fault status reg 3
>>> dmar: DMAR:[DMA Write] Request device [05:00.0] fault addr ffd52000
>>> DMAR:[fault reason 05] PTE Write access is not set
>>>
>>> sta300: authentication with 00:03:83:3d:30:aa timed out
>>> [root at ct523-9292 ~]# ath10k: Failed to delete peer: 00:03:83:3d:30:aa for VDEV: 1
>>> ath10k: WMI vdev stop failed: ret -108
>>
>>> ------------[ cut here ]------------
>>> WARNING: CPU: 1 PID: 6 at /mnt/sda/home/greearb/git/ath/net/mac80211/sta_info.c:839 __sta_info_destroy+0x12)
>>> Modules linked in: nf_nat_ipv4 nf_nat veth 8021q garp stp mrp llc macvlan pktgen lockd f71882fg coretemp hw]
>>
>> I think this may be a result of whatever bug or limitation
>> caused the firmware to error and/or crash when adding a second
>> station VIF and trying to associate it to the same AP.
>>
>> Probably not a problem with the rest of the wifi stacks.
>
> Yup. This originates from the firmware limitation. It's unable to
> handle two peer nodes with same mac addr on different vdevs. That's
> why it's impossible to associate 2 (or more) station interfaces to the
> same BSS.

I think we should add some sort of check to ath10k to detect that and
not crash firmware.

-- 
Kalle Valo


From michal.kazior at tieto.com  Mon Oct 28 05:24:59 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Mon, 28 Oct 2013 10:24:59 +0100
Subject: DMAR faults?
In-Reply-To: <8761sheoom.fsf@kamboji.qca.qualcomm.com>
References: <5266B204.8030901@candelatech.com>
 <8761sheoom.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CA+BoTQ=pzpP1vYnDSnaMndrwQE6TFo8jQ2=pHG-1-=PcVmqpUQ@mail.gmail.com>

On 28 October 2013 10:21, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Ben Greear <greearb at candelatech.com> writes:
>
>> Any idea what this means?  The 05:00.0 is the ath10k device...
>>
>> ath10k_pci 0000:05:00.0: BAR 0: assigned [mem 0xf4400000-0xf45fffff 64bit]
>> ath10k: MSI-X interrupt handling (8 intrs)
>> dmar: DRHD: handling fault status reg 3
>> dmar: DMAR:[DMA Write] Request device [05:00.0] fault addr ffe46000
>> DMAR:[fault reason 02] Present bit in context entry is clear
>
> I guess you have iommu enabled? I think that means ath10k device tried
> to write to a memory area which was not mapped by the driver.

>From what I understand this is what supposedly can happen when cold
booting the hw 2.0.


>> ath10k: Hardware name qca988x hw2.0 version 0x4100016c
>> ath10k: UART prints disabled
>> ath10k: firmware 999.999.0.636 booted
>> ath10k: htt target version 2.1
>> ath10k: Completion buffers are full
>
> Timestamps would be really useful. How fast did you get that completion
> buffers are full message?

I'm wondering what CE ring buffer this is reported for. Judging from
Ben's recent reports I'd guess this can be an unsolicited interrupt
for an unused CE which doesn't have completions allocated at all --
thus this message is printed.


Micha?


From kvalo at qca.qualcomm.com  Mon Oct 28 06:10:50 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 28 Oct 2013 12:10:50 +0200
Subject: [PATCH] ath10k:  Fix un-initialized debug objects.
In-Reply-To: <526B467E.1060607@candelatech.com> (Ben Greear's message of "Fri, 
 25 Oct 2013 21:35:10 -0700")
References: <1382639166-25698-1-git-send-email-greearb@candelatech.com>
 <871u39iydt.fsf@kamboji.qca.qualcomm.com>
 <526A8762.9050009@candelatech.com>
 <877gd0fzti.fsf@kamboji.qca.qualcomm.com>
 <526B467E.1060607@candelatech.com>
Message-ID: <87hac1d7th.fsf@kamboji.qca.qualcomm.com>

Ben Greear <greearb at candelatech.com> writes:

> On 10/25/2013 08:58 PM, Kalle Valo wrote:
>> Ben Greear <greearb at candelatech.com> writes:
>>
>>> On 10/25/2013 12:49 AM, Kalle Valo wrote:
>>>> greearb at candelatech.com writes:
>>>
>>>>>    	INIT_WORK(&ar->restart_work, ath10k_core_restart);
>>>>>
>>>>> +	ath10k_debug_init(ar);
>>>>
>>>> For symmetry would it make more sense to move ath10k_debug_destroy() to
>>>> ath10k_core_unregister()? That way we could avoid adding a new function.
>>>>
>>>
>>> In my opinion, you should initialize such things as early as possible
>>> so you don't have to worry so much about the various error cases leaving
>>> things un-initialized.  I believe my patch accomplished that.
>>
>> Well, I again like symmetry and simplicity.
>>
>>> What new function are you planning to avoid?
>>
>> I would prefer not to create ath10k_debug_init().
>>
>> What I was trying to suggest is this, I think it should fix the bug you
>> are seeing:
>
> I don't think so.  The problem is that the init logic can fail before
> the debug logic is ever initialized, so any cleanup that attempts to
> access the debug logic can blow up.

Please look again. My idea was to fix the logic so that
ath10k_debug_destroy() is called only if ath10k_debug_create() succeeds.

> All my patch does is ensure the debug related members are always initialized,
> and so can be cleaned up later without problem.

It adds an unnecessary function which is not needed AFAICS.

-- 
Kalle Valo


From greearb at candelatech.com  Mon Oct 28 10:49:29 2013
From: greearb at candelatech.com (Ben Greear)
Date: Mon, 28 Oct 2013 07:49:29 -0700
Subject: DMAR faults?
In-Reply-To: <8761sheoom.fsf@kamboji.qca.qualcomm.com>
References: <5266B204.8030901@candelatech.com>
 <8761sheoom.fsf@kamboji.qca.qualcomm.com>
Message-ID: <526E7979.8040202@candelatech.com>

On 10/28/2013 02:21 AM, Kalle Valo wrote:
> Ben Greear <greearb at candelatech.com> writes:
>
>> Any idea what this means?  The 05:00.0 is the ath10k device...
>>
>> ath10k_pci 0000:05:00.0: BAR 0: assigned [mem 0xf4400000-0xf45fffff 64bit]
>> ath10k: MSI-X interrupt handling (8 intrs)
>> dmar: DRHD: handling fault status reg 3
>> dmar: DMAR:[DMA Write] Request device [05:00.0] fault addr ffe46000
>> DMAR:[fault reason 02] Present bit in context entry is clear
>
> I guess you have iommu enabled? I think that means ath10k device tried
> to write to a memory area which was not mapped by the driver.
>
>> ath10k: Hardware name qca988x hw2.0 version 0x4100016c
>> ath10k: UART prints disabled
>> ath10k: firmware 999.999.0.636 booted
>> ath10k: htt target version 2.1
>> ath10k: Completion buffers are full
>
> Timestamps would be really useful. How fast did you get that completion
> buffers are full message?

These mostly happen after I crash firmware if I remember corectly.
I haven't looked closely yet.

I'm using a normal-ish Intel core-i7 system with 64-bit Fedora 19
OS.  Probably iommu is enabled.


Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Mon Oct 28 12:43:35 2013
From: greearb at candelatech.com (Ben Greear)
Date: Mon, 28 Oct 2013 09:43:35 -0700
Subject: [PATCH] ath10k:  Fix un-initialized debug objects.
In-Reply-To: <87hac1d7th.fsf@kamboji.qca.qualcomm.com>
References: <1382639166-25698-1-git-send-email-greearb@candelatech.com>
 <871u39iydt.fsf@kamboji.qca.qualcomm.com> <526A8762.9050009@candelatech.com>
 <877gd0fzti.fsf@kamboji.qca.qualcomm.com> <526B467E.1060607@candelatech.com>
 <87hac1d7th.fsf@kamboji.qca.qualcomm.com>
Message-ID: <526E9437.9020705@candelatech.com>

On 10/28/2013 03:10 AM, Kalle Valo wrote:
> Ben Greear <greearb at candelatech.com> writes:
> 
>> On 10/25/2013 08:58 PM, Kalle Valo wrote:
>>> Ben Greear <greearb at candelatech.com> writes:
>>>
>>>> On 10/25/2013 12:49 AM, Kalle Valo wrote:
>>>>> greearb at candelatech.com writes:
>>>>
>>>>>>    	INIT_WORK(&ar->restart_work, ath10k_core_restart);
>>>>>>
>>>>>> +	ath10k_debug_init(ar);
>>>>>
>>>>> For symmetry would it make more sense to move ath10k_debug_destroy() to
>>>>> ath10k_core_unregister()? That way we could avoid adding a new function.
>>>>>
>>>>
>>>> In my opinion, you should initialize such things as early as possible
>>>> so you don't have to worry so much about the various error cases leaving
>>>> things un-initialized.  I believe my patch accomplished that.
>>>
>>> Well, I again like symmetry and simplicity.
>>>
>>>> What new function are you planning to avoid?
>>>
>>> I would prefer not to create ath10k_debug_init().
>>>
>>> What I was trying to suggest is this, I think it should fix the bug you
>>> are seeing:
>>
>> I don't think so.  The problem is that the init logic can fail before
>> the debug logic is ever initialized, so any cleanup that attempts to
>> access the debug logic can blow up.
> 
> Please look again. My idea was to fix the logic so that
> ath10k_debug_destroy() is called only if ath10k_debug_create() succeeds.

Ok, I think your patch will work.  I'll back mine out when you push
yours and will let you know if I find any more problems in this
area.

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Mon Oct 28 12:51:00 2013
From: greearb at candelatech.com (Ben Greear)
Date: Mon, 28 Oct 2013 09:51:00 -0700
Subject: README for the ath10k firmware repository?
In-Reply-To: <87a9htephy.fsf@kamboji.qca.qualcomm.com>
References: <5265A58B.8000403@candelatech.com>
 <87a9htephy.fsf@kamboji.qca.qualcomm.com>
Message-ID: <526E95F4.1010904@candelatech.com>

On 10/28/2013 02:03 AM, Kalle Valo wrote:
> Ben Greear <greearb at candelatech.com> writes:
> 
>> I noticed some new firmware images were added to the ath10k firmware
>> repository ( https://github.com/kvalo/ath10k-firmware.git).
>>
>> Could someone that knows add a small README that describes what firmware
>> does what?
> 
> I added a small readme and wrote a bit more information to the wiki:
> 
> https://github.com/kvalo/ath10k-firmware
> http://wireless.kernel.org/en/users/Drivers/ath10k/firmware
> 
> Do those help?
> 
>> For instance, I was thinking that maybe I should rename firmware-2.bin
>> to firmware.bin on the host machine in order to use it..but that makes
>> my system not boot.
> 
> You should not rename the files, except firmware-2.bin-10.1.389 ->
> firmware-2.bin.

Yes, that does help.

It is correct to say that if firmware-2.bin exists then the
firmware.bin and otp.bin will always be ignored for recent
ath10k drivers?

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From kvalo at qca.qualcomm.com  Mon Oct 28 12:54:34 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 28 Oct 2013 18:54:34 +0200
Subject: README for the ath10k firmware repository?
In-Reply-To: <526E95F4.1010904@candelatech.com> (Ben Greear's message of "Mon, 
 28 Oct 2013 09:51:00 -0700")
References: <5265A58B.8000403@candelatech.com>
 <87a9htephy.fsf@kamboji.qca.qualcomm.com>
 <526E95F4.1010904@candelatech.com>
Message-ID: <87li1d9vzp.fsf@kamboji.qca.qualcomm.com>

Ben Greear <greearb at candelatech.com> writes:

> On 10/28/2013 02:03 AM, Kalle Valo wrote:
>> Ben Greear <greearb at candelatech.com> writes:
>> 
>>> I noticed some new firmware images were added to the ath10k firmware
>>> repository ( https://github.com/kvalo/ath10k-firmware.git).
>>>
>>> Could someone that knows add a small README that describes what firmware
>>> does what?
>> 
>> I added a small readme and wrote a bit more information to the wiki:
>> 
>> https://github.com/kvalo/ath10k-firmware
>> http://wireless.kernel.org/en/users/Drivers/ath10k/firmware
>> 
>> Do those help?
>> 
>>> For instance, I was thinking that maybe I should rename firmware-2.bin
>>> to firmware.bin on the host machine in order to use it..but that makes
>>> my system not boot.
>> 
>> You should not rename the files, except firmware-2.bin-10.1.389 ->
>> firmware-2.bin.
>
> Yes, that does help.
>
> It is correct to say that if firmware-2.bin exists then the
> firmware.bin and otp.bin will always be ignored for recent
> ath10k drivers?

That's correct, firmware.bin and otp.bin are only to support old
versions of ath10k. Consider them obsolete now.

-- 
Kalle Valo


From marek.puzyniak at tieto.com  Tue Oct 29 08:06:33 2013
From: marek.puzyniak at tieto.com (Marek Puzyniak)
Date: Tue, 29 Oct 2013 13:06:33 +0100
Subject: [PATCH 2/3] ath10k: introduce DFS implementation
In-Reply-To: <1383048394-15256-1-git-send-email-marek.puzyniak@tieto.com>
References: <1383048394-15256-1-git-send-email-marek.puzyniak@tieto.com>
Message-ID: <1383048394-15256-2-git-send-email-marek.puzyniak@tieto.com>

Configure interface combination for AP running on channels
where radar detection is required. It allows only one type
of interface - AP on DFS channel and limits number of AP
interfaces to 8. Setup WMI channel flags accordingly to mac
channel configuration. CAC based on additional monitor vdev
is started if required for current channel.

Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>
Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/Kconfig  |   7 ++
 drivers/net/wireless/ath/ath10k/core.h   |   6 ++
 drivers/net/wireless/ath/ath10k/htt_rx.c |   5 +
 drivers/net/wireless/ath/ath10k/mac.c    | 156 +++++++++++++++++++++++++++++--
 drivers/net/wireless/ath/ath10k/wmi.c    |  23 ++++-
 drivers/net/wireless/ath/ath10k/wmi.h    |   1 +
 6 files changed, 185 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/Kconfig b/drivers/net/wireless/ath/ath10k/Kconfig
index 82e8088..f51b8e9 100644
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
@@ -37,3 +37,10 @@ config ATH10K_TRACING
 	---help---
 	  Select this to ath10k use tracing infrastructure.
 
+config ATH10K_DFS_CERTIFIED
+	bool "Atheros DFS support for certified platforms"
+	depends on ATH10K && CFG80211_CERTIFICATION_ONUS
+	default n
+	---help---
+	  This option enables DFS support for initiating radiation on
+	  ath10k.
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 671dbe3..d5fd74b 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -310,6 +310,11 @@ enum ath10k_fw_features {
 	ATH10K_FW_FEATURE_COUNT,
 };
 
+enum ath10k_dev_flags {
+	/* Indicates that ath10k device is during CAC phase of DFS */
+	ATH10K_CAC_RUNNING,
+};
+
 struct ath10k {
 	struct ath_common ath_common;
 	struct ieee80211_hw *hw;
@@ -403,6 +408,7 @@ struct ath10k {
 	bool monitor_enabled;
 	bool monitor_present;
 	unsigned int filter_flags;
+	unsigned long dev_flags;
 
 	struct wmi_pdev_set_wmm_params_arg wmm_params;
 	struct completion install_key_done;
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 90d4f74..d619291 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -959,6 +959,11 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
 				continue;
 			}
 
+			if (test_bit(ATH10K_CAC_RUNNING, &htt->ar->dev_flags)) {
+				ath10k_htt_rx_free_msdu_chain(msdu_head);
+				continue;
+			}
+
 			/* FIXME: we do not support chaining yet.
 			 * this needs investigation */
 			if (msdu_chaining) {
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 79f8bfd..4c62201 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -459,6 +459,10 @@ static int ath10k_vdev_start(struct ath10k_vif *arvif)
 		arg.ssid = arvif->u.ap.ssid;
 		arg.ssid_len = arvif->u.ap.ssid_len;
 		arg.hidden_ssid = arvif->u.ap.hidden_ssid;
+
+		/* For now allow DFS for AP mode */
+		arg.channel.chan_radar =
+			!!(channel->flags & IEEE80211_CHAN_RADAR);
 	} else if (arvif->vdev_type == WMI_VDEV_TYPE_IBSS) {
 		arg.ssid = arvif->vif->bss_conf.ssid;
 		arg.ssid_len = arvif->vif->bss_conf.ssid_len;
@@ -528,6 +532,8 @@ static int ath10k_monitor_start(struct ath10k *ar, int vdev_id)
 	/* TODO setup this dynamically, what in case we
 	   don't have any vifs? */
 	arg.channel.mode = chan_to_phymode(&ar->hw->conf.chandef);
+	arg.channel.chan_radar =
+			!!(channel->flags & IEEE80211_CHAN_RADAR);
 
 	arg.channel.min_power = 0;
 	arg.channel.max_power = channel->max_power * 2;
@@ -662,6 +668,107 @@ static int ath10k_monitor_destroy(struct ath10k *ar)
 	return ret;
 }
 
+static int ath10k_start_cac(struct ath10k *ar)
+{
+	int ret;
+
+	lockdep_assert_held(&ar->conf_mutex);
+
+	set_bit(ATH10K_CAC_RUNNING, &ar->dev_flags);
+
+	ret = ath10k_monitor_create(ar);
+	if (ret) {
+		clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags);
+		return ret;
+	}
+
+	ret = ath10k_monitor_start(ar, ar->monitor_vdev_id);
+	if (ret) {
+		clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags);
+		ath10k_monitor_destroy(ar);
+		return ret;
+	}
+
+	ath10k_dbg(ATH10K_DBG_MAC, "mac cac start monitor vdev %d\n",
+		   ar->monitor_vdev_id);
+
+	return 0;
+}
+
+static int ath10k_stop_cac(struct ath10k *ar)
+{
+	lockdep_assert_held(&ar->conf_mutex);
+
+	/* CAC is not running - do nothing */
+	if (!test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags))
+		return 0;
+
+	ath10k_monitor_stop(ar);
+	ath10k_monitor_destroy(ar);
+	clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags);
+
+	ath10k_dbg(ATH10K_DBG_MAC, "mac cac finished\n");
+
+	return 0;
+}
+
+static const char *ath10k_dfs_state(enum nl80211_dfs_state dfs_state)
+{
+	switch (dfs_state) {
+	case NL80211_DFS_USABLE:
+		return "USABLE";
+	case NL80211_DFS_UNAVAILABLE:
+		return "UNAVAILABLE";
+	case NL80211_DFS_AVAILABLE:
+		return "AVAILABLE";
+	default:
+		WARN_ON(1);
+		return "bug";
+	}
+}
+
+static void ath10k_config_radar_detection(struct ath10k *ar)
+{
+	struct ieee80211_channel *chan = ar->hw->conf.chandef.chan;
+	bool radar = ar->hw->conf.radar_enabled;
+	bool chan_radar = !!(chan->flags & IEEE80211_CHAN_RADAR);
+	enum nl80211_dfs_state dfs_state = chan->dfs_state;
+	int ret;
+
+	lockdep_assert_held(&ar->conf_mutex);
+
+	ath10k_dbg(ATH10K_DBG_MAC,
+		   "mac radar config update: chan %dMHz radar %d chan radar %d chan state %s\n",
+		   chan->center_freq, radar, chan_radar,
+		   ath10k_dfs_state(dfs_state));
+
+	/*
+	 * It's safe to call it even if CAC is not started.
+	 * This call here guarantees changing channel, etc. will stop CAC.
+	 */
+	ath10k_stop_cac(ar);
+
+	if (!radar)
+		return;
+
+	if (!chan_radar)
+		return;
+
+	if (dfs_state != NL80211_DFS_USABLE)
+		return;
+
+	ret = ath10k_start_cac(ar);
+	if (ret) {
+		/*
+		 * Not possible to start CAC on current channel so starting
+		 * radiation is not allowed, make this channel DFS_UNAVAILABLE
+		 * by indicating that radar was detected.
+		 */
+		ath10k_warn("failed to start CAC (%d)\n", ret);
+		ieee80211_radar_detected(ar->hw);
+	}
+}
+
 static void ath10k_control_beaconing(struct ath10k_vif *arvif,
 				struct ieee80211_bss_conf *info)
 {
@@ -1371,6 +1478,9 @@ static int ath10k_update_channel_list(struct ath10k *ar)
 			ch->ht40plus =
 				!(channel->flags & IEEE80211_CHAN_NO_HT40PLUS);
 
+			ch->chan_radar =
+				!!(channel->flags & IEEE80211_CHAN_RADAR);
+
 			passive = channel->flags & IEEE80211_CHAN_PASSIVE_SCAN;
 			ch->passive = passive;
 
@@ -1915,6 +2025,7 @@ void ath10k_halt(struct ath10k *ar)
 {
 	lockdep_assert_held(&ar->conf_mutex);
 
+	ath10k_stop_cac(ar);
 	del_timer_sync(&ar->scan.timeout);
 	ath10k_offchan_tx_purge(ar);
 	ath10k_mgmt_over_wmi_tx_purge(ar);
@@ -2029,11 +2140,16 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
 	mutex_lock(&ar->conf_mutex);
 
 	if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
-		ath10k_dbg(ATH10K_DBG_MAC, "mac config channel %d mhz\n",
-			   conf->chandef.chan->center_freq);
+		ath10k_dbg(ATH10K_DBG_MAC,
+			   "mac config channel %d mhz flags 0x%x\n",
+			   conf->chandef.chan->center_freq,
+			   conf->chandef.chan->flags);
+
 		spin_lock_bh(&ar->data_lock);
 		ar->rx_channel = conf->chandef.chan;
 		spin_unlock_bh(&ar->data_lock);
+
+		ath10k_config_radar_detection(ar);
 	}
 
 	if (changed & IEEE80211_CONF_CHANGE_POWER) {
@@ -3302,12 +3418,32 @@ static const struct ieee80211_iface_limit ath10k_if_limits[] = {
 	},
 };
 
-static const struct ieee80211_iface_combination ath10k_if_comb = {
-	.limits = ath10k_if_limits,
-	.n_limits = ARRAY_SIZE(ath10k_if_limits),
-	.max_interfaces = 8,
-	.num_different_channels = 1,
-	.beacon_int_infra_match = true,
+static const struct ieee80211_iface_limit ath10k_if_dfs_limits[] = {
+	{
+	.max	= 8,
+	.types	= BIT(NL80211_IFTYPE_AP)
+	},
+};
+
+static const struct ieee80211_iface_combination ath10k_if_comb[] = {
+	{
+		.limits = ath10k_if_limits,
+		.n_limits = ARRAY_SIZE(ath10k_if_limits),
+		.max_interfaces = 8,
+		.num_different_channels = 1,
+		.beacon_int_infra_match = true,
+	},
+	{
+		.limits = ath10k_if_dfs_limits,
+		.n_limits = ARRAY_SIZE(ath10k_if_dfs_limits),
+		.max_interfaces = 8,
+		.num_different_channels = 1,
+		.beacon_int_infra_match = true,
+		.radar_detect_widths =	BIT(NL80211_CHAN_WIDTH_20_NOHT) |
+					BIT(NL80211_CHAN_WIDTH_20) |
+					BIT(NL80211_CHAN_WIDTH_40) |
+					BIT(NL80211_CHAN_WIDTH_80),
+	}
 };
 
 static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
@@ -3531,8 +3667,8 @@ int ath10k_mac_register(struct ath10k *ar)
 	 */
 	ar->hw->queues = 4;
 
-	ar->hw->wiphy->iface_combinations = &ath10k_if_comb;
-	ar->hw->wiphy->n_iface_combinations = 1;
+	ar->hw->wiphy->iface_combinations = ath10k_if_comb;
+	ar->hw->wiphy->n_iface_combinations = ARRAY_SIZE(ath10k_if_comb);
 
 	ar->hw->netdev_features = NETIF_F_HW_CSUM;
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index b7dcdce..8a7ebcc 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -909,6 +909,11 @@ static int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
 	ath10k_dbg(ATH10K_DBG_MGMT,
 		   "event mgmt rx status %08x\n", rx_status);
 
+	if (test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags)) {
+		dev_kfree_skb(skb);
+		return 0;
+	}
+
 	if (rx_status & WMI_RX_STATUS_ERR_DECRYPT) {
 		dev_kfree_skb(skb);
 		return 0;
@@ -2304,6 +2309,7 @@ int ath10k_wmi_pdev_set_channel(struct ath10k *ar,
 {
 	struct wmi_set_channel_cmd *cmd;
 	struct sk_buff *skb;
+	u32 ch_flags = 0;
 
 	if (arg->passive)
 		return -EINVAL;
@@ -2312,10 +2318,14 @@ int ath10k_wmi_pdev_set_channel(struct ath10k *ar,
 	if (!skb)
 		return -ENOMEM;
 
+	if (arg->chan_radar)
+		ch_flags |= WMI_CHAN_FLAG_DFS;
+
 	cmd = (struct wmi_set_channel_cmd *)skb->data;
 	cmd->chan.mhz               = __cpu_to_le32(arg->freq);
 	cmd->chan.band_center_freq1 = __cpu_to_le32(arg->freq);
 	cmd->chan.mode              = arg->mode;
+	cmd->chan.flags		   |= __cpu_to_le32(ch_flags);
 	cmd->chan.min_power         = arg->min_power;
 	cmd->chan.max_power         = arg->max_power;
 	cmd->chan.reg_power         = arg->max_reg_power;
@@ -2864,6 +2874,7 @@ static int ath10k_wmi_vdev_start_restart(struct ath10k *ar,
 	struct sk_buff *skb;
 	const char *cmdname;
 	u32 flags = 0;
+	u32 ch_flags = 0;
 
 	if (cmd_id != ar->wmi.cmd->vdev_start_request_cmdid &&
 	    cmd_id != ar->wmi.cmd->vdev_restart_request_cmdid)
@@ -2890,6 +2901,8 @@ static int ath10k_wmi_vdev_start_restart(struct ath10k *ar,
 		flags |= WMI_VDEV_START_HIDDEN_SSID;
 	if (arg->pmf_enabled)
 		flags |= WMI_VDEV_START_PMF_ENABLED;
+	if (arg->channel.chan_radar)
+		ch_flags |= WMI_CHAN_FLAG_DFS;
 
 	cmd = (struct wmi_vdev_start_request_cmd *)skb->data;
 	cmd->vdev_id         = __cpu_to_le32(arg->vdev_id);
@@ -2911,6 +2924,7 @@ static int ath10k_wmi_vdev_start_restart(struct ath10k *ar,
 		__cpu_to_le32(arg->channel.band_center_freq1);
 
 	cmd->chan.mode = arg->channel.mode;
+	cmd->chan.flags |= __cpu_to_le32(ch_flags);
 	cmd->chan.min_power = arg->channel.min_power;
 	cmd->chan.max_power = arg->channel.max_power;
 	cmd->chan.reg_power = arg->channel.max_reg_power;
@@ -2918,9 +2932,10 @@ static int ath10k_wmi_vdev_start_restart(struct ath10k *ar,
 	cmd->chan.antenna_max = arg->channel.max_antenna_gain;
 
 	ath10k_dbg(ATH10K_DBG_WMI,
-		   "wmi vdev %s id 0x%x freq %d, mode %d, ch_flags: 0x%0X,"
-		   "max_power: %d\n", cmdname, arg->vdev_id, arg->channel.freq,
-		   arg->channel.mode, flags, arg->channel.max_power);
+		   "wmi vdev %s id 0x%x flags: 0x%0X, freq %d, mode %d, "
+		   "ch_flags: 0x%0X, max_power: %d\n", cmdname, arg->vdev_id,
+		   flags, arg->channel.freq, arg->channel.mode,
+		   cmd->chan.flags, arg->channel.max_power);
 
 	return ath10k_wmi_cmd_send(ar, skb, cmd_id);
 }
@@ -3254,6 +3269,8 @@ int ath10k_wmi_scan_chan_list(struct ath10k *ar,
 			flags |= WMI_CHAN_FLAG_ALLOW_VHT;
 		if (ch->ht40plus)
 			flags |= WMI_CHAN_FLAG_HT40_PLUS;
+		if (ch->chan_radar)
+			flags |= WMI_CHAN_FLAG_DFS;
 
 		ci->mhz               = __cpu_to_le32(ch->freq);
 		ci->band_center_freq1 = __cpu_to_le32(ch->freq);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index ad53333..b47a301 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -916,6 +916,7 @@ struct wmi_channel_arg {
 	bool allow_ht;
 	bool allow_vht;
 	bool ht40plus;
+	bool chan_radar;
 	/* note: power unit is 0.5 dBm */
 	u32 min_power;
 	u32 max_power;
-- 
1.8.1.2



From marek.puzyniak at tieto.com  Tue Oct 29 08:06:34 2013
From: marek.puzyniak at tieto.com (Marek Puzyniak)
Date: Tue, 29 Oct 2013 13:06:34 +0100
Subject: [PATCH 3/3] ath10k: add debugfs file to control radar events blocking
In-Reply-To: <1383048394-15256-1-git-send-email-marek.puzyniak@tieto.com>
References: <1383048394-15256-1-git-send-email-marek.puzyniak@tieto.com>
Message-ID: <1383048394-15256-3-git-send-email-marek.puzyniak@tieto.com>

Sometimes for DFS testing is required to stay on current channel even after
radar detected. This patch allows to enable/disable radar detected event to be
passed to mac80211.

By default radar detected event in not blocked.

To block it:
echo 1 > /sys/kernel/debug/ieee80211/phyX/ath10k/dfs_block_radar_events

To unblock again:
echo 0 > /sys/kernel/debug/ieee80211/phyX/ath10k/dfs_block_radar_events

Inform about blocking radar detected event even when logs are disabled
for throughput/performance reasons.

Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>
Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h  | 1 +
 drivers/net/wireless/ath/ath10k/debug.c | 4 ++++
 drivers/net/wireless/ath/ath10k/wmi.c   | 8 ++++++++
 3 files changed, 13 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index d5fd74b..cdedcbf 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -409,6 +409,7 @@ struct ath10k {
 	bool monitor_present;
 	unsigned int filter_flags;
 	unsigned long dev_flags;
+	u32 dfs_block_radar_events;
 
 	struct wmi_pdev_set_wmm_params_arg wmm_params;
 	struct completion install_key_done;
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index d4d0cdd..2cfe96b 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -749,6 +749,10 @@ int ath10k_debug_create(struct ath10k *ar)
 				    ar->debug.debugfs_phy, ar,
 				    &fops_simulate_radar);
 
+		debugfs_create_bool("dfs_block_radar_events", S_IWUSR,
+				    ar->debug.debugfs_phy,
+				    &ar->dfs_block_radar_events);
+
 		debugfs_create_file("dfs_stats", S_IRUSR,
 				    ar->debug.debugfs_phy, ar,
 				    &fops_dfs_stats);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 8a7ebcc..8600465 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1456,6 +1456,14 @@ static void ath10k_dfs_radar_report(struct ath10k *ar,
 
 	ath10k_dbg(ATH10K_DBG_REGULATORY, "dfs radar detected\n");
 	ATH10K_DFS_STAT_INC(ar, radar_detected);
+
+	/* Control radar events reporting in debugfs file
+	   dfs_block_radar_events */
+	if (ar->dfs_block_radar_events) {
+		ath10k_info("DFS Radar detected, but ignored as requested\n");
+		return;
+	}
+
 	ieee80211_radar_detected(ar->hw);
 }
 
-- 
1.8.1.2



From marek.puzyniak at tieto.com  Tue Oct 29 08:06:32 2013
From: marek.puzyniak at tieto.com (Marek Puzyniak)
Date: Tue, 29 Oct 2013 13:06:32 +0100
Subject: [PATCH 1/3] ath10k: add phyerr/dfs handling
Message-ID: <1383048394-15256-1-git-send-email-marek.puzyniak@tieto.com>

From: Janusz Dziedzic <janusz.dziedzic at tieto.com>

Handle phyerr, dfs event, radar_report and fft_report.
Add also debugfs dfs_simulate_radar and dfs_stats files.
Use ath dfs pattern detector.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h  |  13 ++
 drivers/net/wireless/ath/ath10k/debug.c |  87 ++++++++++++
 drivers/net/wireless/ath/ath10k/debug.h |   3 +
 drivers/net/wireless/ath/ath10k/mac.c   |  24 ++++
 drivers/net/wireless/ath/ath10k/wmi.c   | 244 +++++++++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath10k/wmi.h   |  85 +++++++++++
 6 files changed, 455 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 0934f76..671dbe3 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -30,6 +30,7 @@
 #include "wmi.h"
 #include "../ath.h"
 #include "../regd.h"
+#include "../dfs_pattern_detector.h"
 
 #define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB)
 #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
@@ -192,6 +193,14 @@ struct ath10k_target_stats {
 
 };
 
+struct ath10k_dfs_stats {
+	u32 phy_errors;
+	u32 pulses_total;
+	u32 pulses_detected;
+	u32 pulses_discarded;
+	u32 radar_detected;
+};
+
 #define ATH10K_MAX_NUM_PEER_IDS (1 << 11) /* htt rx_desc limit */
 
 struct ath10k_peer {
@@ -261,6 +270,8 @@ struct ath10k_debug {
 
 	unsigned long htt_stats_mask;
 	struct delayed_work htt_stats_dwork;
+	struct ath10k_dfs_stats dfs_stats;
+	struct ath_dfs_pool_stats dfs_pool_stats;
 };
 
 enum ath10k_state {
@@ -428,6 +439,8 @@ struct ath10k {
 	u32 survey_last_cycle_count;
 	struct survey_info survey[ATH10K_NUM_CHANS];
 
+	struct dfs_pattern_detector *dfs_detector;
+
 #ifdef CONFIG_ATH10K_DEBUGFS
 	struct ath10k_debug debug;
 #endif
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 760ff22..d4d0cdd 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -21,6 +21,14 @@
 #include "core.h"
 #include "debug.h"
 
+#define ATH10K_DFS_STAT(s, p) (\
+	len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \
+			 ar->debug.dfs_stats.p))
+
+#define ATH10K_DFS_POOL_STAT(s, p) (\
+	len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \
+			 ar->debug.dfs_pool_stats.p))
+
 /* ms */
 #define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000
 
@@ -639,6 +647,75 @@ void ath10k_debug_stop(struct ath10k *ar)
 		cancel_delayed_work(&ar->debug.htt_stats_dwork);
 }
 
+static ssize_t ath10k_write_simulate_radar(struct file *file,
+					   const char __user *user_buf,
+					   size_t count, loff_t *ppos)
+{
+	struct ath10k *ar = file->private_data;
+
+	ieee80211_radar_detected(ar->hw);
+
+	return count;
+}
+
+static const struct file_operations fops_simulate_radar = {
+	.write = ath10k_write_simulate_radar,
+	.open = simple_open,
+	.owner = THIS_MODULE,
+	.llseek = default_llseek,
+};
+
+static ssize_t ath10k_read_file_dfs(struct file *file, char __user *user_buf,
+				    size_t count, loff_t *ppos)
+{
+	int retval = 0, size = 8000, len = 0;
+	struct ath10k *ar = file->private_data;
+	char *buf;
+
+	buf = kzalloc(size, GFP_KERNEL);
+	if (buf == NULL)
+		return -ENOMEM;
+
+	if (!ar->dfs_detector) {
+		len += scnprintf(buf + len, size - len, "DFS not enabled\n");
+		goto exit;
+	}
+
+	ar->debug.dfs_pool_stats = ar->dfs_detector->get_stats(ar->dfs_detector);
+
+	len += scnprintf(buf + len, size - len, "Pulse detector statistics:\n");
+	ATH10K_DFS_STAT("reported phy errors     ", phy_errors);
+	ATH10K_DFS_STAT("pulse events reported   ", pulses_total);
+	ATH10K_DFS_STAT("DFS pulses detected     ", pulses_detected);
+	ATH10K_DFS_STAT("DFS pulses discarded    ", pulses_discarded);
+	ATH10K_DFS_STAT("Radars detected         ", radar_detected);
+
+	len += scnprintf(buf + len, size - len, "Global Pool statistics:\n");
+	ATH10K_DFS_POOL_STAT("Pool references         ", pool_reference);
+	ATH10K_DFS_POOL_STAT("Pulses allocated        ", pulse_allocated);
+	ATH10K_DFS_POOL_STAT("Pulses alloc error      ", pulse_alloc_error);
+	ATH10K_DFS_POOL_STAT("Pulses in use           ", pulse_used);
+	ATH10K_DFS_POOL_STAT("Seqs. allocated         ", pseq_allocated);
+	ATH10K_DFS_POOL_STAT("Seqs. alloc error       ", pseq_alloc_error);
+	ATH10K_DFS_POOL_STAT("Seqs. in use            ", pseq_used);
+
+exit:
+	if (len > size)
+		len = size;
+
+	retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
+	kfree(buf);
+
+	return retval;
+}
+
+static const struct file_operations fops_dfs_stats = {
+	.read = ath10k_read_file_dfs,
+	.open = simple_open,
+	.owner = THIS_MODULE,
+	.llseek = default_llseek,
+};
+
 int ath10k_debug_create(struct ath10k *ar)
 {
 	ar->debug.debugfs_phy = debugfs_create_dir("ath10k",
@@ -667,6 +744,16 @@ int ath10k_debug_create(struct ath10k *ar)
 	debugfs_create_file("htt_stats_mask", S_IRUSR, ar->debug.debugfs_phy,
 			    ar, &fops_htt_stats_mask);
 
+	if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED)) {
+		debugfs_create_file("dfs_simulate_radar", S_IWUSR,
+				    ar->debug.debugfs_phy, ar,
+				    &fops_simulate_radar);
+
+		debugfs_create_file("dfs_stats", S_IRUSR,
+				    ar->debug.debugfs_phy, ar,
+				    &fops_dfs_stats);
+	}
+
 	return 0;
 }
 
diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index 46e640a..cde53d6 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -33,6 +33,7 @@ enum ath10k_debug_mask {
 	ATH10K_DBG_MGMT		= 0x00000100,
 	ATH10K_DBG_DATA		= 0x00000200,
 	ATH10K_DBG_BMI		= 0x00000400,
+	ATH10K_DBG_REGULATORY	= 0x00000800,
 	ATH10K_DBG_ANY		= 0xffffffff,
 };
 
@@ -53,6 +54,7 @@ void ath10k_debug_read_service_map(struct ath10k *ar,
 void ath10k_debug_read_target_stats(struct ath10k *ar,
 				    struct wmi_stats_event *ev);
 
+#define ATH10K_DFS_STAT_INC(ar, c) (ar->debug.dfs_stats.c++)
 #else
 static inline int ath10k_debug_start(struct ath10k *ar)
 {
@@ -82,6 +84,7 @@ static inline void ath10k_debug_read_target_stats(struct ath10k *ar,
 						  struct wmi_stats_event *ev)
 {
 }
+#define ATH10K_DFS_STAT_INC(ar, c) do { } while (0)
 #endif /* CONFIG_ATH10K_DEBUGFS */
 
 #ifdef CONFIG_ATH10K_DEBUG
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index bbb0efa..79f8bfd 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1438,9 +1438,20 @@ static void ath10k_reg_notifier(struct wiphy *wiphy,
 {
 	struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
 	struct ath10k *ar = hw->priv;
+	bool result;
 
 	ath_reg_notifier_apply(wiphy, request, &ar->ath_common.regulatory);
 
+	if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) {
+		ath10k_dbg(ATH10K_DBG_REGULATORY, "dfs region 0x%X\n",
+			   request->dfs_region);
+		result = ar->dfs_detector->set_dfs_domain(ar->dfs_detector,
+							  request->dfs_region);
+		if (!result)
+			ath10k_warn("dfs region 0x%X not supported, will trigger radar for every pulse\n",
+				    request->dfs_region);
+	}
+
 	mutex_lock(&ar->conf_mutex);
 	if (ar->state == ATH10K_STATE_ON)
 		ath10k_regd_update(ar);
@@ -3525,6 +3536,16 @@ int ath10k_mac_register(struct ath10k *ar)
 
 	ar->hw->netdev_features = NETIF_F_HW_CSUM;
 
+	if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED)) {
+		/* Init ath dfs pattern detector */
+		ar->ath_common.debug_mask = ATH_DBG_DFS;
+		ar->dfs_detector = dfs_pattern_detector_init(&ar->ath_common,
+							     NL80211_DFS_UNSET);
+
+		if (!ar->dfs_detector)
+			ath10k_warn("dfs pattern detector init failed\n");
+	}
+
 	ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy,
 			    ath10k_reg_notifier);
 	if (ret) {
@@ -3560,6 +3581,9 @@ void ath10k_mac_unregister(struct ath10k *ar)
 {
 	ieee80211_unregister_hw(ar->hw);
 
+	if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector)
+		ar->dfs_detector->exit(ar->dfs_detector);
+
 	kfree(ar->mac.sbands[IEEE80211_BAND_2GHZ].channels);
 	kfree(ar->mac.sbands[IEEE80211_BAND_5GHZ].channels);
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index a796d0b..b7dcdce 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1383,9 +1383,251 @@ static void ath10k_wmi_event_tbttoffset_update(struct ath10k *ar,
 	ath10k_dbg(ATH10K_DBG_WMI, "WMI_TBTTOFFSET_UPDATE_EVENTID\n");
 }
 
+static void ath10k_dfs_radar_report(struct ath10k *ar,
+				    struct wmi_single_phyerr_rx_event *event,
+				    struct phyerr_radar_report *rr,
+				    u64 tsf)
+{
+	u32 reg0, reg1, tsf32l;
+	struct pulse_event pe;
+	u64 tsf64;
+	u8 rssi, width;
+
+	reg0 = __le32_to_cpu(rr->reg0);
+	reg1 = __le32_to_cpu(rr->reg1);
+
+	ath10k_dbg(ATH10K_DBG_REGULATORY,
+		   "wmi phyerr radar report chirp %d max_width %d agc_total_gain %d pulse_delta_diff %d\n",
+		   MS(reg0, RADAR_REPORT_REG0_PULSE_IS_CHIRP),
+		   MS(reg0, RADAR_REPORT_REG0_PULSE_IS_MAX_WIDTH),
+		   MS(reg0, RADAR_REPORT_REG0_AGC_TOTAL_GAIN),
+		   MS(reg0, RADAR_REPORT_REG0_PULSE_DELTA_DIFF));
+	ath10k_dbg(ATH10K_DBG_REGULATORY,
+		   "wmi phyerr radar report pulse_delta_pean %d pulse_sidx %d fft_valid %d agc_mb_gain %d subchan_mask %d\n",
+		   MS(reg0, RADAR_REPORT_REG0_PULSE_DELTA_PEAK),
+		   MS(reg0, RADAR_REPORT_REG0_PULSE_SIDX),
+		   MS(reg1, RADAR_REPORT_REG1_PULSE_SRCH_FFT_VALID),
+		   MS(reg1, RADAR_REPORT_REG1_PULSE_AGC_MB_GAIN),
+		   MS(reg1, RADAR_REPORT_REG1_PULSE_SUBCHAN_MASK));
+	ath10k_dbg(ATH10K_DBG_REGULATORY,
+		   "wmi phyerr radar report pulse_tsf_offset 0x%X pulse_dur: %d\n",
+		   MS(reg1, RADAR_REPORT_REG1_PULSE_TSF_OFFSET),
+		   MS(reg1, RADAR_REPORT_REG1_PULSE_DUR));
+
+	if (!ar->dfs_detector)
+		return;
+
+	/* report event to DFS pattern detector */
+	tsf32l = __le32_to_cpu(event->hdr.tsf_timestamp);
+	tsf64 = tsf & (~0xFFFFFFFFULL);
+	tsf64 |= tsf32l;
+
+	width = MS(reg1, RADAR_REPORT_REG1_PULSE_DUR);
+	rssi = event->hdr.rssi_combined;
+
+	/*
+	 * hardware store this as 8 bit signed value,
+	 * set to zero if negative number
+	 */
+	if (rssi & 0x80)
+		rssi = 0;
+
+	pe.ts = tsf64;
+	pe.freq = ar->hw->conf.chandef.chan->center_freq;
+	pe.width = width;
+	pe.rssi = rssi;
+
+	ath10k_dbg(ATH10K_DBG_REGULATORY,
+		   "dfs add pulse freq: %d, width: %d, rssi %d, tsf: %llX\n",
+		   pe.freq, pe.width, pe.rssi, pe.ts);
+
+	ATH10K_DFS_STAT_INC(ar, pulses_detected);
+
+	if (!ar->dfs_detector->add_pulse(ar->dfs_detector, &pe)) {
+		ath10k_dbg(ATH10K_DBG_REGULATORY,
+			   "dfs no pulse pattern detected, yet\n");
+		return;
+	}
+
+	ath10k_dbg(ATH10K_DBG_REGULATORY, "dfs radar detected\n");
+	ATH10K_DFS_STAT_INC(ar, radar_detected);
+	ieee80211_radar_detected(ar->hw);
+}
+
+static int ath10k_dfs_fft_report(struct ath10k *ar,
+				 struct wmi_single_phyerr_rx_event *event,
+				 struct phyerr_fft_report *fftr,
+				 u64 tsf)
+{
+	u32 reg0, reg1;
+	u8 rssi, peak_mag;
+
+	reg0 = __le32_to_cpu(fftr->reg0);
+	reg1 = __le32_to_cpu(fftr->reg1);
+	rssi = event->hdr.rssi_combined;
+
+	ath10k_dbg(ATH10K_DBG_REGULATORY,
+		   "wmi phyerr fft report total_gain_db %d base_pwr_db %d fft_chn_idx %d peak_sidx %d\n",
+		   MS(reg0, SEARCH_FFT_REPORT_REG0_TOTAL_GAIN_DB),
+		   MS(reg0, SEARCH_FFT_REPORT_REG0_BASE_PWR_DB),
+		   MS(reg0, SEARCH_FFT_REPORT_REG0_FFT_CHN_IDX),
+		   MS(reg0, SEARCH_FFT_REPORT_REG0_PEAK_SIDX));
+	ath10k_dbg(ATH10K_DBG_REGULATORY,
+		   "wmi phyerr fft report rel_pwr_db %d avgpwr_db %d peak_mag %d num_store_bin %d\n",
+		   MS(reg1, SEARCH_FFT_REPORT_REG1_RELPWR_DB),
+		   MS(reg1, SEARCH_FFT_REPORT_REG1_AVGPWR_DB),
+		   MS(reg1, SEARCH_FFT_REPORT_REG1_PEAK_MAG),
+		   MS(reg1, SEARCH_FFT_REPORT_REG1_NUM_STR_BINS_IB));
+
+	peak_mag = MS(reg1, SEARCH_FFT_REPORT_REG1_PEAK_MAG);
+
+	/* false event detection */
+	if (rssi == DFS_RSSI_POSSIBLY_FALSE &&
+	    peak_mag < 2 * DFS_PEAK_MAG_THOLD_POSSIBLY_FALSE) {
+		ath10k_dbg(ATH10K_DBG_REGULATORY, "dfs false pulse detected\n");
+		ATH10K_DFS_STAT_INC(ar, pulses_discarded);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static void ath10k_wmi_event_dfs(struct ath10k *ar,
+				 struct wmi_single_phyerr_rx_event *event,
+				 u64 tsf)
+{
+	int buf_len, tlv_len, res, i = 0;
+	struct phyerr_tlv *tlv;
+	struct phyerr_radar_report *rr;
+	struct phyerr_fft_report *fftr;
+	u8 *tlv_buf;
+
+	buf_len = __le32_to_cpu(event->hdr.buf_len);
+	ath10k_dbg(ATH10K_DBG_REGULATORY,
+		   "wmi event dfs err_code %d rssi %d tsfl 0x%X tsf64 0x%llX len %d\n",
+		   event->hdr.phy_err_code, event->hdr.rssi_combined,
+		   __le32_to_cpu(event->hdr.tsf_timestamp), tsf, buf_len);
+
+	/* Skip event if DFS disabled */
+	if (!config_enabled(CONFIG_ATH10K_DFS_CERTIFIED))
+		return;
+
+	ATH10K_DFS_STAT_INC(ar, pulses_total);
+
+	while (i < buf_len) {
+		if (i + sizeof(*tlv) > buf_len) {
+			ath10k_warn("too short buf for tlv header (%d)\n", i);
+			return;
+		}
+
+		tlv = (struct phyerr_tlv *)&event->bufp[i];
+		tlv_len = __le16_to_cpu(tlv->len);
+		tlv_buf = &event->bufp[i + sizeof(*tlv)];
+		ath10k_dbg(ATH10K_DBG_REGULATORY,
+			   "wmi event dfs tlv_len %d tlv_tag 0x%02X tlv_sig 0x%02X\n",
+			   tlv_len, tlv->tag, tlv->sig);
+
+		switch (tlv->tag) {
+		case PHYERR_TLV_TAG_RADAR_PULSE_SUMMARY:
+			if (i + sizeof(*tlv) + sizeof(*rr) > buf_len) {
+				ath10k_warn("too short radar pulse summary (%d)\n", i);
+				return;
+			}
+
+			rr = (struct phyerr_radar_report *)tlv_buf;
+			ath10k_dfs_radar_report(ar, event, rr, tsf);
+			break;
+		case PHYERR_TLV_TAG_SEARCH_FFT_REPORT:
+			if (i + sizeof(*tlv) + sizeof(*fftr) > buf_len) {
+				ath10k_warn("too short fft report (%d)\n", i);
+				return;
+			}
+
+			fftr = (struct phyerr_fft_report *)tlv_buf;
+			res = ath10k_dfs_fft_report(ar, event, fftr, tsf);
+			if (res)
+				return;
+			break;
+		}
+
+		i += sizeof(*tlv) + tlv_len;
+	}
+}
+
+static void ath10k_wmi_event_spectral_scan(struct ath10k *ar,
+				struct wmi_single_phyerr_rx_event *event,
+				u64 tsf)
+{
+	ath10k_dbg(ATH10K_DBG_WMI, "wmi event spectral scan\n");
+}
+
 static void ath10k_wmi_event_phyerr(struct ath10k *ar, struct sk_buff *skb)
 {
-	ath10k_dbg(ATH10K_DBG_WMI, "WMI_PHYERR_EVENTID\n");
+	struct wmi_comb_phyerr_rx_event *comb_event;
+	struct wmi_single_phyerr_rx_event *event;
+	u32 count, i, buf_len, phy_err_code;
+	u64 tsf;
+	int left_len = skb->len;
+
+	ATH10K_DFS_STAT_INC(ar, phy_errors);
+
+	/* Check if combined event available */
+	if (left_len < sizeof(*comb_event)) {
+		ath10k_warn("wmi phyerr combined event wrong len\n");
+		return;
+	}
+
+	left_len -= sizeof(*comb_event);
+
+	/* Check number of included events */
+	comb_event = (struct wmi_comb_phyerr_rx_event *)skb->data;
+	count = __le32_to_cpu(comb_event->hdr.num_phyerr_events);
+
+	tsf = __le32_to_cpu(comb_event->hdr.tsf_u32);
+	tsf <<= 32;
+	tsf |= __le32_to_cpu(comb_event->hdr.tsf_l32);
+
+	ath10k_dbg(ATH10K_DBG_WMI,
+		   "wmi event phyerr count %d tsf64 0x%llX\n",
+		   count, tsf);
+
+	event = (struct wmi_single_phyerr_rx_event *)comb_event->bufp;
+	for (i = 0; i < count; i++) {
+		/* Check if we can read event header */
+		if (left_len < sizeof(*event)) {
+			ath10k_warn("single event (%d) wrong head len\n", i);
+			return;
+		}
+
+		left_len -= sizeof(*event);
+
+		buf_len = __le32_to_cpu(event->hdr.buf_len);
+		phy_err_code = event->hdr.phy_err_code;
+
+		if (left_len < buf_len) {
+			ath10k_warn("single event (%d) wrong buf len\n", i);
+			return;
+		}
+
+		left_len -= buf_len;
+
+		switch (phy_err_code) {
+		case PHY_ERROR_RADAR:
+			ath10k_wmi_event_dfs(ar, event, tsf);
+			break;
+		case PHY_ERROR_SPECTRAL_SCAN:
+			ath10k_wmi_event_spectral_scan(ar, event, tsf);
+			break;
+		case PHY_ERROR_FALSE_RADAR_EXT:
+			ath10k_wmi_event_dfs(ar, event, tsf);
+			ath10k_wmi_event_spectral_scan(ar, event, tsf);
+			break;
+		default:
+			break;
+		}
+
+		event += sizeof(*event) + buf_len;
+	}
 }
 
 static void ath10k_wmi_event_roam(struct ath10k *ar, struct sk_buff *skb)
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 81e33a7..ad53333 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -1978,6 +1978,10 @@ struct wmi_mgmt_rx_event_v2 {
 #define WMI_RX_STATUS_ERR_MIC			0x10
 #define WMI_RX_STATUS_ERR_KEY_CACHE_MISS	0x20
 
+#define PHY_ERROR_SPECTRAL_SCAN		0x26
+#define PHY_ERROR_FALSE_RADAR_EXT		0x24
+#define PHY_ERROR_RADAR				0x05
+
 struct wmi_single_phyerr_rx_hdr {
 	/* TSF timestamp */
 	__le32 tsf_timestamp;
@@ -2069,6 +2073,87 @@ struct wmi_comb_phyerr_rx_event {
 	u8 bufp[0];
 } __packed;
 
+#define PHYERR_TLV_SIG				0xBB
+#define PHYERR_TLV_TAG_SEARCH_FFT_REPORT	0xFB
+#define PHYERR_TLV_TAG_RADAR_PULSE_SUMMARY	0xF8
+
+struct phyerr_radar_report {
+	__le32 reg0; /* RADAR_REPORT_REG0_* */
+	__le32 reg1; /* REDAR_REPORT_REG1_* */
+} __packed;
+
+#define RADAR_REPORT_REG0_PULSE_IS_CHIRP_MASK		0x80000000
+#define RADAR_REPORT_REG0_PULSE_IS_CHIRP_LSB		31
+
+#define RADAR_REPORT_REG0_PULSE_IS_MAX_WIDTH_MASK	0x40000000
+#define RADAR_REPORT_REG0_PULSE_IS_MAX_WIDTH_LSB	30
+
+#define RADAR_REPORT_REG0_AGC_TOTAL_GAIN_MASK		0x3FF00000
+#define RADAR_REPORT_REG0_AGC_TOTAL_GAIN_LSB		20
+
+#define RADAR_REPORT_REG0_PULSE_DELTA_DIFF_MASK		0x000F0000
+#define RADAR_REPORT_REG0_PULSE_DELTA_DIFF_LSB		16
+
+#define RADAR_REPORT_REG0_PULSE_DELTA_PEAK_MASK		0x0000FC00
+#define RADAR_REPORT_REG0_PULSE_DELTA_PEAK_LSB		10
+
+#define RADAR_REPORT_REG0_PULSE_SIDX_MASK		0x000003FF
+#define RADAR_REPORT_REG0_PULSE_SIDX_LSB		0
+
+#define RADAR_REPORT_REG1_PULSE_SRCH_FFT_VALID_MASK	0x80000000
+#define RADAR_REPORT_REG1_PULSE_SRCH_FFT_VALID_LSB	31
+
+#define RADAR_REPORT_REG1_PULSE_AGC_MB_GAIN_MASK	0x7F000000
+#define RADAR_REPORT_REG1_PULSE_AGC_MB_GAIN_LSB		24
+
+#define RADAR_REPORT_REG1_PULSE_SUBCHAN_MASK_MASK	0x00FF0000
+#define RADAR_REPORT_REG1_PULSE_SUBCHAN_MASK_LSB	16
+
+#define RADAR_REPORT_REG1_PULSE_TSF_OFFSET_MASK		0x0000FF00
+#define RADAR_REPORT_REG1_PULSE_TSF_OFFSET_LSB		8
+
+#define RADAR_REPORT_REG1_PULSE_DUR_MASK		0x000000FF
+#define RADAR_REPORT_REG1_PULSE_DUR_LSB			0
+
+struct phyerr_fft_report {
+	__le32 reg0; /* SEARCH_FFT_REPORT_REG0_ * */
+	__le32 reg1; /* SEARCH_FFT_REPORT_REG1_ * */
+} __packed;
+
+#define SEARCH_FFT_REPORT_REG0_TOTAL_GAIN_DB_MASK	0xFF800000
+#define SEARCH_FFT_REPORT_REG0_TOTAL_GAIN_DB_LSB	23
+
+#define SEARCH_FFT_REPORT_REG0_BASE_PWR_DB_MASK		0x007FC000
+#define SEARCH_FFT_REPORT_REG0_BASE_PWR_DB_LSB		14
+
+#define SEARCH_FFT_REPORT_REG0_FFT_CHN_IDX_MASK		0x00003000
+#define SEARCH_FFT_REPORT_REG0_FFT_CHN_IDX_LSB		12
+
+#define SEARCH_FFT_REPORT_REG0_PEAK_SIDX_MASK		0x00000FFF
+#define SEARCH_FFT_REPORT_REG0_PEAK_SIDX_LSB		0
+
+#define SEARCH_FFT_REPORT_REG1_RELPWR_DB_MASK		0xFC000000
+#define SEARCH_FFT_REPORT_REG1_RELPWR_DB_LSB		26
+
+#define SEARCH_FFT_REPORT_REG1_AVGPWR_DB_MASK		0x03FC0000
+#define SEARCH_FFT_REPORT_REG1_AVGPWR_DB_LSB		18
+
+#define SEARCH_FFT_REPORT_REG1_PEAK_MAG_MASK		0x0003FF00
+#define SEARCH_FFT_REPORT_REG1_PEAK_MAG_LSB		8
+
+#define SEARCH_FFT_REPORT_REG1_NUM_STR_BINS_IB_MASK	0x000000FF
+#define SEARCH_FFT_REPORT_REG1_NUM_STR_BINS_IB_LSB	0
+
+
+struct phyerr_tlv {
+	__le16 len;
+	u8 tag;
+	u8 sig;
+} __packed;
+
+#define DFS_RSSI_POSSIBLY_FALSE			50
+#define DFS_PEAK_MAG_THOLD_POSSIBLY_FALSE	40
+
 struct wmi_mgmt_tx_hdr {
 	__le32 vdev_id;
 	struct wmi_mac_addr peer_macaddr;
-- 
1.8.1.2



From joe at perches.com  Tue Oct 29 13:25:01 2013
From: joe at perches.com (Joe Perches)
Date: Tue, 29 Oct 2013 10:25:01 -0700
Subject: [PATCH 1/3] ath10k: add phyerr/dfs handling
In-Reply-To: <1383048394-15256-1-git-send-email-marek.puzyniak@tieto.com>
References: <1383048394-15256-1-git-send-email-marek.puzyniak@tieto.com>
Message-ID: <1383067501.12439.5.camel@joe-AO722>

On Tue, 2013-10-29 at 13:06 +0100, Marek Puzyniak wrote:
> Handle phyerr, dfs event, radar_report and fft_report.
> Add also debugfs dfs_simulate_radar and dfs_stats files.
> Use ath dfs pattern detector.

Just some simple notes:

> diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
[]
> +#define ATH10K_DFS_STAT(s, p) (\
> +	len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \
> +			 ar->debug.dfs_stats.p))
> +
> +#define ATH10K_DFS_POOL_STAT(s, p) (\
> +	len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \
> +			 ar->debug.dfs_pool_stats.p))

You've already got sizes for the description field
might as well use %-28s

> +static ssize_t ath10k_read_file_dfs(struct file *file, char __user *user_buf,
> +				    size_t count, loff_t *ppos)
> +{
> +	int retval = 0, size = 8000, len = 0;

size should either be a #define or a const

[]

> +	len += scnprintf(buf + len, size - len, "Pulse detector statistics:\n");
> +	ATH10K_DFS_STAT("reported phy errors     ", phy_errors);
> +	ATH10K_DFS_STAT("pulse events reported   ", pulses_total);
> +	ATH10K_DFS_STAT("DFS pulses detected     ", pulses_detected);
> +	ATH10K_DFS_STAT("DFS pulses discarded    ", pulses_discarded);
> +	ATH10K_DFS_STAT("Radars detected         ", radar_detected);
> +
> +	len += scnprintf(buf + len, size - len, "Global Pool statistics:\n");
> +	ATH10K_DFS_POOL_STAT("Pool references         ", pool_reference);
> +	ATH10K_DFS_POOL_STAT("Pulses allocated        ", pulse_allocated);
> +	ATH10K_DFS_POOL_STAT("Pulses alloc error      ", pulse_alloc_error);
> +	ATH10K_DFS_POOL_STAT("Pulses in use           ", pulse_used);
> +	ATH10K_DFS_POOL_STAT("Seqs. allocated         ", pseq_allocated);
> +	ATH10K_DFS_POOL_STAT("Seqs. alloc error       ", pseq_alloc_error);
> +	ATH10K_DFS_POOL_STAT("Seqs. in use            ", pseq_used);

If using %-28s, the trailing quoted spaces can be removed.




From greearb at candelatech.com  Tue Oct 29 17:38:57 2013
From: greearb at candelatech.com (greearb at candelatech.com)
Date: Tue, 29 Oct 2013 14:38:57 -0700
Subject: [PATCH] ath10k:  Fix crash due to tasklet race.
Message-ID: <1383082737-20728-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb at candelatech.com>

The tasklet can run after the rings have been cleaned up,
so check for NULL before de-referencing the ring.

Signed-off-by: Ben Greear <greearb at candelatech.com>
---
 drivers/net/wireless/ath/ath10k/ce.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index d243f28..dfcfda9 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -547,12 +547,18 @@ static int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state,
 	struct ath10k_ce_ring *src_ring = ce_state->src_ring;
 	u32 ctrl_addr = ce_state->ctrl_addr;
 	struct ath10k *ar = ce_state->ar;
-	unsigned int nentries_mask = src_ring->nentries_mask;
-	unsigned int sw_index = src_ring->sw_index;
+	unsigned int nentries_mask;
+	unsigned int sw_index;
 	struct ce_desc *sdesc, *sbase;
 	unsigned int read_index;
 	int ret;
 
+	if (!src_ring)
+		return -EIO;
+
+	nentries_mask = src_ring->nentries_mask;
+	sw_index = src_ring->sw_index;
+
 	if (src_ring->hw_index == sw_index) {
 		/*
 		 * The SW completion index has caught up with the cached
-- 
1.7.11.7



From weiyj.lk at gmail.com  Wed Oct 30 01:24:39 2013
From: weiyj.lk at gmail.com (Wei Yongjun)
Date: Wed, 30 Oct 2013 13:24:39 +0800
Subject: [PATCH -next] ath10k: fix possible memory leak in ath10k_pci_probe()
Message-ID: <CAPgLHd9o1oGjjM=9B2H0tB41t8Kinp_1Djp6aA=sW5Eo5M7jfA@mail.gmail.com>

From: Wei Yongjun <yongjun_wei at trendmicro.com.cn>

memory is malloced in ath10k_pci_probe() and should be freed before
leaving from the error handling cases, otherwise it will cause
memory leak.

Signed-off-by: Wei Yongjun <yongjun_wei at trendmicro.com.cn>
---
 drivers/net/wireless/ath/ath10k/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index dff23d9..af01631 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2470,7 +2470,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
 	ret = ath10k_do_pci_wake(ar);
 	if (ret) {
 		ath10k_err("Failed to get chip id: %d\n", ret);
-		return ret;
+		goto err_iomap;
 	}
 
 	chip_id = ath10k_pci_read32(ar,



From michal.kazior at tieto.com  Wed Oct 30 05:03:48 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 30 Oct 2013 10:03:48 +0100
Subject: [PATCH] ath10k: Fix crash due to tasklet race.
In-Reply-To: <1383082737-20728-1-git-send-email-greearb@candelatech.com>
References: <1383082737-20728-1-git-send-email-greearb@candelatech.com>
Message-ID: <CA+BoTQ=qUgR4TEcUMjV88RD+fFreCkkEtHfu5hB2_BguirfNHg@mail.gmail.com>

On 29 October 2013 22:38,  <greearb at candelatech.com> wrote:
> From: Ben Greear <greearb at candelatech.com>
>
> The tasklet can run after the rings have been cleaned up,
> so check for NULL before de-referencing the ring.
>
> Signed-off-by: Ben Greear <greearb at candelatech.com>
> ---
>  drivers/net/wireless/ath/ath10k/ce.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
> index d243f28..dfcfda9 100644
> --- a/drivers/net/wireless/ath/ath10k/ce.c
> +++ b/drivers/net/wireless/ath/ath10k/ce.c
> @@ -547,12 +547,18 @@ static int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state,
>         struct ath10k_ce_ring *src_ring = ce_state->src_ring;
>         u32 ctrl_addr = ce_state->ctrl_addr;
>         struct ath10k *ar = ce_state->ar;
> -       unsigned int nentries_mask = src_ring->nentries_mask;
> -       unsigned int sw_index = src_ring->sw_index;
> +       unsigned int nentries_mask;
> +       unsigned int sw_index;
>         struct ce_desc *sdesc, *sbase;
>         unsigned int read_index;
>         int ret;
>
> +       if (!src_ring)
> +               return -EIO;
> +
> +       nentries_mask = src_ring->nentries_mask;
> +       sw_index = src_ring->sw_index;
> +
>         if (src_ring->hw_index == sw_index) {
>                 /*
>                  * The SW completion index has caught up with the cached

I don't think this is a proper way to fix the problem. What should be
done is initialization clean up and some reordering to prevent this
from happening in the first place.


Micha?


From kvalo at qca.qualcomm.com  Wed Oct 30 05:53:24 2013
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 30 Oct 2013 11:53:24 +0200
Subject: [PATCH 0/2] ath10k: memory leak fixes
In-Reply-To: <1382941094-3291-1-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Mon, 28 Oct 2013 07:18:12 +0100")
References: <1382941094-3291-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <87ppqn6q5n.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> Michal Kazior (2):
>   ath10k: plug memory leak in wmi mgmt tx worker
>   ath10k: plug memory leak on beacon tx

Thanks, both patches applied.

-- 
Kalle Valo


From michal.kazior at tieto.com  Wed Oct 30 07:42:14 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 30 Oct 2013 12:42:14 +0100
Subject: [PATCH/RFT 00/12] ath10k: pci fixes 2013-10-30
Message-ID: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>

Hi,

This patchset contains a slew of PCI/CE cleanups
and fixes. The aim of the patchset is to deal with
CE null dereference bugs Ben has been reporting on
the mailing list for some time now.

I've done some brief testing and don't see any
major regressions. I wasn't able to reproduce the
reported bugs though. @Ben: Could you perhaps test
this, please?


Michal Kazior (12):
  ath10k: remove ar_pci->ce_count
  ath10k: don't forget to kill fw error tasklet
  ath10k: split tasklet killing function
  ath10k: rename function to match it's role
  ath10k: make sure to mask all CE irqs
  ath10k: fix ath10k_ce_init() failpath
  ath10k: remove meaningless check
  ath10k: use ath10k_do_pci_wake/sleep
  ath10k: propagate ath10k_ce_disable_interrupts() errors
  ath10k: guard against CE corruption from firmware
  ath10k: re-arrange PCI init code
  ath10k: add some debug prints

 drivers/net/wireless/ath/ath10k/ce.c  |  56 ++++++---
 drivers/net/wireless/ath/ath10k/ce.h  |   3 +-
 drivers/net/wireless/ath/ath10k/htc.c |   5 +
 drivers/net/wireless/ath/ath10k/pci.c | 221 ++++++++++++++++++----------------
 drivers/net/wireless/ath/ath10k/pci.h |   3 -
 5 files changed, 161 insertions(+), 127 deletions(-)

-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 30 07:42:15 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 30 Oct 2013 12:42:15 +0100
Subject: [PATCH/RFT 01/12] ath10k: remove ar_pci->ce_count
In-Reply-To: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1383133346-8135-2-git-send-email-michal.kazior@tieto.com>

It wasn't really useful to have it to begin with.
This makes it a little simpler to re-arrange PCI
init code as some function depended on
ar_pci->ce_count being set.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/ce.c  |  9 +++------
 drivers/net/wireless/ath/ath10k/pci.c | 18 ++++++++----------
 drivers/net/wireless/ath/ath10k/pci.h |  3 ---
 3 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index d243f28..2b99bd4 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -731,7 +731,6 @@ void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id)
 
 void ath10k_ce_per_engine_service_any(struct ath10k *ar)
 {
-	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 	int ce_id, ret;
 	u32 intr_summary;
 
@@ -741,7 +740,7 @@ void ath10k_ce_per_engine_service_any(struct ath10k *ar)
 
 	intr_summary = CE_INTERRUPT_SUMMARY(ar);
 
-	for (ce_id = 0; intr_summary && (ce_id < ar_pci->ce_count); ce_id++) {
+	for (ce_id = 0; intr_summary && (ce_id < CE_COUNT); ce_id++) {
 		if (intr_summary & (1 << ce_id))
 			intr_summary &= ~(1 << ce_id);
 		else
@@ -785,16 +784,14 @@ static void ath10k_ce_per_engine_handler_adjust(struct ath10k_ce_pipe *ce_state,
 
 void ath10k_ce_disable_interrupts(struct ath10k *ar)
 {
-	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 	int ce_id, ret;
 
 	ret = ath10k_pci_wake(ar);
 	if (ret)
 		return;
 
-	for (ce_id = 0; ce_id < ar_pci->ce_count; ce_id++) {
-		struct ath10k_ce_pipe *ce_state = &ar_pci->ce_states[ce_id];
-		u32 ctrl_addr = ce_state->ctrl_addr;
+	for (ce_id = 0; ce_id < CE_COUNT; ce_id++) {
+		u32 ctrl_addr = ath10k_ce_base_address(ce_id);
 
 		ath10k_ce_copy_complete_intr_disable(ar, ctrl_addr);
 	}
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 42d2473..05cdbf0 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -831,7 +831,7 @@ static int ath10k_pci_start_ce(struct ath10k *ar)
 	spin_lock_init(&ar_pci->compl_lock);
 	INIT_LIST_HEAD(&ar_pci->compl_process);
 
-	for (pipe_num = 0; pipe_num < ar_pci->ce_count; pipe_num++) {
+	for (pipe_num = 0; pipe_num < CE_COUNT; pipe_num++) {
 		pipe_info = &ar_pci->pipe_info[pipe_num];
 
 		spin_lock_init(&pipe_info->pipe_lock);
@@ -924,7 +924,7 @@ static void ath10k_pci_cleanup_ce(struct ath10k *ar)
 	spin_unlock_bh(&ar_pci->compl_lock);
 
 	/* Free unused completions for each pipe. */
-	for (pipe_num = 0; pipe_num < ar_pci->ce_count; pipe_num++) {
+	for (pipe_num = 0; pipe_num < CE_COUNT; pipe_num++) {
 		pipe_info = &ar_pci->pipe_info[pipe_num];
 
 		spin_lock_bh(&pipe_info->pipe_lock);
@@ -1166,7 +1166,7 @@ static int ath10k_pci_post_rx(struct ath10k *ar)
 	const struct ce_attr *attr;
 	int pipe_num, ret = 0;
 
-	for (pipe_num = 0; pipe_num < ar_pci->ce_count; pipe_num++) {
+	for (pipe_num = 0; pipe_num < CE_COUNT; pipe_num++) {
 		pipe_info = &ar_pci->pipe_info[pipe_num];
 		attr = &host_ce_config_wlan[pipe_num];
 
@@ -1295,7 +1295,7 @@ static void ath10k_pci_buffer_cleanup(struct ath10k *ar)
 	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 	int pipe_num;
 
-	for (pipe_num = 0; pipe_num < ar_pci->ce_count; pipe_num++) {
+	for (pipe_num = 0; pipe_num < CE_COUNT; pipe_num++) {
 		struct ath10k_pci_pipe *pipe_info;
 
 		pipe_info = &ar_pci->pipe_info[pipe_num];
@@ -1310,7 +1310,7 @@ static void ath10k_pci_ce_deinit(struct ath10k *ar)
 	struct ath10k_pci_pipe *pipe_info;
 	int pipe_num;
 
-	for (pipe_num = 0; pipe_num < ar_pci->ce_count; pipe_num++) {
+	for (pipe_num = 0; pipe_num < CE_COUNT; pipe_num++) {
 		pipe_info = &ar_pci->pipe_info[pipe_num];
 		if (pipe_info->ce_hdl) {
 			ath10k_ce_deinit(pipe_info->ce_hdl);
@@ -1755,7 +1755,7 @@ static int ath10k_pci_ce_init(struct ath10k *ar)
 	const struct ce_attr *attr;
 	int pipe_num;
 
-	for (pipe_num = 0; pipe_num < ar_pci->ce_count; pipe_num++) {
+	for (pipe_num = 0; pipe_num < CE_COUNT; pipe_num++) {
 		pipe_info = &ar_pci->pipe_info[pipe_num];
 		pipe_info->pipe_num = pipe_num;
 		pipe_info->hif_ce_state = ar;
@@ -1772,13 +1772,12 @@ static int ath10k_pci_ce_init(struct ath10k *ar)
 			return -1;
 		}
 
-		if (pipe_num == ar_pci->ce_count - 1) {
+		if (pipe_num == CE_COUNT - 1) {
 			/*
 			 * Reserve the ultimate CE for
 			 * diagnostic Window support
 			 */
-			ar_pci->ce_diag =
-			ar_pci->pipe_info[ar_pci->ce_count - 1].ce_hdl;
+			ar_pci->ce_diag = pipe_info->ce_hdl;
 			continue;
 		}
 
@@ -2235,7 +2234,6 @@ static int ath10k_pci_start_intr(struct ath10k *ar)
 
 exit:
 	ar_pci->num_msi_intrs = num;
-	ar_pci->ce_count = CE_COUNT;
 	return ret;
 }
 
diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h
index a304c33..73a3d4e 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -199,9 +199,6 @@ struct ath10k_pci {
 	struct tasklet_struct intr_tq;
 	struct tasklet_struct msi_fw_err;
 
-	/* Number of Copy Engines supported */
-	unsigned int ce_count;
-
 	int started;
 
 	atomic_t keep_awake_count;
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 30 07:42:16 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 30 Oct 2013 12:42:16 +0100
Subject: [PATCH/RFT 02/12] ath10k: don't forget to kill fw error tasklet
In-Reply-To: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1383133346-8135-3-git-send-email-michal.kazior@tieto.com>

It was possible for FW error tasklet to be
executed during teardown. This could lead to
system crashes and/or memory corruption.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 05cdbf0..aa43466 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -888,6 +888,7 @@ static void ath10k_pci_stop_ce(struct ath10k *ar)
 
 	/* Cancel the pending tasklet */
 	tasklet_kill(&ar_pci->intr_tq);
+	tasklet_kill(&ar_pci->msi_fw_err);
 
 	for (i = 0; i < CE_COUNT; i++)
 		tasklet_kill(&ar_pci->pipe_info[i].intr);
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 30 07:42:17 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 30 Oct 2013 12:42:17 +0100
Subject: [PATCH/RFT 03/12] ath10k: split tasklet killing function
In-Reply-To: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1383133346-8135-4-git-send-email-michal.kazior@tieto.com>

The function will soon be called from more than 1
place.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/pci.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index aa43466..d9467e5 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -877,21 +877,26 @@ static int ath10k_pci_start_ce(struct ath10k *ar)
 	return 0;
 }
 
-static void ath10k_pci_stop_ce(struct ath10k *ar)
+static void ath10k_pci_kill_tasklet(struct ath10k *ar)
 {
 	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
-	struct ath10k_pci_compl *compl;
-	struct sk_buff *skb;
 	int i;
 
-	ath10k_ce_disable_interrupts(ar);
-
-	/* Cancel the pending tasklet */
 	tasklet_kill(&ar_pci->intr_tq);
 	tasklet_kill(&ar_pci->msi_fw_err);
 
 	for (i = 0; i < CE_COUNT; i++)
 		tasklet_kill(&ar_pci->pipe_info[i].intr);
+}
+
+static void ath10k_pci_stop_ce(struct ath10k *ar)
+{
+	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+	struct ath10k_pci_compl *compl;
+	struct sk_buff *skb;
+
+	ath10k_ce_disable_interrupts(ar);
+	ath10k_pci_kill_tasklet(ar);
 
 	/* Mark pending completions as aborted, so that upper layers free up
 	 * their associated resources */
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 30 07:42:18 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 30 Oct 2013 12:42:18 +0100
Subject: [PATCH/RFT 04/12] ath10k: rename function to match it's role
In-Reply-To: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1383133346-8135-5-git-send-email-michal.kazior@tieto.com>

What the function does is to actually wait for the
firmware indication bit to be set. Prerequisite
for this is having interrupts registered.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index d9467e5..1e430d0 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -53,7 +53,7 @@ static int ath10k_pci_post_rx_pipe(struct ath10k_pci_pipe *pipe_info,
 static void ath10k_pci_rx_pipe_cleanup(struct ath10k_pci_pipe *pipe_info);
 static void ath10k_pci_stop_ce(struct ath10k *ar);
 static void ath10k_pci_device_reset(struct ath10k *ar);
-static int ath10k_pci_reset_target(struct ath10k *ar);
+static int ath10k_pci_wait_for_target_init(struct ath10k *ar);
 static int ath10k_pci_start_intr(struct ath10k *ar);
 static void ath10k_pci_stop_intr(struct ath10k *ar);
 
@@ -1857,7 +1857,7 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
 	 */
 	ath10k_pci_device_reset(ar);
 
-	ret = ath10k_pci_reset_target(ar);
+	ret = ath10k_pci_wait_for_target_init(ar);
 	if (ret)
 		goto err_irq;
 
@@ -2257,7 +2257,7 @@ static void ath10k_pci_stop_intr(struct ath10k *ar)
 		pci_disable_msi(ar_pci->pdev);
 }
 
-static int ath10k_pci_reset_target(struct ath10k *ar)
+static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
 {
 	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 	int wait_limit = 300; /* 3 sec */
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 30 07:42:19 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 30 Oct 2013 12:42:19 +0100
Subject: [PATCH/RFT 05/12] ath10k: make sure to mask all CE irqs
In-Reply-To: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1383133346-8135-6-git-send-email-michal.kazior@tieto.com>

CE error interrupts were not disabled. This could
lead to invalid memory accesses / memory
corruption.

Also make sure CE watermark interrupts are also
disabled.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/ce.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index 2b99bd4..7a49cde 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -243,6 +243,16 @@ static inline void ath10k_ce_error_intr_enable(struct ath10k *ar,
 			   misc_ie_addr | CE_ERROR_MASK);
 }
 
+static inline void ath10k_ce_error_intr_disable(struct ath10k *ar,
+						u32 ce_ctrl_addr)
+{
+	u32 misc_ie_addr = ath10k_pci_read32(ar,
+					     ce_ctrl_addr + MISC_IE_ADDRESS);
+
+	ath10k_pci_write32(ar, ce_ctrl_addr + MISC_IE_ADDRESS,
+			   misc_ie_addr & ~CE_ERROR_MASK);
+}
+
 static inline void ath10k_ce_engine_int_status_clear(struct ath10k *ar,
 						     u32 ce_ctrl_addr,
 						     unsigned int mask)
@@ -794,6 +804,8 @@ void ath10k_ce_disable_interrupts(struct ath10k *ar)
 		u32 ctrl_addr = ath10k_ce_base_address(ce_id);
 
 		ath10k_ce_copy_complete_intr_disable(ar, ctrl_addr);
+		ath10k_ce_error_intr_disable(ar, ctrl_addr);
+		ath10k_ce_watermark_intr_disable(ar, ctrl_addr);
 	}
 	ath10k_pci_sleep(ar);
 }
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 30 07:42:23 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 30 Oct 2013 12:42:23 +0100
Subject: [PATCH/RFT 09/12] ath10k: propagate ath10k_ce_disable_interrupts()
 errors
In-Reply-To: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1383133346-8135-10-git-send-email-michal.kazior@tieto.com>

This shouldn't be silenced. This will be necessary
for PCI init code reordering.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/ce.c  | 6 ++++--
 drivers/net/wireless/ath/ath10k/ce.h  | 2 +-
 drivers/net/wireless/ath/ath10k/pci.c | 6 +++++-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index 657e8f2..3e8395d 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -792,13 +792,13 @@ static void ath10k_ce_per_engine_handler_adjust(struct ath10k_ce_pipe *ce_state,
 	ath10k_pci_sleep(ar);
 }
 
-void ath10k_ce_disable_interrupts(struct ath10k *ar)
+int ath10k_ce_disable_interrupts(struct ath10k *ar)
 {
 	int ce_id, ret;
 
 	ret = ath10k_pci_wake(ar);
 	if (ret)
-		return;
+		return ret;
 
 	for (ce_id = 0; ce_id < CE_COUNT; ce_id++) {
 		u32 ctrl_addr = ath10k_ce_base_address(ce_id);
@@ -807,7 +807,9 @@ void ath10k_ce_disable_interrupts(struct ath10k *ar)
 		ath10k_ce_error_intr_disable(ar, ctrl_addr);
 		ath10k_ce_watermark_intr_disable(ar, ctrl_addr);
 	}
+
 	ath10k_pci_sleep(ar);
+	return ret;
 }
 
 void ath10k_ce_send_cb_register(struct ath10k_ce_pipe *ce_state,
diff --git a/drivers/net/wireless/ath/ath10k/ce.h b/drivers/net/wireless/ath/ath10k/ce.h
index 15d45b5..67dbde6 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -234,7 +234,7 @@ void ath10k_ce_deinit(struct ath10k_ce_pipe *ce_state);
 /*==================CE Interrupt Handlers====================*/
 void ath10k_ce_per_engine_service_any(struct ath10k *ar);
 void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id);
-void ath10k_ce_disable_interrupts(struct ath10k *ar);
+int ath10k_ce_disable_interrupts(struct ath10k *ar);
 
 /* ce_attr.flags values */
 /* Use NonSnooping PCIe accesses? */
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index ffc63cc..63ad250 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -879,8 +879,12 @@ static void ath10k_pci_stop_ce(struct ath10k *ar)
 	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 	struct ath10k_pci_compl *compl;
 	struct sk_buff *skb;
+	int ret;
+
+	ret = ath10k_ce_disable_interrupts(ar);
+	if (ret)
+		ath10k_warn("failed to disable CE interrupts (%d)\n", ret);
 
-	ath10k_ce_disable_interrupts(ar);
 	ath10k_pci_kill_tasklet(ar);
 
 	/* Mark pending completions as aborted, so that upper layers free up
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 30 07:42:21 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 30 Oct 2013 12:42:21 +0100
Subject: [PATCH/RFT 07/12] ath10k: remove meaningless check
In-Reply-To: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1383133346-8135-8-git-send-email-michal.kazior@tieto.com>

The check doesn't make much sense. If the address
were to be 0x0000 the check would fail. In this
case a 0 address isn't wrong.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/pci.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 1e430d0..5a1ac9e 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2307,9 +2307,6 @@ static void ath10k_pci_device_reset(struct ath10k *ar)
 	int i;
 	u32 val;
 
-	if (!SOC_GLOBAL_RESET_ADDRESS)
-		return;
-
 	ath10k_pci_reg_write32(ar, PCIE_SOC_WAKE_ADDRESS,
 			       PCIE_SOC_WAKE_V_MASK);
 	for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 30 07:42:20 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 30 Oct 2013 12:42:20 +0100
Subject: [PATCH/RFT 06/12] ath10k: fix ath10k_ce_init() failpath
In-Reply-To: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1383133346-8135-7-git-send-email-michal.kazior@tieto.com>

Make sure to put target back to sleep. This was a
minor issue as it didn't really matter if we put
target back to sleep at this point. It just looked
wrong.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/ce.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index 7a49cde..657e8f2 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -1077,7 +1077,7 @@ struct ath10k_ce_pipe *ath10k_ce_init(struct ath10k *ar,
 	ce_state = ath10k_ce_init_state(ar, ce_id, attr);
 	if (!ce_state) {
 		ath10k_err("Failed to initialize CE state for ID: %d\n", ce_id);
-		return NULL;
+		goto out;
 	}
 
 	if (attr->src_nentries) {
@@ -1086,7 +1086,8 @@ struct ath10k_ce_pipe *ath10k_ce_init(struct ath10k *ar,
 			ath10k_err("Failed to initialize CE src ring for ID: %d (%d)\n",
 				   ce_id, ret);
 			ath10k_ce_deinit(ce_state);
-			return NULL;
+			ce_state = NULL;
+			goto out;
 		}
 	}
 
@@ -1096,15 +1097,16 @@ struct ath10k_ce_pipe *ath10k_ce_init(struct ath10k *ar,
 			ath10k_err("Failed to initialize CE dest ring for ID: %d (%d)\n",
 				   ce_id, ret);
 			ath10k_ce_deinit(ce_state);
-			return NULL;
+			ce_state = NULL;
+			goto out;
 		}
 	}
 
 	/* Enable CE error interrupts */
 	ath10k_ce_error_intr_enable(ar, ctrl_addr);
 
+out:
 	ath10k_pci_sleep(ar);
-
 	return ce_state;
 }
 
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 30 07:42:25 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 30 Oct 2013 12:42:25 +0100
Subject: [PATCH/RFT 11/12] ath10k: re-arrange PCI init code
In-Reply-To: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1383133346-8135-12-git-send-email-michal.kazior@tieto.com>

This patch moves irq registering after necessary
structures have been allocated and initialized.
This should prevent interrupts from causing
tasklet access invalid memory pointers.

Reported-By: Ben Greear <greearb at candelatech.com>
Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/ce.c  | 19 +++++++--
 drivers/net/wireless/ath/ath10k/ce.h  |  1 +
 drivers/net/wireless/ath/ath10k/pci.c | 79 +++++++++++++++++++++--------------
 3 files changed, 64 insertions(+), 35 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index 3e8395d..7517b94 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -792,6 +792,21 @@ static void ath10k_ce_per_engine_handler_adjust(struct ath10k_ce_pipe *ce_state,
 	ath10k_pci_sleep(ar);
 }
 
+int ath10k_ce_enable_err_irq(struct ath10k *ar)
+{
+	int i, ret;
+
+	ret = ath10k_pci_wake(ar);
+	if (ret)
+		return ret;
+
+	for (i = 0; i < CE_COUNT; i++)
+		ath10k_ce_error_intr_enable(ar, ath10k_ce_base_address(i));
+
+	ath10k_pci_sleep(ar);
+	return 0;
+}
+
 int ath10k_ce_disable_interrupts(struct ath10k *ar)
 {
 	int ce_id, ret;
@@ -1058,7 +1073,6 @@ struct ath10k_ce_pipe *ath10k_ce_init(struct ath10k *ar,
 				const struct ce_attr *attr)
 {
 	struct ath10k_ce_pipe *ce_state;
-	u32 ctrl_addr = ath10k_ce_base_address(ce_id);
 	int ret;
 
 	/*
@@ -1104,9 +1118,6 @@ struct ath10k_ce_pipe *ath10k_ce_init(struct ath10k *ar,
 		}
 	}
 
-	/* Enable CE error interrupts */
-	ath10k_ce_error_intr_enable(ar, ctrl_addr);
-
 out:
 	ath10k_pci_sleep(ar);
 	return ce_state;
diff --git a/drivers/net/wireless/ath/ath10k/ce.h b/drivers/net/wireless/ath/ath10k/ce.h
index 67dbde6..8a58bac 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -235,6 +235,7 @@ void ath10k_ce_deinit(struct ath10k_ce_pipe *ce_state);
 void ath10k_ce_per_engine_service_any(struct ath10k *ar);
 void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id);
 int ath10k_ce_disable_interrupts(struct ath10k *ar);
+int ath10k_ce_enable_err_irq(struct ath10k *ar);
 
 /* ce_attr.flags values */
 /* Use NonSnooping PCIe accesses? */
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 43cdc35..7b606d0 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1786,18 +1786,6 @@ static int ath10k_pci_ce_init(struct ath10k *ar)
 		pipe_info->buf_sz = (size_t) (attr->src_sz_max);
 	}
 
-	/*
-	 * Initially, establish CE completion handlers for use with BMI.
-	 * These are overwritten with generic handlers after we exit BMI phase.
-	 */
-	pipe_info = &ar_pci->pipe_info[BMI_CE_NUM_TO_TARG];
-	ath10k_ce_send_cb_register(pipe_info->ce_hdl,
-				   ath10k_pci_bmi_send_done, 0);
-
-	pipe_info = &ar_pci->pipe_info[BMI_CE_NUM_TO_HOST];
-	ath10k_ce_recv_cb_register(pipe_info->ce_hdl,
-				   ath10k_pci_bmi_recv_data);
-
 	return 0;
 }
 
@@ -1830,17 +1818,27 @@ static void ath10k_pci_fw_interrupt_handler(struct ath10k *ar)
 	ath10k_pci_sleep(ar);
 }
 
+static void ath10k_pci_start_bmi(struct ath10k *ar)
+{
+	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+	struct ath10k_pci_pipe *pipe;
+
+	/*
+	 * Initially, establish CE completion handlers for use with BMI.
+	 * These are overwritten with generic handlers after we exit BMI phase.
+	 */
+	pipe = &ar_pci->pipe_info[BMI_CE_NUM_TO_TARG];
+	ath10k_ce_send_cb_register(pipe->ce_hdl, ath10k_pci_bmi_send_done, 0);
+
+	pipe = &ar_pci->pipe_info[BMI_CE_NUM_TO_HOST];
+	ath10k_ce_recv_cb_register(pipe->ce_hdl, ath10k_pci_bmi_recv_data);
+}
+
 static int ath10k_pci_hif_power_up(struct ath10k *ar)
 {
 	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 	int ret;
 
-	ret = ath10k_pci_start_intr(ar);
-	if (ret) {
-		ath10k_err("could not start interrupt handling (%d)\n", ret);
-		goto err;
-	}
-
 	/*
 	 * Bring the target up cleanly.
 	 *
@@ -1854,13 +1852,9 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
 	ret = ath10k_pci_device_reset(ar);
 	if (ret) {
 		ath10k_err("failed to reset target (%d)\n", ret);
-		goto err_irq;
+		goto err;
 	}
 
-	ret = ath10k_pci_wait_for_target_init(ar);
-	if (ret)
-		goto err_irq;
-
 	if (!test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features))
 		/* Force AWAKE forever */
 		ath10k_do_pci_wake(ar);
@@ -1869,25 +1863,48 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
 	if (ret)
 		goto err_ps;
 
+	ret = ath10k_ce_disable_interrupts(ar);
+	if (ret) {
+		ath10k_err("could not disable CE interrupts (%d)\n", ret);
+		goto err_ce;
+	}
+
+	ret = ath10k_pci_start_intr(ar);
+	if (ret) {
+		ath10k_err("could not start interrupt handling (%d)\n", ret);
+		goto err_ce;
+	}
+
+	ret = ath10k_pci_wait_for_target_init(ar);
+	if (ret)
+		goto err_irq;
+
+	ret = ath10k_ce_enable_err_irq(ar);
+	if (ret)
+		goto err_irq;
+
 	ret = ath10k_pci_init_config(ar);
 	if (ret)
-		goto err_ce;
+		goto err_irq;
 
 	ret = ath10k_pci_wake_target_cpu(ar);
 	if (ret) {
 		ath10k_err("could not wake up target CPU (%d)\n", ret);
-		goto err_ce;
+		goto err_irq;
 	}
 
+	ath10k_pci_start_bmi(ar);
 	return 0;
 
+err_irq:
+	ath10k_ce_disable_interrupts(ar);
+	ath10k_pci_stop_intr(ar);
+	ath10k_pci_kill_tasklet(ar);
 err_ce:
 	ath10k_pci_ce_deinit(ar);
 err_ps:
 	if (!test_bit(ATH10K_PCI_FEATURE_SOC_POWER_SAVE, ar_pci->features))
 		ath10k_do_pci_sleep(ar);
-err_irq:
-	ath10k_pci_stop_intr(ar);
 err:
 	return ret;
 }
@@ -2156,7 +2173,7 @@ static int ath10k_pci_start_intr_legacy(struct ath10k *ar)
 	if (ret < 0)
 		return ret;
 
-	ret = ath10k_do_pci_wake(ar);
+	ret = ath10k_pci_wake(ar);
 	if (ret) {
 		free_irq(ar_pci->pdev->irq, ar);
 		ath10k_err("target didn't wake up (%d)\n", ret);
@@ -2176,7 +2193,7 @@ static int ath10k_pci_start_intr_legacy(struct ath10k *ar)
 		  ar_pci->mem + (SOC_CORE_BASE_ADDRESS |
 				 PCIE_INTR_ENABLE_ADDRESS));
 
-	ath10k_do_pci_sleep(ar);
+	ath10k_pci_sleep(ar);
 	ath10k_info("legacy interrupt handling\n");
 	return 0;
 }
@@ -2252,7 +2269,7 @@ static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
 	int wait_limit = 300; /* 3 sec */
 	int ret;
 
-	ret = ath10k_do_pci_wake(ar);
+	ret = ath10k_pci_wake(ar);
 	if (ret) {
 		ath10k_err("target didn't wake up (%d)\n", ret);
 		return ret;
@@ -2277,7 +2294,7 @@ static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
 	}
 
 out:
-	ath10k_do_pci_sleep(ar);
+	ath10k_pci_sleep(ar);
 	return ret;
 }
 
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 30 07:42:24 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 30 Oct 2013 12:42:24 +0100
Subject: [PATCH/RFT 10/12] ath10k: guard against CE corruption from firmware
In-Reply-To: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1383133346-8135-11-git-send-email-michal.kazior@tieto.com>

In case firmware crashes it may report CE
completions for entries that were never
submitted/filled with meaningful data. This in
turn led to NULL dereferences.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/htc.c | 5 +++++
 drivers/net/wireless/ath/ath10k/pci.c | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 3118d75..c59f5b4 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -191,6 +191,11 @@ static int ath10k_htc_tx_completion_handler(struct ath10k *ar,
 	struct ath10k_htc *htc = &ar->htc;
 	struct ath10k_htc_ep *ep = &htc->endpoint[eid];
 
+	if (!skb) {
+		ath10k_warn("invalid sk_buff completion - NULL pointer. firmware crashed?");
+		return 0;
+	}
+
 	ath10k_htc_notify_tx_completion(ep, skb);
 	/* the skb now belongs to the completion handler */
 
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 63ad250..43cdc35 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1270,6 +1270,13 @@ static void ath10k_pci_tx_pipe_cleanup(struct ath10k_pci_pipe *pipe_info)
 		 * Indicate the completion to higer layer to free
 		 * the buffer
 		 */
+
+		if (!netbuf) {
+			ath10k_warn("invalid sk_buff on CE %d - NULL pointer. firmware crashed?",
+				    ce_hdl->id);
+			continue;
+		}
+
 		ATH10K_SKB_CB(netbuf)->is_aborted = true;
 		ar_pci->msg_callbacks_current.tx_completion(ar,
 							    netbuf,
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 30 07:42:26 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 30 Oct 2013 12:42:26 +0100
Subject: [PATCH/RFT 12/12] ath10k: add some debug prints
In-Reply-To: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1383133346-8135-13-git-send-email-michal.kazior@tieto.com>

Some errors were handled too silently. Also add a
print indicating BMI is booted.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/pci.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 7b606d0..42dd0b7 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1832,6 +1832,8 @@ static void ath10k_pci_start_bmi(struct ath10k *ar)
 
 	pipe = &ar_pci->pipe_info[BMI_CE_NUM_TO_HOST];
 	ath10k_ce_recv_cb_register(pipe->ce_hdl, ath10k_pci_bmi_recv_data);
+
+	ath10k_dbg(ATH10K_DBG_BOOT, "boot start bmi\n");
 }
 
 static int ath10k_pci_hif_power_up(struct ath10k *ar)
@@ -1860,8 +1862,10 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
 		ath10k_do_pci_wake(ar);
 
 	ret = ath10k_pci_ce_init(ar);
-	if (ret)
+	if (ret) {
+		ath10k_err("could not initialize CE (%d)\n", ret);
 		goto err_ps;
+	}
 
 	ret = ath10k_ce_disable_interrupts(ar);
 	if (ret) {
@@ -1876,16 +1880,22 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
 	}
 
 	ret = ath10k_pci_wait_for_target_init(ar);
-	if (ret)
+	if (ret) {
+		ath10k_err("failed to wait for target to init (%d)\n", ret);
 		goto err_irq;
+	}
 
 	ret = ath10k_ce_enable_err_irq(ar);
-	if (ret)
+	if (ret) {
+		ath10k_err("failed to enable CE error irq (%d)\n", ret);
 		goto err_irq;
+	}
 
 	ret = ath10k_pci_init_config(ar);
-	if (ret)
+	if (ret) {
+		ath10k_err("failed to setup init config (%d)\n", ret);
 		goto err_irq;
+	}
 
 	ret = ath10k_pci_wake_target_cpu(ar);
 	if (ret) {
-- 
1.8.4.rc3



From michal.kazior at tieto.com  Wed Oct 30 07:42:22 2013
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 30 Oct 2013 12:42:22 +0100
Subject: [PATCH/RFT 08/12] ath10k: use ath10k_do_pci_wake/sleep
In-Reply-To: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1383133346-8135-9-git-send-email-michal.kazior@tieto.com>

This removes some remaining direct use of the wake
register which could interfere with power state
tracking of the target device. This will allow
initialization code reordering.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/pci.c | 84 +++++++++++------------------------
 1 file changed, 26 insertions(+), 58 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 5a1ac9e..ffc63cc 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -52,7 +52,7 @@ static int ath10k_pci_post_rx_pipe(struct ath10k_pci_pipe *pipe_info,
 					     int num);
 static void ath10k_pci_rx_pipe_cleanup(struct ath10k_pci_pipe *pipe_info);
 static void ath10k_pci_stop_ce(struct ath10k *ar);
-static void ath10k_pci_device_reset(struct ath10k *ar);
+static int ath10k_pci_device_reset(struct ath10k *ar);
 static int ath10k_pci_wait_for_target_init(struct ath10k *ar);
 static int ath10k_pci_start_intr(struct ath10k *ar);
 static void ath10k_pci_stop_intr(struct ath10k *ar);
@@ -526,21 +526,6 @@ static bool ath10k_pci_target_is_awake(struct ath10k *ar)
 	return (RTC_STATE_V_GET(val) == RTC_STATE_V_ON);
 }
 
-static int ath10k_pci_wait(struct ath10k *ar)
-{
-	int n = 100;
-
-	while (n-- && !ath10k_pci_target_is_awake(ar))
-		msleep(10);
-
-	if (n < 0) {
-		ath10k_warn("Unable to wakeup target\n");
-		return -ETIMEDOUT;
-	}
-
-	return 0;
-}
-
 int ath10k_do_pci_wake(struct ath10k *ar)
 {
 	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
@@ -1855,7 +1840,11 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
 	 * is in an unexpected state. We try to catch that here in order to
 	 * reset the Target and retry the probe.
 	 */
-	ath10k_pci_device_reset(ar);
+	ret = ath10k_pci_device_reset(ar);
+	if (ret) {
+		ath10k_err("failed to reset target (%d)\n", ret);
+		goto err_irq;
+	}
 
 	ret = ath10k_pci_wait_for_target_init(ar);
 	if (ret)
@@ -2156,19 +2145,10 @@ static int ath10k_pci_start_intr_legacy(struct ath10k *ar)
 	if (ret < 0)
 		return ret;
 
-	/*
-	 * Make sure to wake the Target before enabling Legacy
-	 * Interrupt.
-	 */
-	iowrite32(PCIE_SOC_WAKE_V_MASK,
-		  ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
-		  PCIE_SOC_WAKE_ADDRESS);
-
-	ret = ath10k_pci_wait(ar);
+	ret = ath10k_do_pci_wake(ar);
 	if (ret) {
-		ath10k_warn("Failed to enable legacy interrupt, target did not wake up: %d\n",
-			    ret);
 		free_irq(ar_pci->pdev->irq, ar);
+		ath10k_err("target didn't wake up (%d)\n", ret);
 		return ret;
 	}
 
@@ -2184,10 +2164,8 @@ static int ath10k_pci_start_intr_legacy(struct ath10k *ar)
 		  PCIE_INTR_CE_MASK_ALL,
 		  ar_pci->mem + (SOC_CORE_BASE_ADDRESS |
 				 PCIE_INTR_ENABLE_ADDRESS));
-	iowrite32(PCIE_SOC_WAKE_RESET,
-		  ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
-		  PCIE_SOC_WAKE_ADDRESS);
 
+	ath10k_do_pci_sleep(ar);
 	ath10k_info("legacy interrupt handling\n");
 	return 0;
 }
@@ -2263,15 +2241,9 @@ static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
 	int wait_limit = 300; /* 3 sec */
 	int ret;
 
-	/* Wait for Target to finish initialization before we proceed. */
-	iowrite32(PCIE_SOC_WAKE_V_MASK,
-		  ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
-		  PCIE_SOC_WAKE_ADDRESS);
-
-	ret = ath10k_pci_wait(ar);
+	ret = ath10k_do_pci_wake(ar);
 	if (ret) {
-		ath10k_warn("Failed to reset target, target did not wake up: %d\n",
-			    ret);
+		ath10k_err("target didn't wake up (%d)\n", ret);
 		return ret;
 	}
 
@@ -2288,31 +2260,26 @@ static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
 	}
 
 	if (wait_limit < 0) {
-		ath10k_err("Target stalled\n");
-		iowrite32(PCIE_SOC_WAKE_RESET,
-			  ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
-			  PCIE_SOC_WAKE_ADDRESS);
-		return -EIO;
+		ath10k_err("target stalled\n");
+		ret = -EIO;
+		goto out;
 	}
 
-	iowrite32(PCIE_SOC_WAKE_RESET,
-		  ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
-		  PCIE_SOC_WAKE_ADDRESS);
-
-	return 0;
+out:
+	ath10k_do_pci_sleep(ar);
+	return ret;
 }
 
-static void ath10k_pci_device_reset(struct ath10k *ar)
+static int ath10k_pci_device_reset(struct ath10k *ar)
 {
-	int i;
+	int i, ret;
 	u32 val;
 
-	ath10k_pci_reg_write32(ar, PCIE_SOC_WAKE_ADDRESS,
-			       PCIE_SOC_WAKE_V_MASK);
-	for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
-		if (ath10k_pci_target_is_awake(ar))
-			break;
-		msleep(1);
+	ret = ath10k_do_pci_wake(ar);
+	if (ret) {
+		ath10k_err("failed to reset target - couldn't wake target (%d)\n",
+			   ret);
+		return ret;
 	}
 
 	/* Put Target, including PCIe, into RESET. */
@@ -2338,7 +2305,8 @@ static void ath10k_pci_device_reset(struct ath10k *ar)
 		msleep(1);
 	}
 
-	ath10k_pci_reg_write32(ar, PCIE_SOC_WAKE_ADDRESS, PCIE_SOC_WAKE_RESET);
+	ath10k_do_pci_sleep(ar);
+	return 0;
 }
 
 static void ath10k_pci_dump_features(struct ath10k_pci *ar_pci)
-- 
1.8.4.rc3



From greearb at candelatech.com  Wed Oct 30 13:06:13 2013
From: greearb at candelatech.com (Ben Greear)
Date: Wed, 30 Oct 2013 10:06:13 -0700
Subject: [PATCH/RFT 00/12] ath10k: pci fixes 2013-10-30
In-Reply-To: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <52713C85.6070607@candelatech.com>

On 10/30/2013 04:42 AM, Michal Kazior wrote:
> Hi,
> 
> This patchset contains a slew of PCI/CE cleanups
> and fixes. The aim of the patchset is to deal with
> CE null dereference bugs Ben has been reporting on
> the mailing list for some time now.
> 
> I've done some brief testing and don't see any
> major regressions. I wasn't able to reproduce the
> reported bugs though. @Ben: Could you perhaps test
> this, please?

I'll test these later today, thanks!

Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From joe at perches.com  Wed Oct 30 13:16:39 2013
From: joe at perches.com (Joe Perches)
Date: Wed, 30 Oct 2013 10:16:39 -0700
Subject: [PATCH/RFT 12/12] ath10k: add some debug prints
In-Reply-To: <1383133346-8135-13-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
 <1383133346-8135-13-git-send-email-michal.kazior@tieto.com>
Message-ID: <1383153399.9435.33.camel@joe-AO722>

On Wed, 2013-10-30 at 12:42 +0100, Michal Kazior wrote:
> Some errors were handled too silently.

These aren't really debug prints.

> diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
[]
> @@ -1860,8 +1862,10 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
>  		ath10k_do_pci_wake(ar);
>  
>  	ret = ath10k_pci_ce_init(ar);
> -	if (ret)
> +	if (ret) {
> +		ath10k_err("could not initialize CE (%d)\n", ret);

Rather than try to reinterpret the function name,
perhaps it's better to simply emit the function name
as is done most other places like:

		ath10k_err("ath10k_pci_ce_init failed: (%d)\n", ret);


> @@ -1876,16 +1880,22 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
>  	}
>  
>  	ret = ath10k_pci_wait_for_target_init(ar);
> -	if (ret)
> +	if (ret) {
> +		ath10k_err("failed to wait for target to init (%d)\n", ret);
>  		goto err_irq;
> +	}

Like this one, because the function did wait,
but the init was unsuccessful.




From greearb at candelatech.com  Wed Oct 30 19:41:50 2013
From: greearb at candelatech.com (Ben Greear)
Date: Wed, 30 Oct 2013 16:41:50 -0700
Subject: [PATCH/RFT 00/12] ath10k: pci fixes 2013-10-30
In-Reply-To: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
References: <1383133346-8135-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <5271993E.5010103@candelatech.com>

On 10/30/2013 04:42 AM, Michal Kazior wrote:
> Hi,
> 
> This patchset contains a slew of PCI/CE cleanups
> and fixes. The aim of the patchset is to deal with
> CE null dereference bugs Ben has been reporting on
> the mailing list for some time now.
> 
> I've done some brief testing and don't see any
> major regressions. I wasn't able to reproduce the
> reported bugs though. @Ben: Could you perhaps test
> this, please?

I have done a bit of testing on this.  First, I did see
a total machine lockup, but I have been seeing those fairly
often on module reloads, so probably that was nothing new
in your patches.

I am also still running the crash avoidance patches I posted
recently.

And good news for me at least...with some modified firmware,
I am getting two stations to associate to the same AP and
pass traffic to each other (no encryption..that probably
doesn't work yet) :)

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Thu Oct 31 00:08:54 2013
From: greearb at candelatech.com (Ben Greear)
Date: Wed, 30 Oct 2013 21:08:54 -0700
Subject: Hard lockup on module reload.
Message-ID: <5271D7D6.7000702@candelatech.com>

I think this might be a known problem, but just in case it
helps, here are the last logs I see before the system is
locked hard (ie, even sysrq over serial terminal does nothing)

This is with today's 'ath' tree, including the RFT patches posted
by Michal.

cfg80211: Regulatory domain changed to country: US
cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 1700 mBm)
cfg80211:   (5250000 KHz - 5330000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5490000 KHz - 5600000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5650000 KHz - 5710000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 3000 mBm)
cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm)
ieee80211 phy3: Atheros AR9300 Rev:3 mem=0xffffc90017cc0000, irq=18
ieee80211 phy4: Atheros AR9300 Rev:3 mem=0xffffc90017d40000, irq=19
ath10k_pci 0000:05:00.0: BAR 0: assigned [mem 0xf4400000-0xf45fffff 64bit]


Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Thu Oct 31 12:45:37 2013
From: greearb at candelatech.com (Ben Greear)
Date: Thu, 31 Oct 2013 09:45:37 -0700
Subject: Crash related to wmi_event_mgt_rx (or ieee80211_rx).
Message-ID: <52728931.9090504@candelatech.com>

This is yesterday's ath tree, with Michal's ath10k RFT patch series applied,
and a few ath10k patches of my own.  Using modified ath10k firmware that supports
two stations to same AP.  This happened on module reload.


(gdb) l *(ath10k_wmi_event_mgmt_rx+0x246)
0xb501 is in ath10k_wmi_event_mgmt_rx (/mnt/sda/home/greearb/git/linux.ath/drivers/net/wireless/ath/ath10k/wmi.c:959).
954		 * because they can originally come in along with a trailer
955		 */
956		skb_trim(skb, buf_len);
957	
958		ieee80211_rx(ar->hw, skb);
959		return 0;
960	}
961	
962	static int freq_to_idx(struct ath10k *ar, int freq)
963	{

(gdb) l *(ieee80211_rx+0x54f)
0x1ac7a is in ieee80211_rx (/mnt/sda/home/greearb/git/linux.ath/arch/x86/include/asm/bitops.h:329).
324	}
325	
326	static __always_inline int constant_test_bit(long nr, const volatile unsigned long *addr)
327	{
328		return ((1UL << (nr & (BITS_PER_LONG-1))) &
329			(addr[nr >> _BITOPS_LONG_SHIFT])) != 0;
330	}
331	
332	static inline int variable_test_bit(long nr, volatile const unsigned long *addr)
333	{

general protection fault: 0000 [#1] PREEMPT SMP
Modules linked in: ath10k_pci(-) ath10k_core nfsv3 nfs_acl nfs fscache nf_nat_ipv4 nf_nat veth 8021q garp s]
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        WC   3.12.0-rc5-wl+ #2
Hardware name: To be filled by O.E.M. To be filled by O.E.M./HURONRIVER, BIOS 4.6.5 05/02/2012
task: ffffffff81a14490 ti: ffffffff81a00000 task.ti: ffffffff81a00000
RIP: 0010:[<ffffffffa032ac7a>]  [<ffffffffa032ac7a>] ieee80211_rx+0x54f/0x649 [mac80211]
RSP: 0018:ffff88021fa03b30  EFLAGS: 00010287
RAX: ffff880032c31ad0 RBX: ffff880032c308a0 RCX: 01526201bc0b4003
RDX: 0000000000000003 RSI: ffffffff81a14ba8 RDI: ffffffff81a14ba8
RBP: ffff88021fa03bc0 R08: ffff88020d766401 R09: ffff88020d766418
R10: ffffffff810c1f95 R11: ffff880032c30bd0 R12: ffff880032e11b00
R13: ffff880034324ca0 R14: ffff880032e36464 R15: dead000000100100
FS:  0000000000000000(0000) GS:ffff88021fa00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000001a90ae0 CR3: 0000000001a0d000 CR4: 00000000000407f0
Stack:
 ffff88021fa03b68 0000000000000001 00000000ffffffe6 dead000000100100
 ffff8800cc013600 ffff880032c308a0 ffff8800cd658a00 ffff8802120bd668
 0000000000000000 0000001000000000 0000000000000010 0000000000000000
Call Trace:
 <IRQ>
 [<ffffffffa0a01501>] ath10k_wmi_event_mgmt_rx+0x246/0x27e [ath10k_core]
 [<ffffffffa0a0435a>] ath10k_wmi_process_rx+0x6cc/0xa5a [ath10k_core]
 [<ffffffffa09fb07a>] ? ath10k_dbg+0x5c/0x5e [ath10k_core]
 [<ffffffffa09fda39>] ath10k_htc_rx_completion_handler+0x3b4/0x3e8 [ath10k_core]
 [<ffffffffa09fb07a>] ? ath10k_dbg+0x5c/0x5e [ath10k_core]
 [<ffffffffa0a18fe5>] ath10k_pci_process_ce+0x1a2/0x21e [ath10k_pci]
 [<ffffffffa0a190ae>] ath10k_pci_ce_recv_data+0x4d/0x123 [ath10k_pci]
 [<ffffffffa0a1b650>] ath10k_ce_per_engine_service+0x6b/0xab [ath10k_pci]
 [<ffffffffa0a1b6df>] ath10k_ce_per_engine_service_any+0x4f/0x6c [ath10k_pci]
 [<ffffffffa0a1a250>] ath10k_pci_tasklet+0x1e/0x4e [ath10k_pci]
 [<ffffffff810a2bed>] tasklet_action+0x88/0xe8
 [<ffffffff810de341>] ? handle_irq_event+0x47/0x5e
 [<ffffffff810a2eb8>] __do_softirq+0xc9/0x18e
 [<ffffffff81597dbc>] call_softirq+0x1c/0x30
 [<ffffffff8100c0d2>] do_softirq+0x45/0x9b
 [<ffffffff810a30a0>] irq_exit+0x56/0x9b
 [<ffffffff8100bd58>] do_IRQ+0x89/0xa0
 [<ffffffff81591eb2>] common_interrupt+0x72/0x72
 <EOI>
 [<ffffffff81495b80>] ? arch_local_irq_enable+0x8/0xd
 [<ffffffff810efe16>] ? trace_hardirqs_on+0xd/0xf
 [<ffffffff81495ead>] cpuidle_enter_state+0x51/0xbc
 [<ffffffff81495fe4>] cpuidle_idle_call+0xcc/0x118
 [<ffffffff81011b57>] arch_cpu_idle+0x9/0x21
 [<ffffffff810dda69>] cpu_startup_entry+0xae/0x119
 [<ffffffff8157fedd>] rest_init+0xc1/0xc8
 [<ffffffff8157fe1c>] ? csum_partial_copy_generic+0x16c/0x16c
 [<ffffffff81ae4d5c>] start_kernel+0x3b2/0x3bf
 [<ffffffff81ae47b2>] ? repair_env_string+0x5a/0x5a
 [<ffffffff81ae44b8>] x86_64_start_reservations+0x2a/0x2c
 [<ffffffff81ae45a4>] x86_64_start_kernel+0xea/0xf7
Code: a8 48 89 45 a0 e9 99 00 00 00 4c 89 e7 e8 13 77 1a e1 e9 fa fd ff ff 48 8b 83 30 12 00 00 45 31 ed 48
RIP  [<ffffffffa032ac7a>] ieee80211_rx+0x54f/0x649 [mac80211]
 RSP <ffff88021fa03b30>
---[ end trace 1385eeb9a1ac09ee ]---

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



