platform/kernel/linux-exynos.git
7 years agoiwlwifi: pcie: remove RSA race workaround
Luca Coelho [Mon, 13 Feb 2017 07:48:17 +0000 (09:48 +0200)]
iwlwifi: pcie: remove RSA race workaround

This workaround is not needed anymore.  Remove it.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: support a000 CDB product
Sara Sharon [Sun, 22 Jan 2017 15:17:19 +0000 (17:17 +0200)]
iwlwifi: support a000 CDB product

Identify and load FW for a000 CDB product.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support change to a000 smem API
Sara Sharon [Thu, 26 Jan 2017 10:40:25 +0000 (12:40 +0200)]
iwlwifi: mvm: support change to a000 smem API

API was changed once more to support 2 LMACs.
Adapt to change while preserving current functionality.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: add four new 8265 and 8275 series PCI IDs
Tzipi Peres [Sun, 12 Feb 2017 09:08:08 +0000 (11:08 +0200)]
iwlwifi: add four new 8265 and 8275 series PCI IDs

Add one new PCI ID for the 8265 series.
Add three new PCI ID for the 8275 series.

Signed-off-by: Tzipi Peres <tzipi.peres@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: provide the actual number of frames for the SP len
Emmanuel Grumbach [Wed, 8 Feb 2017 12:53:32 +0000 (14:53 +0200)]
iwlwifi: mvm: provide the actual number of frames for the SP len

In the end, the firmware doesn't want the SP len as present
in the WMM IE, but rather the actual number of frames.

Fixes: bd3c6cf901a8 ("iwlwifi: mvm: tell the firmware about the U-APSD parameters")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: ignore BAID for SN smaller than SSN
Sara Sharon [Thu, 2 Feb 2017 10:51:39 +0000 (12:51 +0200)]
iwlwifi: mvm: ignore BAID for SN smaller than SSN

When we get SN that is smaller than SSN of the aggregation,
we shouldn't apply any reordering on them.
Further more, HW NSSN will be zeroed, which can cause us
to make some invalid decisions.
Detect the situation and invalidate the BAID.

Fixes: b915c10174fb ("iwlwifi: mvm: add reorder buffer per queue")
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: change TX_CMD_SEC_KEY_FROM_TABLE value
David Spinadel [Wed, 4 Jan 2017 07:30:24 +0000 (09:30 +0200)]
iwlwifi: mvm: change TX_CMD_SEC_KEY_FROM_TABLE value

Change the value of TX_CMD_SEC_KEY_FROM_TABLE flag
in TX_CMD security flags to accommodate a FW API change.

Bump min API for 9000 series devices to 30 to keep the driver aligned
aligned the FW.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: work around HW issue with AMSDU de-aggregation
Sara Sharon [Tue, 31 Jan 2017 12:36:10 +0000 (14:36 +0200)]
iwlwifi: mvm: work around HW issue with AMSDU de-aggregation

Seems like HW is reversing addr3 in the MAC header of de-aggregated
AMSDU. Reverse it back.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: do not turn on RX_FLAG_AMSDU_MORE
Sara Sharon [Thu, 19 May 2016 13:19:22 +0000 (16:19 +0300)]
iwlwifi: mvm: do not turn on RX_FLAG_AMSDU_MORE

This flag is used for mac80211 reordering. As we do reordering
ourselves, turning it on is misleading and pointless.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: remove unneeded reg write in iwl_mvm_up()
Liad Kaufman [Wed, 1 Feb 2017 14:21:32 +0000 (16:21 +0200)]
iwlwifi: mvm: remove unneeded reg write in iwl_mvm_up()

Not only that this write is not needed (as FW does this
itself), on newer HW this register is write protected
so trying to write there will cause problems.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: move to TVQM mode
Sara Sharon [Tue, 17 Jan 2017 12:27:48 +0000 (14:27 +0200)]
iwlwifi: move to TVQM mode

In TVQM firmware returns the value of the queue ID and code
should accept it.
The TX queue config API was changed. Move to new API.
This has to be done in parallel in mvm and pcie.
Do not move yet to 512 queues since there are some opens
with enabling it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support new TX response for TVQM
Sara Sharon [Tue, 17 Jan 2017 12:28:21 +0000 (14:28 +0200)]
iwlwifi: mvm: support new TX response for TVQM

In TVQM mode the TX responses were changed to include
queue number since legacy TX queue number retrieval cannot
be scaled up to 512 queues.
Support this change.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: get rid of txq id assignment
Sara Sharon [Tue, 17 Jan 2017 12:14:29 +0000 (14:14 +0200)]
iwlwifi: pcie: get rid of txq id assignment

In TVQM mode the queue ID is assigned after enablement.
Get rid of assuming pre-defined TX queue ID in functions
that will be used by TVQM allocation path.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: remove unnecessary label in iwl_mvm_handle_rx_statistics()
Luca Coelho [Wed, 25 Jan 2017 16:57:26 +0000 (18:57 +0200)]
iwlwifi: mvm: remove unnecessary label in iwl_mvm_handle_rx_statistics()

