OSDN Git Service

android-x86/kernel.git
6 years agoiwlwifi: add 9000 and A000 device families
Sara Sharon [Wed, 22 Mar 2017 12:07:50 +0000 (14:07 +0200)]
iwlwifi: add 9000 and A000 device families

Add two new device families to differentiate them from 8000.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: support init flow debugging
Liad Kaufman [Thu, 16 Mar 2017 11:00:59 +0000 (13:00 +0200)]
iwlwifi: mvm: support init flow debugging

In case an assert happens on init flow, the current
driver powers down the NIC, except if iwlmvm modparam
init_dbg=1, and only on very specific flows.

Extend this capability to cover most failure cases
by keeping track of what init configurations have been
completed. This way, we can allow NOT powering down
the NIC, while making sure that when the driver is
removed we don't try to free resources that haven't
been allocated. (This can result in a kernel panic.)

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: add TLV for NAN API differentiation
Beni Lev [Sun, 19 Mar 2017 17:03:51 +0000 (19:03 +0200)]
iwlwifi: mvm: add TLV for NAN API differentiation

Due to NAN FW API change, add TLV in order to distiguish between the
2 API versions

Signed-off-by: Beni Lev <beni.lev@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: add dbgc_supported to transport configuration
Sara Sharon [Wed, 22 Mar 2017 12:06:41 +0000 (14:06 +0200)]
iwlwifi: add dbgc_supported to transport configuration

Use transport configuration to determine DBGC support
instead of relying on device family.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: remove references to 8000 B-step devices
Sara Sharon [Wed, 22 Mar 2017 11:51:12 +0000 (13:51 +0200)]
iwlwifi: remove references to 8000 B-step devices

We don't have any 8000 B-step right now, and there is no
firmware loading code for them anyway.
Further more, 9000 B-step devices will hit those code paths.
Remove code that was introduced only for 8000 B-step.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: cleanup references to 8000 family in NVM code
Sara Sharon [Wed, 22 Mar 2017 10:20:40 +0000 (12:20 +0200)]
iwlwifi: cleanup references to 8000 family in NVM code

NVM code is tightly coupled with 8000 family, while
it really refers to extended NVM format introduced
back then. Separate it to a configuration dependent
boolean, and rename defines accordingly.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: pcie: add AMSDU to gen2
Sara Sharon [Thu, 16 Mar 2017 09:06:41 +0000 (11:06 +0200)]
iwlwifi: pcie: add AMSDU to gen2

This is essentially the same code as gen1, except that it uses
gen2 functions and SW checksum is not included.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: document RX structures
Johannes Berg [Wed, 15 Mar 2017 13:06:53 +0000 (14:06 +0100)]
iwlwifi: mvm: document RX structures

Document the structures used in RX and link them to the command ID.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: add AMSDU flag to offload assist
Sara Sharon [Thu, 16 Mar 2017 08:44:31 +0000 (10:44 +0200)]
iwlwifi: mvm: add AMSDU flag to offload assist

Enable offload assist for AMSDU when the AMSDU present flag is set.

Fixes: a830baba9c2e ("iwlwifi: mvm: support new TX API")
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: add wait for tx queue empty
Sara Sharon [Mon, 6 Mar 2017 08:16:11 +0000 (10:16 +0200)]
iwlwifi: add wait for tx queue empty

Now that we have 512 queues, add a wait for single TX
queue to gen2.
This replaces gen1 wait_tx_queues_empty, which was limited
to 32 queues.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix many kernel-doc warnings
Johannes Berg [Wed, 15 Mar 2017 09:18:20 +0000 (10:18 +0100)]
iwlwifi: mvm: fix many kernel-doc warnings

Fix many kernel-doc warnings. In one case, this required adding
a new enum value to be able to document things properly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: remove unused REPLY_MAX
Johannes Berg [Wed, 15 Mar 2017 09:22:06 +0000 (10:22 +0100)]
iwlwifi: mvm: remove unused REPLY_MAX

This value is unused, and there's no reason we'd ever use it.
Just remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: kernel-doc: make proper links
Johannes Berg [Wed, 15 Mar 2017 09:02:23 +0000 (10:02 +0100)]
iwlwifi: kernel-doc: make proper links

Using %enum instead of &enum (and in one case, %struct) results in
the wrong parsing. Fix that so that if documentation is generated,
the result is clickable links.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: remove unused TX_CMD_NEXT_FRAME_*
Johannes Berg [Wed, 15 Mar 2017 08:53:13 +0000 (09:53 +0100)]
iwlwifi: mvm: remove unused TX_CMD_NEXT_FRAME_*

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: Add fw_name_pre_rf_next_step to support different rf steps
Haim Dreyfuss [Thu, 9 Mar 2017 13:18:58 +0000 (15:18 +0200)]
iwlwifi: Add fw_name_pre_rf_next_step to support different rf steps

