GitHub/moto-9609/android_kernel_motorola_exynos9610.git
10 years agomwifiex: Use the proper interfaces
Thomas Gleixner [Fri, 20 Jun 2014 04:48:12 +0000 (21:48 -0700)]
mwifiex: Use the proper interfaces

Why is converting time formats so desired if there are proper
interfaces for this?

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoPCMCIA_HERMES: ioport_map/unmap relies on HAS_IOPORT_MAP
Fabian Frederick [Wed, 18 Jun 2014 17:55:38 +0000 (19:55 +0200)]
PCMCIA_HERMES: ioport_map/unmap relies on HAS_IOPORT_MAP

Fixing following sh-allmodconfig errors reported on kisskb

"
drivers/net/wireless/orinoco/orinoco_cs.c:153:2: error: implicit declaration of function 'ioport_map' [-Werror=implicit-function-declaration]
drivers/net/wireless/orinoco/orinoco_cs.c:205:3: error: implicit declaration of function 'ioport_unmap' [-Werror=implicit-function-declaration]
"

Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoLIBERTAS_CS: ioport_map/unmap relies on HAS_IOPORT_MAP
Fabian Frederick [Wed, 18 Jun 2014 17:48:02 +0000 (19:48 +0200)]
LIBERTAS_CS: ioport_map/unmap relies on HAS_IOPORT_MAP

Fixing following sh-allmodconfig errors reported on kisskb

"
drivers/net/wireless/libertas/if_cs.c:826:3: error: implicit declaration of function 'ioport_unmap' [-Werror=implicit-function-declaration]
drivers/net/wireless/libertas/if_cs.c:878:2: error: implicit declaration of function 'ioport_map' [-Werror=implicit-function-declaration]
"

Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Dan Williams <dcbw@redhat.com>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoSPECTRUM_CS: ioport_map/unmap relies on HAS_IOPORT_MAP
Fabian Frederick [Wed, 18 Jun 2014 17:43:31 +0000 (19:43 +0200)]
SPECTRUM_CS: ioport_map/unmap relies on HAS_IOPORT_MAP

Fixing following sh-allmodconfig errors reported on kisskb

"
drivers/net/wireless/orinoco/spectrum_cs.c:216:2: error: implicit declaration of function 'ioport_map' [-Werror=implicit-function-declaration]
drivers/net/wireless/orinoco/spectrum_cs.c:273:3: error: implicit declaration of function 'ioport_unmap' [-Werror=implicit-function-declaration]
"

Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agodrivers/net/wireless/rt2x00/rt2x00dev.c: remove null test before kfree
Fabian Frederick [Wed, 18 Jun 2014 14:51:29 +0000 (16:51 +0200)]
drivers/net/wireless/rt2x00/rt2x00dev.c: remove null test before kfree

Fix checkpatch warning:
WARNING: kfree(NULL) is safe this check is probably not required

Cc: Ivo van Doorn <IvDoorn@gmail.com>
Cc: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: track Tx queue state
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:23 +0000 (19:37 +0300)]
wil6210: track Tx queue state

Provide both event (netif_tx_[stop|wake]) tracking via printk;
and state via debugfs 'info'

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: interrupt statistics
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:22 +0000 (19:37 +0300)]
wil6210: interrupt statistics

Track number of interrupts and Tx/Rx packets;
expose through debugfs 'info'. Reset upon read.
Used to analyse effectivness of interrupt coalescing and NAPI.
Read twice with some interval like
cat info > /dev/null; sleep 1; cat info

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: add 'info' debugfs entry
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:21 +0000 (19:37 +0300)]
wil6210: add 'info' debugfs entry

Use 'info' debugfs entry for misc. assorted information.
Start with indication whether platform is AC-powered;
will use it later for power related decisions

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: work around for platforms with broken INTx
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:20 +0000 (19:37 +0300)]
wil6210: work around for platforms with broken INTx

There are platforms where INTx can't be routed by ACPI,
this leads to pci_enable_device failure. Re-try pretending we have
MSI already configured; in this case pci_enable_device do not try
to configure INTx. However, MSI could still work.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: fix for unreachable code in wmi_recv_cmd
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:19 +0000 (19:37 +0300)]
wil6210: fix for unreachable code in wmi_recv_cmd

As reported by Dan Carpenter <dan.carpenter@oracle.com>:

