platform/kernel/linux-rpi.git
6 years agoqtnfmac: remove unused qtnf_rx_frame declaration
Sergey Matyukevich [Tue, 15 Aug 2017 13:06:31 +0000 (16:06 +0300)]
qtnfmac: remove unused qtnf_rx_frame declaration

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: check for NL80211_SCAN_FLAG_RANDOM_ADDR during hidden SSID scan
Ganapathi Bhat [Thu, 10 Aug 2017 12:41:26 +0000 (18:11 +0530)]
mwifiex: check for NL80211_SCAN_FLAG_RANDOM_ADDR during hidden SSID scan

At the end of user scan request, driver will perform an active
scan for hidden SSIDs in passive channels. While doing this,
driver unconditionally adding random_mac in scan command, which
is no expected. It should add random_mac only if scan_request
has NL80211_SCAN_FLAG_RANDOM_ADDR flag set.

Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: do not use random MAC for pre-association scanning
Ganapathi Bhat [Thu, 10 Aug 2017 12:41:25 +0000 (18:11 +0530)]
mwifiex: do not use random MAC for pre-association scanning

Driver should use random MAC address only if the scan is
requested by user(provided NL80211_SCAN_FLAG_RANDOM_ADDR
is set in scan request). It should not be used for a scan
performed before association.

Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoMerge tag 'iwlwifi-next-for-kalle-2017-08-11' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Fri, 11 Aug 2017 14:07:40 +0000 (17:07 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2017-08-11' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

Sencond batch of iwlwifi patches for 4.14

* Some more code moved to a new directory;
* Fixes in LED handling;
* Some FW API updates;
* General fixes and cleanups here and there.

6 years agobrcm80211: constify usb_device_id
Arvind Yadav [Fri, 11 Aug 2017 05:23:50 +0000 (10:53 +0530)]
brcm80211: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: uap: enable 11d based on userspace configruation
Xinming Hu [Wed, 9 Aug 2017 02:31:43 +0000 (02:31 +0000)]
mwifiex: uap: enable 11d based on userspace configruation

This patch check whether userspace beacon data include country
ie, if so then download command to enable 11d setup in firmeare
accordingly.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agozd1211rw: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:31:42 +0000 (22:01 +0530)]
zd1211rw: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agozd1201: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:31:24 +0000 (22:01 +0530)]
zd1201: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortl8192cu: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:31:05 +0000 (22:01 +0530)]
rtl8192cu: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortl8xxxu: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:30:39 +0000 (22:00 +0530)]
rtl8xxxu: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortl8187: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:30:13 +0000 (22:00 +0530)]
rtl8187: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agort73usb: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:29:48 +0000 (21:59 +0530)]
rt73usb: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agort2800usb: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:29:15 +0000 (21:59 +0530)]
rt2800usb: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agort2500usb: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:29:14 +0000 (21:59 +0530)]
rt2500usb: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt7601u: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:28:24 +0000 (21:58 +0530)]
mt7601u: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:27:59 +0000 (21:57 +0530)]
mwifiex: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agolibertas_tf: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:27:29 +0000 (21:57 +0530)]
libertas_tf: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agolibertas: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:27:28 +0000 (21:57 +0530)]
libertas: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agop54: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:26:43 +0000 (21:56 +0530)]
p54: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoorinoco: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:26:28 +0000 (21:56 +0530)]
orinoco: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoat76c50x: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:25:03 +0000 (21:55 +0530)]
at76c50x: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agocarl9170: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:24:41 +0000 (21:54 +0530)]
carl9170: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoar5523: constify usb_device_id
Arvind Yadav [Wed, 9 Aug 2017 16:23:42 +0000 (21:53 +0530)]
ar5523: constify usb_device_id

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoiwlwifi: mvm: fix the coex firmware API
Emmanuel Grumbach [Sun, 23 Jul 2017 09:53:46 +0000 (12:53 +0300)]
iwlwifi: mvm: fix the coex firmware API

The firmware API defined in the header files didn't match
the structure that are actually passed by the firmware.
The impact could be a decision for MIMO in Tx or Rx in
coex scenarios.

Fixes: 430a3bbafdc7 ("iwlwifi: mvm: BT Coex - new API")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: pcie: free the TSO page when a Tx queue is unmapped on A000 devices
Emmanuel Grumbach [Sun, 16 Jul 2017 09:45:12 +0000 (12:45 +0300)]
iwlwifi: pcie: free the TSO page when a Tx queue is unmapped on A000 devices

When we unmap a non-empty Tx queue, we need to free the
pages that we allocated for the headers in TSO flows.
This code existed for the 9000 device family, but somehow
it got left out when the new Tx path for the A000 devices
was written.

Fixes: 2b0c5946d9ed ("iwlwifi: pcie: introduce a000 TX queues management")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: remove references to unsupported HW
Luca Coelho [Mon, 17 Jul 2017 06:15:34 +0000 (09:15 +0300)]
iwlwifi: remove references to unsupported HW

There are still some references to 3945 and 4965 HW, which were never
supported in iwlwifi.  These references were inherited from a previous
project and are irrelevant here.  Additionally, remove some irrelevant
references to 5100 HW.  Remove all these.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: fix nmi triggering from host
Golan Ben-Ami [Wed, 28 Jun 2017 10:03:58 +0000 (13:03 +0300)]
iwlwifi: fix nmi triggering from host

Although nmi was triggered fine till now, it appears
that the driver didn't write the exact correct values
to the correct addresses for each HW.
Fix the nmi triggering by setting the correct addresses
and values.