Integrated chip may have different HW and RF steps.
Currently, the driver supports only different HW steps.
Add logic to support different RF steps enables combining different
HW and RF steps.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: support page dumping in wrt in gen2
Liad Kaufman [Sun, 12 Mar 2017 09:09:58 +0000 (11:09 +0200)]
iwlwifi: pcie: support page dumping in wrt in gen2

In gen2, page dumping needs to be done in the trans
layer, as it is the one with access to the paging
pointers.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: remove wrt support of page dumps in gen2
Liad Kaufman [Sun, 12 Mar 2017 09:00:04 +0000 (11:00 +0200)]
iwlwifi: mvm: remove wrt support of page dumps in gen2

In gen2, page dumping should be done in transport
layer, since the addresses needed for the paging
mechanism reside there.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: document structures used by commands
Johannes Berg [Fri, 10 Mar 2017 13:01:42 +0000 (14:01 +0100)]
iwlwifi: mvm: document structures used by commands

Add documentation to a lot of command IDs that links to the
appropriate structure(s) used with those IDs. In one case,
actually add and use a new struct for that purpose.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: create/name various enums
Johannes Berg [Tue, 14 Mar 2017 09:58:16 +0000 (10:58 +0100)]
iwlwifi: mvm: create/name various enums

Some values should be in enums so documentation can refer to
them, some values should be named for the same reason.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: disentangle binding command versions
Johannes Berg [Tue, 14 Mar 2017 10:04:06 +0000 (11:04 +0100)]
iwlwifi: mvm: disentangle binding command versions

The comments/size of the different binding commands get lost
in documentation, so introduce two different command structs
that can be used there.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: update device ID for a000 family
Sara Sharon [Sun, 12 Mar 2017 08:34:10 +0000 (10:34 +0200)]
iwlwifi: update device ID for a000 family

Three configurations will share device ID 2720, and will
be differentiated by RF ID.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add documentation links to various fields
Johannes Berg [Tue, 14 Mar 2017 10:01:27 +0000 (11:01 +0100)]
iwlwifi: mvm: add documentation links to various fields

Link various fields to the documentation of the enums that
define their values.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix some kernel-doc
Johannes Berg [Thu, 9 Mar 2017 14:56:57 +0000 (15:56 +0100)]
iwlwifi: mvm: fix some kernel-doc

This mostly fixes missing tags/struct names, but also some other
things. Lots of issues remain though.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: wait for the flushed queue only
Sara Sharon [Thu, 9 Mar 2017 11:09:03 +0000 (13:09 +0200)]
iwlwifi: mvm: wait for the flushed queue only

The function flushed only agg queue and no more traffic
is queued on it.
However, it waits for all queues to empty, which is not
necessary and may take more time.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add documentation to some WoWLAN commands
Johannes Berg [Tue, 14 Mar 2017 09:55:09 +0000 (10:55 +0100)]
iwlwifi: mvm: add documentation to some WoWLAN commands

Add some documentation for the WoWLAN commands, also linking the
correct enums used.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: disentangle paging command structs
Johannes Berg [Mon, 13 Mar 2017 20:48:39 +0000 (21:48 +0100)]
iwlwifi: mvm: disentangle paging command structs

Instead of using a union and hard-coding the size difference,
declare both command structs properly, use a union on the
stack to build them and the right sizeof() for the size.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: use u8 for reserved fields
Johannes Berg [Mon, 13 Mar 2017 11:47:37 +0000 (12:47 +0100)]
iwlwifi: mvm: use u8 for reserved fields

There's no saying what kind of type a reserved field will
get in the future, so use u8 arrays to reserve space.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix MCC endianness bug
Johannes Berg [Mon, 13 Mar 2017 11:07:52 +0000 (12:07 +0100)]
iwlwifi: mvm: fix MCC endianness bug

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: use proper sta_addr in firmware API
Johannes Berg [Thu, 9 Mar 2017 13:08:51 +0000 (14:08 +0100)]
iwlwifi: mvm: use proper sta_addr in firmware API

There's no point to declare an address as a __le32/__le16
and then only take a pointer to it anyway, change that to
just a sta_addr[ETH_ALEN].

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: document which group enums are used with which group ID
Johannes Berg [Thu, 9 Mar 2017 16:06:45 +0000 (17:06 +0100)]
iwlwifi: mvm: document which group enums are used with which group ID

Make it explicit which command definition enum is supposed to be
used with which command group, rather than relying on being able
to figure it out by name.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix endianness in lq_cmd declaration
Johannes Berg [Mon, 13 Mar 2017 12:40:23 +0000 (13:40 +0100)]
iwlwifi: mvm: fix endianness in lq_cmd declaration

This member doesn't seem to be used, so this doesn't really
fix anything, but it's better to have the right type there.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support old method of NVM parsing
Sara Sharon [Mon, 6 Mar 2017 09:13:02 +0000 (11:13 +0200)]
iwlwifi: mvm: support old method of NVM parsing

Add configuration for allowing driver's nvm parsing and
bypassing the new host command, for debugging.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support getting nvm data from firmware
Sara Sharon [Sun, 8 Jan 2017 14:46:14 +0000 (16:46 +0200)]
iwlwifi: mvm: support getting nvm data from firmware

