platform/kernel/linux-exynos.git
8 years agobrcmfmac: fix memory leak in brcmf_flowring_add_tdls_peer()
Arend Van Spriel [Mon, 19 Sep 2016 11:09:53 +0000 (12:09 +0100)]
brcmfmac: fix memory leak in brcmf_flowring_add_tdls_peer()

In the error paths in brcmf_flowring_add_tdls_peer() the allocated
resource should be freed.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: rework pointer trickery in brcmf_proto_bcdc_query_dcmd()
Arend Van Spriel [Mon, 19 Sep 2016 11:09:52 +0000 (12:09 +0100)]
brcmfmac: rework pointer trickery in brcmf_proto_bcdc_query_dcmd()

The variable info is assigned to point to bcdc->msg[1], which is the
same as pointing to bcdc->buf. As that is what we want to access
make it clear by fixing the assignment. This also avoid out-of-bounds
errors from static analyzers are bcdc->msg[1] is not in the structure
definition.

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>
8 years agobrcmfmac: ignore 11d configuration errors
Hante Meuleman [Mon, 19 Sep 2016 11:09:51 +0000 (12:09 +0100)]
brcmfmac: ignore 11d configuration errors

802.11d is not always supported by firmware anymore. Currently the
AP configuration of 11d will cause an abort if the ioctl set is
failing. This behavior is not correct and the error should be
ignored.

Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: cfg80211 set_default_mgmt_key handler
Ganapathi Bhat [Tue, 20 Sep 2016 13:16:23 +0000 (18:46 +0530)]
mwifiex: cfg80211 set_default_mgmt_key handler

Previously device used to start using IGTK key as Tx key as soon as it
gets downloaded in add_key(). This patch implements set_default_mgmt_key
handler. We will update Tx key ID in set_default_mgmt_key().

Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agowlcore: wl18xx: Use chip specific configuration firmware
Tony Lindgren [Sat, 17 Sep 2016 16:06:33 +0000 (09:06 -0700)]
wlcore: wl18xx: Use chip specific configuration firmware

Use the wl18xx specific config firmware we now have available.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agowlcore: Fix config firmware loading issues
Tony Lindgren [Sat, 17 Sep 2016 16:06:32 +0000 (09:06 -0700)]
wlcore: Fix config firmware loading issues

Booting multiple wl12xx and wl18xx devices using the same rootfs is
a pain. You currently have to symlink the right nvs file depending
on the wl12xx type.

For example, with wl1271-nvs.bin being a symlink to wl127x-nvs.bin
by default and trying to bring up a wl128x based device:

wlcore: ERROR nvs size is not as expected: 1113 != 912
wlcore: ERROR NVS file is needed during boot
wlcore: ERROR NVS file is needed during boot
wlcore: ERROR firmware boot failed despite 3 retries

Note that wl18xx uses a separate config firmware wl18xx-conf.bin
that can be generated with tools using the following two git repos:

git.ti.com/wilink8-wlan/18xx-ti-utils
git.ti.com/wilink8-wlan/wl18xx_fw

So let's not configure the nvs file for wl18xx as it's not needed
AFAIK. If it turns out that we also need the nvs file for wl18xx,
we can just add it to the config firmware data for wl18xx.

Let's fix the issue by using the chip specific config firmware
data, and make sure we produce understandable warnings if something
is missing.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agowlcore: spi: Populate config firmware data
Tony Lindgren [Sat, 17 Sep 2016 16:06:31 +0000 (09:06 -0700)]
wlcore: spi: Populate config firmware data

Configure the config firmware names and make it available
in platform data.

Let's also fix the order of the struct wilink_family_data
while at it.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agowlcore: sdio: Populate config firmware data
Tony Lindgren [Sat, 17 Sep 2016 16:06:30 +0000 (09:06 -0700)]
wlcore: sdio: Populate config firmware data

Configure the config firmware names and make it available
in platform data.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agowlcore: Prepare family to fix nvs file handling
Tony Lindgren [Sat, 17 Sep 2016 16:06:29 +0000 (09:06 -0700)]
wlcore: Prepare family to fix nvs file handling

Move struct wilink_family_data to be available for all TI WLAN
variants. And fix familiy typo, it should be just family.