The "invalid" label was a bit ugly and unnecessary.  Remove it.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: alloc queues dynamically
Sara Sharon [Tue, 29 Nov 2016 11:49:59 +0000 (13:49 +0200)]
iwlwifi: pcie: alloc queues dynamically

Change queue allocation to be dynamic. On transport init only
the command queue is being allocated. Other queues are allocated
on demand.
This is due to the huge amount of queues we will soon enable (512)
and as a preparation for TX Virtual Queue Manager feature (TVQM),
where firmware will assign the actual queue number on demand.
This includes also allocation of the byte count table per queue
and not as a contiguous chunk of memory.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: introduce new stop_device
Sara Sharon [Mon, 12 Dec 2016 10:48:48 +0000 (12:48 +0200)]
iwlwifi: pcie: introduce new stop_device

This function is basically the same as gen1, except for clean
ups of old devices configuration that are never used in a000
configuration.
It will also help with refactoring rf_kill later on.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: prepare for dynamic queue allocation
Sara Sharon [Sun, 11 Dec 2016 09:36:38 +0000 (11:36 +0200)]
iwlwifi: pcie: prepare for dynamic queue allocation

In a000 transport we will allocate queues dynamically.
Right now queue are allocated as one big chunk of memory
and accessed as such.
The dynamic allocation of the queues will require accessing
the queues as pointers.
In order to keep simplicity of pre-a000 tx queues handling,
keep allocating and freeing the memory in the same style,
but move to access the queues in the various functions as
individual pointers.
Dynamic allocation for the a000 devices will be in a separate
patch.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: remove block and freeze operations from new transport
Sara Sharon [Tue, 29 Nov 2016 11:19:25 +0000 (13:19 +0200)]
iwlwifi: pcie: remove block and freeze operations from new transport

New transport will be used only by op modes that supports
buffer station offload - hence those will never be called.
Clean it up.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: support new write pointer width
Sara Sharon [Thu, 8 Dec 2016 10:05:58 +0000 (12:05 +0200)]
iwlwifi: pcie: support new write pointer width

In a000 devices we have 16 bytes for the TFD index and 16 for the
queue, in order to support 512 queues.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: support host commands in new transport
Sara Sharon [Thu, 8 Dec 2016 11:22:55 +0000 (13:22 +0200)]
iwlwifi: pcie: support host commands in new transport

Code is basically the same, with a cleanups of old narrow host
command, ampg workarounds, some cosmetic stuff, and usage of
TFH functions when accessing TFD queues.
This enables also the cleanup of iwl_pcie_tfd_set_tb() since
now it won't be called anywhere in the a000 data path

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: rewrite TFD creation
Sara Sharon [Tue, 24 Jan 2017 13:50:35 +0000 (15:50 +0200)]
iwlwifi: pcie: rewrite TFD creation

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: support new TX command
Sara Sharon [Tue, 24 Jan 2017 13:29:57 +0000 (15:29 +0200)]
iwlwifi: pcie: support new TX command

Move to use the correct structure.
Remove code referring to old command.
Update DMA locations.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: cleanup old transport code from gen2
Sara Sharon [Tue, 24 Jan 2017 12:53:11 +0000 (14:53 +0200)]
iwlwifi: pcie: cleanup old transport code from gen2

Cleanup code that is irrelevant for a000 devices.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: move new API code to the end
Goodstein, Mordechay [Mon, 21 Nov 2016 08:26:36 +0000 (10:26 +0200)]
iwlwifi: mvm: move new API code to the end

By moving all the code that depends on the new API
we avoid unnecessary indentation in the code.

Signed-off-by: Mordechai Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: tell the firmware about the U-APSD parameters
Emmanuel Grumbach [Thu, 12 Jan 2017 13:43:57 +0000 (15:43 +0200)]
iwlwifi: mvm: tell the firmware about the U-APSD parameters

Newer firmware versions will be able to handle all the
WMM-PS flows internally when we act as a GO. The firwmare
relies on the fact that the drivers puts frames for
different peers in different queues (DQA) to achieve this.
The driver will not be aware of the power state of the peers
anymore.

Tell the firmware about the WMM-PS parameters of earch peer
that connects to us so that it can know what are the
trigger-enabled ACs, the delivery-enableds ACs and the
Service Period length.

This API change is backward compatible since older firmware
versions will simply ignore the newly added values.

Since we don't support ieee80211 TSPECs for now, just copy
the trigger-enabled ACs to the delivery enabled ones.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: remove unnecessary debugging from UMAC scan
Luca Coelho [Tue, 24 Jan 2017 07:40:43 +0000 (09:40 +0200)]
iwlwifi: mvm: remove unnecessary debugging from UMAC scan

There are several occasions where a scan of the same type is requested
concurrently, so logging every time this happens is just noisy and
unnecessary.  Remove the logging for these cases.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: copy TX functions to new transport
Sara Sharon [Tue, 1 Nov 2016 10:37:49 +0000 (12:37 +0200)]
iwlwifi: pcie: copy TX functions to new transport

