GitHub/LineageOS/android_kernel_motorola_exynos9610.git
7 years agoiwlwifi: mvm: update rx statistics cmd api
Liad Kaufman [Thu, 18 May 2017 15:00:49 +0000 (18:00 +0300)]
iwlwifi: mvm: update rx statistics cmd api

The API has changed - update the code.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: remove DQA non-STA client mode special case
Johannes Berg [Thu, 22 Jun 2017 11:06:21 +0000 (13:06 +0200)]
iwlwifi: mvm: remove DQA non-STA client mode special case

When we get a non-STA frame to transmit in client mode, we try to use
the IWL_MVM_DQA_BSS_CLIENT_QUEUE queue (queue #4). However, at this
point, the queue might not be allocated at all, causing warnings. The
scenario on which this happened was a race condition between mac80211
and our queue allocation work:
 * mac80211 sends auth
 * we stop mac80211 queues to allocate a hw queue
 * authentication is aborted
 * we allocate HW queue and start mac80211 queues
 * mac80211 removes station
 * mac80211 hands us the auth frame from the pending queue

At this point, since mac80211 has already removed the station, we try
to transmit the frame through this special non-station case on queue
4 anyway.

In order to really use it properly, we'd have to again go through the
hw queue allocation work, and attach it to a station, etc. In this
case that isn't possible (there's no station anymore), but if this
special case were needed, then we'd have to do it this way.

However, the special case is documented to exist for TDLS, but can't
trigger there because the TDLS setup frames etc. are normal to-DS
frames going to the peer through the AP. Testing also confirms that
this code path isn't triggered in TDLS.

Therefore, remove the code path to avoid using an unused queue. The
erroneous frame described above will still be transmitted on the AUX
queue, but arguably that's a mac80211 problem, which will eventually
be fixed by moving everything there to TXQs.

Fixes: e3118ad74d7e ("iwlwifi: mvm: support tdls in dqa mode")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: don't mess the SNAP header in TSO for non-QoS packets
Emmanuel Grumbach [Wed, 21 Jun 2017 06:40:15 +0000 (09:40 +0300)]
iwlwifi: mvm: don't mess the SNAP header in TSO for non-QoS packets

When we get large sends on non-QoS association, we had a
bug that mangled the SNAP header. Fix that.

Fixes: a6d5e32f247c ("iwlwifi: mvm: send large SKBs to the transport")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: reconfigure MSI-X HW on resume
Johannes Berg [Tue, 20 Jun 2017 10:51:30 +0000 (12:51 +0200)]
iwlwifi: pcie: reconfigure MSI-X HW on resume

When going into suspend, the HW configuration for MSI-X will
likely be lost. As a consequence, after waking up, all IRQ
causes will be mapped to interrupt 0, and as a consequence we
don't notice the interrupt because in most cases this is an
interrupt for a queue, and getting it doesn't read the other
cause registers.

Fixes: 2e5d4a8f61dc ("iwlwifi: pcie: Add new configuration to enable MSIX")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: don't send fetch the TID from a non-QoS packet in TSO
Emmanuel Grumbach [Tue, 20 Jun 2017 13:05:30 +0000 (16:05 +0300)]
iwlwifi: mvm: don't send fetch the TID from a non-QoS packet in TSO

Getting the TID of a packet before we know it is a QoS data
packet isn't a good idea. Delay the TID retrieval until
we know the packet is a QoS data packet.

Fixes: bb81bb68f472 ("iwlwifi: mvm: add Tx A-MSDU inside A-MPDU")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix mac80211's hw_queue in DQA mode
Johannes Berg [Mon, 19 Jun 2017 21:26:55 +0000 (23:26 +0200)]
iwlwifi: mvm: fix mac80211's hw_queue in DQA mode

When in non-DQA mode, mac80211 actually gets a pretty much perfect
idea (in vif->hw_queue/cab_queue) of which queues we're using. But
in DQA mode, this isn't true - nonetheless, we were adding all the
queues, even the ones stations are using, to the queue allocation
bitmap.

Fix this, we should only add the queues we really are using in DQA
mode:
 * IWL_MVM_OFFCHANNEL_QUEUE, as we use this in both modes
 * mvm->aux_queue, as we use this in both modes - mac80211
   never really knows about it but we use it as a cookie
   internally, so can't reuse it
 * possibly the GCAST queue (cab_queue)
 * all the "queues" we told mac80211 about we were using on each
   interface (vif->hw_queue), these are entirely virtual in this
   mode