Looks like wl12xx use two different nvs.bin files and wl18xx
uses a different conf.bin file.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoMerge tag 'iwlwifi-next-for-kalle-2016-09-19-2' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Mon, 26 Sep 2016 11:10:31 +0000 (14:10 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2016-09-19-2' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

* added support for MU-MIMO sniffer
* added support for RRM by scan
* added support for packet injection
* migrate to devm memory allocation handling
* some fixes, mostly in DQA and new HW support
* other generic cleanups

8 years agoiwlwifi: pcie: use LIST_HEAD() macro
Johannes Berg [Wed, 31 Aug 2016 20:16:11 +0000 (22:16 +0200)]
iwlwifi: pcie: use LIST_HEAD() macro

There's no need to declare a list and then init it manually,
just use the LIST_HEAD() macro.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: use LIST_HEAD() macro
Johannes Berg [Wed, 31 Aug 2016 20:16:11 +0000 (22:16 +0200)]
iwlwifi: mvm: use LIST_HEAD() macro

There's no need to declare a list and then init it manually,
just use the LIST_HEAD() macro.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: set HCMD_NAME for PHY_DB as well
Sara Sharon [Wed, 31 Aug 2016 16:03:01 +0000 (19:03 +0300)]
iwlwifi: mvm: set HCMD_NAME for PHY_DB as well

Currently it is logged as UNKNOWN.
Also, 0x6c seems to be the permanent ID for this command, remove
incorrect comment and uncomment the command from the commands
list.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: Add mem debugfs entry
Ido Yariv [Tue, 23 Aug 2016 18:44:59 +0000 (14:44 -0400)]
iwlwifi: mvm: Add mem debugfs entry

In order to access cached/paged memory, there are a couple of firmware
commands (one for UMAC and one for LMAC) that let the host access memory
and registers indirectly. Since this is done by the firmware on behalf
of the host, even if memory is paged out or cached, the host will
retrieve the memory as the firmware sees it (paged out memory will get
paged in).

Export this mechanism via a debugfs entry for both read and write
access.

WARNING: This mechanism has no protections at all. Invalid addresses may
crash or hang the firmware. Writing to arbitrary memory also comes with
no guarantees.

Signed-off-by: Ido Yariv <idox.yariv@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: move AP-specific code to right function
Johannes Berg [Wed, 24 Aug 2016 08:05:40 +0000 (10:05 +0200)]
iwlwifi: mvm: move AP-specific code to right function

There's no need for the common MAC context function to have an
if on AP mode, the values can be overridden in the AP-specific
function later. Clean that up by adding the full command as a
new parameter to the AP-specific function, and doing it there.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: add new 8265 series PCI ID
Oren Givon [Thu, 25 Aug 2016 10:15:24 +0000 (13:15 +0300)]
iwlwifi: add new 8265 series PCI ID

Add a new PCI ID for the 8265 series.

Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: Add debugfs function for clocks diff
Roee Zamir [Tue, 2 Aug 2016 10:55:13 +0000 (13:55 +0300)]
iwlwifi: mvm: Add debugfs function for clocks diff

New function, reveals the diff between gp2 and host time.

Signed-off-by: Roee Zamir <roee.zamir@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: migrate to devm_* API
Sharon Dvir [Wed, 10 Aug 2016 06:05:48 +0000 (09:05 +0300)]
iwlwifi: migrate to devm_* API

Change PCIE and trans resource allocations to managed resources.

Signed-off-by: Sharon Dvir <sharon.dvir@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: disable P2P queue on mac context release
Sara Sharon [Thu, 18 Aug 2016 17:14:38 +0000 (20:14 +0300)]
iwlwifi: mvm: disable P2P queue on mac context release

AP queue is properly released, but P2P queue isn't.

Fixes: commit 4c965139a3cd ("iwlwifi: mvm: support p2p device frames tx on dqa queue #2")
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: don't export trace points that are used in iwlwifi only
Emmanuel Grumbach [Mon, 22 Aug 2016 20:24:40 +0000 (23:24 +0300)]
iwlwifi: don't export trace points that are used in iwlwifi only

This can save a few bytes

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: document passing unexpected Block Ack Request frames
Johannes Berg [Thu, 18 Aug 2016 12:18:40 +0000 (14:18 +0200)]
iwlwifi: mvm: document passing unexpected Block Ack Request frames

When we get an unexpected Block Ack Request frame, the BAID from
the hardware will be invalid, and we'll pass it to mac80211 for
further handling (sending a delBA action frame.)

Add a comment explaining that, in case anyone looks in the future.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: move to wide ID for all commands
Sara Sharon [Mon, 15 Aug 2016 14:36:47 +0000 (17:36 +0300)]
iwlwifi: move to wide ID for all commands

Due to firmware design considerations, move to wide ID for
all commands.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: make iwl_mvm_update_sta() an inline
Johannes Berg [Thu, 18 Aug 2016 08:32:58 +0000 (10:32 +0200)]
iwlwifi: mvm: make iwl_mvm_update_sta() an inline

There's no point in making this an out-of-line function
since it just calls a single other function with a few
changed parameters.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: pcie: log full command sequence
Sara Sharon [Mon, 15 Aug 2016 14:13:27 +0000 (17:13 +0300)]
iwlwifi: pcie: log full command sequence

Log group as well. Remove 0x prefix to match TX logging.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: move BIOS MCC retrieval to common code
Arik Nemtsov [Sun, 7 Aug 2016 15:58:29 +0000 (18:58 +0300)]
iwlwifi: move BIOS MCC retrieval to common code

This will be used by more than MVM, so move it to iwlwifi

While at it, rename WRD_METHOD to the more appropriate
WRDD_METHOD and add some documentation.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: support packet injection
Sara Sharon [Tue, 9 Aug 2016 17:03:52 +0000 (20:03 +0300)]
iwlwifi: mvm: support packet injection

For automatic testing packet injection can be useful.
Support injection through debugfs.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: Add support for RRM by scan
Avrahams Stern [Tue, 19 Jul 2016 08:15:09 +0000 (11:15 +0300)]
iwlwifi: mvm: Add support for RRM by scan

Implement support for RRM by adding an option to configure the scan
dwell time and reporting scan start time and BSS detection time, and
Advertise support for these features.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: support BAR in reorder buffer
Sara Sharon [Mon, 8 Aug 2016 10:07:01 +0000 (13:07 +0300)]
iwlwifi: mvm: support BAR in reorder buffer

On default queue we will not receive frame release notification,
but the BAR itself.
Upon receiving the BAR driver should look at the NSSN and adjust
window accordingly.

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>
8 years agoiwlwifi: mvm: fix DQA AP mode station assumption
Sara Sharon [Mon, 8 Aug 2016 08:51:24 +0000 (11:51 +0300)]
iwlwifi: mvm: fix DQA AP mode station assumption

There was recently a Full AP mode feature added where hostap adds
the station at auth stage, and not assoc.
However, when running with legacy hostapd, we get the auth response
before station was added, and tx_skb_non_sta fails to allocate
a queue, resulting in a complete failure of association.
Take care of this situation as well.
Add a warning when no valid queue is returned at all and make mvm
drop the packet instead of passing it on.
Refactor the function a bit while at it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: check for valid ethernet address provided by OEM
Haim Dreyfuss [Tue, 2 Aug 2016 12:28:23 +0000 (15:28 +0300)]
iwlwifi: check for valid ethernet address provided by OEM

In 9000 family products we added an option to let the OEM fuse the
mac address via registers. If these registers are zeroed we use the OTP
address instead. Make sure that the address provided by the OEM is valid
and, if not, fall back to the OTP address as well.

Fixes: commit 17c867bfe89b ("iwlwifi: add support for getting HW address from CSR")
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: add support for MU-MIMO air sniffer
Aviya Erenfeld [Sun, 27 Mar 2016 11:53:49 +0000 (14:53 +0300)]
iwlwifi: mvm: add support for MU-MIMO air sniffer

enable MU-MIMO air sniffer if it's supported by the NIC

Signed-off-by: Aviya Erenfeld <aviya.erenfeld@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: compare full command ID
Johannes Berg [Thu, 4 Aug 2016 06:57:59 +0000 (08:57 +0200)]
iwlwifi: mvm: compare full command ID

When comparing command IDs, the group should be taken
into account so the same command/notification from a
different group doesn't trigger anything unexpected.
Fix this by comparing to the wide ID.

Fixes: commit 1738d60b31d7 ("iwlwifi: mvm: handle RX MPDUs separately")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: cleanup skb queue functions use
Sara Sharon [Wed, 3 Aug 2016 11:08:00 +0000 (14:08 +0300)]
iwlwifi: mvm: cleanup skb queue functions use

Use skb_queue_empty() and not skb_peek_tail() to check for
empty list.
Avoid a redundant check as well - loop will take care of it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: pcie: fix typo in struct name for a000 devices
Sara Sharon [Thu, 4 Aug 2016 07:56:53 +0000 (10:56 +0300)]
iwlwifi: pcie: fix typo in struct name for a000 devices

commit 3cd1980b0cdf ("iwlwifi: pcie: introduce new tfd and tb formats")
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: remove variable shadowing
Liad Kaufman [Wed, 3 Aug 2016 15:41:27 +0000 (18:41 +0300)]
iwlwifi: mvm: remove variable shadowing

Variable "ac" defined twice. Fix that.

Fixes: commit 93f436e2c7fe ("iwlwifi: mvm: set sta_id in SCD_QUEUE_CONFIG cmd")
Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agomwifiex: fix null pointer deference when adapter is null
Colin Ian King [Fri, 16 Sep 2016 09:37:31 +0000 (10:37 +0100)]
mwifiex: fix null pointer deference when adapter is null

If adapter is null the error exit path in mwifiex_shutdown_sw is
to down the semaphore sem and print some debug via mwifiex_dbg.
However, passing a NULL adapter to mwifiex_dbg causes a null
pointer deference when accessing adapter->dev.  This fix checks
for a null adapter at the start of the function and to exit
without the need to up the semaphore and we also skip the debug
to avoid the null pointer dereference.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: fix error handling in mwifiex_create_custom_regdomain
Bob Copeland [Wed, 14 Sep 2016 12:42:36 +0000 (08:42 -0400)]
mwifiex: fix error handling in mwifiex_create_custom_regdomain

smatch reports:

sta_cmdresp.c:1053 mwifiex_create_custom_regdomain() warn: possible memory leak of 'regd'

Indeed, mwifiex_create_custom_regdomain() returns NULL in the
case that channel is missing in the TLV without freeing regd.

Moreover, some other error paths in this function return ERR_PTR
values which are assigned without checking to the regd field in
the mwifiex_adapter struct.  The latter is only null-checked where
used.

Fix by freeing regd in the error path, and only update
priv->adapter->regd if the returned pointer is valid.

Cc: Amitkumar Karwar <akarwar@marvell.com>
Cc: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implement 8192e specific power down sequence
Jes Sorensen [Tue, 13 Sep 2016 19:03:15 +0000 (15:03 -0400)]
rtl8xxxu: Implement 8192e specific power down sequence

This powers down the 8192e correctly, or at least to the point where
the firmware will load again, when reloading the driver module.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoMerge tag 'iwlwifi-next-for-kalle-2016-09-15-2' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Sat, 17 Sep 2016 15:10:33 +0000 (18:10 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2016-09-15-2' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

* work for new hardware support continues
* dynamic queue allocation stabilization
* improvements in the MSIx code
* multiqueue support work continues
* new firmware version support
* general cleanups and improvements

8 years agoMerge branch 'ip_tunnel-collect_md'
David S. Miller [Sat, 17 Sep 2016 14:13:16 +0000 (10:13 -0400)]
Merge branch 'ip_tunnel-collect_md'

Alexei Starovoitov says:

====================
ip_tunnel: add collect_md mode to IPv4/IPv6 tunnels

Similar to geneve, vxlan, gre tunnels implement 'collect metadata' mode
in ipip, ipip6, ip6ip6 tunnels.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosamples/bpf: add comprehensive ipip, ipip6, ip6ip6 test
Alexei Starovoitov [Thu, 15 Sep 2016 20:00:32 +0000 (13:00 -0700)]
samples/bpf: add comprehensive ipip, ipip6, ip6ip6 test

the test creates 3 namespaces with veth connected via bridge.
First two namespaces simulate two different hosts with the same
IPv4 and IPv6 addresses configured on the tunnel interface and they
communicate with outside world via standard tunnels.
Third namespace creates collect_md tunnel that is driven by BPF
program which selects different remote host (either first or
second namespace) based on tcp dest port number while tcp dst
ip is the same.
This scenario is rough approximation of load balancer use case.
The tests check both traditional tunnel configuration and collect_md mode.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosamples/bpf: extend test_tunnel_bpf.sh with IPIP test
Alexei Starovoitov [Thu, 15 Sep 2016 20:00:31 +0000 (13:00 -0700)]
samples/bpf: extend test_tunnel_bpf.sh with IPIP test

extend existing tests for vxlan, geneve, gre to include IPIP tunnel.
It tests both traditional tunnel configuration and
dynamic via bpf helpers.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoip6_tunnel: add collect_md mode to IPv6 tunnels
Alexei Starovoitov [Thu, 15 Sep 2016 20:00:30 +0000 (13:00 -0700)]
ip6_tunnel: add collect_md mode to IPv6 tunnels

Similar to gre, vxlan, geneve tunnels allow IPIP6 and IP6IP6 tunnels
to operate in 'collect metadata' mode.
Unlike ipv4 code here it's possible to reuse ip6_tnl_xmit() function
for both collect_md and traditional tunnels.
bpf_skb_[gs]et_tunnel_key() helpers and ovs (in the future) are the users.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoip_tunnel: add collect_md mode to IPIP tunnel
Alexei Starovoitov [Thu, 15 Sep 2016 20:00:29 +0000 (13:00 -0700)]
ip_tunnel: add collect_md mode to IPIP tunnel

Similar to gre, vxlan, geneve tunnels allow IPIP tunnels to
operate in 'collect metadata' mode.
bpf_skb_[gs]et_tunnel_key() helpers can make use of it right away.
ovs can use it as well in the future (once appropriate ovs-vport
abstractions and user apis are added).
Note that just like in other tunnels we cannot cache the dst,
since tunnel_info metadata can be different for every packet.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agol2tp: constify net_device_ops structures
Julia Lawall [Thu, 15 Sep 2016 20:23:26 +0000 (22:23 +0200)]
l2tp: constify net_device_ops structures

Check for net_device_ops structures that are only stored in the netdev_ops
field of a net_device structure.  This field is declared const, so
net_device_ops structures that have this property can be declared as const
also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct net_device_ops i@p = { ... };

@ok@
identifier r.i;
struct net_device e;
position p;
@@
e.netdev_ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct net_device_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct net_device_ops i = { ... };
// </smpl>

The result of size on this file before the change is:
   text       data     bss     dec         hex   filename
   3401        931      44    4376        1118 net/l2tp/l2tp_eth.o

and after the change it is:
   text      data        bss     dec     hex filename
   3993       347         44       4384    1120 net/l2tp/l2tp_eth.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agodwc_eth_qos: constify net_device_ops structures
Julia Lawall [Thu, 15 Sep 2016 20:23:25 +0000 (22:23 +0200)]
dwc_eth_qos: constify net_device_ops structures

Check for net_device_ops structures that are only stored in the netdev_ops
field of a net_device structure.  This field is declared const, so
net_device_ops structures that have this property can be declared as const
also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct net_device_ops i@p = { ... };

@ok@
identifier r.i;
struct net_device e;
position p;
@@
e.netdev_ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct net_device_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct net_device_ops i = { ... };
// </smpl>

The result of size on this file before the change is:
   text       data     bss     dec         hex   filename
  21623       1316      40   22979        59c3
   drivers/net/ethernet/synopsys/dwc_eth_qos.o

and after the change it is:
   text      data        bss     dec     hex filename
  22199       724         40      22963    59b3
   drivers/net/ethernet/synopsys/dwc_eth_qos.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agohisilicon: constify net_device_ops structures
Julia Lawall [Thu, 15 Sep 2016 20:23:24 +0000 (22:23 +0200)]
hisilicon: constify net_device_ops structures

Check for net_device_ops structures that are only stored in the netdev_ops
field of a net_device structure.  This field is declared const, so
net_device_ops structures that have this property can be declared as const
also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct net_device_ops i@p = { ... };

@ok@
identifier r.i;
struct net_device e;
position p;
@@
e.netdev_ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct net_device_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct net_device_ops i = { ... };
// </smpl>

The result of size on this file before the change is:

   text       data     bss     dec         hex   filename
   7995        848       8    8851        2293
   drivers/net/ethernet/hisilicon/hip04_eth.o

and after the change it is:

   text      data        bss     dec     hex filename
   8571       256          8       8835    2283
   drivers/net/ethernet/hisilicon/hip04_eth.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agollc: switch type to bool as the timeout is only tested versus 0
Alan Cox [Thu, 15 Sep 2016 17:51:25 +0000 (18:51 +0100)]
llc: switch type to bool as the timeout is only tested versus 0

(As asked by Dave in Februrary)

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: l3mdev: Remove netif_index_is_l3_master
David Ahern [Thu, 15 Sep 2016 17:18:45 +0000 (10:18 -0700)]
net: l3mdev: Remove netif_index_is_l3_master

No longer used after e0d56fdd73422 ("net: l3mdev: remove redundant calls")

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: vrf: Remove RT_FL_TOS
David Ahern [Thu, 15 Sep 2016 17:13:47 +0000 (10:13 -0700)]
net: vrf: Remove RT_FL_TOS

No longer used after d66f6c0a8f3c0 ("net: ipv4: Remove l3mdev_get_saddr")

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotcp: prepare skbs for better sack shifting
Eric Dumazet [Thu, 15 Sep 2016 16:33:02 +0000 (09:33 -0700)]
tcp: prepare skbs for better sack shifting

With large BDP TCP flows and lossy networks, it is very important
to keep a low number of skbs in the write queue.

RACK and SACK processing can perform a linear scan of it.

We should avoid putting any payload in skb->head, so that SACK
shifting can be done if needed.

With this patch, we allow to pack ~0.5 MB per skb instead of
the 64KB initially cooked at tcp_sendmsg() time.

This gives a reduction of number of skbs in write queue by eight.
tcp_rack_detect_loss() likes this.

We still allow payload in skb->head for first skb put in the queue,
to not impact RPC workloads.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge tag 'wireless-drivers-next-for-davem-2016-09-15' of git://git.kernel.org/pub...
David S. Miller [Sat, 17 Sep 2016 13:53:29 +0000 (09:53 -0400)]
Merge tag 'wireless-drivers-next-for-davem-2016-09-15' of git://git./linux/kernel/git/kvalo/wireless-drivers-next

Kalle Valo says:

====================
wireless-drivers-next patches for 4.9

Major changes:

iwlwifi

* preparation for new a000 HW continues
* some DQA improvements
* add support for GMAC
* add support for 9460, 9270 and 9170 series

mwifiex

* support random MAC address for scanning
* add HT aggregation support for adhoc mode
* add custom regulatory domain support
* add manufacturing mode support via nl80211 testmode interface

bcma

* support BCM53573 series of wireless SoCs

bitfield.h

* add FIELD_PREP() and FIELD_GET() macros

mt7601u

* convert to use the new bitfield.h macros

brcmfmac

* add support for bcm4339 chip with modalias sdio:c00v02D0d4339

ath10k

* add nl80211 testmode support for 10.4 firmware
* hide kernel addresses from logs using %pK format specifier
* implement NAPI support
* enable peer stats by default

ath9k

* use ieee80211_tx_status_noskb where possible

wil6210

* extract firmware capabilities from the firmware file

ath6kl

* enable firmware crash dumps on the AR6004

ath-current is also merged to fix a conflict in ath10k.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'mlx5e-order-0'
David S. Miller [Sat, 17 Sep 2016 13:51:48 +0000 (09:51 -0400)]
Merge branch 'mlx5e-order-0'

Tariq Toukan says:

====================
mlx5e Order-0 pages for Striding RQ

In this series, we refactor our Striding RQ receive-flow to always use
fragmented WQEs (Work Queue Elements) using order-0 pages, omitting the
flow that allocates and splits high-order pages which would fragment
and deplete high-order pages in the system.

The first patch gives a slight degradation, but opens the opportunity
to using a simple page-cache mechanism of a fair size.
The page-cache, implemented in patch 3, not only closes the performance
gap but even gives a gain.
In patch 2 we re-organize the code to better manage the calls for
alloc/de-alloc pages in the RX flow.

Series generated against net-next commit:
bed806cb266e "Merge branch 'mlxsw-ethtool'"
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Implement RX mapped page cache for page recycle
Tariq Toukan [Thu, 15 Sep 2016 13:08:38 +0000 (16:08 +0300)]
net/mlx5e: Implement RX mapped page cache for page recycle

Instead of reallocating and mapping pages for RX data-path,
recycle already used pages in a per ring cache.

Performance tests:
The following results were measured on a freshly booted system,
giving optimal baseline performance, as high-order pages are yet to
be fragmented and depleted.

We ran pktgen single-stream benchmarks, with iptables-raw-drop:

Single stride, 64 bytes:
* 4,739,057 - baseline
* 4,749,550 - order0 no cache
* 4,786,899 - order0 with cache
1% gain

Larger packets, no page cross, 1024 bytes:
* 3,982,361 - baseline
* 3,845,682 - order0 no cache
* 4,127,852 - order0 with cache
3.7% gain

Larger packets, every 3rd packet crosses a page, 1500 bytes:
* 3,731,189 - baseline
* 3,579,414 - order0 no cache
* 3,931,708 - order0 with cache
5.4% gain

Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Introduce API for RX mapped pages
Tariq Toukan [Thu, 15 Sep 2016 13:08:37 +0000 (16:08 +0300)]
net/mlx5e: Introduce API for RX mapped pages

Manage the allocation and deallocation of mapped RX pages only
through dedicated API functions.

Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/mlx5e: Single flow order-0 pages for Striding RQ
Tariq Toukan [Thu, 15 Sep 2016 13:08:36 +0000 (16:08 +0300)]
net/mlx5e: Single flow order-0 pages for Striding RQ

To improve the memory consumption scheme, we omit the flow that
demands and splits high-order pages in Striding RQ, and stay
with a single Striding RQ flow that uses order-0 pages.

Moving to fragmented memory allows the use of larger MPWQEs,
which reduces the number of UMR posts and filler CQEs.

Moving to a single flow allows several optimizations that improve
performance, especially in production servers where we would
anyway fallback to order-0 allocations:
- inline functions that were called via function pointers.
- improve the UMR post process.

This patch alone is expected to give a slight performance reduction.
However, the new memory scheme gives the possibility to use a page-cache
of a fair size, that doesn't inflate the memory footprint, which will
dramatically fix the reduction and even give a performance gain.

Performance tests:
The following results were measured on a freshly booted system,
giving optimal baseline performance, as high-order pages are yet to
be fragmented and depleted.

We ran pktgen single-stream benchmarks, with iptables-raw-drop:

Single stride, 64 bytes:
* 4,739,057 - baseline
* 4,749,550 - this patch
no reduction

Larger packets, no page cross, 1024 bytes:
* 3,982,361 - baseline
* 3,845,682 - this patch
3.5% reduction

Larger packets, every 3rd packet crosses a page, 1500 bytes:
* 3,731,189 - baseline
* 3,579,414 - this patch
4% reduction

Fixes: 461017cb006a ("net/mlx5e: Support RX multi-packet WQE (Striding RQ)")
Fixes: bc77b240b3c5 ("net/mlx5e: Add fragmented memory support for RX multi packet WQE")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agorxrpc: Make IPv6 support conditional on CONFIG_IPV6
David Howells [Sat, 17 Sep 2016 06:26:01 +0000 (07:26 +0100)]
rxrpc: Make IPv6 support conditional on CONFIG_IPV6

Add CONFIG_AF_RXRPC_IPV6 and make the IPv6 support code conditional on it.
This is then made conditional on CONFIG_IPV6.

Without this, the following can be seen:

   net/built-in.o: In function `rxrpc_init_peer':
>> peer_object.c:(.text+0x18c3c8): undefined reference to `ip6_route_output_flags'

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'QCA8K'
David S. Miller [Fri, 16 Sep 2016 08:31:56 +0000 (04:31 -0400)]
Merge branch 'QCA8K'

John Crispin says:

====================
net-next: dsa: add QCA8K support

This series is based on the AR8xxx series posted by Matthieu Olivari in may
2015. The following changes were made since then

* fixed the nitpicks from the previous review
* updated to latest API
* turned it into an mdio device
* added callbacks for fdb, bridge offloading, stp, eee, port status
* fixed several minor issues to the port setup and arp learning
* changed the namespacing as this driver to qca8k

The driver has so far only been tested on qca8337/N. It should work on other QCA
switches such as the qca8327 with minor changes.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet-next: dsa: add new driver for qca8xxx family
John Crispin [Thu, 15 Sep 2016 14:26:41 +0000 (16:26 +0200)]
net-next: dsa: add new driver for qca8xxx family

This patch contains initial support for the QCA8337 switch. It
will detect a QCA8337 switch, if present and declared in the DT.

Each port will be represented through a standalone net_device interface,
as for other DSA switches. CPU can communicate with any of the ports by
setting an IP@ on ethN interface. Most of the extra callbacks of the DSA
subsystem are already supported, such as bridge offloading, stp, fdb.

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet-next: dsa: add Qualcomm tag RX/TX handler
John Crispin [Thu, 15 Sep 2016 14:26:40 +0000 (16:26 +0200)]
net-next: dsa: add Qualcomm tag RX/TX handler

Add support for the 2-bytes Qualcomm tag that gigabit switches such as
the QCA8337/N might insert when receiving packets, or that we need
to insert while targeting specific switch ports. The tag is inserted
directly behind the ethernet header.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoDocumentation: devicetree: add qca8k binding
John Crispin [Thu, 15 Sep 2016 14:26:39 +0000 (16:26 +0200)]
Documentation: devicetree: add qca8k binding

Add device-tree binding for ar8xxx switch families.

Cc: devicetree@vger.kernel.org
Signed-off-by: John Crispin <john@phrozen.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: emac: remove .owner field for driver
Wei Yongjun [Thu, 15 Sep 2016 02:26:10 +0000 (02:26 +0000)]
net: emac: remove .owner field for driver

Remove .owner field if calls are used which set it automatically.

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: emac: remove unnecessary dev_set_drvdata()
Wei Yongjun [Thu, 15 Sep 2016 02:25:52 +0000 (02:25 +0000)]
net: emac: remove unnecessary dev_set_drvdata()

The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: dsa: b53: Remove unused including <linux/version.h>
Wei Yongjun [Thu, 15 Sep 2016 02:24:37 +0000 (02:24 +0000)]
net: dsa: b53: Remove unused including <linux/version.h>

Remove including <linux/version.h> that don't need it.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: dsa: bcm_sf2: Fix non static symbol warning
Wei Yongjun [Thu, 15 Sep 2016 02:24:13 +0000 (02:24 +0000)]
net: dsa: bcm_sf2: Fix non static symbol warning

Fixes the following sparse warning:

drivers/net/dsa/bcm_sf2.c:963:19: warning:
 symbol 'bcm_sf2_io_ops' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotcp: fix a stale ooo_last_skb after a replace
Eric Dumazet [Wed, 14 Sep 2016 05:55:05 +0000 (22:55 -0700)]
tcp: fix a stale ooo_last_skb after a replace

When skb replaces another one in ooo queue, I forgot to also
update tp->ooo_last_skb as well, if the replaced skb was the last one
in the queue.

To fix this, we simply can re-use the code that runs after an insertion,
trying to merge skbs at the right of current skb.

This not only fixes the bug, but also remove all small skbs that might
be a subset of the new one.

Example:

We receive segments 2001:3001,  4001:5001

Then we receive 2001:8001 : We should replace 2001:3001 with the big
skb, but also remove 4001:50001 from the queue to save space.

packetdrill test demonstrating the bug

0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0

+0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 7>
+0.100 < . 1:1(0) ack 1 win 1024
+0 accept(3, ..., ...) = 4

+0.01 < . 1001:2001(1000) ack 1 win 1024
+0    > . 1:1(0) ack 1 <nop,nop, sack 1001:2001>

+0.01 < . 1001:3001(2000) ack 1 win 1024
+0    > . 1:1(0) ack 1 <nop,nop, sack 1001:2001 1001:3001>

Fixes: 9f5afeae5152 ("tcp: use an RB tree for ooo receive queue")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Yuchung Cheng <ycheng@google.com>
Cc: Yaogong Wang <wygivan@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'mediatek-reset-flow'
David S. Miller [Fri, 16 Sep 2016 06:23:06 +0000 (02:23 -0400)]
Merge branch 'mediatek-reset-flow'

Sean Wang says:

====================
mediatek: add enhancement into the existing reset flow

Current driver only resets DMA used by descriptor rings which
can't guarantee it can recover all various kinds of fatal
errors, so the patch
1) tries to reset the underlying hardware resource from scratch on
Mediatek SoC required for ethernet running.
2) refactors code in order to the reusability of existing code.
3) considers handling for race condition between the reset flow and
callbacks registered into core driver called about hardware accessing.
4) introduces power domain usage to hardware setup which leads to have
cleanly and completely restore to the state as the initial.