The patch a715c7ddd65a: "wil6210: improve debug for WMI receive" from
May 29, 2014, leads to the following static checker warning:

        drivers/net/wireless/ath/wil6210/wmi.c:746 wmi_recv_cmd()
        info: ignoring unreachable code.

drivers/net/wireless/ath/wil6210/wmi.c
   739                  spin_unlock_irqrestore(&wil->wmi_ev_lock, flags);
   740                  {
   741                          int q = queue_work(wil->wmi_wq,
   742                                             &wil->wmi_event_worker);
   743                          wil_dbg_wmi(wil, "queue_work -> %d\n", q);
   744                  }
   745          }
   746          if (n > 1)
                ^^^^^^^^^^
We never reach this if statemtent.

   747                  wil_dbg_wmi(wil, "%s -> %d events processed\n", __func__, n);
   748  }

Exit loop with "break", not "return".

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: map additional registers on target
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:18 +0000 (19:37 +0300)]
wil6210: map additional registers on target

New registers area introduced, mark corresponded address range as valid

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: remove unused #include
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:17 +0000 (19:37 +0300)]
wil6210: remove unused #include

In the pcie_bus.c, knowledge about debugfs is not necessary

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: fix disconnect handling for AP
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:16 +0000 (19:37 +0300)]
wil6210: fix disconnect handling for AP

For the AP-like interface, if "disconnect all" requested,
every station should be deleted with cfg80211_del_sta().
Implement this behavior.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: avoid dmesg pollution by Tx errors
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:15 +0000 (19:37 +0300)]
wil6210: avoid dmesg pollution by Tx errors

On Tx path, when vring for the destination not found,
it was considered as error and message was printed unconditionally.
However, this situation is normal after disconnect. If disconnect was while
heavy traffic load, lots of Tx packets will be dropped and this would
cause significant amount of prints in dmesg.
Demote messages priority from 'error' to 'debug'.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: Debug print GRO Rx result
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:14 +0000 (19:37 +0300)]
wil6210: Debug print GRO Rx result

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: add 'freq' and 'link' debugfs entries
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:13 +0000 (19:37 +0300)]
wil6210: add 'freq' and 'link' debugfs entries

Expose operational frequency and link info

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: Use "name = value" format in the debugfs
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:12 +0000 (19:37 +0300)]
wil6210: Use "name = value" format in the debugfs

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: debug print when scan request state changes
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:11 +0000 (19:37 +0300)]
wil6210: debug print when scan request state changes

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: print error when notifying about FW error
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:10 +0000 (19:37 +0300)]
wil6210: print error when notifying about FW error

Print to dmesg when FW error notification is about to be sent

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: writeable ITR registers
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:09 +0000 (19:37 +0300)]
wil6210: writeable ITR registers

Interrupt threshold registers may be written to.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: debugfs interface to send raw WMI command
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:08 +0000 (19:37 +0300)]
wil6210: debugfs interface to send raw WMI command

Debug aid

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: BACK: track last dropped SSN
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:07 +0000 (19:37 +0300)]
wil6210: BACK: track last dropped SSN

Track and print on debugfs

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: Allow driver load if FW not ready
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:06 +0000 (19:37 +0300)]
wil6210: Allow driver load if FW not ready

Usable for debugging, to be able to obtain FW traces

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: Tx performance monitoring
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:05 +0000 (19:37 +0300)]
wil6210: Tx performance monitoring

For performance monitoring, trace time intervals when Tx vring
is idle/not idle. Use CPU cycle counter for this, because jiffies is
too rough, and other precise time measurement methods involve
overhead while get_cycles() should be fast.
This used to provide some estimation for percentage when Tx vring
was idle, i.e. when hardware is under-utilized.
Estimation is not precise because of many reasons - CPU frequency scaling,
grt_cycles() may be per core etc. But still, it is good estimation

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: more debug info for vring
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:04 +0000 (19:37 +0300)]
wil6210: more debug info for vring

print used/available counters on debugfs;
print to dmesg when Tx vring becomes empty

This aids with performance investigation

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: print more info about BSS found
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:03 +0000 (19:37 +0300)]
wil6210: print more info about BSS found

print essential info to dmesg

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: trace wil->status on debugfs
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:02 +0000 (19:37 +0300)]
wil6210: trace wil->status on debugfs