Also add back the failure now when we can't allocate any more of
these - now virtual - queues; this was skipped in DQA mode and
would lead to having multiple ACs or even interfaces use the same
queue number in mac80211 (10, since that's the limit), which would
stop far too many queues if stopped.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: map cab_queue to real one earlier
Johannes Berg [Mon, 19 Jun 2017 20:48:32 +0000 (22:48 +0200)]
iwlwifi: mvm: map cab_queue to real one earlier

There may be a difference between the mac80211 vif->cab_queue and
mvmvif->cab_queue, particularly with TVQM. Make the code map this
earlier, instead of first returning the mac80211 one again from
iwl_mvm_get_ctrl_vif_queue().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix mac80211 queue tracking
Johannes Berg [Mon, 19 Jun 2017 20:31:56 +0000 (22:31 +0200)]
iwlwifi: mvm: fix mac80211 queue tracking

In the driver, we track which hardware queue is associated with
which mac80211 "hw_queue", in order to be able to stop and wake
it. When moving these bitmaps out of the queue_info structures,
the type of the bitmap was erroneously changed from u32 to u8,
presumably in order to save memory.

Turns out that u32 isn't needed, because the highest queue we
can ever tell mac80211 is always < 16, but a u16 definitely is
needed, queues >=8 do happen.

While at it, throw a BUILD_BUG_ON() into the place where we set
the limit (mvm->first_agg_queue) and a warning when it actually
gets put into the bitmap.

The consequence of this bug is that full HW queues associated
with such a too-high mac80211 number never stop higher layer
queues when full, and thus would simply drop all packets that
couldn't be enqueued to the hardware queue.

Fixes: 34e10860ae8d ("iwlwifi: mvm: remove references to queue_info in new TX path")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: properly enable IP header checksumming
Johannes Berg [Mon, 19 Jun 2017 11:24:49 +0000 (13:24 +0200)]
iwlwifi: mvm: properly enable IP header checksumming

The code was intended to enable IP header checksumming on AMSDUs, but
failed to really do so because the A-MSDU bit was set after all the
checksumming bits, and thus checking for A-MSDU could never be true.

Fix this by setting the A-MSDU bit before the offload bits.

Fixes: 5e6a98dc4863 ("iwlwifi: mvm: enable TCP/UDP checksum support for 9000 family")
Reported-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: add MSI-X interrupt tracing
Johannes Berg [Tue, 13 Jun 2017 19:19:47 +0000 (21:19 +0200)]
iwlwifi: pcie: add MSI-X interrupt tracing

We have tracing for both pre-ICT and ICT interrupts, including all
the data read there. Extend the tracing to MSI-X interrupts.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: quietly accept non-sta assoc response frames
Johannes Berg [Mon, 12 Jun 2017 09:24:06 +0000 (11:24 +0200)]
iwlwifi: mvm: quietly accept non-sta assoc response frames

When hostapd adds a station, it does so before sending the association
response frame, so that it can indicate the correct status code in the
response.

However, when this then fails, or the association response already is
a reject for some other reason, then there's no station entry and thus
no per-station management queue to send the response on and it must be
sent on the probe response queue. The code should therefore not warn.

In theory, we could check and warn if the status code is success, but
that seems excessive, so just relax the check to allow any association
response frames.

Fixes: 3ee0f0e23e4f ("iwlwifi: mvm: fix DQA AP mode station assumption")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: remove version 2 of paging command
Johannes Berg [Thu, 1 Jun 2017 09:37:25 +0000 (11:37 +0200)]
iwlwifi: mvm: remove version 2 of paging command

Only a000-series devices were going to use this, but actually
initialize using the context info, which includes paging, so
this code is never invoked; remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: move configuration into sub-directory
Johannes Berg [Thu, 1 Jun 2017 08:38:04 +0000 (10:38 +0200)]
iwlwifi: move configuration into sub-directory

Since we now support 8 device families, move their configuration
files into a new subdirectory "cfg".

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: move notification wait into fw/
Johannes Berg [Thu, 1 Jun 2017 08:32:17 +0000 (10:32 +0200)]
iwlwifi: move notification wait into fw/

Move the notification wait code into the new fw interaction directory.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: create new subdirectory for FW interaction
Johannes Berg [Thu, 1 Jun 2017 08:22:09 +0000 (10:22 +0200)]
iwlwifi: create new subdirectory for FW interaction

There's a lot of mvm code that really should be more generic
and part of the iwlwifi module. Start by making a place to
keep such code - in the new "fw" subdirectory - and already
move the firmware related header files there.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: rename iwl_shared_mem_cfg_v1 to the correct _v2
Johannes Berg [Thu, 1 Jun 2017 07:06:11 +0000 (09:06 +0200)]
iwlwifi: mvm: rename iwl_shared_mem_cfg_v1 to the correct _v2

This structure represents V2, V1 has the three last fields missing.
Rename it to be more accurate.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix deduplication start logic
Johannes Berg [Wed, 7 Jun 2017 08:35:54 +0000 (10:35 +0200)]
iwlwifi: mvm: fix deduplication start logic

If the first frame on a given TID is received with seqno 0 and needed
to be retransmitted, we erroneously drop it because the deduplication
data is initialized to zero, and then comparing

        if (unlikely(ieee80211_has_retry(hdr->frame_control) &&
                     dup_data->last_seq[tid] == hdr->seq_ctrl &&
                     dup_data->last_sub_frame[tid] >= sub_frame_idx))
                return true;

will return in iwl_mvm_is_dup() since last_sub_frame is also set to
zero, and sub_frame_idx is usually zero since this only covers the
relatively rare case of A-MSDU.

Fix this by initializing the last_seq array to 0xffff, which is an
impossible value for hdr->seq_ctrl to have here because the lower
four bits are the fragment number, and fragments aren't handled in
this code but go to mac80211 instead.

Fixes: a571f5f635ef ("iwlwifi: mvm: add duplicate packet detection per rx queue")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: unconditionally stop device after init
Johannes Berg [Wed, 31 May 2017 12:14:51 +0000 (14:14 +0200)]
iwlwifi: mvm: unconditionally stop device after init

In commit b93b1fe3b532 ("iwlwifi: mvm: fix init_dbg flow to work
as expected"), the code was changed to make the stop conditional
on not having failed (and on not having init_dbg), which doesn't
make sense - we should stop the device regardless of failures.

Failure to do so is leading to the device being enabled when it
shouldn't be, and - if it gets re-enabled later - the new context
info code gets confused as paging data wasn't freed.

Remove the invalid error condition again.

Fixes: b93b1fe3b532 ("iwlwifi: mvm: fix init_dbg flow to work as expected")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: warn if paging is already initialized during init
Johannes Berg [Wed, 31 May 2017 11:19:10 +0000 (13:19 +0200)]
iwlwifi: pcie: warn if paging is already initialized during init

This appears to happen in some cases, like when iwlmvm is unloaded and
loaded again without also unloading iwlwifi. Warn in this case and free
the paging data to be able to continue without causing corruption and
kernel crashes due to it (otherwise, paging data is overwritten, but
dram->paging_cnt gets to be twice as big as it should be, and then an
eventual free will crash.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: make ctxt-info free idempotent
Johannes Berg [Wed, 31 May 2017 11:15:18 +0000 (13:15 +0200)]
iwlwifi: pcie: make ctxt-info free idempotent

By setting the pointers to NULL at the end, these functions
are made idempotent.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: unify external & internal modparam names
Johannes Berg [Tue, 30 May 2017 14:45:31 +0000 (16:45 +0200)]
iwlwifi: unify external & internal modparam names

Where possible (all except for "11n_disable", which isn't valid in C)
rename the internal names for module parameters to be the same as the
externally visible names, to aid finding their use etc.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support multi tid ba notif
Liad Kaufman [Thu, 13 Apr 2017 14:10:33 +0000 (17:10 +0300)]
iwlwifi: mvm: support multi tid ba notif

When receiving a BA_NOTIF on new TX API, it can
contain BAs for several TIDs. Go over them and
reclaim TX for every TID.

Note that although the small API change, the API
version still isn't bumped forward, as this NIC
isn't still officially released.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: change when the BT_COEX is sent
Emmanuel Grumbach [Mon, 29 May 2017 11:01:06 +0000 (14:01 +0300)]
iwlwifi: mvm: change when the BT_COEX is sent

The BT_COEX command should not be sent to the INIT
firmware image starting from 8000 family.
The firmware team also requested to send the BT_COEX
command after the PHY_DB_CMD and the PHY_CFG_CMD.

While at it:
s/iwl_send_bt_init_conf/iwl_mvm_send_bt_init_conf/

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: improve debug in iwl_pcie_rx_handle_rb()
Johannes Berg [Mon, 29 May 2017 10:15:45 +0000 (12:15 +0200)]
iwlwifi: pcie: improve debug in iwl_pcie_rx_handle_rb()

Print the queue for the existing debug message and add a new
debug message indicating where the RB ended.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support aggs of 64 frames in A000 family
Liad Kaufman [Sun, 28 May 2017 11:20:04 +0000 (14:20 +0300)]
iwlwifi: mvm: support aggs of 64 frames in A000 family

A SCD bug was fixed in the A000 family, allowing to
support aggregations of 64 frames (rather than 63).

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: improve "invalid queue" warning
Johannes Berg [Fri, 26 May 2017 09:16:39 +0000 (11:16 +0200)]
iwlwifi: pcie: improve "invalid queue" warning

Print out both queue IDs to be able to see what went wrong.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: use proper CDB check in PHY context modify
Johannes Berg [Fri, 26 May 2017 11:11:44 +0000 (13:11 +0200)]
iwlwifi: mvm: use proper CDB check in PHY context modify

When the firmware supports CDB, PHY contexts cannot be modified to
change their band, but need to be added/remove instead. Instead of
relying on iwl_mvm_has_new_tx_api(), check the right FW capa flag
IWL_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT and remove the comment.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: add twelve new 9560 series PCI IDs
Tzipi Peres [Mon, 22 May 2017 13:16:52 +0000 (16:16 +0300)]
iwlwifi: add twelve new 9560 series PCI IDs

Add twelve new PCI IDs for the 9560 series.

Signed-off-by: Tzipi Peres <tzipi.peres@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: add the new a000_2ax series
Tzipi Peres [Mon, 22 May 2017 09:36:28 +0000 (12:36 +0300)]
iwlwifi: add the new a000_2ax series

Add a new config struct for the new a000 2ax series and add
the five PCI ID for it.

Signed-off-by: Tzipi Peres <tzipi.peres@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: simplify CHECK_MLME_TRIGGER macro
Luca Coelho [Fri, 19 May 2017 12:06:29 +0000 (15:06 +0300)]
iwlwifi: mvm: simplify CHECK_MLME_TRIGGER macro

There's no reason to pass mvm and trig as parameters to the macro,
since it will be expanded inside the function itself.  Also remove the
bogus buf parameter which doesn't exist and is not used.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: change sta_id to u8
Sharon Dvir [Sun, 21 May 2017 09:09:49 +0000 (12:09 +0300)]
iwlwifi: mvm: change sta_id to u8

The sta_id variable is used as an index in an array, should be unsigned.
Found by Klocwork.

Fixes: 9f9af3d7d303 ("iwlwifi: mvm: re-aggregate shared queue after unsharing")
Signed-off-by: Sharon Dvir <sharon.dvir@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: fix 9000-series RF-kill interrupt propagation
Johannes Berg [Thu, 18 May 2017 15:02:05 +0000 (17:02 +0200)]
iwlwifi: pcie: fix 9000-series RF-kill interrupt propagation

A hardware issue on 9000 series devices sometimes causes RF-kill
interrupts to not be propagated to the host properly if ASPM is
enabled. Work around this by setting the right hardware bit to
allow it to interrupt the host for this reason (rfkill).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: only apply retention workaround on 9000-series A-step
Johannes Berg [Wed, 10 May 2017 09:31:06 +0000 (11:31 +0200)]
iwlwifi: pcie: only apply retention workaround on 9000-series A-step

Due to a hardware issue, certain power saving had to be
disabled. However, this issue was fixed in B-step, so the
workaround only needs to apply to A-step.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: dvm: use macros for format strings
Johannes Berg [Wed, 17 May 2017 11:45:29 +0000 (13:45 +0200)]
iwlwifi: dvm: use macros for format strings

Some static checkers (e.g. smatch) complain if a non-constant
format string is used, even if that's a static const variable.
Since there's no impact on code generation, just change those
format strings to be macros.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix a bunch of kernel-doc warnings
Johannes Berg [Tue, 16 May 2017 14:15:42 +0000 (16:15 +0200)]
iwlwifi: mvm: fix a bunch of kernel-doc warnings

Fix the kernel-doc, and remove some fields even the firmware doesn't
use in ToF, RX, scan, station and generic FW APIS.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add documentation for all command IDs
Johannes Berg [Tue, 16 May 2017 13:14:19 +0000 (15:14 +0200)]
iwlwifi: mvm: add documentation for all command IDs

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: use __le16 even for reserved fields
Johannes Berg [Tue, 16 May 2017 13:12:14 +0000 (15:12 +0200)]
iwlwifi: mvm: use __le16 even for reserved fields

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: remove various unused command IDs/structs
Johannes Berg [Tue, 16 May 2017 12:33:41 +0000 (14:33 +0200)]
iwlwifi: mvm: remove various unused command IDs/structs

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix various "Excess ... description" kernel-doc warnings
Johannes Berg [Tue, 16 May 2017 11:28:53 +0000 (13:28 +0200)]
iwlwifi: mvm: fix various "Excess ... description" kernel-doc warnings

Fix various "Excess struct/union/enum/typedef member '...' description
in '...'" warnings from kernel-doc, mostly caused by typos.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: remove some CamelCase from firmware API
Johannes Berg [Tue, 16 May 2017 11:21:52 +0000 (13:21 +0200)]
iwlwifi: mvm: remove some CamelCase from firmware API

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: Add debugfs entry to retrieve SAR geographic profile
Haim Dreyfuss [Mon, 15 May 2017 11:27:21 +0000 (14:27 +0300)]
iwlwifi: mvm: Add debugfs entry to retrieve SAR geographic profile

Add a debugfs entry to get a verbose description of the power settings
used in each band with the currently selected SAR geographic profile.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: refactor geo init
Haim Dreyfuss [Thu, 30 Mar 2017 08:16:17 +0000 (11:16 +0300)]
iwlwifi: mvm: refactor geo init

We are going to add debugfs entry to retrieve the current geographic
profile being used in the FW. Currently the driver reads those tables
from the BIOS and passes them to the FW.
To prepare for this retrieving we want to store those
tables in the driver.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Wed, 28 Jun 2017 19:10:48 +0000 (22:10 +0300)]
Merge ath-next from git://git./linux/kernel/git/kvalo/ath.git

ath.git patches for 4.13. Major changes:

Only bugfixes or cleanups, no new features.

7 years agomwifiex: fix spelling mistake: "secuirty" -> "security"
Colin Ian King [Wed, 28 Jun 2017 15:50:54 +0000 (16:50 +0100)]
mwifiex: fix spelling mistake: "secuirty" -> "security"

Trivial fix to spelling mistake in mwifiex_dbg message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agowl18xx: add checks on wl18xx_top_reg_write() return value
Gustavo A. R. Silva [Mon, 26 Jun 2017 23:06:19 +0000 (18:06 -0500)]
wl18xx: add checks on wl18xx_top_reg_write() return value

Check return value from call to wl18xx_top_reg_write(),
so in case of error jump to goto label out and return.

Also, remove unnecessary value check before goto label out.

Addresses-Coverity-ID: 1226938
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agolibertas: Fix lbs_prb_rsp_limit_set()
Dan Carpenter [Fri, 23 Jun 2017 15:17:38 +0000 (18:17 +0300)]
libertas: Fix lbs_prb_rsp_limit_set()

The kstrtoul() test was reversed so this always returned -ENOTSUPP.

Fixes: 27d7f47756f4 ("net: wireless: replace strict_strtoul() with kstrtoul()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: James Cameron <quozl@laptop.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agocw1200: add const to hwbus_ops structures
Bhumika Goyal [Fri, 23 Jun 2017 11:43:19 +0000 (17:13 +0530)]
cw1200: add const to hwbus_ops structures

Declare hwbus_ops structures as const as they are only passed as an
argument to the function cw1200_core_probe. This argument is of type
const. So, make these structures const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: add in missing RSI_FSM_STATES into array fsm_state
Colin Ian King [Thu, 22 Jun 2017 16:58:04 +0000 (17:58 +0100)]
rsi: add in missing RSI_FSM_STATES into array fsm_state

Two recent commits added new RSI_FSM_STATES (namely FSM_FW_NOT_LOADED
and FSM_COMMON_DEV_PARAMS_SENT) and the corresponding table fsm_state
was not updated to match. This can lead to an array overrun when
accessing the latter two states in fsm_state. Fix this by adding in
the missing states.

Detected by CoverityScan, CID#1398379 ("Illegal address computation")

Fixes: 9920322ccd8e ("rsi: add tx frame for common device configuration")
Fixes: 015e367494c1 ("rsi: Register interrupt handler before firmware load")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoMAINTAINERS: add brcm80211 maintainer info from Cypress
Arend Van Spriel [Thu, 22 Jun 2017 10:01:04 +0000 (11:01 +0100)]
MAINTAINERS: add brcm80211 maintainer info from Cypress

Since Cypress took over IoT part of Broadcom some chips supported
by brcmfmac moved over as well. Adding maintainer info of our peers
at Cypress to make their support official.

Cc: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Cc: Wright Feng <wright.feng@cypress.com>
Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: rework headroom check in .start_xmit()
Arend Van Spriel [Thu, 22 Jun 2017 10:01:03 +0000 (11:01 +0100)]
brcmfmac: rework headroom check in .start_xmit()

Since commit 9cc4b7cb86cb ("brcmfmac: Make skb header writable
before use") the headroom usage has been fixed. However, the
driver was keeping statistics that got lost. So reworking the
code so we get those driver statistics back for debugging.

Cc: James Hughes <james.hughes@raspberrypi.org>
Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: use atomic_t for statistic counter in struct brcmf_bus
Arend Van Spriel [Thu, 22 Jun 2017 10:01:02 +0000 (11:01 +0100)]
brcmfmac: use atomic_t for statistic counter in struct brcmf_bus

The statistic counter is used in common layer and in the bus layer
in different thread contexts so change to use atomic operations.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: cleanup kerneldoc for struct brcmf_bus
Arend Van Spriel [Thu, 22 Jun 2017 10:01:01 +0000 (11:01 +0100)]
brcmfmac: cleanup kerneldoc for struct brcmf_bus

A couple of old fields were still described and one field was not
described.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: Do not change bss_type in change_virtual_intf
Ganapathi Bhat [Thu, 22 Jun 2017 07:02:52 +0000 (12:32 +0530)]
mwifiex: Do not change bss_type in change_virtual_intf

When user adds a virtual interface driver will set the
bss_type to the iface_type given by the user. When
supplicant is started on the same interface, a call to
change_virtual_intf will be triggered if if_type is not
NL80211_IFTYPE_STATION. Here driver should not update
it's bss_type, because bss_type is intended to indicate
the original iface_type and changing the same will defeat
the purpose of creating this interface.

Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Add in_4way field for btcoexist
Ping-Ke Shih [Wed, 21 Jun 2017 17:15:38 +0000 (12:15 -0500)]
rtlwifi: Add in_4way field for btcoexist

If wifi is in 4way, btcoex give wifi higher priority to use antenna.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Fill ap_num field by driver
Ping-Ke Shih [Wed, 21 Jun 2017 17:15:37 +0000 (12:15 -0500)]
rtlwifi: Fill ap_num field by driver

Check beacon and probe_resp frames to know ap_num

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Add ap_num field for btcoexist
Ping-Ke Shih [Wed, 21 Jun 2017 17:15:36 +0000 (12:15 -0500)]
rtlwifi: Add ap_num field for btcoexist

If there are many AP (dirty environment), we use another strategy set
to resolve coex issue.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Add return value to btc_set.
Ping-Ke Shih [Wed, 21 Jun 2017 17:15:35 +0000 (12:15 -0500)]
rtlwifi: Add return value to btc_set.

We will use return value to handle error case.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Update some cases in btc_get function -- roam, 5G, AP mode, and return value.
Ping-Ke Shih [Wed, 21 Jun 2017 17:15:34 +0000 (12:15 -0500)]
rtlwifi: Update some cases in btc_get function -- roam, 5G, AP mode, and return value.

Return value may be false in some situations.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Modify power mode parameters of 8723be and 8821ae.
Ping-Ke Shih [Wed, 21 Jun 2017 17:15:33 +0000 (12:15 -0500)]
rtlwifi: Modify power mode parameters of 8723be and 8821ae.

Change the parameters suggested by FW.
awake int: 2
smart_ps: 2 or 0
ps_mode: 2 (MAX -- every DTIM)

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Do IQK only once to reduce wifi occupy antenna
Ping-Ke Shih [Wed, 21 Jun 2017 17:15:32 +0000 (12:15 -0500)]
rtlwifi: Do IQK only once to reduce wifi occupy antenna

Modify 8723be and 8192e only.
8812/8821 do IQK in DM, so we may do it later.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Fix a2dp choppy while BT RSSI stays on threshold.
Ping-Ke Shih [Wed, 21 Jun 2017 17:15:31 +0000 (12:15 -0500)]
rtlwifi: Fix a2dp choppy while BT RSSI stays on threshold.

In this case, BTC asks to enter/leave PS mode frequently to cause A2DP
choppy.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoqtnfmac: fix uninitialized return code in ret
Colin Ian King [Wed, 21 Jun 2017 13:25:30 +0000 (14:25 +0100)]
qtnfmac: fix uninitialized return code in ret

The return value ret is unitialized and garbage is being returned
for the three different error conditions when setting up the PCIe
BARs. Fix this by initializing ret to  -ENOMEM to indicate that
the BARs failed to be setup correctly.

Detected by CoverityScan, CID#1437563 ("Unitialized scalar variable")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoath9k: remove useless variable assignment in ath_mci_intr()
Gustavo A. R. Silva [Mon, 26 Jun 2017 23:26:58 +0000 (18:26 -0500)]
ath9k: remove useless variable assignment in ath_mci_intr()

Value assigned to variable offset at line 551 is overwritten at line 562,
before it can be used. This makes such variable assignment useless.

Addresses-Coverity-ID: 1226941
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: fix a bunch of spelling mistakes in messages
Colin Ian King [Sun, 25 Jun 2017 21:29:32 +0000 (22:29 +0100)]
ath10k: fix a bunch of spelling mistakes in messages

Fix the following spelling mistakes in messages:
  syncronise -> synchronize
  unusally -> unusually
  addrress -> address
  inverval -> interval

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k: Use mutex_lock to avoid potential race in start/stop rng
Miaoqing Pan [Tue, 27 Jun 2017 14:31:55 +0000 (17:31 +0300)]
ath9k: Use mutex_lock to avoid potential race in start/stop rng

Move ath9k_rng_stop/ath9k_rng_start pair into critical section,
use mutex_lock to void potential race accessing.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k: avoid potential freezing during random generator read
Miaoqing Pan [Tue, 27 Jun 2017 14:31:54 +0000 (17:31 +0300)]
ath9k: avoid potential freezing during random generator read

In the worst case, ath9k_rng_stop() may take 10s to stop rng kthread.
The time is too long for users, use wait_event_interruptible_timeout()
instead of msleep_interruptible(), wakup immediately once
kthread_should_stop() is true.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k: fix an invalid pointer dereference in ath9k_rng_stop()
Miaoqing Pan [Tue, 27 Jun 2017 14:31:53 +0000 (17:31 +0300)]
ath9k: fix an invalid pointer dereference in ath9k_rng_stop()

The bug was triggered when do suspend/resuming continuously
on Dell XPS L322X/0PJHXN version 9333 (2013) with kernel
4.12.0-041200rc4-generic. But can't reproduce on DELL
E5440 + AR9300 PCIE chips.

The warning is caused by accessing invalid pointer sc->rng_task.
sc->rng_task is not be cleared after kthread_stop(sc->rng_task)
be called in ath9k_rng_stop(). Because the kthread is stopped
before ath9k_rng_kthread() be scheduled.

So set sc->rng_task to null after kthread_stop(sc->rng_task) to
resolve this issue.

WARNING: CPU: 0 PID: 984 at linux/kernel/kthread.c:71 kthread_stop+0xf1/0x100
CPU: 0 PID: 984 Comm: NetworkManager Not tainted 4.12.0-041200rc4-generic #201706042031
Hardware name: Dell Inc.          Dell System XPS L322X/0PJHXN, BIOS A09 05/15/2013
task: ffff950170fdda00 task.stack: ffffa22c01538000
RIP: 0010:kthread_stop+0xf1/0x100
RSP: 0018:ffffa22c0153b5b0 EFLAGS: 00010246
RAX: ffffffffa6257800 RBX: ffff950171b79560 RCX: 0000000000000000
RDX: 0000000080000000 RSI: 000000007fffffff RDI: ffff9500ac9a9680
RBP: ffffa22c0153b5c8 R08: 0000000000000000 R09: 0000000000000000
R10: ffffa22c0153b648 R11: ffff9501768004b8 R12: ffff9500ac9a9680
R13: ffff950171b79f70 R14: ffff950171b78780 R15: ffff9501749dc018
FS:  00007f0d6bfd5540(0000) GS:ffff95017f200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fc190161a08 CR3: 0000000232906000 CR4: 00000000001406f0
Call Trace:
  ath9k_rng_stop+0x1a/0x20 [ath9k]
  ath9k_stop+0x3b/0x1d0 [ath9k]
  drv_stop+0x33/0xf0 [mac80211]
  ieee80211_stop_device+0x43/0x50 [mac80211]
  ieee80211_do_stop+0x4f2/0x810 [mac80211]

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196043
Reported-by: Giulio Genovese <giulio.genovese@gmail.com>
Tested-by: Giulio Genovese <giulio.genovese@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: add const to thermal_cooling_device_ops structure
Bhumika Goyal [Tue, 27 Jun 2017 14:31:52 +0000 (17:31 +0300)]
ath10k: 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: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k: fix tx99 bus error
Miaoqing Pan [Tue, 27 Jun 2017 14:31:51 +0000 (17:31 +0300)]
ath9k: fix tx99 bus error

The hard coded register 0x9864 and 0x9924 are invalid
for ar9300 chips.

Cc: <stable@vger.kernel.org>
Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k: fix tx99 use after free
Miaoqing Pan [Tue, 27 Jun 2017 14:31:49 +0000 (17:31 +0300)]
ath9k: fix tx99 use after free

One scenario that could lead to UAF is two threads writing
simultaneously to the "tx99" debug file. One of them would
set the "start" value to true and follow to ath9k_tx99_init().
Inside the function it would set the sc->tx99_state to true
after allocating sc->tx99skb. Then, the other thread would
execute write_file_tx99() and call ath9k_tx99_deinit().
sc->tx99_state would be freed. After that, the first thread
would continue inside ath9k_tx99_init() and call
r = ath9k_tx99_send(sc, sc->tx99_skb, &txctl);
that would make use of the freed sc->tx99_skb memory.

Cc: <stable@vger.kernel.org>
Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoMerge tag 'iwlwifi-next-for-kalle-2017-06-28' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Wed, 28 Jun 2017 15:55:55 +0000 (18:55 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2017-06-28' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

More iwlwifi patches for 4.13

* Some changes in suspend/resume handling to support new FWs;
* A bunch of RF-kill related fixes;
* Continued work towards the A000 family;
* Support for a new version of the TX flush FW API;
* Some fixes in monitor interfaces;
* A few fixes in the recovery flows;
* Johannes' documentation fixes and FW API struct cleanups continue;
* Remove some noise from the kernel logs;
* Some other small improvements, fixes and cleanups;

7 years agobrcmfmac: Fix a memory leak in error handling path in 'brcmf_cfg80211_attach'
Christophe Jaillet [Wed, 21 Jun 2017 05:45:53 +0000 (07:45 +0200)]
brcmfmac: Fix a memory leak in error handling path in 'brcmf_cfg80211_attach'

If 'wiphy_new()' fails, we leak 'ops'. Add a new label in the error
handling path to free it in such a case.

Cc: stable@vger.kernel.org
Fixes: 5c22fb85102a7 ("brcmfmac: add wowl gtk rekeying offload support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: fix double free upon register_netdevice() failure
Arend Van Spriel [Sat, 24 Jun 2017 21:08:27 +0000 (22:08 +0100)]
brcmfmac: fix double free upon register_netdevice() failure

The function brcmf_net_attach() can only fail when register_netdevice()
fails. When this happens register_netdevice() calls priv_destructor, ie.
brcmf_cfg80211_free_netdev() freeing the vif instance. Also upon this
failure brcmf_net_attach() calls free_netdev(). However, callers are also
doing cleanup resulting in double free. In some places they need netdev
private space as it holds parameters to communicate with the device. So
we want to do the cleanup only in callers of brcmf_net_attach() by making
the following changes:

 - set priv_destructor after register_netdevice() succeeds.
 - remove call to free_netdev() in brcmf_net_attach().
 - call free_netdev() in brcmf_net_detach() for unregistered netdev.
 - add free_netdev() if brcmf_net_attach() fails for a created interface.

Fixes: cf124db566e6 ("net: Fix inconsistent teardown and release of private netdev state.")
Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agonet/mlx4: fix spelling mistake: "coalesing" -> "coalescing"
Colin Ian King [Mon, 26 Jun 2017 12:53:46 +0000 (13:53 +0100)]
net/mlx4: fix spelling mistake: "coalesing" -> "coalescing"

Trivial fix to spelling mistake in en_dbg debug message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'net-add-netlink_ext_ack-support-to-rtnl_link_ops'
David S. Miller [Tue, 27 Jun 2017 03:13:23 +0000 (23:13 -0400)]
Merge branch 'net-add-netlink_ext_ack-support-to-rtnl_link_ops'

Matthias Schiffer says:

====================
net: add netlink_ext_ack support to rtnl_link_ops

Same changes as http://patchwork.ozlabs.org/patch/780351/ , split into
separate patches for each rtnl_link_ops field as requested.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: add netlink_ext_ack argument to rtnl_link_ops.slave_validate
Matthias Schiffer [Sun, 25 Jun 2017 21:56:03 +0000 (23:56 +0200)]
net: add netlink_ext_ack argument to rtnl_link_ops.slave_validate

Add support for extended error reporting.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Acked-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: add netlink_ext_ack argument to rtnl_link_ops.slave_changelink
Matthias Schiffer [Sun, 25 Jun 2017 21:56:02 +0000 (23:56 +0200)]
net: add netlink_ext_ack argument to rtnl_link_ops.slave_changelink

Add support for extended error reporting.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Acked-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: add netlink_ext_ack argument to rtnl_link_ops.validate
Matthias Schiffer [Sun, 25 Jun 2017 21:56:01 +0000 (23:56 +0200)]
net: add netlink_ext_ack argument to rtnl_link_ops.validate

Add support for extended error reporting.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Acked-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: add netlink_ext_ack argument to rtnl_link_ops.changelink
Matthias Schiffer [Sun, 25 Jun 2017 21:56:00 +0000 (23:56 +0200)]
net: add netlink_ext_ack argument to rtnl_link_ops.changelink

Add support for extended error reporting.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Acked-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: add netlink_ext_ack argument to rtnl_link_ops.newlink
Matthias Schiffer [Sun, 25 Jun 2017 21:55:59 +0000 (23:55 +0200)]
net: add netlink_ext_ack argument to rtnl_link_ops.newlink

Add support for extended error reporting.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Acked-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: macb: add fixed-link node support
Michael Grzeschik [Fri, 23 Jun 2017 14:54:10 +0000 (16:54 +0200)]
net: macb: add fixed-link node support

In case the MACB is directly connected to a
non-mdio PHY/device, it should be possible to provide
a fixed link configuration in the DT.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge tag 'wireless-drivers-next-for-davem-2017-06-25' of git://git.kernel.org/pub...
David S. Miller [Sun, 25 Jun 2017 18:45:34 +0000 (14:45 -0400)]
Merge tag 'wireless-drivers-next-for-davem-2017-06-25' of git://git./linux/kernel/git/kvalo/wireless-drivers-next

Kalle Valo says:

====================
wireless-drivers-next patches for 4.13

New features and bug fixes to quite a few different drivers, but
nothing really special standing out.

What makes me happy that we have now more vendors actively
contributing to upstream drivers. In this pull request we have patches
from Broadcom, Intel, Qualcomm, Realtek and Redpine Signals, and I
still have patches from Marvell and Quantenna pending in patchwork. Now
that's something comparing to how things looked 11 years ago in Jeff
Garzik's "State of the Union: Wireless" email:

https://lkml.org/lkml/2006/1/5/671

Major changes:

wil6210

* add low level RF sector interface via nl80211 vendor commands

* add module parameter ftm_mode to load separate firmware for factory
  testing

* support devices with different PCIe bar size

* add support for PCIe D3hot in system suspend

* remove ioctl interface which should not be in a wireless driver

ath10k

* go back to using dma_alloc_coherent() for firmware scratch memory

* add per chain RSSI reporting

brcmfmac

* add support multi-scheduled scan

* add scheduled scan support for specified BSSIDs

* add support for brcm43430 revision 0

wlcore

* add wil1285 compatible

rsi

* add RS9113 USB support

iwlwifi

* FW API documentation improvements (for tools and htmldoc)

* continuing work for the new A000 family

* bump the maximum supported FW API to 31

* improve the differentiation between 8000, 9000 and A000 families
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'sctp-RFC-4960-Errata-fixes'
David S. Miller [Sun, 25 Jun 2017 18:43:53 +0000 (14:43 -0400)]
Merge branch 'sctp-RFC-4960-Errata-fixes'

Marcelo Ricardo Leitner says:

====================
sctp: RFC 4960 Errata fixes

This patchset contains fixes for 4 Errata topics from
https://tools.ietf.org/html/draft-ietf-tsvwg-rfc4960-errata-01
Namely, sections:
 3.12. Order of Adjustments of partial_bytes_acked and cwnd
 3.22. Increase of partial_bytes_acked in Congestion Avoidance
 3.26. CWND Increase in Congestion Avoidance Phase
 3.27. Refresh of cwnd and ssthresh after Idle Period

Tests performed with netperf using net namespaces, with drop rates at
0%, 0.5% and 1% by netem, IPv4 and IPv6, 10 runs for each combination.
I couldn't spot differences on the stats. With and without these patches
the results vary in a similar way in terms of throughput and
retransmissions.

Tests with 20ms delay and 20ms delay + drops at 0.5% and 1% also had
results in a similar way, no noticeable difference.

Looking at cwnd, it was possible to notice slightly lower values being
used while still sustaining same throughput profile.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosctp: adjust ssthresh when transport is idle
Marcelo Ricardo Leitner [Fri, 23 Jun 2017 22:59:36 +0000 (19:59 -0300)]
sctp: adjust ssthresh when transport is idle

RFC 4960 Errata 3.27 identifies that ssthresh should be adjusted to cwnd
because otherwise it could cause the transport to lock into congestion
avoidance phase specially if ssthresh was previously reduced by some
packet drop, leading to poor performance.

The Errata says to adjust ssthresh to cwnd only once, though the same
goal is achieved by updating it every time we update cwnd too. The
caveat is that we could take longer to get back up to speed but that
should be compensated by the fact that we don't adjust on RTO basis (as
RFC says) but based on Heartbeats, which are usually way longer.

See-also: https://tools.ietf.org/html/draft-ietf-tsvwg-rfc4960-errata-01#section-3.27
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosctp: adjust cwnd increase in Congestion Avoidance phase
Marcelo Ricardo Leitner [Fri, 23 Jun 2017 22:59:35 +0000 (19:59 -0300)]
sctp: adjust cwnd increase in Congestion Avoidance phase

RFC4960 Errata 3.26 identified that at the same time RFC4960 states that
cwnd should never grow more than 1*MTU per RTT, Section 7.2.2 was
underspecified and as described could allow increasing cwnd more than
that.

This patch updates it so partial_bytes_acked is maxed to cwnd if
flight_size doesn't reach cwnd, protecting it from such case.

See-also: https://tools.ietf.org/html/draft-ietf-tsvwg-rfc4960-errata-01#section-3.26
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosctp: allow increasing cwnd regardless of ctsn moving or not
Marcelo Ricardo Leitner [Fri, 23 Jun 2017 22:59:34 +0000 (19:59 -0300)]
sctp: allow increasing cwnd regardless of ctsn moving or not

As per RFC4960 Errata 3.22, this condition is not needed anymore as it
could cause the partial_bytes_acked to not consider the TSNs acked in
the Gap Ack Blocks although they were received by the peer successfully.

This patch thus drops the check for new Cumulative TSN Ack Point,
leaving just the flight_size < cwnd one.

See-also: https://tools.ietf.org/html/draft-ietf-tsvwg-rfc4960-errata-01#section-3.22
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosctp: update order of adjustments of partial_bytes_acked and cwnd
Marcelo Ricardo Leitner [Fri, 23 Jun 2017 22:59:33 +0000 (19:59 -0300)]
sctp: update order of adjustments of partial_bytes_acked and cwnd

RFC4960 Errata 3.12 says RFC4960 is unclear about the order of
adjustments applied to partial_bytes_acked and cwnd in the congestion
avoidance phase, and that the actual order should be:
partial_bytes_acked is reset to (partial_bytes_acked - cwnd). Next, cwnd
is increased by MTU.

We were first increasing cwnd, and then subtracting the new value pba,
which leads to a different result as pba is smaller than what it should
and could cause cwnd to not grow as much.

See-also: https://tools.ietf.org/html/draft-ietf-tsvwg-rfc4960-errata-01#section-3.12
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: Remove ndo_dfwd_start_xmit
Mintz, Yuval [Sun, 25 Jun 2017 08:09:12 +0000 (11:09 +0300)]
net: Remove ndo_dfwd_start_xmit

Looks like commit f663dd9aaf9e ("net: core: explicitly select a txq before doing l2 forwarding")
has removed the need for this dedicated xmit function [it even explicitly
states so in its commit log message] but it hasn't removed the definition
of the ndo.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
CC: Jason Wang <jasowang@redhat.com>
CC: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'qcom-emac-various-minor-improvements'
David S. Miller [Sun, 25 Jun 2017 15:44:29 +0000 (11:44 -0400)]
Merge branch 'qcom-emac-various-minor-improvements'

Timur Tabi says:

====================
net: qcom/emac: various minor improvements

A collection of minor fixes and features to the Qualcomm Technologies
EMAC network driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: qcom/emac: add support for emulation systems
Timur Tabi [Fri, 23 Jun 2017 19:33:30 +0000 (14:33 -0500)]
net: qcom/emac: add support for emulation systems

On emulation systems, the EMAC's internal PHY ("SGMII") is not present,
but is not needed for network functionality.  So just display a warning
message and ignore the SGMII.

Tested-by: Philip Elcan <pelcan@codeaurora.org>
Tested-by: Adam Wallis <awallis@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: qcom/emac: do not reset the EMAC during initialization
Timur Tabi [Fri, 23 Jun 2017 19:33:29 +0000 (14:33 -0500)]
net: qcom/emac: do not reset the EMAC during initialization

On ACPI systems, the driver depends on firmware pre-initializing the
EMAC because we don't have access to the clocks, and the EMAC has specific
clock programming requirements.  Therefore, we don't want to reset the
EMAC while we are completing the initialization.

Tested-by: Richard Ruigrok <rruigrok@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: qcom/emac: add shutdown function
Timur Tabi [Fri, 23 Jun 2017 19:33:28 +0000 (14:33 -0500)]
net: qcom/emac: add shutdown function

The shutdown function halts all DMA and interrupts, so that all
operations are discontinued when the system shuts down, e.g. via
kexec or a forced reboot.

Tested-by: Tyler Baicar <tbaicar@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoaf_iucv: Move sockaddr length checks to before accessing sa_family in bind and connec...
Mateusz Jurczyk [Fri, 23 Jun 2017 17:32:28 +0000 (19:32 +0200)]
af_iucv: Move sockaddr length checks to before accessing sa_family in bind and connect handlers

Verify that the caller-provided sockaddr structure is large enough to
contain the sa_family field, before accessing it in bind() and connect()
handlers of the AF_IUCV socket. Since neither syscall enforces a minimum
size of the corresponding memory region, very short sockaddrs (zero or
one byte long) result in operating on uninitialized memory while
referencing .sa_family.

Fixes: 52a82e23b9f2 ("af_iucv: Validate socket address length in iucv_sock_bind()")
Signed-off-by: Mateusz Jurczyk <mjurczyk@google.com>
[jwi: removed unneeded null-check for addr]
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/iucv: improve endianness handling
Hans Wippel [Fri, 23 Jun 2017 17:32:27 +0000 (19:32 +0200)]
net/iucv: improve endianness handling

Use proper endianness conversion for an skb protocol assignment. Given
that IUCV is only available on big endian systems (s390), this simply
avoids an endianness warning reported by sparse.

Signed-off-by: Hans Wippel <hwippel@linux.vnet.ibm.com>
Reviewed-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: dsa: mv88e6xxx: fix error code in mv88e6390_serdes_power()
Dan Carpenter [Fri, 23 Jun 2017 15:17:04 +0000 (18:17 +0300)]
net: dsa: mv88e6xxx: fix error code in mv88e6390_serdes_power()

We're accidentally returning the wrong variable.  "cmode" is
uninitialized at this point so it causes a static checker warning.

Fixes: 6335e9f2446b ("net: dsa: mv88e6xxx: mv88e6390X SERDES support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'nfp-add-flower-app-with-representors'
David S. Miller [Sun, 25 Jun 2017 15:42:09 +0000 (11:42 -0400)]
Merge branch 'nfp-add-flower-app-with-representors'

Simon Horman says:

====================
nfp: add flower app with representors

this series adds a flower app to the NFP driver.
It initialises four types of netdevs:

* PF netdev - lower-device for communication of packets to device
* PF representor netdev
* VF representor netdevs
* Phys port representor netdevs

The PF netdev acts as a lower-device which sends and receives packets to
and from the firmware. The representors act as upper-devices. For TX
representors attach a metadata dst to the skb which is used by the PF
netdev to prepend metadata to the packet before forwarding the firmware. On
RX the PF netdev looks up the representor based on the prepended metadata
received from the firmware and forwards the skb to the representor after
removing the metadata.

Control queues are used to send and receive control messages which are
used to communicate configuration information with the firmware. These
are in separate vNIC to the queues belonging to the PF netdev. The control
queues are not exposed to use-space via a netdev or any other means.

The first 9 patches of this series provide app-independent infrastructure
to instantiate representors and the remaining 3 patches provide an app
which uses this infrastructure.

As the name implies this app is targeted at providing offload of TC flower.
Flower offload - allowing classifiers to be attached to representor netdevs
- is intended to be provided by follow-up patches at which point it will
become the dominant feature of the app.

Minor changes since v2 noted in changelogs of individual patches.
Review of v1 and v2 of this patchset have been addressed either
through discussion on-list or changes in this patchset.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: add VF and PF representors to flower app
Simon Horman [Fri, 23 Jun 2017 20:12:09 +0000 (22:12 +0200)]
nfp: add VF and PF representors to flower app

Initialise VF and PF representors in flower app.

Based in part on work by Benjamin LaHaise, Bert van Leeuwen and
Jakub Kicinski.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: add flower app
Simon Horman [Fri, 23 Jun 2017 20:12:08 +0000 (22:12 +0200)]
nfp: add flower app

Add app for flower offload. At this point the PF netdev and phys port
representor netdevs are initialised. Follow-up work will add support for
VF and PF representors and beyond that offloading the flower classifier.

Based in part on work by Benjamin LaHaise and Bert van Leeuwen.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: add support for control messages for flower app
Simon Horman [Fri, 23 Jun 2017 20:12:07 +0000 (22:12 +0200)]
nfp: add support for control messages for flower app

In preparation for adding a new flower app - targeted at offloading
the flower classifier - provide support for control message that it will
use to communicate with the NFP.

Based in part on work by Bert van Leeuwen.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: add support for tx/rx with metadata portid
Simon Horman [Fri, 23 Jun 2017 20:12:06 +0000 (22:12 +0200)]
nfp: add support for tx/rx with metadata portid

Allow tx/rx with metadata port id. This will be used for tx/rx of
representor netdevs acting as upper-devices while a pf netdev acts
as a lower-device.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>