Changes since v1:
- fix the build error with module built causing undefined symbol for
  pinctrl_bind_pins, so using pinctrl_select_state instead accomplishes
  the pin mux setup during the reset process.
====================

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: mediatek: avoid race condition during the reset process
Sean Wang [Wed, 14 Sep 2016 15:13:21 +0000 (23:13 +0800)]
net: ethernet: mediatek: avoid race condition during the reset process

add the protection of the race condition between
the reset process and hardware access happening
on the related callbacks.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: mediatek: add more resets for internal ethernet circuit block
Sean Wang [Wed, 14 Sep 2016 15:13:20 +0000 (23:13 +0800)]
net: ethernet: mediatek: add more resets for internal ethernet circuit block

struct mtk_eth has already contained struct regmap ethsys pointer
to the address range of the internal circuit reset, so we reuse it
to reset more internal blocks on ethernet hardware such as packet
processing engine (PPE) and frame engine (FE) instead of rstc which
deals with FE only.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: mediatek: add the whole ethernet reset into the reset process
Sean Wang [Wed, 14 Sep 2016 15:13:19 +0000 (23:13 +0800)]
net: ethernet: mediatek: add the whole ethernet reset into the reset process

1) original driver only resets DMA used by descriptor rings
which can't guarantee it can recover all various kinds of fatal
errors, so the patch tries to reset the underlying hardware
resource from scratch on Mediatek SoC required for ethernet
running, including power, pin mux control, clock and internal
circuits on the ethernet in order to restore into the initial
state which the rebooted machine gives.