For debug purposes

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: print debug info when starting AP
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:01 +0000 (19:37 +0300)]
wil6210: print debug info when starting AP

In the wil_cfg80211_start_ap(), debug print selected data:
- beacon (before and after fix-up)
- crypto parameters
- mark start/stop AP invocation

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: indicate mgmt_tx status
Vladimir Kondratiev [Mon, 16 Jun 2014 16:37:00 +0000 (19:37 +0300)]
wil6210: indicate mgmt_tx status

Inform cfg80211 about Tx result

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowil6210: Tx mgmt frame from debugfs
Vladimir Kondratiev [Mon, 16 Jun 2014 16:36:59 +0000 (19:36 +0300)]
wil6210: Tx mgmt frame from debugfs

Provide 2 files on the debugfs:
- "rxon": write channel (1..4) to open Rx on it, 0 to rxoff
- "tx_mgmt": write binary frame, starting from MAC header

one need to care about turning receiver on/off before/after tx_mgmt

Correct sequence is:
 echo $channel > rxon
 cat mfmt_frame > tx_mgmt
 echo 0 > rxon

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Changes for 40MHz
Jahnavi Meher [Mon, 16 Jun 2014 14:17:03 +0000 (19:47 +0530)]
rsi: Changes for 40MHz

Added code required for 40MHz.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Adding support for host based bgscan.
Jahnavi Meher [Mon, 16 Jun 2014 14:16:48 +0000 (19:46 +0530)]
rsi: Adding support for host based bgscan.

Added support for host based bgscan. The h/w queues are blocked
while bgscan is being performed and after coming to the connected
channel, the queues are unblocked.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Adding support for 5GHz
Jahnavi Meher [Mon, 16 Jun 2014 14:16:31 +0000 (19:46 +0530)]
rsi: Adding support for 5GHz

Adding support for 5GHz.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Sending QoS null packet via the mgmt queue.
Jahnavi Meher [Mon, 16 Jun 2014 14:16:13 +0000 (19:46 +0530)]
rsi: Sending QoS null packet via the mgmt queue.

Send the QoS null packet via mgmt queue.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Added debug messages.
Jahnavi Meher [Mon, 16 Jun 2014 14:15:45 +0000 (19:45 +0530)]
rsi: Added debug messages.

Added some debug messages.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Changed the logic of dequeuing packets from hal queues.
Jahnavi Meher [Mon, 16 Jun 2014 14:15:03 +0000 (19:45 +0530)]
rsi: Changed the logic of dequeuing packets from hal queues.

The number of packets being dequeued from s/w queues was fixed -
changed it to a dynamic calculation based on txop. There are also
some fixes to the dequeuing algorithm.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Changed the SDIO interrupt variables and some clean up.
Jahnavi Meher [Mon, 16 Jun 2014 14:14:12 +0000 (19:44 +0530)]
rsi: Changed the SDIO interrupt variables and some clean up.

Changed the SDIO interrupt variables and some clean ups.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Use SGI if configured for fixed rate transmission.
Jahnavi Meher [Mon, 16 Jun 2014 14:13:54 +0000 (19:43 +0530)]
rsi: Use SGI if configured for fixed rate transmission.

Use SGI if configured while sending data packets at a fixed rate.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Lower level debug messages and changed handling of confirm received for rsi_prog...
Jahnavi Meher [Mon, 16 Jun 2014 14:13:35 +0000 (19:43 +0530)]
rsi: Lower level debug messages and changed handling of confirm received for rsi_program_bb_rf().

Lower level debug messages for some frames and changed confirm
received for rsi_program_bb_rf() to a valid case.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Changed rate handling.
Jahnavi Meher [Mon, 16 Jun 2014 14:13:09 +0000 (19:43 +0530)]
rsi: Changed rate handling.

Changed rate handling.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Changed the rsi_set_channel() and rsi_program_bb_rf().
Jahnavi Meher [Mon, 16 Jun 2014 14:11:58 +0000 (19:41 +0530)]
rsi: Changed the rsi_set_channel() and rsi_program_bb_rf().

Made required changes to rsi_set_channel() and rsi_program_bb_rf()
functions.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Changed the radio caps frame.
Jahnavi Meher [Mon, 16 Jun 2014 14:11:41 +0000 (19:41 +0530)]
rsi: Changed the radio caps frame.