This is just a copy-paste in order to make changes tracking
easier.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support moving to mgmt tid
Sara Sharon [Tue, 13 Dec 2016 14:10:28 +0000 (16:10 +0200)]
iwlwifi: mvm: support moving to mgmt tid

For a000 FW moved to 15 as management TID.
The change for us is fairly local - translate old TID to 15
when enabling and disabling a queue, and make sure to cover
it also on TX responses.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support a000 SCD queue configuration
Sara Sharon [Thu, 29 Sep 2016 11:52:40 +0000 (14:52 +0300)]
iwlwifi: mvm: support a000 SCD queue configuration

a000 devices queue management is going to change significantly.
We will have 512 queues. Those queues will be assigned number
by the firmware and not by the driver.

In addition, due to SN offload having TX queue shared between TIDs
is impossible

Also, the ADD_STA command no longer updates queues status.
The only point of changing queue in the SCD queue config API.

From driver perspective we have here a new design:

Queue sharing and inactivity checks are disabled.

Once this is done, the only paths that call scd_queue_cfg command
are paths that alloc and release TX queues - which will make future
accommodation to queue number assignment by FW easier.
Since allocating 512 queues statically is not advisable, transport
will allocate the queue on demand, fill the command with DRAM data
and send it. This is reflected in the new transport API.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: introduce a000 TX queues management
Sara Sharon [Thu, 29 Sep 2016 11:36:19 +0000 (14:36 +0300)]
iwlwifi: pcie: introduce a000 TX queues management

In a000 devices the TX handling is different in a few ways:
* Queues are allocated dynamically
* DQA is enabled by default
* Driver shouldn't access TFH registers - ucode configures it
  all in SCD_QUEUE_CFG command

Support all this in a new API with op mode, where op mode sends
the command, transport will allocate the queue dynamically, fill
in DMA properties, send the command to FW and get the ID back.
Current implementation only sets the new transport API and fills
the DMA properties.
Future patches will complete the other parts.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support new TX API
Sara Sharon [Thu, 29 Sep 2016 14:28:33 +0000 (17:28 +0300)]
iwlwifi: mvm: support new TX API

Support the new TX command API for a000 devices.
Command is a very slim version of current TX command.
Generalize iwl_mvm_tx_mpdu to get rid of TX command dependencies.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add support for EWRD (Dynamic SAR) ACPI table
Luca Coelho [Thu, 12 Jan 2017 10:43:12 +0000 (12:43 +0200)]
iwlwifi: mvm: add support for EWRD (Dynamic SAR) ACPI table

Dynamic SAR allows changing TX power limits at runtime to comply with
SAR regulations on multiple form factors (e.g. tablet vs. clamshell
mode).  To support this, a new table was added to ACPI, which is
called Extended Wireless Regulatory Descriptor (EWRD).  This table
allows OEMs to define different TX power profiles for each form-factor
or usage mode.

Read this new table and store it in our SAR profiles table, in
preparation for Dynamic SAR support.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: spin off SAR profile selection function
Luca Coelho [Wed, 11 Jan 2017 21:36:30 +0000 (23:36 +0200)]
iwlwifi: mvm: spin off SAR profile selection function

For dynamic SAR, we will need to select the current profile from
different places.  In preparation for that, spin the profile selection
code out of iwl_mvm_sar_init().

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: refactor SAR init to prepare for dynamic SAR
Haim Dreyfuss [Wed, 28 Dec 2016 13:58:22 +0000 (15:58 +0200)]
iwlwifi: mvm: refactor SAR init to prepare for dynamic SAR

We are adding support for dynamic TX power tables for SAR (specific
absorption rate) compliance.  Currently, we only support a single
(static) TX power table, which is read from ACPI, and use it
statically.

To prepare for more tables that can be switched dynamically, refactor
the SAR init flow to allow reusage and add the current static table as
a single entry in an array of tables.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: disable multi-queue for a000 devices
Sara Sharon [Mon, 19 Dec 2016 12:10:35 +0000 (14:10 +0200)]
iwlwifi: mvm: disable multi-queue for a000 devices

Firmware isn't configuring multi RX queue hardware yet in
the self init mode.
Disable it for now until we have an API that enables it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: use same scan API for all a000 devices
Sara Sharon [Thu, 12 Jan 2017 14:01:11 +0000 (16:01 +0200)]
iwlwifi: mvm: use same scan API for all a000 devices

API will be the same regardless of FW compilation.
CDB related values will be filled in only for CDB.
Cahneg code and names accordingly.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: prepare for station count change
Sara Sharon [Wed, 4 Jan 2017 12:53:58 +0000 (14:53 +0200)]
iwlwifi: mvm: prepare for station count change

In a000 devices we will support up to 32 stations.
The max station define is used also for invalid station marking
which makes finding usages of actual maximum station pretty hard
to sort through - change it to be a different define in order
to make future changes easier.
Use also ARRAY_SIZE intead of define when possible.
Do not move yet to 32 stations until firmware do it though.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: cleanup unused function
Sara Sharon [Sun, 15 Jan 2017 15:08:40 +0000 (17:08 +0200)]
iwlwifi: cleanup unused function