2) add state variable inside structure mtk_eth to help distinguish
mtk_hw_init is called between the initialization during boot time
or re-initialization during the reset process.

3) add ge_mode variable inside structure mtk_mac for restoring
the interface mode of the current setup for the target MAC.

4) remove __init attribute from mtk_hw_init definition

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: mediatek: add controlling power domain the ethernet belongs to
Sean Wang [Wed, 14 Sep 2016 15:13:18 +0000 (23:13 +0800)]
net: ethernet: mediatek: add controlling power domain the ethernet belongs to

introduce power domain control which the digital circuit of
the ethernet belongs to inside the flow of hardware initialization
and deinitialization which helps the entire ethernet hardware block
could restart cleanly and completely as being back to the initial
state when the whole machine reboot.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: mediatek: cleanup error path inside mtk_hw_init
Sean Wang [Wed, 14 Sep 2016 15:13:17 +0000 (23:13 +0800)]
net: ethernet: mediatek: cleanup error path inside mtk_hw_init

This cleans up the error path inside mtk_hw_init call, causing it able
to exit appropriately when something fails and also includes refactoring
mtk_cleanup call to make the partial logic reusable on the error path.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: mediatek: add mtk_hw_deinit call as the opposite to mtk_hw_init call
Sean Wang [Wed, 14 Sep 2016 15:13:16 +0000 (23:13 +0800)]
net: ethernet: mediatek: add mtk_hw_deinit call as the opposite to mtk_hw_init call