Changed the radio caps frame and added the required fields.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Add macros for endpoints and set default value of endpoint.
Jahnavi Meher [Mon, 16 Jun 2014 14:11:22 +0000 (19:41 +0530)]
rsi: Add macros for endpoints and set default value of endpoint.

Added macros for the endpoints and set the default value of endpoint
to 2.4GHz and 20MHz.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Using band from rsi_common to fill in ieee80211_rx_status
Jahnavi Meher [Mon, 16 Jun 2014 14:10:55 +0000 (19:40 +0530)]
rsi: Using band from rsi_common to fill in ieee80211_rx_status

Filling in band from common->band.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Fixed the kernel doc
Jahnavi Meher [Mon, 16 Jun 2014 14:10:02 +0000 (19:40 +0530)]
rsi: Fixed the kernel doc

Changed the function header to match the function name.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Mapping the debugfs stats to the correct s/w queues.
Jahnavi Meher [Mon, 16 Jun 2014 14:09:40 +0000 (19:39 +0530)]
rsi: Mapping the debugfs stats to the correct s/w queues.

Changed the queue numbers to macros, and corrected the mappings.

Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: Use dma_zalloc_coherent
Joe Perches [Sun, 15 Jun 2014 20:37:43 +0000 (13:37 -0700)]
rt2x00: Use dma_zalloc_coherent

Use the zeroing function instead of dma_alloc_coherent & memset(,0,)

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Advertise multichannel support
Rajkumar Manoharan [Wed, 11 Jun 2014 10:48:16 +0000 (16:18 +0530)]
ath9k: Advertise multichannel support

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: use separate HW queue for each channel context
Rajkumar Manoharan [Wed, 11 Jun 2014 10:48:15 +0000 (16:18 +0530)]
ath9k: use separate HW queue for each channel context

Use seperate tx queue for each AC in each channel context and expose
these information to mac80211 to avoid stopping one channel context
leads to stopping the entire traffic for that AC even on other contexts.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add recovery mechanism for hw TSF timer
Felix Fietkau [Wed, 11 Jun 2014 10:48:14 +0000 (16:18 +0530)]
ath9k: Add recovery mechanism for hw TSF timer

Configure the TSF based hardware timer for a channel switch.
Also set up backup software timer, in case the gen timer fails.
This could be caused by a hardware reset.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Update channel switch timer
Felix Fietkau [Wed, 11 Jun 2014 10:48:13 +0000 (16:18 +0530)]
ath9k: Update channel switch timer

TSF time might have been updated by the incoming beacon,
need update the channel switch timer to reflect the change.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Handle beacon miss on multi channel context
Felix Fietkau [Wed, 11 Jun 2014 10:48:12 +0000 (16:18 +0530)]
ath9k: Handle beacon miss on multi channel context

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add periodic NoA support
Felix Fietkau [Wed, 11 Jun 2014 10:48:11 +0000 (16:18 +0530)]
ath9k: Add periodic NoA support

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add multi-channel scheduling support
Felix Fietkau [Wed, 11 Jun 2014 10:48:10 +0000 (16:18 +0530)]
ath9k: Add multi-channel scheduling support

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Implement mgd_prepare_tx
Felix Fietkau [Wed, 11 Jun 2014 10:48:09 +0000 (16:18 +0530)]
ath9k: Implement mgd_prepare_tx

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Adjust AP beacon tsf based on station context
Felix Fietkau [Wed, 11 Jun 2014 10:48:08 +0000 (16:18 +0530)]
ath9k: Adjust AP beacon tsf based on station context

In multi channel context (AP + STA case), adjust the TSF time of
the AP chanctx to keep its beacons at half beacon interval offset
relative to the STA chanctx.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: switch channel after sending beacon
Felix Fietkau [Wed, 11 Jun 2014 10:48:07 +0000 (16:18 +0530)]
ath9k: switch channel after sending beacon

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add p2p go NoA attribute
Felix Fietkau [Wed, 11 Jun 2014 10:48:06 +0000 (16:18 +0530)]
ath9k: Add p2p go NoA attribute

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Store current offchannel duration
Rajkumar Manoharan [Wed, 11 Jun 2014 10:48:05 +0000 (16:18 +0530)]
ath9k: Store current offchannel duration