Fixes: 4c9706dc2f29 ("iwlwifi: update nmi register")
Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: pcie: don't init a Tx queue with an SSN > size of the queue
Emmanuel Grumbach [Thu, 13 Jul 2017 06:49:32 +0000 (09:49 +0300)]
iwlwifi: pcie: don't init a Tx queue with an SSN > size of the queue

The TVQM tells us the initial write pointer for a queue,
but that write pointer is in WiFi sequence number unit
and not in TFD index unit. Which means that the write
pointer in the TVQM's response can be bigger than the
Tx queue ring size.

Fix that by modulo'ing the write pointer from the TVQM
with the Tx queue size.

Fixes: 66128fa08806 ("iwlwifi: move to TVQM mode")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: add station before allocating a queue
Shaul Triebitz [Mon, 10 Jul 2017 16:58:10 +0000 (19:58 +0300)]
iwlwifi: mvm: add station before allocating a queue

One of the queue config params is the associated station id.
Hence the FW must know about the station prior to the queue allocation.
In a000 devices, allocating a queue without a valid station
results with assert 0x2B00.
In FW restart flow the queues are allocated before
adding the station so first add the station.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: don't send CTDP commands via debugfs if not supported
Matt Chen [Fri, 23 Jun 2017 09:50:18 +0000 (17:50 +0800)]
iwlwifi: mvm: don't send CTDP commands via debugfs if not supported

Fix this issue if it is not supported by the firmware.

Fixes: 00f481bd895a ("iwlwifi: mvm: add ctdp operations to debugfs")
Signed-off-by: Matt Chen <matt.chen@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: support new beacon template command
Haim Dreyfuss [Mon, 12 Jun 2017 11:59:02 +0000 (14:59 +0300)]
iwlwifi: mvm: support new beacon template command

Support a new version of the beacon template command. This replaces v8
of the command, which was missing the rate code.  Also, export rate
decision logic to a separate function.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: set the default cTDP budget
Chaya Rachel Ivgi [Sun, 9 Jul 2017 13:35:14 +0000 (16:35 +0300)]
iwlwifi: mvm: set the default cTDP budget

In case there is no value received from BIOS
for cTDP budget, the default should be 2000 mWatt.

Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: move a000 device NVM retrieval to a common place
Shaul Triebitz [Thu, 22 Jun 2017 14:09:08 +0000 (17:09 +0300)]
iwlwifi: mvm: move a000 device NVM retrieval to a common place

Getting the NVM data in a000 devices should be shared
across operation mode.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: dump smem configuration when firmware crashes
Golan Ben-Ami [Sun, 25 Jun 2017 14:23:23 +0000 (17:23 +0300)]
iwlwifi: dump smem configuration when firmware crashes

Add the smem configuration to the fw data dump, once
the firmware crashes. This is useful mainly for later
parsing of the smem.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: fix a000 RF_ID define
Liad Kaufman [Sun, 2 Jul 2017 07:32:34 +0000 (10:32 +0300)]
iwlwifi: fix a000 RF_ID define

One of the defines has a wrong value.

Fixes: 1afb0ae42174 ("iwlwifi: allow combining different phy images with mac images")
Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: add support of FPGA fw
Tzipi Peres [Wed, 14 Jun 2017 07:02:47 +0000 (10:02 +0300)]
iwlwifi: add support of FPGA fw

Load FW according to NIC type,
taking into account simulation, if exists.
This is determined by a prph register.

Signed-off-by: Tzipi Peres <tzipi.peres@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: fix a few instances of misaligned kerneldoc parameters
Luca Coelho [Wed, 28 Jun 2017 11:08:53 +0000 (14:08 +0300)]
iwlwifi: fix a few instances of misaligned kerneldoc parameters

There are a few places where we don't have a space between the * and
the @ in the parameter description.  Also, in one case, the @ had
trailing space before the parameter name.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: change functions that can only return 0 to void
Sharon Dvir [Mon, 12 Jun 2017 08:28:21 +0000 (11:28 +0300)]
iwlwifi: change functions that can only return 0 to void

Change iwl_set_ucode_api_flags(), iwl_set_ucode_capabilities() to be void.
No need to check returned values.
Found by Klocwork.

Signed-off-by: Sharon Dvir <sharon.dvir@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: add debugfs to force CT-kill
Chaya Rachel Ivgi [Tue, 27 Jun 2017 11:13:02 +0000 (14:13 +0300)]
iwlwifi: mvm: add debugfs to force CT-kill

CT-kill is a thermal-based "RF-kill", which disables the NIC
completely if the temperature gets too high, in order to avoid damage.

Add a debugfs entry to simulate high temperatures, in order to test
CT-kill flows in the driver without having to physically heat the
device up.

Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: add const to thermal_cooling_device_ops structure
Bhumika Goyal [Wed, 21 Jun 2017 08:40:42 +0000 (14:10 +0530)]
iwlwifi: mvm: add const to thermal_cooling_device_ops structure

Declare thermal_cooling_device_ops structure as const as it is only passed
as an argument to the function thermal_cooling_device_register and this
argument is of type const. So, declare the structure as const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: use firmware LED command where applicable
Johannes Berg [Wed, 28 Jun 2017 14:19:49 +0000 (16:19 +0200)]
iwlwifi: mvm: use firmware LED command where applicable

On devices starting from 8000 series, the host can no longer toggle
the LED through the CSR_LED_REG register, but must do it via the
firmware instead. Add support for this. Note that this means that
the LED cannot be turned on while the firmware is off, so using an
arbitrary LED trigger may not work as expected.

Fixes: 503ab8c56ca0 ("iwlwifi: Add 8000 HW family support")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: remove useless condition in LED code
Johannes Berg [Thu, 29 Jun 2017 07:14:45 +0000 (09:14 +0200)]
iwlwifi: mvm: remove useless condition in LED code