grouping things related to the deinitialization of what
mtk_hw_init call does that help to be reused by the reset
process and the error path handling.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: mediatek: refactoring mtk_hw_init to be reused
Sean Wang [Wed, 14 Sep 2016 15:13:15 +0000 (23:13 +0800)]
net: ethernet: mediatek: refactoring mtk_hw_init to be reused

the existing mtk_hw_init includes hardware and software
initialization inside so that it is slightly hard to reuse
them for the process of the reset recovery, so some splitting
is made here for keeping hardware initializing relevant thing
and the else such as IRQ registration and MDIO initialization
what are all about to the interface of core driver moved to the
other proper place because they have no needs to register IRQ and
re-initialize structure again during the reset process.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoiwlwifi: mvm: tighten BAID range check
Johannes Berg [Wed, 3 Aug 2016 11:52:56 +0000 (13:52 +0200)]
iwlwifi: mvm: tighten BAID range check

As pointed out by smatch, checking the BAID for just >= INVALID
is a bad idea since only 32 (IWL_MAX_BAID) actually exist. Check
the range for that and print invalid ones in the warning.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: remove pointless _bh from spinlock in timer
Johannes Berg [Wed, 3 Aug 2016 11:38:59 +0000 (13:38 +0200)]
iwlwifi: mvm: remove pointless _bh from spinlock in timer