Update current offchannel duration during scan or roc request.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: switch channel context for beaconing
Felix Fietkau [Wed, 11 Jun 2014 10:48:04 +0000 (16:18 +0530)]
ath9k: switch channel context for beaconing

Add a basic state machine for switch channel context
for beacon transmission.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Summarize hw state per channel context
Rajkumar Manoharan [Wed, 11 Jun 2014 10:48:03 +0000 (16:18 +0530)]
ath9k: Summarize hw state per channel context

Group and set hw state (opmode, primary_sta, beacon conf) per
channel context instead of whole list of vifs. This would allow
each channel context to run in different mode (STA/AP).

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Move beacon config to channel context
Rajkumar Manoharan [Wed, 11 Jun 2014 10:48:02 +0000 (16:18 +0530)]
ath9k: Move beacon config to channel context

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: save tsf in channel context
Felix Fietkau [Wed, 11 Jun 2014 10:48:01 +0000 (16:18 +0530)]
ath9k: save tsf in channel context

Save TSF in channel context for multiple operating channels.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add ATH_OP_MULTI_CHANNEL
Felix Fietkau [Wed, 11 Jun 2014 10:48:00 +0000 (16:18 +0530)]
ath9k: Add ATH_OP_MULTI_CHANNEL

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Move caldata into channel context
Felix Fietkau [Wed, 11 Jun 2014 10:47:59 +0000 (16:17 +0530)]
ath9k: Move caldata into channel context

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Fetch appropriate operating channel context
Rajkumar Manoharan [Wed, 11 Jun 2014 10:47:58 +0000 (16:17 +0530)]
ath9k: Fetch appropriate operating channel context

Retrieve appropriate operating channel context while switching
between operating and off channels.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Implement channel context ops
Felix Fietkau [Wed, 11 Jun 2014 10:47:57 +0000 (16:17 +0530)]
ath9k: Implement channel context ops

Add channel context operations (add, remove, change, assign and
unassign) to enable support for multiple channels.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Implement remain-on-channal support
Felix Fietkau [Wed, 11 Jun 2014 10:47:56 +0000 (16:17 +0530)]
ath9k: Implement remain-on-channal support

Add remain on channel support in order to enable multi-channel
concurrency.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Implement hw_scan support
Felix Fietkau [Wed, 11 Jun 2014 10:47:55 +0000 (16:17 +0530)]
ath9k: Implement hw_scan support

Implement hw_scan support for enabling multi-channel cuncurrency.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: send powersave frame on channel switch
Felix Fietkau [Wed, 11 Jun 2014 10:47:54 +0000 (16:17 +0530)]
ath9k: send powersave frame on channel switch

While leaving from or entering to active channel context, send out
nullfunc frame to inform to the AP about the presence of station.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: channel context based transmission
Felix Fietkau [Wed, 11 Jun 2014 10:47:53 +0000 (16:17 +0530)]
ath9k: channel context based transmission

Force queueing of all frames that belong to a virtual interface on
a different channel context, to ensure that they are sent on the
correct channel.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add channel context worker thread
Felix Fietkau [Wed, 11 Jun 2014 10:47:52 +0000 (16:17 +0530)]
ath9k: Add channel context worker thread

The channel context worker is used to switch to next requested
channel context.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Move acq to channel context
Felix Fietkau [Wed, 11 Jun 2014 10:47:51 +0000 (16:17 +0530)]
ath9k: Move acq to channel context

Add support to maintain per-channel ACs list.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Move txpower limit to channel context
Felix Fietkau [Wed, 11 Jun 2014 10:47:50 +0000 (16:17 +0530)]
ath9k: Move txpower limit to channel context

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Add channel context structure
Felix Fietkau [Wed, 11 Jun 2014 10:47:49 +0000 (16:17 +0530)]
ath9k: Add channel context structure

The channel context structure is defined to enable
multi-channel concurrency support.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agortlwifi: btcoexist: avoid format string in printk
Kees Cook [Tue, 10 Jun 2014 17:37:24 +0000 (10:37 -0700)]
rtlwifi: btcoexist: avoid format string in printk

Since CL_PRINTF only ever takes a single argument, make sure a format
string cannot leak into printk.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi_91x_sdio: add error handling into rsi_module_init()
Alexey Khoroshilov [Sat, 7 Jun 2014 03:18:31 +0000 (07:18 +0400)]
rsi_91x_sdio: add error handling into rsi_module_init()

