openwrt/staging/blogic.git
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>
7 years agoftgmac100: Rename ftgmac100_setup_mac to ftgmac100_initial_mac
Benjamin Herrenschmidt [Wed, 12 Apr 2017 03:27:06 +0000 (13:27 +1000)]
ftgmac100: Rename ftgmac100_setup_mac to ftgmac100_initial_mac

To remove more confusion. This function is about obtaining the
initial MAC address at driver probe time.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoftgmac100: Rename ftgmac100_set_mac to ftgmac100_write_mac_addr
Benjamin Herrenschmidt [Wed, 12 Apr 2017 03:27:05 +0000 (13:27 +1000)]
ftgmac100: Rename ftgmac100_set_mac to ftgmac100_write_mac_addr

To avoid confusion with the ndo callback and generally be
clearer about the purpose of that function

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

So features can be turned on/off via ethtool

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoftgmac100: Disable HW checksum generation on AST2400, enable on others
Benjamin Herrenschmidt [Wed, 12 Apr 2017 03:27:03 +0000 (13:27 +1000)]
ftgmac100: Disable HW checksum generation on AST2400, enable on others

We found out that HW checksum generation only works from AST2500
onward. This disables it on AST2400 and removes the "no-hw-checksum"
properties in the device-trees. The problem we had wasn't related
to NC-SI.

Also rework the logic testing for that property so it can be used
to disable HW checksum generation and checking regardless of whether
NC-SI is used or not in case other variants out there need this.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoftgmac100: Use device "compatible" property, not machine.
Benjamin Herrenschmidt [Wed, 12 Apr 2017 03:27:02 +0000 (13:27 +1000)]
ftgmac100: Use device "compatible" property, not machine.

We test for aspeed chips to handle a couple of special cases,
but we do that by checking the machine type which isn't right.

Instead check the actual device compatible property. This also
updates the dtsi files for the aspeed SoC to match.

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

The documentation describes NETIF_F_IP_CSUM as deprecated
so let's switch to NETIF_F_HW_CSUM and use the helper to
handle unhandled protocols.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'net-smc-next'
David S. Miller [Wed, 12 Apr 2017 03:01:15 +0000 (23:01 -0400)]
Merge branch 'net-smc-next'

Ursula Braun says:

====================
net/smc: patches for net-next

here are some patches for net/smc. Most important are
improvements for socket closing.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/smc: do not use IB_SEND_INLINE together with mapped data
Ursula Braun [Mon, 10 Apr 2017 12:58:05 +0000 (14:58 +0200)]
net/smc: do not use IB_SEND_INLINE together with mapped data

smc specifies IB_SEND_INLINE for IB_WR_SEND ib_post_send calls, but
provides a mapped buffer to be sent. This is inconsistent, since
IB_SEND_INLINE works without mapped buffer. Problem has not been
detected in the past, because tests had been limited to Connect X3 cards
from Mellanox, whose mlx4 driver just ignored the IB_SEND_INLINE flag.
For now, the IB_SEND_INLINE flag is removed.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/smc: destruct non-accepted sockets
Ursula Braun [Mon, 10 Apr 2017 12:58:04 +0000 (14:58 +0200)]
net/smc: destruct non-accepted sockets

Make sure sockets never accepted are removed cleanly.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/smc: remove duplicate unhash
Ursula Braun [Mon, 10 Apr 2017 12:58:03 +0000 (14:58 +0200)]
net/smc: remove duplicate unhash

unhash is already called in sock_put_work. Remove the second call.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/smc: guarantee ConnClosed send after shutdown SHUT_WR
Ursula Braun [Mon, 10 Apr 2017 12:58:02 +0000 (14:58 +0200)]
net/smc: guarantee ConnClosed send after shutdown SHUT_WR

State SMC_CLOSED should be reached only, if ConnClosed has been sent to
the peer. If ConnClosed is received from the peer, a socket with
shutdown SHUT_WR done, switches errorneously to state SMC_CLOSED, which
means the peer socket is dangling. The local SMC socket is supposed to
switch to state APPFINCLOSEWAIT to make sure smc_close_final() is called
during socket close.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/smc: no socket state changes in tasklet context
Ursula Braun [Mon, 10 Apr 2017 12:58:01 +0000 (14:58 +0200)]
net/smc: no socket state changes in tasklet context