If the module parameter is set to disable the LED, we leave the
initialization routine before setting the LEDS_INIT_COMPLETE
status bit. Therefore, there's no need to check the parameter
again on exit, just the status check is sufficient.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agort2x00: Fix MMIC Countermeasures
Michael Skeffington [Mon, 7 Aug 2017 16:47:36 +0000 (12:47 -0400)]
rt2x00: Fix MMIC Countermeasures

Set RX_FLAG_DECRYPTED in case of MMIC failure so that
ieee80211_rx_h_decrypt() doesnt drop the frame before getting to
ieee80211_rx_h_michael_mic_verify().

Signed-off-by: Michael Skeffington <mike@astro.ai>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: constify rate_control_ops structure
Bhumika Goyal [Mon, 7 Aug 2017 05:00:51 +0000 (10:30 +0530)]
rtlwifi: constify rate_control_ops structure

rate_control_ops structure is only passed as an argument to the
function ieee80211_rate_control_{register/unregister}. This argument
is of type const, so declare the structure as const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agowlcore: add const to bin_attribute structure
Bhumika Goyal [Wed, 2 Aug 2017 17:57:13 +0000 (23:27 +0530)]
wlcore: add const to bin_attribute structure

Add const to bin_attribute structure as it is only passed to the
functions sysfs_{remove/create}_bin_file. The corresponding arguments
are of type const, so declare the structure to be const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: add setting carrier state ON for successful roaming
Chung-Hsien Hsu [Mon, 7 Aug 2017 08:16:52 +0000 (16:16 +0800)]
brcmfmac: add setting carrier state ON for successful roaming

After association, ping is not working when sweeping the channel at the
AP side. It is caused by having incorrect carrier state (OFF) for the STA
in successful roaming. This patch sets the carrier state ON for the case.

Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: fix wrong num_different_channels when mchan feature enabled
Wright Feng [Thu, 3 Aug 2017 09:37:59 +0000 (17:37 +0800)]
brcmfmac: fix wrong num_different_channels when mchan feature enabled

When the device/firmware supports multi-channel, it can have P2P
connection and regular connection with AP simultaneous. In this case,
the num_different_channels in wiphy info was not correct when firmware
supports multi-channel (The iw wiphy# info showed "#channels <= 1" in
interface combinations). It caused association failed and error message
"CTRL-EVENT-FREQ-CONFLICT error" in wpa_supplicant when P2P GO interface
was running at the same time.
The root cause is that the num_different_channels was always overridden
to 1 in brcmf_setup_ifmodes even multi-channel was enabled.
We correct the logic by moving num_different_channels setting forward.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Add support for CYW4373 SDIO/USB chipset
Chi-Hsien Lin [Thu, 3 Aug 2017 09:37:58 +0000 (17:37 +0800)]
brcmfmac: Add support for CYW4373 SDIO/USB chipset

Add support for CYW4373 SDIO/USB chipset.
CYW4373 is a 1x1 dual-band 11ac chipset with 20/40/80Mhz channel support.
It's a WiFi/BT combo device.

Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: set wpa_auth to WPA_AUTH_DISABLED in AP/OPEN security mode
Wright Feng [Thu, 3 Aug 2017 09:37:57 +0000 (17:37 +0800)]
brcmfmac: set wpa_auth to WPA_AUTH_DISABLED in AP/OPEN security mode

When setting wpa_auth to WPA_AUTH_NONE(1) in AP mode with WEP security,
firmware will set privacy bit and add WPA OUI in VENDOR IE in beacon and
probe response. The security type in softAP beacons confuse the
supplicant in client side, and the user client will see [WPA-?] in
supplicant scan result. So we set WPA_AUTH_DISABLED in softAP mode with
OPEN security.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: p2p: use separate device address
Xinming Hu [Mon, 7 Aug 2017 01:36:06 +0000 (01:36 +0000)]
mwifiex: p2p: use separate device address

Per below statement about p2p device address in WFA P2P
spec $2.4.3:

The P2P Device Address of a P2P Device shall be its globally
administered MAC address, or its globally administered MAC
address with the locally administered bit set.

This patch follow above statement, using a separate device
address for p2p interface

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: wrapper wps ie in pass through tlv
Xinming Hu [Thu, 3 Aug 2017 09:13:28 +0000 (09:13 +0000)]
mwifiex: wrapper wps ie in pass through tlv

This patch wrapper wps ie in pass through tlv, so that
firmware could parse correctly.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: Do not change bss_num in change_virtual_intf
Xinming Hu [Thu, 3 Aug 2017 09:13:27 +0000 (09:13 +0000)]
mwifiex: Do not change bss_num in change_virtual_intf