iwl_has_secure_boot() isn't getting called anywhere. Clean it up.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add queues after adding station
Sara Sharon [Tue, 15 Nov 2016 08:20:48 +0000 (10:20 +0200)]
iwlwifi: mvm: add queues after adding station

Currently aux & broadcast queues are added before calling add
station, which results with a SCD_QUEUE_CFG command sent with
a station id unknown yet to fw.
While this works for pre-a000 firmware, the a000 fw requires
the order to be reversed.
The reason the change is only for a000 devices and not for
previous devices is that we cannot reverse the order since
the tfd_queue_mask containing the aux queue will cause FW to
assert on adding a queue mask with a queue that is not enabled.
This is not a problem in a000 fw since the tfd_queue_mask was
removed from the add sta API.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: read new secure boot registers
Sara Sharon [Thu, 12 Jan 2017 09:31:25 +0000 (11:31 +0200)]
iwlwifi: mvm: read new secure boot registers

Addresses were changed for a000 devices.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agobrcmfmac: only build fwsignal module for CONFIG_BRCMFMAC_PROTO_BCDC
Arend Van Spriel [Fri, 14 Apr 2017 21:27:37 +0000 (22:27 +0100)]
brcmfmac: only build fwsignal module for CONFIG_BRCMFMAC_PROTO_BCDC

The fwsignal module is only referenced by the bcdc module and part of the
bcdc protocol. So only build it when CONFIG_BRCMFMAC_PROTO_BCDC is selected.