Several state changes occur during SMC socket closing. Currently
state changes triggered locally occur in process context with
lock_sock() taken while state changes triggered by peer occur in
tasklet context with bh_lock_sock() taken. bh_lock_sock() does not
wait till a lock_sock(() task in process context is finished. This
may lead to races in socket state transitions resulting in dangling
SMC-sockets, or it may lead to duplicate SMC socket freeing.
This patch introduces a closing worker to run all state changes under
lock_sock().

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reported-by: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/smc: always call the POLL_IN part of sk_wake_async
Ursula Braun [Mon, 10 Apr 2017 12:58:00 +0000 (14:58 +0200)]
net/smc: always call the POLL_IN part of sk_wake_async

Wake up reading file descriptors for a closing socket as well, otherwise
some socket applications may stall.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/smc: guarantee reset of write_blocked for heavy workload
Ursula Braun [Mon, 10 Apr 2017 12:57:59 +0000 (14:57 +0200)]
net/smc: guarantee reset of write_blocked for heavy workload

If peer indicates write_blocked, the cursor state of the received data
should be send to the peer immediately (in smc_tx_consumer_update()).
Afterwards the write_blocked indicator is cleared.

If there is no free slot for another write request, sending is postponed
to worker smc_tx_work, and the write_blocked indicator is not cleared.
Therefore another clearing check is needed in smc_tx_work().

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/smc: return active RoCE port only
Ursula Braun [Mon, 10 Apr 2017 12:57:58 +0000 (14:57 +0200)]
net/smc: return active RoCE port only

SMC requires an active ib port on the RoCE device.
smc_pnet_find_roce_resource() determines the matching RoCE device port
according to the configured PNET table. Do not return the found
RoCE device port, if it is not flagged active.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/smc: remove useless smc_ib_devices_list check
Ursula Braun [Mon, 10 Apr 2017 12:57:57 +0000 (14:57 +0200)]
net/smc: remove useless smc_ib_devices_list check

The global event handler is created only, if the ib_device has already
been used by at least one link group. It is guaranteed that there exists
the corresponding entry in the smc_ib_devices list. Get rid of this
superfluous check.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/smc: get rid of old comment
Ursula Braun [Mon, 10 Apr 2017 12:57:56 +0000 (14:57 +0200)]
net/smc: get rid of old comment

This patch removes an outdated comment.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: stmmac: use netif_set_real_num_{rx,tx}_queues
Joao Pinto [Mon, 10 Apr 2017 10:32:14 +0000 (11:32 +0100)]
net: stmmac: use netif_set_real_num_{rx,tx}_queues

In the submission of the lastest multiple buffer patch set, this fix was lost.
I am sending this patch to put it right again. The fix was originally proposed
by Arnd Bergmann.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Joao Pinto <jpinto@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: pass sk to helper functions
Willem de Bruijn [Tue, 11 Apr 2017 18:08:08 +0000 (14:08 -0400)]
bpf: pass sk to helper functions

BPF helper functions access socket fields through skb->sk. This is not
set in ingress cgroup and socket filters. The association is only made
in skb_set_owner_r once the filter has accepted the packet. Sk is
available as socket lookup has taken place.

Temporarily set skb->sk to sk in these cases.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agodevlink: fix return value check in devlink_dpipe_header_put()
Wei Yongjun [Tue, 11 Apr 2017 16:02:02 +0000 (16:02 +0000)]
devlink: fix return value check in devlink_dpipe_header_put()

Fix the return value check which testing the wrong variable
in devlink_dpipe_header_put().

Fixes: 1555d204e743 ("devlink: Support for pipeline debug (dpipe)")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 's390-qeth-updates'
David S. Miller [Tue, 11 Apr 2017 18:51:36 +0000 (14:51 -0400)]
Merge branch 's390-qeth-updates'

Julian Wiedmann says:

====================
more s390/net updates

here's a second batch of s390/net patches for net-next.
A mixed bunch of qeth cleanups, and a few patches to add support for
ETHTOOL_GLINKSETTINGS.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: remove unimplemented gdev routines
Julian Wiedmann [Tue, 11 Apr 2017 14:11:19 +0000 (16:11 +0200)]
s390/qeth: remove unimplemented gdev routines

prepare() and complete() are not implemented by any discipline, so just
drop all the indirection.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: Hans Wippel <hwippel@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: use LINK_MODE_* to report the link characteristics
Julian Wiedmann [Tue, 11 Apr 2017 14:11:18 +0000 (16:11 +0200)]
s390/qeth: use LINK_MODE_* to report the link characteristics

LINK_MODE_* replaces the u32-limited SUPPORTED_* / ENABLED_*
definitions.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: convert to ETHTOOL_GLINKSETTINGS API
Julian Wiedmann [Tue, 11 Apr 2017 14:11:17 +0000 (16:11 +0200)]
s390/qeth: convert to ETHTOOL_GLINKSETTINGS API

get_settings() is deprecated and lacks support for higher link
speeds, so implement get_link_ksettings() instead.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: clean up qeth_set_ecmd_adv_sup()
Julian Wiedmann [Tue, 11 Apr 2017 14:11:16 +0000 (16:11 +0200)]
s390/qeth: clean up qeth_set_ecmd_adv_sup()

In preparation for moving to get_link_ksettings(), clean up how
we build the supported and advertised port/speed masks.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: use and remove some defines
Julian Wiedmann [Tue, 11 Apr 2017 14:11:15 +0000 (16:11 +0200)]
s390/qeth: use and remove some defines

1. a buffer has 16 is_header flags, because that's its # of elements
2. replace the last occurrence of QETH_HEADER_SIZE, and remove it

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: use correct return type for hard_start_xmit()
Julian Wiedmann [Tue, 11 Apr 2017 14:11:14 +0000 (16:11 +0200)]
s390/qeth: use correct return type for hard_start_xmit()

ndo_start_xmit() expects us to return netdev_tx_t here...

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: remove unused parameter
Julian Wiedmann [Tue, 11 Apr 2017 14:11:13 +0000 (16:11 +0200)]
s390/qeth: remove unused parameter

'elements_needed' is not used in qeth_do_send_packet_fast(),
so consequently remove it.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: move gdev shutdown handler to core
Julian Wiedmann [Tue, 11 Apr 2017 14:11:12 +0000 (16:11 +0200)]
s390/qeth: move gdev shutdown handler to core

Duplicated code.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: move NAPI poll routine to core
Julian Wiedmann [Tue, 11 Apr 2017 14:11:11 +0000 (16:11 +0200)]
s390/qeth: move NAPI poll routine to core

Identical code, we just need to call a layer-specific hook
to process any received buffer.

qeth_buffer_reclaim_work() is shuffled around to avoid a
forward declaration for qeth_queue_input_buffer().

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: move common ioctl handling to core
Julian Wiedmann [Tue, 11 Apr 2017 14:11:10 +0000 (16:11 +0200)]
s390/qeth: move common ioctl handling to core

There's a number of layer-independent ioctls that we can handle
in core, and reduce code duplication. For layer-specific ioctls,
add a do_ioctl() discipline hook.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: remove struct bpf_map_type_list
Johannes Berg [Tue, 11 Apr 2017 13:34:58 +0000 (15:34 +0200)]
bpf: remove struct bpf_map_type_list

There's no need to have struct bpf_map_type_list since
it just contains a list_head, the type, and the ops
pointer. Since the types are densely packed and not
actually dynamically registered, it's much easier and
smaller to have an array of type->ops pointer. Also
initialize this array statically to remove code needed
to initialize it.

In order to save duplicating the list, move it to the
types header file added by the previous patch and
include it in the same fashion.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: remove struct bpf_prog_type_list
Johannes Berg [Tue, 11 Apr 2017 13:34:57 +0000 (15:34 +0200)]
bpf: remove struct bpf_prog_type_list

There's no need to have struct bpf_prog_type_list since
it just contains a list_head, the type, and the ops
pointer. Since the types are densely packed and not
actually dynamically registered, it's much easier and
smaller to have an array of type->ops pointer. Also
initialize this array statically to remove code needed
to initialize it.

In order to save duplicating the list, move it to a new
header file and include it in the places needing it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'fec-driver-code-clean'
David S. Miller [Tue, 11 Apr 2017 18:36:28 +0000 (14:36 -0400)]
Merge branch 'fec-driver-code-clean'

Fugang Duan says:

====================
net: fec: driver code clean

The patch series are for fec ethernet driver code clean up, each patch is
independent.
Patch #1,#4,#5 are code clean up.
Patch #2,#3 are for aarch64 platform.
Patch #6 is for i.MX6UL to add lost errata workaround.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: fec: add ERR007885 for i.MX6ul enet IP
Fugang Duan [Tue, 11 Apr 2017 11:13:08 +0000 (19:13 +0800)]
net: fec: add ERR007885 for i.MX6ul enet IP

The errata ERR007885 HW fix don't add to i.MX6ul ENET IP version,
so add sw workaroud for the chip.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: fec: correct the errata number comment typo
Fugang Duan [Tue, 11 Apr 2017 11:13:07 +0000 (19:13 +0800)]
net: fec: correct the errata number comment typo

Correct the errata number ERR006358 comment typo.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: fec: add phy-reset-gpios PROBE_DEFER check
Fugang Duan [Tue, 11 Apr 2017 11:13:06 +0000 (19:13 +0800)]
net: fec: add phy-reset-gpios PROBE_DEFER check

Many boards use i2c/spi expander gpio as phy-reset-gpios and these
gpios maybe registered after fec port, driver should check the return
value of .of_get_named_gpio().

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: fec: pass ->dev to dma_alloc__coherent() API
Fugang Duan [Tue, 11 Apr 2017 11:13:05 +0000 (19:13 +0800)]
net: fec: pass ->dev to dma_alloc__coherent() API

In aarch64 system, it requires to trasfer ->dev to dma_alloc_coherent()
API, otherwise allocate failed and print kernel warning.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>