Fix rsi_module_init() to propagate sdio_register_driver() errors.

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agorsi: Use module_usb_driver
Alexey Khoroshilov [Sat, 7 Jun 2014 03:18:30 +0000 (07:18 +0400)]
rsi: Use module_usb_driver

module_usb_driver eliminates the boilerplate and makes the code simpler,
in addition to the fact currently rsi_module_init() ignores usb_deregister() error.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: wowlan: do not disconnect on suspend
Bing Zhao [Sat, 7 Jun 2014 02:47:44 +0000 (19:47 -0700)]
mwifiex: wowlan: do not disconnect on suspend

For users who do not need wowlan, load mwifiex.ko with
disconnect_on_suspend = 1; or iw phy0 wowlan disable.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: support wowlan magic-packet encapsulated as UDP packet
Zhiyuan Yang [Sat, 7 Jun 2014 02:47:42 +0000 (19:47 -0700)]
mwifiex: support wowlan magic-packet encapsulated as UDP packet

When magic-packet is generated as a UDP packet the offset should
be 20+8 more bytes to cover IPv4 header and UDP header. So the
total offset become 56.
Add a new MEF entry to support both magic-packet patterns
generated by different tools.

Cc: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Zhiyuan Yang <yangzy@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agobcma: gpio: register all 32 GPIOs on BCM53572
Rafał Miłecki [Thu, 5 Jun 2014 18:20:44 +0000 (20:20 +0200)]
bcma: gpio: register all 32 GPIOs on BCM53572

I've here a device detected as:
bcma: bus0: Found chip with id 0xD144, rev 0x01 and package 0x08
I couldn't find GPIO handling hw button until trying GPIO 20. It seems
BCM53572 also has 32 GPIOs.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: do not initialize BCN_OFFSET registers
Stanislaw Gruszka [Thu, 5 Jun 2014 11:52:27 +0000 (13:52 +0200)]
rt2x00: do not initialize BCN_OFFSET registers

We setup BCN_OFFSET{0,1} registers dynamically, don't have to
initialize them.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: change order when stop beaconing
Stanislaw Gruszka [Thu, 5 Jun 2014 11:52:26 +0000 (13:52 +0200)]
rt2x00: change order when stop beaconing

When no beaconing is needed, first stop beacon queue (disable beaconing
globally) to avoid possible sending of not prepared beacon on short
period after clearing beacon and before stop of BCN queue.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: change default MAC_BSSID_DW1_BSS_BCN_NUM
Stanislaw Gruszka [Thu, 5 Jun 2014 11:52:25 +0000 (13:52 +0200)]
rt2x00: change default MAC_BSSID_DW1_BSS_BCN_NUM

We setup MAC_BSSID_DW1_BSS_BCN_NUM dynamically when numbers of active
beacons increase. Change default to 0 to tell hardware that we want to
send only one beacon as default.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: change beaconing setup on RT2800
Stanislaw Gruszka [Thu, 5 Jun 2014 11:52:24 +0000 (13:52 +0200)]
rt2x00: change beaconing setup on RT2800

As reported by Matthias, on 5572 chip, even if we clear up TXWI
of corresponding beacon, hardware still try to send it or do other
action that increase power consumption peak up to 1A.

To avoid the issue, setup beaconing dynamically by configuring offsets
of currently active beacons and MAC_BSSID_DW1_BSS_BCN_NUM variable,
which limit number of beacons that hardware will try to send.

Reported-by: Matthias Fend <Matthias.Fend@wolfvision.net>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agort2x00: change beaconing locking
Stanislaw Gruszka [Thu, 5 Jun 2014 11:52:23 +0000 (13:52 +0200)]
rt2x00: change beaconing locking

This patch is needed for further changes to keep global variables
consistent when changing beaconing on diffrent vif's.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: Remove custom world regulatory domain
Markus Pargmann [Wed, 4 Jun 2014 13:32:32 +0000 (15:32 +0200)]
mwifiex: Remove custom world regulatory domain

A custom regulatory domain was introduced in this commit:
cc0ba0d mwifiex: support custom world regulatory domain