This API replaces the complex NVM parsing of the iwlwifi module.
Instead, we get all needed data from firmware.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: flush per station for DQA mode
Sara Sharon [Sun, 5 Mar 2017 11:01:08 +0000 (13:01 +0200)]
iwlwifi: mvm: flush per station for DQA mode

Avoid using the global flush and move to flush per
station whenever possible in DQA mode.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agorsi: use subdirectory for firmware file
amit karwar [Fri, 26 May 2017 15:01:31 +0000 (20:31 +0530)]
rsi: use subdirectory for firmware file

linux-firmware maintainers prefer to have a subdirectory for
firmware files. Code is changed here to pick firmware file from
a subdirectory. Firmware file with a new loading mechanism will
be submitted inside rsi directory.

Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: uap: process remain on channel expired event
Xinming Hu [Fri, 26 May 2017 06:57:13 +0000 (06:57 +0000)]
mwifiex: uap: process remain on channel expired event

AP interface need process remain-on-channel firmware event and notify
cfg80211, this will be used in the listen-stage of p2p find procedure.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: simplify the code around ra_list
Shawn Lin [Fri, 26 May 2017 01:41:49 +0000 (09:41 +0800)]
mwifiex: simplify the code around ra_list

We don't need to check if the list is empty separately
as we could use list_first_entry_or_null to cover it.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoqtnfmac: remove duplicated assignment to mac
Colin Ian King [Thu, 25 May 2017 13:45:03 +0000 (14:45 +0100)]
qtnfmac: remove duplicated assignment to mac

mac is being assigned twice, remove redundant 2nd assignment.

Detected by CoverityScan, CID#1437554 ("Incorrect expression")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: check next packet length for usb tx aggregation
Xinming Hu [Tue, 23 May 2017 07:12:34 +0000 (07:12 +0000)]
mwifiex: check next packet length for usb tx aggregation

The next packet length will be used by interface driver, to check if the
next packet still could be aggregated.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: usb: add timer to flush aggregation packets
Xinming Hu [Tue, 23 May 2017 07:12:33 +0000 (07:12 +0000)]
mwifiex: usb: add timer to flush aggregation packets

Aggregation will wait for next packet until limit aggr size/number reach.
Packet might be drop and also packet dequeue will be stop in some cases.
This patch add timer to flush packets in aggregation list to avoid long
time waiting.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: usb: transmit aggregation packets
Xinming Hu [Tue, 23 May 2017 07:12:32 +0000 (07:12 +0000)]
mwifiex: usb: transmit aggregation packets

Instead of using 4KB packet buffer for data transfer, new chipset have
more device memory. This patch try to aggregation packets in an 16KB
buffer. In this way, totally usb transaction cost will be reduced.

Thoughput test on usb 2.0 show both TCP TX and UPD TX promote ~40M,
from ~240M to ~280M.

This feature is default disabled, and can be enabled by module
parameter, like:
insmod mwifiex.ko aggr_ctrl=1

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: usb: kill urb before free its memory
Xinming Hu [Tue, 23 May 2017 07:12:31 +0000 (07:12 +0000)]
mwifiex: usb: kill urb before free its memory

we have observed host system hang when device firmware crash,
stack trace show it was an use-after-free case: previous submitted
urb will be holding in usbcore, and given back to device driver
when device disconnected, while the urb have been freed in usb
device disconnect handler. This patch kill the holding urb before
free its memory.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: use variable interface header length
Xinming Hu [Tue, 23 May 2017 07:12:30 +0000 (07:12 +0000)]
mwifiex: use variable interface header length

Usb tx aggregation feature will utilize 4-bytes bus interface header,
otherwise it will be set to zero in default case.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoqtnfmac: introduce new FullMAC driver for Quantenna chipsets
Igor Mitsyanko [Thu, 11 May 2017 21:51:01 +0000 (14:51 -0700)]
qtnfmac: introduce new FullMAC driver for Quantenna chipsets

This patch adds support for new FullMAC WiFi driver for Quantenna
QSR10G chipsets.

QSR10G (aka Pearl) is Quantenna's 8x8, 160M, 11ac offering.
QSR10G supports 2 simultaneous WMACs - one 5G and one 2G.
5G WMAC supports 160M, 8x8 configuration. FW supports
up to 8 concurrent virtual interfaces on each WMAC.

Patch introduces 2 new drivers:
- qtnfmac.ko for interfacing with kernel wireless core
- qtnfmac_pearl_pcie.ko for interfacing with hardware over PCIe interface

Signed-off-by: Dmitrii Lebed <dlebed@quantenna.com>
Signed-off-by: Sergei Maksimenko <smaksimenko@quantenna.com>
Signed-off-by: Sergey Matyukevich <smatyukevich@quantenna.com>
Signed-off-by: Bindu Therthala <btherthala@quantenna.com>
Signed-off-by: Huizhao Wang <hwang@quantenna.com>
Signed-off-by: Kamlesh Rath <krath@quantenna.com>
Signed-off-by: Avinash Patil <avinashp@quantenna.com>
Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: initialize bt_disabled to false
Dan Carpenter [Fri, 19 May 2017 21:25:39 +0000 (00:25 +0300)]
rtlwifi: btcoex: 23b 1ant: initialize bt_disabled to false