Inside the reorder timer expire function, there's no point in
disabling BHs since it is in BH context. Remove that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: make RSS RX more robust
Johannes Berg [Wed, 3 Aug 2016 07:34:39 +0000 (09:34 +0200)]
iwlwifi: mvm: make RSS RX more robust

If the firmware ever decides to send any new/more notifications
to the RSS queues, the driver would currently try to interpret
those as REPLY_RX_MPDU_CMD and, if the notification was small,
access invalid memory.

Prevent that by checking for REPLY_RX_MPDU_CMD explicitly which
allows ignoring unexpected notifications.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: unify iwl_get_ucode_image() implementations
Sharon Dvir [Wed, 3 Aug 2016 07:55:45 +0000 (10:55 +0300)]
iwlwifi: unify iwl_get_ucode_image() implementations

Avoid multiple implementations.

Signed-off-by: Sharon Dvir <sharon.dvir@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: pcie: replace possible_cpus() with online_cpus() in MSIX mode
Haim Dreyfuss [Tue, 26 Jul 2016 15:03:07 +0000 (18:03 +0300)]
iwlwifi: pcie: replace possible_cpus() with online_cpus() in MSIX mode

In MSIX mode the number of irq depends on the number of
possible cpus existing on the host.
This cause to bug in case there are offline cores.
Take into account only the online CPUs instead.
Also save it in temporary variable.