Fixes: acf8ac41dd73 ("brcmfmac: remove reference to fwsignal data from struct brcmf_pub")
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoMerge tag 'iwlwifi-next-for-kalle-2017-04-13' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Tue, 18 Apr 2017 06:41:45 +0000 (09:41 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2017-04-13' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

Patches intended for v4.12:

  * Some small fixes here and there;
  * The usual cleanups and small improvements;
  * Work to support A000 devices continues;
  * New FW API version;
  * Some debugging improvements;

7 years agort2x00: reverse external PA capability flag logic
Daniel Golle [Mon, 10 Apr 2017 13:29:45 +0000 (15:29 +0200)]
rt2x00: reverse external PA capability flag logic

Consequently refer to external PA instead of inverting the logic and
use an internal PA capability flag which is a bit confusing.
Currently this is used for Rt3352 only, but MT7620A also allows for an
external PA which will be supported by a follow up patch.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: 21a 1ant: avoid LPS/IPS mismatch for pnp notify
Yan-Hsuan Chuang [Mon, 10 Apr 2017 16:23:10 +0000 (11:23 -0500)]
rtlwifi: btcoex: 21a 1ant: avoid LPS/IPS mismatch for pnp notify

When driver is going to sleep, it does not leave LPS/IPS, thus the
BTCoex may have mismatch when driver wakes up. To avoid that, BTCoex
needs to clear the IPS/LPS state when it receives a pnp notify, then
it can properly set up the hw when driver wakes up.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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: 21a 1ant: do not switch antenna when wifi is under 5G channel
Yan-Hsuan Chuang [Mon, 10 Apr 2017 16:23:09 +0000 (11:23 -0500)]
rtlwifi: btcoex: 21a 1ant: do not switch antenna when wifi is under 5G channel

When wifi is on a 5G channel, the 5G signal will not interfere bt 2.4G
signal, and they can transmit simultaneously, hence there is no need to
switch antenna between wifi and bt.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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: 21a 1ant: monitor bt profiling when scan
Yan-Hsuan Chuang [Mon, 10 Apr 2017 16:23:08 +0000 (11:23 -0500)]
rtlwifi: btcoex: 21a 1ant: monitor bt profiling when scan

When wifi is scanning and not connected, set the tdma and coex table
properly to control the priority of the packets to make the wifi bt
coexistence operate smoothly

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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: 21a 1ant: consider more cases when bt inquiry
Yan-Hsuan Chuang [Mon, 10 Apr 2017 16:23:07 +0000 (11:23 -0500)]
rtlwifi: btcoex: 21a 1ant: consider more cases when bt inquiry

With bt inquiry, the wifi may start as a softap or the wifi and bt are
busy, we take these scenarios into consider to avoid bt inquiry to
degrade the performance of the network

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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: 21a 1ant: move bt_disabled to global struct
Yan-Hsuan Chuang [Mon, 10 Apr 2017 16:23:06 +0000 (11:23 -0500)]
rtlwifi: btcoex: 21a 1ant: move bt_disabled to global struct

Move the bt disable flag to a global structure to indicate that bt is
turned off.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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: 21a 1ant: If wifi only, do not initiate coex mechanism
Yan-Hsuan Chuang [Mon, 10 Apr 2017 16:23:05 +0000 (11:23 -0500)]
rtlwifi: btcoex: 21a 1ant: If wifi only, do not initiate coex mechanism

If the device has wifi mode only, there is no need to initiate the
hardware for wifi and bt coexistence, so just return to avoid it.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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: 21a 1ant: action when associating/authenticating
Yan-Hsuan Chuang [Mon, 10 Apr 2017 16:23:04 +0000 (11:23 -0500)]
rtlwifi: btcoex: 21a 1ant: action when associating/authenticating

When wifi is associating or authenticating, set the coex table for wifi
to establish link. These packets should have higher priority.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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: 21a 1ant: add multi port action for miracast and P2P
Yan-Hsuan Chuang [Mon, 10 Apr 2017 16:23:03 +0000 (11:23 -0500)]
rtlwifi: btcoex: 21a 1ant: add multi port action for miracast and P2P

To support miracast and P2P, the chip may operate under concurrent mode,
In this situation, do not aggregate tx packet and properly set the rx
aggregation size.

We detect it by monitoring the number of link established.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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: 21a 1ant: set antenna control path for PTA
Yan-Hsuan Chuang [Mon, 10 Apr 2017 16:23:02 +0000 (11:23 -0500)]
rtlwifi: btcoex: 21a 1ant: set antenna control path for PTA

Set antenna control path if PTA is in control of the packet path of wifi
and bt. If wifi is turned off, tell the PTA about it.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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: 21a 1ant: remove setting for 2 antennas
Yan-Hsuan Chuang [Mon, 10 Apr 2017 16:23:01 +0000 (11:23 -0500)]
rtlwifi: btcoex: 21a 1ant: remove setting for 2 antennas

The antenna position setting is useless for 1 antenna chip.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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: 21a 1ant: mask profile bit for connect-ilde
Yan-Hsuan Chuang [Mon, 10 Apr 2017 16:23:00 +0000 (11:23 -0500)]
rtlwifi: btcoex: 21a 1ant: mask profile bit for connect-ilde

Mask out the connect-idle bit.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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: 21a 1ant: coex table setting for new fw
Yan-Hsuan Chuang [Mon, 10 Apr 2017 16:22:59 +0000 (11:22 -0500)]
rtlwifi: btcoex: 21a 1ant: coex table setting for new fw

For newer fw, the coex table setting needs to be modified to operate
correctly.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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: 21a 1ant: add function to check wifi status
Yan-Hsuan Chuang [Mon, 10 Apr 2017 16:22:58 +0000 (11:22 -0500)]
rtlwifi: btcoex: 21a 1ant: add function to check wifi status

This function checks if wifi has changed its statusi. It will be needed
in the future.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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: 21a 1ant: fw settings for softap mode
Yan-Hsuan Chuang [Mon, 10 Apr 2017 16:22:57 +0000 (11:22 -0500)]
rtlwifi: btcoex: 21a 1ant: fw settings for softap mode

For ap mode, adjust fw settings to operate properly.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: some hi-prio pkt will cause hid_exist
Yan-Hsuan Chuang [Thu, 6 Apr 2017 20:19:58 +0000 (15:19 -0500)]
rtlwifi: btcoex: 23b 2ant: some hi-prio pkt will cause hid_exist

Clear the hid_exist flag by monitoring the packet counter.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: notify more bt information
Yan-Hsuan Chuang [Thu, 6 Apr 2017 20:19:57 +0000 (15:19 -0500)]
rtlwifi: btcoex: 23b 2ant: notify more bt information

These bt information are displayed in display coex

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: fine tune for bt hid_a2dp
Yan-Hsuan Chuang [Thu, 6 Apr 2017 20:19:56 +0000 (15:19 -0500)]
rtlwifi: btcoex: 23b 2ant: fine tune for bt hid_a2dp

Let bt control the aggregation size to improve stability.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: fine tune for bt pan_edr_a2dp
Yan-Hsuan Chuang [Thu, 6 Apr 2017 20:19:55 +0000 (15:19 -0500)]
rtlwifi: btcoex: 23b 2ant: fine tune for bt pan_edr_a2dp

If we don't limit the rx aggregation size, and set tdma instead, the bt profile can
get more stable.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: before firmware ready settings
Yan-Hsuan Chuang [Thu, 6 Apr 2017 20:19:54 +0000 (15:19 -0500)]
rtlwifi: btcoex: 23b 2ant: before firmware ready settings

Before firmware is ready, set GNT_BT to high to let bt transmit

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: power on settings for coex
Yan-Hsuan Chuang [Thu, 6 Apr 2017 20:19:53 +0000 (15:19 -0500)]
rtlwifi: btcoex: 23b 2ant: power on settings for coex

When power on, the wifi could be initiating, force the antenna to
transmit bt packets to avoid bt unstable problems

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: wifi is not actually off in mp mode
Yan-Hsuan Chuang [Thu, 6 Apr 2017 20:19:52 +0000 (15:19 -0500)]
rtlwifi: btcoex: 23b 2ant: wifi is not actually off in mp mode

In mp mode, the wifi will not turn off and still has control of the PTA,
so the driver needs to distinguish whether it is mp mode or not

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: need those information when scan
Yan-Hsuan Chuang [Thu, 6 Apr 2017 20:19:51 +0000 (15:19 -0500)]
rtlwifi: btcoex: 23b 2ant: need those information when scan

For scan notify, we need to supervise some registers to make sure that
coexistence is operating as we expected.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: remove debugging code for 0x948
Yan-Hsuan Chuang [Thu, 6 Apr 2017 20:19:50 +0000 (15:19 -0500)]
rtlwifi: btcoex: 23b 2ant: remove debugging code for 0x948

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: treat too many low prio packets as retry
Yan-Hsuan Chuang [Thu, 6 Apr 2017 20:19:49 +0000 (15:19 -0500)]
rtlwifi: btcoex: 23b 2ant: treat too many low prio packets as retry

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: set coex table when wifi is idle
Yan-Hsuan Chuang [Thu, 6 Apr 2017 20:19:48 +0000 (15:19 -0500)]
rtlwifi: btcoex: 23b 2ant: set coex table when wifi is idle

When wifi is idle, the bt should have more resource to transmit.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: set coex table when wifi is linking
Yan-Hsuan Chuang [Tue, 4 Apr 2017 16:50:06 +0000 (11:50 -0500)]
rtlwifi: btcoex: 23b 2ant: set coex table when wifi is linking

When wifi is under linking process, those packets are important. Mark
them as high priority to protect the linking process

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: turn off antenna when rssi is too high/low
Yan-Hsuan Chuang [Tue, 4 Apr 2017 16:50:05 +0000 (11:50 -0500)]
rtlwifi: btcoex: 23b 2ant: turn off antenna when rssi is too high/low

For 2-antenna combo card, the signal of the neighbor antenna could be
over noise level and cause be severe interference. So we monitor the
rssi and turn off one of the antennas when the other is transmitting
and the rssi level is beyond a threshold.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: turn off ps and tdma mechanism when in concurrent mode
Yan-Hsuan Chuang [Tue, 4 Apr 2017 16:50:04 +0000 (11:50 -0500)]
rtlwifi: btcoex: 23b 2ant: turn off ps and tdma mechanism when in concurrent mode

When wifi is in 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: Pkshih <pkshih@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 2ant: let bt transmit when hw initialisation done
Yan-Hsuan Chuang [Tue, 4 Apr 2017 16:50:03 +0000 (11:50 -0500)]
rtlwifi: btcoex: 23b 2ant: let bt transmit when hw initialisation done

During hw initialisation, wifi may be ready after bt has already been
ready, which causes bt to act abnormally. To avoid this, set GNT_BT to
high during hw init.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Stable <stable@vger.kernel.org>
Cc: Pkshih <pkshih@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 2ant: tell fw if external or internal switch is used
Yan-Hsuan Chuang [Tue, 4 Apr 2017 16:50:02 +0000 (11:50 -0500)]
rtlwifi: btcoex: 23b 2ant: tell fw if external or internal switch is used

Some chips use an external antenna switch, but fw may not realize it.
Here we tell fw exactly that which type of switch we are using.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: workaround for bt a2dp and hid
Yan-Hsuan Chuang [Tue, 4 Apr 2017 16:50:01 +0000 (11:50 -0500)]
rtlwifi: btcoex: 23b 2ant: workaround for bt a2dp and hid

For a2dp and hid, we need extra process to avoid voice degradation

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: check more cases when bt is queuing
Yan-Hsuan Chuang [Tue, 4 Apr 2017 16:50:00 +0000 (11:50 -0500)]
rtlwifi: btcoex: 23b 2ant: check more cases when bt is queuing

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: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: add pnp notidy to avoid LPS/IPS mismatch
Yan-Hsuan Chuang [Tue, 4 Apr 2017 16:49:59 +0000 (11:49 -0500)]
rtlwifi: btcoex: 23b 2ant: add pnp notidy to avoid LPS/IPS mismatch

When driver is going to sleep, it does not leave LPS/IPS, thus the
BTCoex may have mismatch when driver wakes up. To avoid that, BTCoex
needs to clear the IPS/LPS state when it receives a pnp notify, then
it can properly set up the hw when driver wakes up.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Pkshih <pkshih@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 2ant: fix PTA unstable problem when hw init
Yan-Hsuan Chuang [Tue, 4 Apr 2017 16:49:58 +0000 (11:49 -0500)]
rtlwifi: btcoex: 23b 2ant: fix PTA unstable problem when hw init

In the hardware initialisation stage, the PTA circuits may be unstable,
so we reset it after 6 secs to fix the problem.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Pkshih <pkshih@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 2ant: more cases for adjusting tdma duration
Yan-Hsuan Chuang [Tue, 4 Apr 2017 16:49:57 +0000 (11:49 -0500)]
rtlwifi: btcoex: 23b 2ant: more cases for adjusting tdma duration

These cases are for the btcoex to tune the performance

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Pkshih <pkshih@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 2ant: detect ap num and set GNT_BT properly
Yan-Hsuan Chuang [Tue, 4 Apr 2017 16:49:56 +0000 (11:49 -0500)]
rtlwifi: btcoex: 23b 2ant: detect ap num and set GNT_BT properly

If ap num < 10, let wifi and bt transmit simultaneously, otherwise set
wifi into standy when bt is transmitting

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: rename tdma_adj_type to ps_tdma_du_adj_type
Yan-Hsuan Chuang [Tue, 4 Apr 2017 16:49:55 +0000 (11:49 -0500)]
rtlwifi: btcoex: 23b 2ant: rename tdma_adj_type to ps_tdma_du_adj_type

The variable is for PS tdma duration adjust, so rename it to clearly
to specify its usage.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 2ant: check PS state before setting tdma duration
Yan-Hsuan Chuang [Tue, 4 Apr 2017 16:49:54 +0000 (11:49 -0500)]
rtlwifi: btcoex: 23b 2ant: check PS state before setting tdma duration

For time division multiple access, the wifi and bt take turns to
transmit, but we need to let AP know that wifi is under standby mode by
sending null data to "pretend" entering power saving state using lps
rpwm.

But, the fw does not know if it is the actual power saving mode or just a
fake one to cheat to the AP. Hence, before fw setting the tdma duration,
the fw needs the driver to check the power saving state first.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@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 agobrcmfmac: only add channels and ssids once in scan request
Arend Van Spriel [Thu, 6 Apr 2017 12:14:42 +0000 (13:14 +0100)]
brcmfmac: only add channels and ssids once in scan request

When receiving pno results there may be duplicate channels and/or
ssids. Assure each is added only once when preparing the internal
escan request.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: remove bogus check in scheduled scan result handler
Arend Van Spriel [Thu, 6 Apr 2017 12:14:41 +0000 (13:14 +0100)]
brcmfmac: remove bogus check in scheduled scan result handler

Checking whether the address of an array element is null is bogus
so removing it.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: add length checks in scheduled scan result handler
Arend Van Spriel [Thu, 6 Apr 2017 12:14:40 +0000 (13:14 +0100)]
brcmfmac: add length checks in scheduled scan result handler

Assure the event data buffer is long enough to hold the array
of netinfo items and that SSID length does not exceed the maximum
of 32 characters as per 802.11 spec.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: remove reference to fwsignal data from struct brcmf_pub
Arend Van Spriel [Thu, 6 Apr 2017 12:14:39 +0000 (13:14 +0100)]
brcmfmac: remove reference to fwsignal data from struct brcmf_pub

The fwsignal module is part of the bcdc protocol and as such does
its instance data is not needed in core structure. Moving it into
struct brcmf_bcdc instead.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: ignore interfaces when fwsignal is disabled
Arend Van Spriel [Thu, 6 Apr 2017 12:14:38 +0000 (13:14 +0100)]
brcmfmac: ignore interfaces when fwsignal is disabled

When brcmf_fws_add_interface() is called the struct brcmf_if::fws_desc
field is initialized regardless the state of the fwsignal functionality,
ie. the fcmode. This is not needed when fcmode is NONE, which is the
default mode.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: rename brcmf_fws_{de,}init to brcmf_fws{at,de}tach
Arend Van Spriel [Thu, 6 Apr 2017 12:14:37 +0000 (13:14 +0100)]
brcmfmac: rename brcmf_fws_{de,}init to brcmf_fws{at,de}tach

This is a non-functional change to align the fwsignal module to
the naming pattern used throughout the driver.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: properly align buffers on certain platforms with 64 bit DMA
Heiner Kallweit [Wed, 5 Apr 2017 18:33:26 +0000 (20:33 +0200)]
brcmfmac: properly align buffers on certain platforms with 64 bit DMA

Systems with 64 bit DMA at least partially require buffers to be used
for DMA to be 8-byte-aligned. One example is Amlogic Meson GX.
Switching the MMC/SDIO driver for this platform to SG DMA mode
resulted in problems due to unaligned buffers.

Fortunately the brcmfmac driver has a global define for the alignment.
Changing it to 8 fixed the issues with Meson GX.

Suggested-by: Helmut Klein <hgkr.klein@gmail.com>
Tested-by: Helmut Klein <hgkr.klein@gmail.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: Fix invalid port issue
Ganapathi Bhat [Tue, 4 Apr 2017 04:46:28 +0000 (10:16 +0530)]
mwifiex: Fix invalid port issue

We have to use start port, for TX/RX of single packet,
instead of current aggregating port. This will fix SDIO
CMD53(TX/RX) returning -ETIMEDOUT and halting the data path.

Fixes: 0cb52aac4d19 ("mwifiex: do not set multiport flag for tx/rx single packet")
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agonet: make struct net_device::min_header_len 8-bit
Alexey Dobriyan [Mon, 10 Apr 2017 08:25:26 +0000 (11:25 +0300)]
net: make struct net_device::min_header_len 8-bit

This field is never big enough to warrant 16-bitness.

8-bit accesses enjoy shorted encoding on i386/x86_64 than 16-bit
accesses:

add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-10 (-10)
function                                     old     new   delta
loopback_setup                               169     164      -5
ether_setup                                  148     143      -5

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: neigh: make ->hh_len 32-bit
Alexey Dobriyan [Mon, 10 Apr 2017 08:11:17 +0000 (11:11 +0300)]
net: neigh: make ->hh_len 32-bit

Using 16-bit ->hh_len doesn't save any memory, save some .text instead:

add/remove: 0/0 grow/shrink: 1/6 up/down: 2/-19 (-17)
function                                     old     new   delta
neigh_update                                2312    2314      +2
fwnet_header_cache                           199     197      -2
eth_header_cache                             101      99      -2
ip6_finish_output2                          2371    2368      -3
vrf_finish_output6                          1522    1518      -4
vrf_finish_output                           1413    1409      -4
ip_finish_output2                           1627    1623      -4

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agogso: Support frag_list splitting with head_frag
Ilan Tayari [Fri, 7 Apr 2017 23:07:08 +0000 (02:07 +0300)]
gso: Support frag_list splitting with head_frag

A driver may use build_skb() for received packets.
These SKBs then have a head_frag.

Since commit d7e8883cfcf4 ("net: make GRO aware of
skb->head_frag"), GRO may build frag_list SKBs out of
head_frag received SKBs.
In such a case, the chained SKBs end up with a head_frag.

Commit 07b26c9454a2 ("gso: Support partial splitting at
the frag_list pointer") adds partial segmentation of frag_list
SKB chains into individual SKBs.
However, this is not done if the chained SKBs have any
linear part, because the device may not be able to DMA
the private linear buffer.

A chained frag_list SKB with head_frag is wrongfully
detected in this case as having a private linear part
and thus falls back to software GSO, while in fact the
linear part is backed by a DMA page just like any other frag.

This causes low performance when forwarding those packets
that were built with build_skb()

Allow partial segmentation at the frag_list pointer for
chained SKBs with head_frag.

Note that such SKBs can only be created by GRO, when applied
to received packets with head_frag.
Also note that this change only affects the data path that
performs the partial segmentation at frag_list pointer, and
not any of the other more common data paths.

Signed-off-by: Ilan Tayari <ilant@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'l2tp-const'
David S. Miller [Wed, 12 Apr 2017 14:44:03 +0000 (10:44 -0400)]
Merge branch 'l2tp-const'

Guillaume Nault says:

====================
l2tp: constify l2tp_session_get*() and l2tp_tunnel_find*()

Declare parameters of these functions as "const" where possible.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agol2tp: define parameters of l2tp_tunnel_find*() as "const"
Guillaume Nault [Wed, 12 Apr 2017 08:05:30 +0000 (10:05 +0200)]
l2tp: define parameters of l2tp_tunnel_find*() as "const"

l2tp_tunnel_find() and l2tp_tunnel_find_nth() don't modify "net".

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agol2tp: define parameters of l2tp_session_get*() as "const"
Guillaume Nault [Wed, 12 Apr 2017 08:05:29 +0000 (10:05 +0200)]
l2tp: define parameters of l2tp_session_get*() as "const"

Make l2tp_pernet()'s parameter constant, so that l2tp_session_get*() can
declare their "net" variable as "const".
Also constify "ifname" in l2tp_session_get_by_ifname().

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'ftgmac100-rework-batch4-misc'
David S. Miller [Wed, 12 Apr 2017 14:17:03 +0000 (10:17 -0400)]
Merge branch 'ftgmac100-rework-batch4-misc'

Benjamin Herrenschmidt says:

====================
ftgmac100: Rework batch 4 - Misc

This is v2 of the fourth batch of updates to the ftgmac100 driver.

This is a bunch of misc cleanups and fixes, such as properly
disabling HW checksum generation on AST2400 where it's known
to be broken and some chip init updates.

This also adds the ability to turn HW checksum on/off and
configure the ring sizes via ethtool.

v2 Fixes patch 1/10 (NETIF_F_HW_CSUM conversion)

The next (and last) batch will add a few more "features" such
as netpoll, multicast/promist, vlan offload...
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoftgmac100: Set default ring sizes to 128 entries
Benjamin Herrenschmidt [Wed, 12 Apr 2017 03:27:10 +0000 (13:27 +1000)]
ftgmac100: Set default ring sizes to 128 entries

I haven't seen any improvement above that size on the machines
I've tested with.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoftgmac100: Make ring sizes configurable via ethtool
Benjamin Herrenschmidt [Wed, 12 Apr 2017 03:27:09 +0000 (13:27 +1000)]
ftgmac100: Make ring sizes configurable via ethtool

We set an arbitrary max at 1024 since we pre-allocate the actual
descriptor arrays and skb arrays to the full size to keep the
code a bit simpler and avoid allocation failures in the reset
task.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoftgmac100: Add more register inits in ftgmac100_init_hw()
Benjamin Herrenschmidt [Wed, 12 Apr 2017 03:27:08 +0000 (13:27 +1000)]
ftgmac100: Add more register inits in ftgmac100_init_hw()

Clear stale interrupts on entry, configure FIFO sizes, set FIFO
thresholds, configure interrupt mitigation.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoftgmac100: Open code remaining register writes
Benjamin Herrenschmidt [Wed, 12 Apr 2017 03:27:07 +0000 (13:27 +1000)]
ftgmac100: Open code remaining register writes

The helpers just take space but don't provide much value. Simple
one line comments are more explanatory.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David S. Miller <davem@davemloft.net>