We only want to disable this if bt_disable_cnt is >= 2.

Fixes: f66509e3d7c2 ("rtlwifi: btcoex: Remove 23b 1ant configuration parameter")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: turn off ps and tdma mechanism when concurrent mode
Yan-Hsuan Chuang [Sat, 20 May 2017 15:49:07 +0000 (10:49 -0500)]
rtlwifi: btcoex: 23b 1ant: turn off ps and tdma mechanism when concurrent mode

When wifi is under concurrent mode, we can not distinguish if it is the
real PS or just a fake one by sending null data, so we turn it off
in case of miracast scenario.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: fine tune for bt_sco_hid busy
Ping-Ke Shih [Sat, 20 May 2017 15:49:06 +0000 (10:49 -0500)]
rtlwifi: btcoex: 23b 1ant: fine tune for bt_sco_hid busy

Fine tune the parameters in case of act_bt_sco_hid_only_busy.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: fine tune for wifi not connected
Ping-Ke Shih [Sat, 20 May 2017 15:49:05 +0000 (10:49 -0500)]
rtlwifi: btcoex: 23b 1ant: fine tune for wifi not connected

Fine tune the parameters in cases of scan, assoc and auth when wifi isn't
connected.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: fine tune for wifi connected
Ping-Ke Shih [Sat, 20 May 2017 15:49:04 +0000 (10:49 -0500)]
rtlwifi: btcoex: 23b 1ant: fine tune for wifi connected

Fine tune the parameters in cases of bt_acl_busy and scan when wifi is
connected.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: coex table fine tune
Ping-Ke Shih [Sat, 20 May 2017 15:49:03 +0000 (10:49 -0500)]
rtlwifi: btcoex: 23b 1ant: coex table fine tune

Set register settings for coex table fine tune.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: Add coex_table_type to log
Ping-Ke Shih [Sat, 20 May 2017 15:49:02 +0000 (10:49 -0500)]
rtlwifi: btcoex: 23b 1ant: Add coex_table_type to log

Display coex_table_type in log.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: remove verbose log from periodic function
Ping-Ke Shih [Sat, 20 May 2017 15:49:01 +0000 (10:49 -0500)]
rtlwifi: btcoex: 23b 1ant: remove verbose log from periodic function

Simplify the debug trace log.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: check more cases when bt is queing
Ping-Ke Shih [Sat, 20 May 2017 15:49:00 +0000 (10:49 -0500)]
rtlwifi: btcoex: 23b 1ant: check more cases when bt is queing

If bt is queing, we need to set the packet priority properly.
Originally we only consider if wifi was connected or not, but now we
also consider if bt is under abnormal scan or wifi is scanning, roaming
or linking, and set the coex table.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: define wifi in high priority task.
Ping-Ke Shih [Sat, 20 May 2017 15:48:59 +0000 (10:48 -0500)]
rtlwifi: btcoex: 23b 1ant: define wifi in high priority task.

Add the definition of wifi in high priority task for bt inquiry.
According to driver's notifications, btc will knows whether wifi is in high
priority tasks or not.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: Special packets statistic in notification
Ping-Ke Shih [Sat, 20 May 2017 15:48:58 +0000 (10:48 -0500)]
rtlwifi: btcoex: 23b 1ant: Special packets statistic in notification

Count and log special packets of DHCP, EAPOL and ARP, and check whether
the interface is in 4-way handshake.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: Revise media status notify to fix no scan result issue
Ping-Ke Shih [Fri, 19 May 2017 15:59:37 +0000 (10:59 -0500)]
rtlwifi: btcoex: 23b 1ant: Revise media status notify to fix no scan result issue

Force antenna setup for no scan result issue

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: fine tune connect notify
Ping-Ke Shih [Fri, 19 May 2017 15:59:36 +0000 (10:59 -0500)]
rtlwifi: btcoex: 23b 1ant: fine tune connect notify

When association starts, force antenna setup for no scan result issue.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: Add rf status notification
Ping-Ke Shih [Fri, 19 May 2017 15:59:35 +0000 (10:59 -0500)]
rtlwifi: btcoex: 23b 1ant: Add rf status notification

If driver announce wifi RF status is off, btc can switch antenna to BT.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: Setup register for BT WHCK test
Ping-Ke Shih [Fri, 19 May 2017 15:59:34 +0000 (10:59 -0500)]
rtlwifi: btcoex: 23b 1ant: Setup register for BT WHCK test

If BT is under WHCK, we enter a special mode.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: parse more BT information from C2H
Ping-Ke Shih [Fri, 19 May 2017 15:59:33 +0000 (10:59 -0500)]
rtlwifi: btcoex: 23b 1ant: parse more BT information from C2H