Fixes: commit 2e5d4a8f61dc ("iwlwifi: pcie: Add new configuration to enable MSIX")
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: bump max API to 26
Emmanuel Grumbach [Tue, 26 Jul 2016 20:22:01 +0000 (23:22 +0300)]
iwlwifi: mvm: bump max API to 26

The driver now support version 26 of the firmware APIs.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: pcie: change indentation of iwl_pcie_set_interrupt_capa()
Sara Sharon [Thu, 21 Jul 2016 12:39:29 +0000 (15:39 +0300)]
iwlwifi: pcie: change indentation of iwl_pcie_set_interrupt_capa()

Function is very indented. Go to msi section if needed to avoid
it and by that make the code more readable.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: use setup_timer instead of init_timer and data fields
Wei Yongjun [Tue, 12 Jul 2016 11:40:57 +0000 (11:40 +0000)]
iwlwifi: mvm: use setup_timer instead of init_timer and data fields

Use setup_timer function instead of initializing timer with the function
and data fields

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: add the new 8275 series
Oren Givon [Thu, 7 Jul 2016 06:11:56 +0000 (09:11 +0300)]
iwlwifi: add the new 8275 series

Add a new config struct for the new 8275 series and add
the first PCI ID for it.

Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: add the new 9560 series
Oren Givon [Thu, 7 Jul 2016 07:40:27 +0000 (10:40 +0300)]
iwlwifi: add the new 9560 series

Add a new config struct for the new 9560 series and add
the 4 new PCI IDs for it.

Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: pcie: Set affinity mask for rx interrupt vectors per cpu
Haim Dreyfuss [Sun, 13 Mar 2016 15:51:59 +0000 (17:51 +0200)]
iwlwifi: pcie: Set affinity mask for rx interrupt vectors per cpu

In order to utilize the host's CPUs in the most efficient way
we bind each rx interrupt vector to each CPU on the host.
Each rx interrupt is prioritized to execute only on the designated CPU
rather than any CPU.
Processor affinity takes advantage of the fact that some remnants of
a process that was run on a given processor may remain in that
processor's memory state for example, data in the CPU cache after
another process is run on that CPU. Scheduling that process to execute
on the same processor could result in an efficient use of process by
reducing performance-degrading situations such as cache misses
and parallel processing.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: free reserved queue on STA removal
Liad Kaufman [Thu, 7 Jul 2016 10:25:59 +0000 (13:25 +0300)]
iwlwifi: mvm: free reserved queue on STA removal

When a STA is removed in DQA mode, if no traffic went through
its reserved queue, the txq continues to be marked as
reserved and no STA can use it.

Make sure that in such a case the reserved queue is marked
as free when the STA is removed.

Fixes: commit 24afba7690e4 ("iwlwifi: mvm: support bss dynamic alloc/dealloc of queues")
Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: fix pending frames tracking on tx resp
Liad Kaufman [Thu, 7 Jul 2016 08:00:26 +0000 (11:00 +0300)]
iwlwifi: mvm: fix pending frames tracking on tx resp

In iwl_mvm_rx_tx_cmd_single(), when checking if a given TID is
aggregated, the driver doesn't check whether or not the queue
itself can be aggregated. For example, a management queue might
be marked as aggregated if TID 0 is aggregated on a (different)
data queue.

Make sure that mgmt frames are sent with TID IWL_TID_NON_QOS,
and in this way make sure no mixups of this sort happen.

Fixes: commit 24afba7690e4 ("iwlwifi: mvm: support bss dynamic alloc/dealloc of queues")
Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: pcie: Configure shared interrupt vector in MSIX mode
Haim Dreyfuss [Sun, 20 Mar 2016 15:57:22 +0000 (17:57 +0200)]
iwlwifi: pcie: Configure shared interrupt vector in MSIX mode