Commit 4d7ab36f0c47 ("mwifiex: Do not change bss_type in
change_virtual_intf") kept original bss_type unchanged. bss_num should
keep the same style, in this way. Unique tuple (bss_type, bss_num) will
be able to locate the right priv structure.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: replace netif_carrier_on/off by netif_device_attach/dettach
Ganapathi Bhat [Wed, 2 Aug 2017 20:04:46 +0000 (01:34 +0530)]
mwifiex: replace netif_carrier_on/off by netif_device_attach/dettach

Driver is doing netif_carrier_off during suspend, which will set
the IFF_LOWER_UP flag to 0. As a result certain applications
will think this as a real carrier down and behave accordingly.
This will cause issues like loss of IP address, for example. To
fix this use netif_device_dettach during suspend.

Fixes: 0026b32d723e ('mwifiex: fix Tx timeout issue during suspend test')

Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: RTS threshold configuration
Karun Eagalapati [Thu, 3 Aug 2017 14:29:04 +0000 (19:59 +0530)]
rsi: RTS threshold configuration

Provision is added for configuring RTS threshold by sending
vap dynamic update frame to firmware.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: buffer available interrupt handling
Karun Eagalapati [Thu, 3 Aug 2017 14:29:03 +0000 (19:59 +0530)]
rsi: buffer available interrupt handling

BUFFER_AVAILABLE interrupt is sent by firmware to indicate
change in buffer status. We should check buffer status while
handling this interrupt. Currently buffer status is checked
only while dequeueing packets. This patch fixes a data
traffic stuck problem observed occasionally.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: buffer full check optimization
Karun Eagalapati [Thu, 3 Aug 2017 14:29:02 +0000 (19:59 +0530)]
rsi: buffer full check optimization

We get buffer full event from firmware whenever Tx queue is full
Host should stop writing packets after this and resume after
buffer free event.
Buffer status checking is optimized for once in 4 times if
BUFF_FULL condition is not set, otherwise once for every
packet.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: rename sdio_read_buffer_status_register
Karun Eagalapati [Thu, 3 Aug 2017 14:29:01 +0000 (19:59 +0530)]
rsi: rename sdio_read_buffer_status_register

rsi_sdio_check_buffer_status would be the appropriate name
for this function as we are checking hardware buffers
availability status.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: add support for U-APSD power save
Karun Eagalapati [Thu, 3 Aug 2017 14:29:00 +0000 (19:59 +0530)]
rsi: add support for U-APSD power save

This patch adds support for U-APSD power save. Configuration
frame is downloaded to firmware with default settings and
support is advertised to mac80211

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: add support for legacy power save
Karun Eagalapati [Thu, 3 Aug 2017 14:28:59 +0000 (19:58 +0530)]
rsi: add support for legacy power save

This patch adds support for legacy power save. Necessary
configuration frames are downloaded to firmware when power save
is enabled/disabled

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: update set_antenna command frame
Pavani Muthyala [Thu, 3 Aug 2017 14:28:58 +0000 (19:58 +0530)]
rsi: update set_antenna command frame

TX command frame set_antenna is modified to use common
descriptor structure. Also it's subframe type is set.

Signed-off-by: Pavani Muthyala <pavani.muthyala@redpinesignals.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: add support for rf-kill functionality
Pavani Muthyala [Thu, 3 Aug 2017 14:28:57 +0000 (19:58 +0530)]
rsi: add support for rf-kill functionality

This patch implements rfkill_poll handler. Also, necessary changes
are done in interface up and down handler to support rfkill
functionality.

Signed-off-by: Pavani Muthyala <pavani.muthyala@redpinesignals.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: fix uninitialized descriptor pointer issue
Prameela Rani Garnepudi [Thu, 3 Aug 2017 14:26:39 +0000 (19:56 +0530)]
rsi: fix uninitialized descriptor pointer issue

This patch fixes the uninitialized descriptor pointer
issue in function rsi_send_internal_mgmt_frame().
Descriptor should point to start of the skb data.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 9a629fafe7d8 ("rsi: immediate wakeup bit and priority for TX command packets")
Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobcma: make BCMA a menuconfig to ease disabling it all
Vincent Legoll [Mon, 17 Apr 2017 10:07:30 +0000 (12:07 +0200)]
bcma: make BCMA a menuconfig to ease disabling it all

No need to get into the submenu to disable all BCMA-related config entries.

Signed-off-by: Vincent Legoll <vincent.legoll@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agonet: vrf: Add extack messages for newlink failures
David Ahern [Mon, 7 Aug 2017 17:08:10 +0000 (10:08 -0700)]
net: vrf: Add extack messages for newlink failures

Add extack error messages for failure paths creating vrf devices. Once
extack support is added to iproute2, we go from the unhelpful:
    $  ip li add foobar type vrf
    RTNETLINK answers: Invalid argument

to:
    $ ip li add foobar type vrf
    Error: VRF table id is missing

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoisdn: kcapi: make capi_version const
Bhumika Goyal [Sun, 6 Aug 2017 17:09:06 +0000 (22:39 +0530)]
isdn: kcapi: make capi_version const

Declare this structure as const as it is only used during a copy
operation.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'Update-DSAs-FDB-API-and-perform-switchdev-cleanup'
David S. Miller [Mon, 7 Aug 2017 21:48:49 +0000 (14:48 -0700)]
Merge branch 'Update-DSAs-FDB-API-and-perform-switchdev-cleanup'

Arkadi Sharshevsky says:

====================
Update DSA's FDB API and perform switchdev cleanup

The patchset adds support for configuring static FDB entries via the
switchdev notification chain. The current method for FDB configuration
uses the switchdev's bridge bypass implementation. In order to support
this legacy way and to perform the switchdev cleanup, the implementation
is moved inside DSA.

The DSA drivers cannot sync the software bridge with hardware learned
entries and use the switchdev's implementation of bypass FDB dumping.
Because they are the only ones using this functionality, the fdb_dump
implementation is moved from switchdev code into DSA.

Finally after this changes a major cleanup in switchdev can be done.

Please see individual patches for patch specific change logs.
v1->v2
- Split MDB/vlan dump removal into core/driver removal.

v2->v3
- The self implementation for FDB add/del is moved inside DSA.
====================

Tested-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: switchdev: Remove bridge bypass support from switchdev
Arkadi Sharshevsky [Sun, 6 Aug 2017 13:15:51 +0000 (16:15 +0300)]
net: switchdev: Remove bridge bypass support from switchdev

Currently the bridge port flags, vlans, FDBs and MDBs can be offloaded
through the bridge code, making the switchdev's SELF bridge bypass
implementation to be redundant. This implies several changes:
- No need for dump infra in switchdev, DSA's special case is handled
  privately.
- Remove obj_dump from switchdev_ops.
- FDBs are removed from obj_add/del routines, due to the fact that they
  are offloaded through the bridge notification chain.
- The switchdev_port_bridge_xx() and switchdev_port_fdb_xx() functions
  can be removed.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ivan Vecera <ivecera@redhat.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: bridge: Remove FDB deletion through switchdev object
Arkadi Sharshevsky [Sun, 6 Aug 2017 13:15:50 +0000 (16:15 +0300)]
net: bridge: Remove FDB deletion through switchdev object

At this point no driver supports FDB add/del through switchdev object
but rather via notification chain, thus, it is removed.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Ivan Vecera <ivecera@redhat.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: Move FDB dump implementation inside DSA
Arkadi Sharshevsky [Sun, 6 Aug 2017 13:15:49 +0000 (16:15 +0300)]
net: dsa: Move FDB dump implementation inside DSA

>From all switchdev devices only DSA requires special FDB dump. This is due
to lack of ability for syncing the hardware learned FDBs with the bridge.
Due to this it is removed from switchdev and moved inside DSA.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: Remove redundant MDB dump support
Arkadi Sharshevsky [Sun, 6 Aug 2017 13:15:48 +0000 (16:15 +0300)]
net: dsa: Remove redundant MDB dump support

Currently the MDB HW database is synced with the bridge's one, thus,
There is no need to support special dump functionality.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: Remove support for MDB dump from DSA's drivers
Arkadi Sharshevsky [Sun, 6 Aug 2017 13:15:47 +0000 (16:15 +0300)]
net: dsa: Remove support for MDB dump from DSA's drivers

This is done as a preparation before removing support for MDB dump from
DSA core. The MDBs are synced with the bridge and thus there is no
need for special dump operation support.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: Remove support for bypass bridge port attributes/vlan set
Arkadi Sharshevsky [Sun, 6 Aug 2017 13:15:46 +0000 (16:15 +0300)]
net: dsa: Remove support for bypass bridge port attributes/vlan set

The bridge port attributes/vlan for DSA devices should be set only
from bridge code. Furthermore, The vlans are synced totally with the
bridge so there is no need for special dump support.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: Remove support for vlan dump from DSA's drivers
Arkadi Sharshevsky [Sun, 6 Aug 2017 13:15:45 +0000 (16:15 +0300)]
net: dsa: Remove support for vlan dump from DSA's drivers

This is done as a preparation before removing support for vlan dump from
DSA core. The vlans are synced with the bridge and thus there is no
need for special dump operation support.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: Add support for querying supported bridge flags
Arkadi Sharshevsky [Sun, 6 Aug 2017 13:15:44 +0000 (16:15 +0300)]
net: dsa: Add support for querying supported bridge flags

The DSA drivers do not support bridge flags offload. Yet, this attribute
should be added in order for the bridge to fail when one tries set a
flag on the port, as explained in commit dc0ecabd6231 ("net: switchdev:
Add support for querying supported bridge flags by hardware").

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: Move FDB add/del implementation inside DSA
Arkadi Sharshevsky [Sun, 6 Aug 2017 13:15:43 +0000 (16:15 +0300)]
net: dsa: Move FDB add/del implementation inside DSA

Currently DSA uses switchdev's implementation of FDB add/del ndos. This
patch moves the implementation inside DSA in order to support the legacy
way for static FDB configuration.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: Add support for learning FDB through notification
Arkadi Sharshevsky [Sun, 6 Aug 2017 13:15:42 +0000 (16:15 +0300)]
net: dsa: Add support for learning FDB through notification

Add support for learning FDB through notification. The driver defers
the hardware update via ordered work queue. In case of a successful
FDB add a notification is sent back to bridge.

In case of hw FDB del failure the static FDB will be deleted from
the bridge, thus, the interface is moved to down state in order to
indicate inconsistent situation.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: Remove switchdev dependency from DSA switch notifier chain
Arkadi Sharshevsky [Sun, 6 Aug 2017 13:15:41 +0000 (16:15 +0300)]
net: dsa: Remove switchdev dependency from DSA switch notifier chain

Currently, the switchdev objects are embedded inside the DSA notifier
info. This patch removes this dependency. This is done as a preparation
stage before adding support for learning FDB through the switchdev
notification chain.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: Remove prepare phase for FDB
Arkadi Sharshevsky [Sun, 6 Aug 2017 13:15:40 +0000 (16:15 +0300)]
net: dsa: Remove prepare phase for FDB

The prepare phase for FDB add is unneeded because most of DSA devices
can have failures during bus transactions (SPI, I2C, etc.), thus, the
prepare phase cannot guarantee success of the commit stage.

The support for learning FDB through notification chain, which will be
introduced in the following patches, will provide the ability to notify
back the bridge about successful offload.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: Change DSA slave FDB API to be switchdev independent
Arkadi Sharshevsky [Sun, 6 Aug 2017 13:15:39 +0000 (16:15 +0300)]
net: dsa: Change DSA slave FDB API to be switchdev independent

In order to support FDB add/del to be on a notifier chain the slave
API need to be changed to be switchdev independent.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agohamradio: baycom: make hdlcdrv_ops const
Bhumika Goyal [Sun, 6 Aug 2017 08:51:45 +0000 (14:21 +0530)]
hamradio: baycom: make hdlcdrv_ops const

Make hdlcdrv_ops structures const as they are only passed to
hdlcdrv_register function. The corresponding argument is of type const,
so make the structures const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoxfrm: check that cached bundle is still valid
Florian Westphal [Sun, 6 Aug 2017 08:19:07 +0000 (10:19 +0200)]
xfrm: check that cached bundle is still valid

Quoting Ilan Tayari:
  1. Set up a host-to-host IPSec tunnel (or transport, doesn't matter)
  2. Ping over IPSec, or do something to populate the pcpu cache
  3. Join a MC group, then leave MC group
  4. Try to ping again using same CPU as before -> traffic
     doesn't egress the machine at all

Ilan debugged the problem down to the fact that one of the path dsts
devices point to lo due to earlier dst_dev_put().
In this case, dst is marked as DEAD and we cannot reuse the bundle.

The cache only asserted that the requested policy and that of the cached
bundle match, but its not enough - also verify the path is still valid.

Fixes: ec30d78c14a813 ("xfrm: add xdst pcpu cache")
Reported-by: Ayham Masood <ayhamm@mellanox.com>
Tested-by: Ilan Tayari <ilant@mellanox.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'net-dsa-remove-useless-arguments'
David S. Miller [Mon, 7 Aug 2017 21:24:21 +0000 (14:24 -0700)]
Merge branch 'net-dsa-remove-useless-arguments'

Vivien Didelot says:

====================
net: dsa: remove useless arguments

Several DSA core setup functions take many arguments, mostly because of
the legacy code. This patch series removes the useless args of these
functions, where either the dsa_switch or dsa_port argument is enough.

Changes in v2:
  - ds->dev is already assigned by dsa_switch_alloc
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: remove useless args of dsa_slave_create
Vivien Didelot [Sat, 5 Aug 2017 20:20:19 +0000 (16:20 -0400)]
net: dsa: remove useless args of dsa_slave_create

dsa_slave_create currently takes 4 arguments while it only needs the
related dsa_port and its name. Remove all other arguments.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: remove useless args of dsa_cpu_dsa_setup
Vivien Didelot [Sat, 5 Aug 2017 20:20:18 +0000 (16:20 -0400)]
net: dsa: remove useless args of dsa_cpu_dsa_setup

dsa_cpu_dsa_setup currently takes 4 arguments but they are all available
from the dsa_port argument. Remove all others.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: remove useless argument in legacy setup
Vivien Didelot [Sat, 5 Aug 2017 20:20:17 +0000 (16:20 -0400)]
net: dsa: remove useless argument in legacy setup

dsa_switch_alloc() already assigns ds-dev, which can be used in
dsa_switch_setup_one and dsa_cpu_dsa_setups instead of requiring an
additional struct device argument.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: hns3: fix spelling mistake: "capabilty" -> "capability"
Colin Ian King [Sat, 5 Aug 2017 13:46:35 +0000 (14:46 +0100)]
net: hns3: fix spelling mistake: "capabilty" -> "capability"

Trivial fix to spelling mistake in dev_err error message and also
split overly long line to avoid a checkpatch warning.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'Refactor-lan9303_xxx_packet_processing'
David S. Miller [Mon, 7 Aug 2017 21:18:01 +0000 (14:18 -0700)]
Merge branch 'Refactor-lan9303_xxx_packet_processing'

Egil Hjelmeland says:

====================
Refactor lan9303_xxx_packet_processing

This series is purely non functional.

It changes the lan9303_enable_packet_processing,
lan9303_disable_packet_processing() to pass port number (0,1,2) as
parameter instead of port offset. This aligns them with
other functions in the module, and makes it possible to simplify the code.

The lan9303_enable_packet_processing, lan9303_disable_packet_processing
functions operate on port. Therefore rename the functions to reflect that
as well.

Reviewer pointed out lan9303_get_ethtool_stats would be better off with
the use of a lan9303_read_switch_port(). So that was added to the series.

Changes v3 -> v4:
 - Whitespace adjustments.

Changes v2 -> v3:
 - Patch 1: Removed the change in lan9303_get_ethtool_stats
 - Added patch 4: rename lan9303_xxx_packet_processing
 - Added patch 5: refactor lan9303_get_ethtool_stats

Changes v1 -> v2:
 - introduced lan9303_write_switch_port() in first patch
 - inserted LAN9303_NUM_PORTS patch
 - Use LAN9303_NUM_PORTS in last patch. Plus whitespace change.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: lan9303: refactor lan9303_get_ethtool_stats
Egil Hjelmeland [Sat, 5 Aug 2017 11:05:50 +0000 (13:05 +0200)]
net: dsa: lan9303: refactor lan9303_get_ethtool_stats

In lan9303_get_ethtool_stats: Get rid of 0x400 constant magic
by using new lan9303_read_switch_reg() inside loop.
Reduced scope of two variables.

Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: lan9303: Rename lan9303_xxx_packet_processing()
Egil Hjelmeland [Sat, 5 Aug 2017 11:05:49 +0000 (13:05 +0200)]
net: dsa: lan9303: Rename lan9303_xxx_packet_processing()

The lan9303_enable_packet_processing, lan9303_disable_packet_processing
functions operate on port, so the names should reflect that.
And to align with lan9303_disable_processing(), rename:

lan9303_enable_packet_processing -> lan9303_enable_processing_port
lan9303_disable_packet_processing -> lan9303_disable_processing_port

Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: lan9303: Simplify lan9303_xxx_packet_processing() usage
Egil Hjelmeland [Sat, 5 Aug 2017 11:05:48 +0000 (13:05 +0200)]
net: dsa: lan9303: Simplify lan9303_xxx_packet_processing() usage

Simplify usage of lan9303_enable_packet_processing,
lan9303_disable_packet_processing()

Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: lan9303: define LAN9303_NUM_PORTS 3
Egil Hjelmeland [Sat, 5 Aug 2017 11:05:47 +0000 (13:05 +0200)]
net: dsa: lan9303: define LAN9303_NUM_PORTS 3

Will be used instead of '3' in upcomming patches.

Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: dsa: lan9303: Change lan9303_xxx_packet_processing() port param.
Egil Hjelmeland [Sat, 5 Aug 2017 11:05:46 +0000 (13:05 +0200)]
net: dsa: lan9303: Change lan9303_xxx_packet_processing() port param.

lan9303_enable_packet_processing, lan9303_disable_packet_processing()
Pass port number (0,1,2) as parameter instead of port offset.
Because other functions in the module pass port numbers.
And to enable simplifications in following patch.

Introduce lan9303_write_switch_port().

Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'ipv6-sr-add-support-for-advanced-local-segment-processing'
David S. Miller [Mon, 7 Aug 2017 21:16:22 +0000 (14:16 -0700)]
Merge branch 'ipv6-sr-add-support-for-advanced-local-segment-processing'

David Lebrun says:

====================
ipv6: sr: add support for advanced local segment processing

v2: use EXPORT_SYMBOL_GPL

The current implementation of IPv6 SR supports SRH insertion/encapsulation
and basic segment endpoint behavior (i.e., processing of an SRH contained in
a packet whose active segment (IPv6 DA) is routed to the local node). This
behavior simply consists of updating the DA to the next segment and forwarding
the packet accordingly. This processing is realised for all such packets,
regardless of the active segment.

The most recent specifications of IPv6 SR [1] [2] extend the SRH processing
features as follows. Each segment endpoint defines a MyLocalSID table.
This table maps segments to operations to perform. For each ingress IPv6
packet whose DA is part of a given prefix, the segment endpoint looks
up the active segment (i.e., the IPv6 DA) in the MyLocalSID table and
applies the corresponding operation. Such specifications enable to specify
arbitrary operations besides the basic SRH processing and allow for a more
fine-grained classification.

This patch series implements those extended specifications by leveraging
a new type of lightweight tunnel, seg6local. The MyLocalSID table is
simply an arbitrary routing table (using CONFIG_IPV6_MULTIPLE_TABLES). The
following commands would assign the prefix fc00::/64 to the MyLocalSID
table, map the segment fc00::42 to the regular SRH processing function
(named "End"), and drop all packets received with an undefined active
segment:

ip -6 rule add fc00::/64 lookup 100
ip -6 route add fc00::42 encap seg6local action End dev eth0 table 100
ip -6 route add blackhole default table 100

As another example, the following command would assign the segment
fc00::1234 to the regular SRH processing function, except that the
processed packet must be forwarded to the next-hop fc42::1 (this operation
is named "End.X"):

ip -6 route add fc00::1234 encap seg6local action End.X nh6 fc42::1 dev eth0 table 100

Those two basic operations (End and End.X) are defined in [1]. A more
extensive list of advanced operations is defined in [2].

The first two patches of the series are preliminary work that remove an
assumption about initial SRH format, and export the two functions used to
insert and encapsulate an SRH onto packets. The third patch defines the
new seg6local lightweight tunnel and implement the core functions. The
fourth patch implements the operations needed to handle the newly defined
rtnetlink attributes. The fifth patch implements a few SRH processing
operations, including End and End.X.

[1] https://tools.ietf.org/html/draft-ietf-6man-segment-routing-header-07
[2] https://tools.ietf.org/html/draft-filsfils-spring-srv6-network-programming-01
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoipv6: sr: implement several seg6local actions
David Lebrun [Sat, 5 Aug 2017 10:39:48 +0000 (12:39 +0200)]
ipv6: sr: implement several seg6local actions

This patch implements the following seg6local actions.

- SEG6_LOCAL_ACTION_END: regular SRH processing. The DA of the packet
  is updated to the next segment and forwarded accordingly.

- SEG6_LOCAL_ACTION_END_X: same as above, except that the packet is
  forwarded to the specified IPv6 next-hop.

- SEG6_LOCAL_ACTION_END_DX6: decapsulate the packet and forward to
  inner IPv6 packet to the specified IPv6 next-hop.

- SEG6_LOCAL_ACTION_END_B6: insert the specified SRH directly after
  the IPv6 header of the packet.

- SEG6_LOCAL_ACTION_END_B6_ENCAP: encapsulate the packet within
  an outer IPv6 header, containing the specified SRH.

Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoipv6: sr: add rtnetlink functions for seg6local action parameters
David Lebrun [Sat, 5 Aug 2017 10:38:27 +0000 (12:38 +0200)]
ipv6: sr: add rtnetlink functions for seg6local action parameters

This patch adds the necessary functions to parse, fill, and compare
seg6local rtnetlink attributes, for all defined action parameters.

- The SRH parameter defines an SRH to be inserted or encapsulated.
- The TABLE parameter defines the table to use for the route lookup of
  the next segment or the inner decapsulated packet.
- The NH4 parameter defines the IPv4 next-hop for an inner decapsulated
  IPv4 packet.
- The NH6 parameter defines the IPv6 next-hop for the next segment or
  for an inner decapsulated IPv6 packet
- The IIF parameter defines an ingress interface index.
- The OIF parameter defines an egress interface index.

Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoipv6: sr: define core operations for seg6local lightweight tunnel
David Lebrun [Sat, 5 Aug 2017 10:38:26 +0000 (12:38 +0200)]
ipv6: sr: define core operations for seg6local lightweight tunnel

This patch implements a new type of lightweight tunnel named seg6local.
A seg6local lwt is defined by a type of action and a set of parameters.
The action represents the operation to perform on the packets matching the
lwt's route, and is not necessarily an encapsulation. The set of parameters
are arguments for the processing function.

Each action is defined in a struct seg6_action_desc within
seg6_action_table[]. This structure contains the action, mandatory
attributes, the processing function, and a static headroom size required by
the action. The mandatory attributes are encoded as a bitmask field. The
static headroom is set to a non-zero value when the processing function
always add a constant number of bytes to the skb (e.g. the header size for
encapsulations).

To facilitate rtnetlink-related operations such as parsing, fill_encap,
and cmp_encap, each type of action parameter is associated to three
function pointers, in seg6_action_params[].

All actions defined in seg6_local.h are detailed in [1].

[1] https://tools.ietf.org/html/draft-filsfils-spring-srv6-network-programming-01

Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoipv6: sr: export SRH insertion functions
David Lebrun [Sat, 5 Aug 2017 10:38:25 +0000 (12:38 +0200)]
ipv6: sr: export SRH insertion functions

This patch exports the seg6_do_srh_encap() and seg6_do_srh_inline()
functions. It also removes the CONFIG_IPV6_SEG6_INLINE knob
that enabled the compilation of seg6_do_srh_inline(). This function
is now built-in.

Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoipv6: sr: allow SRH insertion with arbitrary segments_left value
David Lebrun [Sat, 5 Aug 2017 10:38:24 +0000 (12:38 +0200)]
ipv6: sr: allow SRH insertion with arbitrary segments_left value

The seg6_validate_srh() function only allows SRHs whose active segment is
the first segment of the path. However, an application may insert an SRH
whose active segment is not the first one. Such an application might be
for example an SR-aware Virtual Network Function.

This patch enables to insert SRHs with an arbitrary active segment.

Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agobpf: devmap fix mutex in rcu critical section
John Fastabend [Sat, 5 Aug 2017 05:02:19 +0000 (22:02 -0700)]
bpf: devmap fix mutex in rcu critical section

Originally we used a mutex to protect concurrent devmap update
and delete operations from racing with netdev unregister notifier
callbacks.

The notifier hook is needed because we increment the netdev ref
count when a dev is added to the devmap. This ensures the netdev
reference is valid in the datapath. However, we don't want to block
unregister events, hence the initial mutex and notifier handler.

The concern was in the notifier hook we search the map for dev
entries that hold a refcnt on the net device being torn down. But,
in order to do this we require two steps,

  (i) dereference the netdev:  dev = rcu_dereference(map[i])
 (ii) test ifindex:   dev->ifindex == removing_ifindex

and then finally we can swap in the NULL dev in the map via an
xchg operation,

  xchg(map[i], NULL)

The danger here is a concurrent update could run a different
xchg op concurrently leading us to replace the new dev with a
NULL dev incorrectly.

      CPU 1                        CPU 2

   notifier hook                   bpf devmap update

   dev = rcu_dereference(map[i])
                                   dev = rcu_dereference(map[i])
                                   xchg(map[i]), new_dev);
                                   rcu_call(dev,...)
   xchg(map[i], NULL)

The above flow would create the incorrect state with the dev
reference in the update path being lost. To resolve this the
original code used a mutex around the above block. However,
updates, deletes, and lookups occur inside rcu critical sections
so we can't use a mutex in this context safely.

Fortunately, by writing slightly better code we can avoid the
mutex altogether. If CPU 1 in the above example uses a cmpxchg
and _only_ replaces the dev reference in the map when it is in
fact the expected dev the race is removed completely. The two
cases being illustrated here, first the race condition,

      CPU 1                          CPU 2

   notifier hook                     bpf devmap update

   dev = rcu_dereference(map[i])
                                     dev = rcu_dereference(map[i])
                                     xchg(map[i]), new_dev);
                                     rcu_call(dev,...)
   odev = cmpxchg(map[i], dev, NULL)

Now we can test the cmpxchg return value, detect odev != dev and
abort. Or in the good case,

      CPU 1                          CPU 2

   notifier hook                     bpf devmap update
   dev = rcu_dereference(map[i])
   odev = cmpxchg(map[i], dev, NULL)
                                     [...]

Now 'odev == dev' and we can do proper cleanup.

And viola the original race we tried to solve with a mutex is
corrected and the trace noted by Sasha below is resolved due
to removal of the mutex.

Note: When walking the devmap and removing dev references as needed
we depend on the core to fail any calls to dev_get_by_index() using
the ifindex of the device being removed. This way we do not race with
the user while searching the devmap.

Additionally, the mutex was also protecting list add/del/read on
the list of maps in-use. This patch converts this to an RCU list
and spinlock implementation. This protects the list from concurrent
alloc/free operations. The notifier hook walks this list so it uses
RCU read semantics.

BUG: sleeping function called from invalid context at kernel/locking/mutex.c:747
in_atomic(): 1, irqs_disabled(): 0, pid: 16315, name: syz-executor1
1 lock held by syz-executor1/16315:
 #0:  (rcu_read_lock){......}, at: [<ffffffff8c363bc2>] map_delete_elem kernel/bpf/syscall.c:577 [inline]
 #0:  (rcu_read_lock){......}, at: [<ffffffff8c363bc2>] SYSC_bpf kernel/bpf/syscall.c:1427 [inline]
 #0:  (rcu_read_lock){......}, at: [<ffffffff8c363bc2>] SyS_bpf+0x1d32/0x4ba0 kernel/bpf/syscall.c:1388

Fixes: 2ddf71e23cc2 ("net: add notifier hooks for devmap bpf map")
Reported-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'net_sched-clean-up-filter-handle'
David S. Miller [Mon, 7 Aug 2017 21:12:18 +0000 (14:12 -0700)]
Merge branch 'net_sched-clean-up-filter-handle'

Cong Wang says:

====================
net_sched: clean up filter handle

This patchset sits in my local branch for a long time, it is time to
send it out. It cleans up the ambiguous use of 'unsigned long fh',
please see each of them for details.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>