BT FW provide more BT status as clues, thus we also display them in
coex log to help debug in field.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: Add power_on_setting
Ping-Ke Shih [Fri, 19 May 2017 15:59:32 +0000 (10:59 -0500)]
rtlwifi: btcoex: 23b 1ant: Add power_on_setting

This change is highly related to init_hwconfig that was decomposed into
two parts for better program flow.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: add wifi_only argument to init_hwconfig
Ping-Ke Shih [Fri, 19 May 2017 15:59:31 +0000 (10:59 -0500)]
rtlwifi: btcoex: 23b 1ant: add wifi_only argument to init_hwconfig

In case of wifi_only, we can simply switch antenna to wifi.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: adjust wifi duration for bt a2dp
Ping-Ke Shih [Fri, 19 May 2017 15:59:30 +0000 (10:59 -0500)]
rtlwifi: btcoex: 23b 1ant: adjust wifi duration for bt a2dp

The larger the bt a2dp bit pool is, the more time bt needs to receive
them. If we do not adjust the wifi duration, the voice quality will be
low. Hence we reduce the time that wifi holds, to improve the a2dp
service.

If the bt is slave, it may receive a packet at any time, so we
need to mark them as high priority packets in case of packet loss

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: need these information when scan
Ping-Ke Shih [Fri, 19 May 2017 15:59:29 +0000 (10:59 -0500)]
rtlwifi: btcoex: 23b 1ant: need these information when scan

Log the scan procedure, and update ap_num for future usage when scan done.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 23b 1ant: Switch antenna to wifi or BT.
Ping-Ke Shih [Fri, 19 May 2017 15:59:28 +0000 (10:59 -0500)]
rtlwifi: btcoex: 23b 1ant: Switch antenna to wifi or BT.

Since wifi and BT share the same physical antenna, we should switch antenna
to fit every situation.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: Add device ID for Epson WN7512BEP
Tom Gaudasinski [Thu, 18 May 2017 09:27:50 +0000 (19:27 +1000)]
rt2x00: Add device ID for Epson WN7512BEP

Make Epson WN7512BEP work by adding its device-id to rt2800usb. Device
contains a Ralink RT3071L, registers as vendor Accton/Arcadyan.

Signed-off-by: Tom Gaudasinski <tomg@records.headdesk.com.au>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agossb: Delete an error message for a failed memory allocation in ssb_devices_register()
Markus Elfring [Wed, 17 May 2017 16:12:16 +0000 (18:12 +0200)]
ssb: Delete an error message for a failed memory allocation in ssb_devices_register()

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Michael Büsch <m@bues.ch>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: convert rt2x00_desc_read return type
Arnd Bergmann [Wed, 17 May 2017 14:47:02 +0000 (16:47 +0200)]
rt2x00: convert rt2x00_desc_read return type

This is a semi-automated conversion to change rt2x00_desc_read to return
the register contents instead of passing them by value, resulting in
much better object code. The majority of the patch was done using:

sed -i 's:\(\<rt2x00_desc_read\>(.*, .*\), &\(.*\));:\2 = \1);:' \
    -i 's:\(\<_rt2x00_desc_read\>(.*, .*\), &\(.*\));:\2 = \1);:' \
drivers/net/wireless/ralink/rt2x00/rt*

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: convert rt2800_eeprom_read return type
Arnd Bergmann [Wed, 17 May 2017 14:47:01 +0000 (16:47 +0200)]
rt2x00: convert rt2800_eeprom_read return type

This is a semi-automated conversion to change rt2800_eeprom_read to return
the register contents instead of passing them by value, resulting in
much better object code. The majority of the patch was done using:

sed -i 's:\(\<rt2800_eeprom_read\(_from_array\|\)\>(.*, .*\), &\(.*\));:\3 = \1);:'
drivers/net/wireless/ralink/rt2x00/rt2800lib.c

Some manual tweaking was required here to work around the line wraps.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: convert rt2x00_eeprom_read return type
Arnd Bergmann [Wed, 17 May 2017 14:47:00 +0000 (16:47 +0200)]
rt2x00: convert rt2x00_eeprom_read return type

This is a semi-automated conversion to change rt2x00_eeprom_read()
to return the register contents instead of passing them by value,
resulting in much better object code. The majority of the patch
was done using:

sed -i 's:\(\<rt2x00_eeprom_read\>(.*, .*\), &\(.*\));:\2 = \1);:' \
   -i 's:= _\(rt2x00_eeprom_read\):= \1:' drivers/net/wireless/ralink/rt2x00/*

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: convert rt2*_bbp_read return type
Arnd Bergmann [Wed, 17 May 2017 14:46:59 +0000 (16:46 +0200)]
rt2x00: convert rt2*_bbp_read return type

This is a semi-automated conversion to change *_bbp_read()
to return the register contents instead of passing them by value,
resulting in much better object code. The majority of the patch
was done using:

sed -i 's:\(\<rt.*_bbp_read\>(.*, .*\), &\(.*\));:\2 = \1);:' \
    -i 's:\(\<rt.*_bbp_dcoc_read\>(.*, .*\), &\(.*\));:\2 = \1);:' \
    -i 's:= _\(rt.*_bbp_read\):\1:' drivers/net/wireless/ralink/rt2x00/*

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: convert rt2800_register_read return type
Arnd Bergmann [Wed, 17 May 2017 14:46:58 +0000 (16:46 +0200)]
rt2x00: convert rt2800_register_read return type

This is a semi-automated conversion to change rt2800_register_read
to return the register contents instead of passing them by value,
resulting in much better object code. The majority of the patch
was done using:

sed -i 's:\(rt2800_register_read(.*, .*\), &\(.*\));:\2 = \1);:' \
       's:\(rt2800_register_read_lock(.*, .*\), &\(.*\));:\2 = \1);:' \
drivers/net/wireless/ralink/rt2x00/rt2800lib.c

The function itself was modified manually along with the one remaining
multi-line caller that was not covered automatically and the indirect
reference.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: convert rt2x00usb_register_read return type
Arnd Bergmann [Wed, 17 May 2017 14:46:57 +0000 (16:46 +0200)]
rt2x00: convert rt2x00usb_register_read return type

This is a semi-automated conversion to change rt2x00usb_register_read
to return the register contents instead of passing them by value,
resulting in much better object code. The majority of the patch
was done using:

sed -i 's:\(\<rt2x00usb_register_read\>(.*, .*\), &\(.*\));:\2 = \1);:' \
    -i 's:\(\<rt2500usb_register_read\>(.*, .*\), &\(.*\));:\2 = \1);:' \
    -i 's:\(\<rt2500usb_register_read_lock\>(.*, .*\), &\(.*\));:\2 = \1);:' \
 drivers/net/wireless/ralink/rt2x00/*

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: convert rt2x00mmio_register_read return type
Arnd Bergmann [Wed, 17 May 2017 14:46:56 +0000 (16:46 +0200)]
rt2x00: convert rt2x00mmio_register_read return type

This is a semi-automated conversion to change rt2x00mmio_register_read
to return the register contents instead of passing them by value,
resulting in much better object code. The majority of the patch
was done using:

sed -i 's:\(rt2x00mmio_register_read(.*, .*\), &\(.*\));:\2 = \1);:' \
    -i 's:_rt2x00mmio_register_read:rt2x00mmio_register_read:' \
drivers/net/wireless/ralink/rt2x00/*.c

The function itself was modified manually along with the one remaining
caller that was not covered automatically.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: convert rt2x00_rf_read return type
Arnd Bergmann [Wed, 17 May 2017 14:46:55 +0000 (16:46 +0200)]
rt2x00: convert rt2x00_rf_read return type

This is a semi-automated conversion to change rt2x00_rf_read()
to return the register contents instead of passing them by value,
resulting in much better object code. The majority of the patch
was done using:

sed -i 's:\(\<rt2x00_rf_read\>(.*, .*\), &\(.*\));:\2 = \1);:' \
drivers/net/wireless/ralink/rt2x00/rt*

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: convert rt2800_rfcsr_read return type
Arnd Bergmann [Wed, 17 May 2017 14:46:54 +0000 (16:46 +0200)]
rt2x00: convert rt2800_rfcsr_read return type

With CONFIG_KASAN enabled and gcc-7, we get a warning about rather high
stack usage (with a private patch set I have to turn on this warning,
which I intend to get into the next kernel release):

wireless/ralink/rt2x00/rt2800lib.c: In function 'rt2800_bw_filter_calibration':
wireless/ralink/rt2x00/rt2800lib.c:7990:1: error: the frame size of 2144 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]

The problem is that KASAN inserts a redzone around each local variable
that gets passed by reference, and the newly added function has a lot
of them.

This is a semi-automated conversion to change rt2800_rfcsr_read to return
the register contents instead of passing them by value, resulting in
much better object code. The majority of the patch was done using:

sed -i 's:\(rt2800_rfcsr_read(.*, .*\), &\(.*\));:\2 = \1);:' \
    -i 's:\(rt2800_rfcsr_read_bank(.*, .*\), &\(.*\));:\2 = \1);:' \
        drivers/net/wireless/ralink/rt2x00/rt2800lib.c

Fixes: 41977e86c984 ("rt2x00: add support for MT7620")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: change function pointers for register accessors
Arnd Bergmann [Wed, 17 May 2017 14:46:53 +0000 (16:46 +0200)]
rt2x00: change function pointers for register accessors

This prepares the driver for changing all the 'read' register accessors
to return the value instead of passing it by reference. Since a lot
of them are used in callbacks, this takes care of the callbacks first,
adding a couple of helpers that will be removed again one at a time.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agolibertas: Remove function entry/exit debugging
Kees Cook [Mon, 15 May 2017 21:33:17 +0000 (14:33 -0700)]
libertas: Remove function entry/exit debugging

In at least one place, the enter/exit debugging was not being correctly
matched. Based on mailing list feedback, it was desired to drop all of
these in favor of using ftrace instead.

Suggested-by: Joe Perches <joe@perches.com>
Suggested-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agolibertas: Avoid reading past end of buffer
Kees Cook [Mon, 15 May 2017 21:26:40 +0000 (14:26 -0700)]
libertas: Avoid reading past end of buffer

Using memcpy() from a string that is shorter than the length copied means
the destination buffer is being filled with arbitrary data from the kernel
rodata segment. Instead, redefine the stat strings to be ETH_GSTRING_LEN
sizes, like other drivers. This lets us use a single memcpy that does not
leak rodata contents. Additionally adjust indentation to keep checkpatch.pl
happy.

This was found with the future CONFIG_FORTIFY_SOURCE feature.

Cc: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoiwlegacy: warn when enabling power save
Stanislaw Gruszka [Mon, 15 May 2017 09:28:26 +0000 (11:28 +0200)]
iwlegacy: warn when enabling power save

iwlegacy firmware can crash when power save is configured. PS was
allowed in "dbdac2b iwlegacy: properly enable power saving" with belive
that user who enable PS is aware of that and can relate firmware crahes
with PS. However some distributions seems to enable PS without user
intervention, so warn about that.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agowlcore: fix 64K page support
Arnd Bergmann [Thu, 11 May 2017 11:52:09 +0000 (13:52 +0200)]
wlcore: fix 64K page support

In the stable linux-3.16 branch, I ran into a warning in the
wlcore driver:

drivers/net/wireless/ti/wlcore/spi.c: In function 'wl12xx_spi_raw_write':
drivers/net/wireless/ti/wlcore/spi.c:315:1: error: the frame size of 12848 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]

Newer kernels no longer show the warning, but the bug is still there,
as the allocation is based on the CPU page size rather than the
actual capabilities of the hardware.

This replaces the PAGE_SIZE macro with the SZ_4K macro, i.e. 4096 bytes
per buffer.

Cc: stable@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: rsi_91x_core: Use time_after time comparison
Karim Eshapa [Mon, 8 May 2017 22:34:10 +0000 (00:34 +0200)]
rsi: rsi_91x_core: Use time_after time comparison

Use time_after kernel macro for time comparison.

Signed-off-by: Karim Eshapa <karim.eshapa@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Remove old firmware loading method
Prameela Rani Garnepudi [Tue, 16 May 2017 10:01:17 +0000 (15:31 +0530)]
rsi: Remove old firmware loading method

The older firmware loading method is not usable by any Redpine chipset.
Hence removing that part of the code. Older firmware image with
rsi_91x.fw name is deprecated

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Add new firmware loading method
Prameela Rani Garnepudi [Tue, 16 May 2017 10:01:16 +0000 (15:31 +0530)]
rsi: Add new firmware loading method

The older firmware loading method has been deprecated and not in use
for any chipets. New method is introduced which works based on soft
boot loader. In this method, complete RAM image and FLASH image are
present in the flash. Before loading the functional firmware, host
issues boot loader commands to verify whether firmware to load is
different from the current functional firmware. If not, firmware
upgrade progresses and boot loader will switch to the new functional
firmware.

"rs9113_wlan_qspi.rps" is the firmware filename used in this patch.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Add new host interface operations
Prameela Rani Garnepudi [Tue, 16 May 2017 10:01:15 +0000 (15:31 +0530)]
rsi: Add new host interface operations

Host interface opearation master_reg_read, master_reg_write and
load_data_master_write are added. These functions are needed for the
new firmware loading method. As part of this, the function
master_access_msword is moved from rsi_91x_sdio_ops.c to rsi_91x_sdio.c.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Add host interface operations as separate structure.
Prameela Rani Garnepudi [Tue, 16 May 2017 10:01:14 +0000 (15:31 +0530)]
rsi: Add host interface operations as separate structure.

Host interface operations are currently function pointers in rsi_hw
structure. As more host interface operations are going to be introduced,
separate structure is added for these for convenience.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Add usb multi-byte read operation
Prameela Rani Garnepudi [Tue, 16 May 2017 10:01:13 +0000 (15:31 +0530)]
rsi: Add usb multi-byte read operation

USB multibyte read will be used in the new firmware loading method
for RS9113 chipset.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Handle usb multi-byte write failure case properly
Prameela Rani Garnepudi [Tue, 16 May 2017 10:01:12 +0000 (15:31 +0530)]
rsi: Handle usb multi-byte write failure case properly

In function usb_write_register_multiple, if any intermediate block transfer
is failed, further operations should be terminated. 'else' is removed, as
there is no significance for it after return.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: use macros in USB specific code
Prameela Rani Garnepudi [Tue, 16 May 2017 10:01:11 +0000 (15:31 +0530)]
rsi: use macros in USB specific code

For USB vendor read and write operations new macros added to avoid
redundant usage of long or'ed macros. Also for timeouts standard USB
macros are used.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Changes in USB read and write operations
Prameela Rani Garnepudi [Tue, 16 May 2017 10:01:10 +0000 (15:31 +0530)]
rsi: Changes in USB read and write operations

USB read and write registers maximum size is limited 2^16. More than
this size is not used in the driver.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: define RSI_USB_BUF_SIZE macro
amit karwar [Tue, 16 May 2017 10:01:09 +0000 (15:31 +0530)]
rsi: define RSI_USB_BUF_SIZE macro

RSI_USB_BUF_SIZE macro is used instead of hardcoding a buffer
size to 4096.

Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Changes to sdio reads and writes
Prameela Rani Garnepudi [Tue, 16 May 2017 10:01:08 +0000 (15:31 +0530)]
rsi: Changes to sdio reads and writes

SDIO read or write maximum size is limited to 2^16. This is done to make
the host interface operations common for SDIO and USB.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Rename file rsi_91x_pkt.c to rsi_91x_hal.c
Prameela Rani Garnepudi [Tue, 16 May 2017 10:01:07 +0000 (15:31 +0530)]
rsi: Rename file rsi_91x_pkt.c to rsi_91x_hal.c

The file rsi_91x_hal.c is going to contain device specific code i.e new
firmware loading method for RS9113 chipset. As the file rsi_91x_pkt.c
contains code to prepare device specific descriptors for transmit packet,
this file is renamed to rsi_91x_hal.c which is more relevant as per it's
functionality.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agop54: allocate enough space for ->used_rxkeys
Dan Carpenter [Sat, 6 May 2017 00:48:35 +0000 (03:48 +0300)]
p54: allocate enough space for ->used_rxkeys

We have the number of longs, but we should be calculating the number of
bytes needed.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoray_cs: Avoid reading past end of buffer
Kees Cook [Fri, 5 May 2017 22:38:41 +0000 (15:38 -0700)]
ray_cs: Avoid reading past end of buffer

Using memcpy() from a buffer that is shorter than the length copied means
the destination buffer is being filled with arbitrary data from the kernel
rodata segment. In this case, the source was made longer, since it did not
match the destination structure size. Additionally removes a needless cast.

This was found with the future CONFIG_FORTIFY_SOURCE feature.

Cc: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoorinoco_usb: convert request_context.refcount from atomic_t to refcount_t
Elena Reshetova [Tue, 28 Mar 2017 08:56:43 +0000 (11:56 +0300)]
orinoco_usb: convert request_context.refcount from atomic_t to refcount_t

refcount_t type and corresponding API should be
used instead of atomic_t when the variable is used as
a reference counter. This allows to avoid accidental
refcounter overflows that might lead to use-after-free
situations.

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Hans Liljestrand <ishkamiel@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David Windsor <dwindsor@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agohostap: convert hostap_cmd_queue.usecnt from atomic_t to refcount_t
Elena Reshetova [Tue, 28 Mar 2017 08:56:42 +0000 (11:56 +0300)]
hostap: convert hostap_cmd_queue.usecnt from atomic_t to refcount_t

refcount_t type and corresponding API should be
used instead of atomic_t when the variable is used as
a reference counter. This allows to avoid accidental
refcounter overflows that might lead to use-after-free
situations.

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Hans Liljestrand <ishkamiel@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David Windsor <dwindsor@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: remove setting IBSS mode when stopping AP
Chi-hsien Lin [Thu, 18 May 2017 09:22:19 +0000 (17:22 +0800)]
brcmfmac: remove setting IBSS mode when stopping AP

Upon stopping an AP interface the driver disable INFRA mode effectively
setting the interface in IBSS mode. However, this may affect other
interfaces running in INFRA mode. For instance, if user creates and stops
hostap daemon on virtual interface, then association cannot work on
primary interface because default BSS has been set to IBSS mode in
firmware side. The IBSS mode should be set when cfg80211 changes the
interface.

Reviewed-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Chi-hsien Lin <Chi-Hsien.Lin@cypress.com>
[kvalo@codeaurora.org: rephased commit log based on discussion]
Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: btcoex: replace init_timer with setup_timer
Xie Qirong [Fri, 12 May 2017 09:32:59 +0000 (17:32 +0800)]
brcmfmac: btcoex: replace init_timer with setup_timer

setup_timer.cocci suggested the following improvement:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c:383:1-11: Use
setup_timer function for function on line 384.

The combination of init_timer and setting up the data and function field
manually is equivalent to calling setup_timer(). This is an api
consolidation only and improves readability.

Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Xie Qirong <cheerx1994@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agob43: Add missing MODULE_FIRMWARE()
Takashi Iwai [Thu, 4 May 2017 09:27:52 +0000 (11:27 +0200)]
b43: Add missing MODULE_FIRMWARE()

Some firmware entries were forgotten to be added via MODULE_FIRMWARE(), which
may result in the non-functional state when the driver is loaded in initrd.

Link: http://bugzilla.opensuse.org/show_bug.cgi?id=1037344
Fixes: 15be8e89cdd9 ("b43: add more bcma cores")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>