In case the OS provides fewer interrupts than requested, different
causes will share the same interrupt vector as follow:
1.One interrupt less: non rx causes shared with FBQ.
2.Two interrupts less: non rx causes shared with FBQ and RSS.
3.More than two interrupts: we will use fewer RSS queues.

Also make the request depend on the number of online CPUs
instead of possible CPUs.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: support new BA notification response
Sara Sharon [Sun, 17 Jul 2016 11:24:55 +0000 (14:24 +0300)]
iwlwifi: mvm: support new BA notification response

Support new format. TX response will not be sent anymore,
so all needed data is in the BA response.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: pcie: merge iwl_queue and iwl_txq
Sara Sharon [Thu, 7 Jul 2016 15:17:45 +0000 (18:17 +0300)]
iwlwifi: pcie: merge iwl_queue and iwl_txq

The original intent was to have the general iwl_queue shared
between RX and TX queues, but it is not the actual status.
Since it is not shared with any struct but iwl_txq, it adds
unnecessary complexity. Merge those structs.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: change byte count table for a000 devices
Sara Sharon [Mon, 4 Jul 2016 11:34:26 +0000 (14:34 +0300)]
iwlwifi: change byte count table for a000 devices

Since TFD was enlarged to 256 bytes, the fetch of the TFD
itself is very expensive.
To make DRAM to SRAM more efficient, bits 12-13 will indicate
the number of 64 byte chunks that should be transferred to
SRAM.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: pcie: assign and access a000 TFD & TBs
Sara Sharon [Sun, 26 Jun 2016 10:17:56 +0000 (13:17 +0300)]
iwlwifi: pcie: assign and access a000 TFD & TBs

Previous patch introduced the new formats. This patch
allocates the new structures and adjusts code accordingly.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: introduce trans API to get byte count table
Sara Sharon [Mon, 4 Jul 2016 12:40:11 +0000 (15:40 +0300)]
iwlwifi: introduce trans API to get byte count table

In future HW the byte count table address will be configured
by ucode per queue. Add API to expose the byte count table to
the opmode

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoMerge tag 'rxrpc-rewrite-20160913-2' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Fri, 16 Sep 2016 05:57:19 +0000 (01:57 -0400)]
Merge tag 'rxrpc-rewrite-20160913-2' of git://git./linux/kernel/git/dhowells/linux-fs

David Howells says:

====================
rxrpc: Support IPv6

Here is a set of patches that add IPv6 support.  They need to be applied on
top of the just-posted miscellaneous fix patches.  They are:

 (1) Make autobinding of an unconnected socket work when sendmsg() is
     called to initiate a client call.

 (2) Don't specify the protocol when creating the client socket, but rather
     take the default instead.

 (3) Use rxrpc_extract_addr_from_skb() in a couple of places that were
     doing the same thing manually.  This allows the IPv6 address
     extraction to be done in fewer places.

 (4) Add IPv6 support.  With this, calls can be made to IPv6 servers from
     userspace AF_RXRPC programs; AFS, however, can't use IPv6 yet as the
     RPC calls need to be upgradeable.
====================

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge tag 'rxrpc-rewrite-20160913-1' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Fri, 16 Sep 2016 05:52:20 +0000 (01:52 -0400)]
Merge tag 'rxrpc-rewrite-20160913-1' of git://git./linux/kernel/git/dhowells/linux-fs

David Howells says:

====================
rxrpc: Miscellaneous fixes

Here's a set of miscellaneous fix patches.  There are a couple of points of
note:

 (1) There is one non-fix patch that adjusts the call ref tracking
     tracepoint to make kernel API-held refs on calls more obvious.  This
     is a prerequisite for the patch that fixes prealloc refcounting.

 (2) The final patch alters how jumbo packets that partially exceed the
     receive window are handled.  Previously, space was being left in the
     Rx buffer for them, but this significantly hurts performance as the Rx
     window can't be increased to match the OpenAFS Tx window size.

     Instead, the excess subpackets are discarded and an EXCEEDS_WINDOW ACK
     is generated for the first.  To avoid the problem of someone trying to
     run the kernel out of space by feeding the kernel a series of
     overlapping maximal jumbo packets, we stop allowing jumbo packets on a
     call if we encounter more than three jumbo packets with duplicate or
     excessive subpackets.
====================

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'libcxgb-next'
David S. Miller [Fri, 16 Sep 2016 00:49:30 +0000 (20:49 -0400)]
Merge branch 'libcxgb-next'

Varun Prakash says:

====================
iw_cxgb4,cxgbit: remove duplicate code

This patch series removes duplicate code from
iw_cxgb4 and cxgbit by adding common function
definitions in libcxgb.

Please review.
====================

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agolibcxgb,iw_cxgb4,cxgbit: add cxgb_mk_rx_data_ack()
Varun Prakash [Tue, 13 Sep 2016 15:54:06 +0000 (21:24 +0530)]
libcxgb,iw_cxgb4,cxgbit: add cxgb_mk_rx_data_ack()

Add cxgb_mk_rx_data_ack() to remove duplicate
code to form CPL_RX_DATA_ACK hardware command.

Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agolibcxgb,iw_cxgb4,cxgbit: add cxgb_mk_abort_rpl()
Varun Prakash [Tue, 13 Sep 2016 15:54:05 +0000 (21:24 +0530)]
libcxgb,iw_cxgb4,cxgbit: add cxgb_mk_abort_rpl()

Add cxgb_mk_abort_rpl() to remove duplicate
code to form CPL_ABORT_RPL hardware command.

Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agolibcxgb,iw_cxgb4,cxgbit: add cxgb_mk_abort_req()
Varun Prakash [Tue, 13 Sep 2016 15:54:04 +0000 (21:24 +0530)]
libcxgb,iw_cxgb4,cxgbit: add cxgb_mk_abort_req()

Add cxgb_mk_abort_req() to remove duplicate code
to form CPL_ABORT_REQ hardware command.

Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agolibcxgb, iw_cxgb4, cxgbit: add cxgb_mk_close_con_req()
Varun Prakash [Tue, 13 Sep 2016 15:54:03 +0000 (21:24 +0530)]
libcxgb, iw_cxgb4, cxgbit: add cxgb_mk_close_con_req()

Add cxgb_mk_close_con_req() to remove duplicate
code to form CPL_CLOSE_CON_REQ hardware command.

Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>