The commit description says that it was introduced because the world
regulatory domain does not include channels 52-64 and 100-140. These
channels are described in the world regulatory domain now, so we can
drop this custom regulatory domain.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agonet: wireless: rtlwifi: rtl8192de: phy.c: Cleaning up uninitialized variable
Rickard Strandqvist [Sun, 1 Jun 2014 20:14:38 +0000 (22:14 +0200)]
net: wireless: rtlwifi: rtl8192de: phy.c: Cleaning up uninitialized variable

There is a risk that the variables will be used without being initialized.
Have also moved variable to the part of the code where it is used.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agonet: wireless: rt2x00: rt2x00mac.c: Cleaning up uninitialized variables
Rickard Strandqvist [Sun, 1 Jun 2014 12:44:13 +0000 (14:44 +0200)]
net: wireless: rt2x00: rt2x00mac.c: Cleaning up uninitialized variables

There is a risk that the variable will be used without being initialized.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agonet: wireless: libertas: cmd.c: Cleaning up uninitialized variables
Rickard Strandqvist [Sun, 1 Jun 2014 12:39:20 +0000 (14:39 +0200)]
net: wireless: libertas: cmd.c: Cleaning up uninitialized variables

There is a risk that the variable will be used without being initialized.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: PHY: drop channel_type (we can get this info from chandef)
Rafał Miłecki [Sat, 31 May 2014 18:49:41 +0000 (20:49 +0200)]
b43: PHY: drop channel_type (we can get this info from chandef)

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: PHY: drop is_40mhz (get width info from chandef)
Rafał Miłecki [Sat, 31 May 2014 18:49:40 +0000 (20:49 +0200)]
b43: PHY: drop is_40mhz (get width info from chandef)

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: PHY: drop own channel_freq (get it from chandef when needed)
Rafał Miłecki [Sat, 31 May 2014 18:49:39 +0000 (20:49 +0200)]
b43: PHY: drop own channel_freq (get it from chandef when needed)

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: store current channel using struct cfg80211_chan_def
Rafał Miłecki [Sat, 31 May 2014 18:49:38 +0000 (20:49 +0200)]
b43: store current channel using struct cfg80211_chan_def

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: b43_op_config: set channel info before switching band
Rafał Miłecki [Sat, 31 May 2014 18:49:37 +0000 (20:49 +0200)]
b43: b43_op_config: set channel info before switching band

Band switching code needs to know what channel we switch to.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: PHY: don't force default channel during init
Rafał Miłecki [Sat, 31 May 2014 18:49:36 +0000 (20:49 +0200)]
b43: PHY: don't force default channel during init

PHY may need to be re-initialized during runtime (e.g. on band switch).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: b43_op_config: use IEEE80211_CONF_CHANGE_CHANNEL
Rafał Miłecki [Sat, 31 May 2014 18:49:35 +0000 (20:49 +0200)]
b43: b43_op_config: use IEEE80211_CONF_CHANGE_CHANNEL

This is tiny optimization and grouping band/channel ops.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: b43_op_config: drop check for core change
Rafał Miłecki [Sat, 31 May 2014 18:49:34 +0000 (20:49 +0200)]
b43: b43_op_config: drop check for core change

There aren't devices with multiple 802.11 cores supported by b43.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: drop B43_DEFAULT_CHANNEL
Rafał Miłecki [Sat, 31 May 2014 18:49:33 +0000 (20:49 +0200)]
b43: drop B43_DEFAULT_CHANNEL

It was never used, b43_switch_channel is always called with hw_value
(from mac80211) or whatever get_default_chan returns.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agortl818x_pci: fix possible RX descriptor invalid data read
Andrea Merello [Sat, 31 May 2014 16:30:26 +0000 (18:30 +0200)]
rtl818x_pci: fix possible RX descriptor invalid data read

RX descriptor data must be read only if the descriptor has been fully
updated by HW.
There is a "ownership" flag in the descriptor itself to test this.

The driver code contains a read for the "ownership" flag and, after
it, other read access for descriptor data.

This is in DMA coherent memory, that is _not_ guaranteed to be immune
to instruction reordering, thus it is possible that the descriptor
data is read _before_ the "ownership" flag.

This can theoretically lead to a DMA/CPU race that may end up with the
driver reading the data when it is still not valid, and the "ownership"
bit just after enough time that the HW make the whole descriptor valid.
The driver will in this case believe the data is valid, but it will use
the invalid data read earlier.

In order to avoid this, this patch adds a rmb() to force the "ownership"
bit read to be issued before other descriptor data reads are attempted.

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>