GitHub/LineageOS/android_kernel_motorola_exynos9610.git
9 years agobrcmfmac: Fix possible race-condition.
Hante Meuleman [Fri, 6 Mar 2015 17:40:40 +0000 (18:40 +0100)]
brcmfmac: Fix possible race-condition.

SDIO is using a "shared" variable to handoff ctl frames to DPC
and to see when they are done. In a timeout situation this can
lead to erroneous situation where DPC started to handle the ctl
frame while the timeout expired. This patch will fix this by
adding locking around the shared variable.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
9 years agobrcmfmac: Simplify watchdog sleep.
Hante Meuleman [Fri, 6 Mar 2015 17:40:39 +0000 (18:40 +0100)]
brcmfmac: Simplify watchdog sleep.

The watchdog thread is used to put the SDIO bus to sleep when the
system is idling. This patch simplifies the way it is determined
when sleep can be entered.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
9 years agobrcmfmac: Fix oops when SDIO device is removed.
Hante Meuleman [Fri, 6 Mar 2015 17:40:38 +0000 (18:40 +0100)]
brcmfmac: Fix oops when SDIO device is removed.

On removal of SDIO card both functions of card will be getting
a remove call. When the first is hanging in ctrl frame xmit then
the second will cause oops. This patch fixes the xmit ctrl
handling in case of serious errors and also limits the handling
for remove to function 1 only.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
9 years agortlwifi: Remove duplicated prototype
Taehee Yoo [Fri, 6 Mar 2015 15:47:17 +0000 (00:47 +0900)]
rtlwifi: Remove duplicated prototype

Remove duplicated prototype in base.h

Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
9 years agoath5k: fix reset race
Sergey Ryazanov [Wed, 4 Mar 2015 02:12:11 +0000 (05:12 +0300)]
ath5k: fix reset race

To prepare for reset ath5k should finish all asynchronous tasks. At
first, it disables the interrupt generation, then it waits for the
interrupt handler and tasklets completion, and then proceeds to the HW
configuration update. But it does not consider that the interrupt
handler or tasklet re-enables the interrupt generation. And we fall in a
situation when ath5k assumes that interrupts are disabled, but it is
not.

This can lead to different consequences, such as reception of the frame,
when we do not expect it. Under certain circumstances, this can lead to
the following warning:

  WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
  invalid hw_rix: 1a
  [..]
  Call Trace:
  [<802656a8>] show_stack+0x48/0x70
  [<802dd92c>] warn_slowpath_common+0x88/0xbc
  [<802dd98c>] warn_slowpath_fmt+0x2c/0x38
  [<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
  [<8028ac64>] tasklet_action+0x8c/0xf0
  [<80075804>] __do_softirq+0x180/0x32c
  [<80196ce8>] irq_exit+0x54/0x70
  [<80041848>] ret_from_irq+0x0/0x4
  [<80182fdc>] ioread32+0x4/0xc
  [<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
  [<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
  [<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
  [<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
  [<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
  [<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
  [<8022c3f4>] process_one_work+0x28c/0x400
  [<802df8f8>] worker_thread+0x258/0x3c0
  [<801b5710>] kthread+0xe0/0xec
  [<800418a8>] ret_from_kernel_thread+0x14/0x1c

Fix this issue by adding a new status flag, which forbids to re-enable
the interrupt generation until the HW configuration is completed.

Note: previous patch, which reorders the Rx disable code helps to avoid
the above warning, but not fixes the root cause of unexpected frame
receiving.

CC: Jiri Slaby <jirislaby@gmail.com>
CC: Nick Kossifidis <mickflemm@gmail.com>
CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
Tested-by: Eric Bree <ebree@nltinc.com>
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
9 years agoath5k: channel change fix
Sergey Ryazanov [Wed, 4 Mar 2015 02:12:10 +0000 (05:12 +0300)]
ath5k: channel change fix

ath5k updates the channel pointer and after that it stops the Rx logic
and apply channel to HW. In case of channel switch, such sequence
creates a small window when a frame, which is received on the old
channel is considered as a frame received on the new one.

The most notable consequence of this situation occurs during the switch
from 2 GHz band (CCK+OFDM) to the 5GHz band (OFDM-only). Frame received
with CCK rate, e.g. beacon received at the 1mbps, causes the following
warning:

  WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
  invalid hw_rix: 1a
  [..]
  Call Trace:
  [<802656a8>] show_stack+0x48/0x70
  [<802dd92c>] warn_slowpath_common+0x88/0xbc
  [<802dd98c>] warn_slowpath_fmt+0x2c/0x38
  [<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
  [<8028ac64>] tasklet_action+0x8c/0xf0
  [<80075804>] __do_softirq+0x180/0x32c
  [<80196ce8>] irq_exit+0x54/0x70
  [<80041848>] ret_from_irq+0x0/0x4
  [<80182fdc>] ioread32+0x4/0xc
  [<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
  [<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
  [<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
  [<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
  [<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
  [<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
  [<8022c3f4>] process_one_work+0x28c/0x400
  [<802df8f8>] worker_thread+0x258/0x3c0
  [<801b5710>] kthread+0xe0/0xec
  [<800418a8>] ret_from_kernel_thread+0x14/0x1c

The easiest way to reproduce this warning is to run scan with dualband
NIC in noisy environments, when the channel 11 runs multiple APs. In my
tests if the APs num >= 12, the warning appears in the first few
seconds of scanning.

In order to fix this, the Rx disable code moved to a higher level and
placed before the channel pointer update. This is also makes the code a
bit more symmetrical, since we disable and enable the Rx in the same
function.

In fact, at the pointer update time new frames should not appear,
because interrupt generation at this point should already be disabled.
The next patch should address this issue.

CC: Jiri Slaby <jirislaby@gmail.com>
CC: Nick Kossifidis <mickflemm@gmail.com>
CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
Tested-by: Eric Bree <ebree@nltinc.com>
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
9 years agoMerge tag 'iwlwifi-next-for-kalle-2015-03-12' of https://git.kernel.org/pub/scm/linux...
Kalle Valo [Fri, 13 Mar 2015 13:09:18 +0000 (15:09 +0200)]
Merge tag 'iwlwifi-next-for-kalle-2015-03-12' of https://git./linux/kernel/git/iwlwifi/iwlwifi-next

* Location Aware Regulatory was added by Arik
* 8000 device family work
* Update to the BT Coex firmware API

9 years agovxlan: Don't set s_addr in vxlan_create_sock
Simon Horman [Fri, 13 Mar 2015 02:00:58 +0000 (11:00 +0900)]
vxlan: Don't set s_addr in vxlan_create_sock

In the case of AF_INET s_addr was set to INADDR_ANY (0) which which both
symmetric with the AF_INET6 case, where s_addr is not set, and unnecessary
as udp_conf is zeroed out earlier in the same function.

I suspect this change does not have any run-time effect due to compiler
optimisations. But it does make the code a little easier on the/my eyes.

Cc: Tom Herbert <therbert@google.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agompls: In mpls_egress verify the packet length.
Eric W. Biederman [Thu, 12 Mar 2015 23:22:59 +0000 (18:22 -0500)]
mpls: In mpls_egress verify the packet length.

Reobert Shearman noticed that mpls_egress is failing to verify that
the bytes to be examined are in fact present in the packet before
mpls_egress reads those bytes.

As suggested by David Miller reduce this to a single pskb_may_pull
call so that we don't do unnecessary work in the fast path.

Reported-by: Robert Shearman <rshearma@brocade.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/macb: Only adjust tx_clk on link change
Jaeden Amero [Thu, 12 Mar 2015 23:07:54 +0000 (18:07 -0500)]
net/macb: Only adjust tx_clk on link change

The PHY state machine (in drivers/net/phy/phy.c) will unconditionally
call phydev->adjust_link (macb_handle_link_change) when polling in the
PHY_CHANGELINK state. As currently written, macb always ends up
requesting a new tx_clk frequency in macb_handle_link_change. It is a
waste of time to request a new tx_clk frequency if the link state hasn't
changed, as the tx_clk will already be configured properly.

Let's only request a new tx_clk clock frequency when necessary.

Signed-off-by: Jaeden Amero <jaeden.amero@ni.com>
Cc: Josh Cartwright <joshc@ni.com>
Cc: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agorhashtable: Fix read-side crash during rehash
Herbert Xu [Fri, 13 Mar 2015 01:54:10 +0000 (12:54 +1100)]
rhashtable: Fix read-side crash during rehash

This patch fixes a typo rhashtable_lookup_compare where we fail
to recompute the hash when looking up the new table.  This causes
elements to be missed and potentially a crash during a resize.

Reported-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agorhashtable: kill ht->shift atomic operations
Daniel Borkmann [Thu, 12 Mar 2015 14:28:40 +0000 (15:28 +0100)]
rhashtable: kill ht->shift atomic operations

Commit c0c09bfdc415 ("rhashtable: avoid unnecessary wakeup for worker
queue") changed ht->shift to be atomic, which is actually unnecessary.

Instead of leaving the current shift in the core rhashtable structure,
it can be cached inside the individual bucket tables.

There, it will only be initialized once during a new table allocation
in the shrink/expansion slow path, and from then onward it stays immutable
for the rest of the bucket table liftime.

That allows shift to be non-atomic. The patch also moves hash_rnd
management into the table setup. The rhashtable structure now consumes
3 instead of 4 cachelines.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Ying Xue <ying.xue@windriver.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agorhashtable: Fix reader/rehash race
Herbert Xu [Thu, 12 Mar 2015 11:07:49 +0000 (22:07 +1100)]
rhashtable: Fix reader/rehash race

There is a potential race condition between readers and the rehasher.
In particular, the rehasher could have started a rehash while the
reader finishes a scan of the old table but fails to see the new
table pointer.

This patch closes this window by adding smp_wmb/smp_rmb.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'listener_refactor'
David S. Miller [Fri, 13 Mar 2015 02:58:27 +0000 (22:58 -0400)]
Merge branch 'listener_refactor'

Eric Dumazet says:

====================
inet: tcp listener refactoring, part 8

These patches prepare request socks being hashed into general ehash
table : We declare 3 aliases (ireq_state, ireq_refcnt, ireq_family)

Note that refcnt is not yet handled, this will be done later.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoinet: introduce ireq_family
Eric Dumazet [Thu, 12 Mar 2015 23:44:10 +0000 (16:44 -0700)]
inet: introduce ireq_family

Before inserting request socks into general hash table,
fill their socket family.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoinet: get_openreq4() & get_openreq6() do not need listener
Eric Dumazet [Thu, 12 Mar 2015 23:44:09 +0000 (16:44 -0700)]
inet: get_openreq4() & get_openreq6() do not need listener

ireq->ir_num contains local port, use it.

Also, get_openreq4() dumping listen_sk->refcnt makes litle sense.

inet_diag_fill_req() can also use ireq->ir_num

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoinet: prepare sock_edemux() & sock_gen_put() for new SYN_RECV state
Eric Dumazet [Thu, 12 Mar 2015 23:44:08 +0000 (16:44 -0700)]
inet: prepare sock_edemux() & sock_gen_put() for new SYN_RECV state

sock_edemux() & sock_gen_put() should be ready to cope with request socks.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: add req_prot_cleanup() & req_prot_init() helpers
Eric Dumazet [Thu, 12 Mar 2015 23:44:07 +0000 (16:44 -0700)]
net: add req_prot_cleanup() & req_prot_init() helpers

Make proto_register() & proto_unregister() a bit nicer.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoinet: add rsk_refcnt/ireq_refcnt to request socks
Eric Dumazet [Thu, 12 Mar 2015 23:44:06 +0000 (16:44 -0700)]
inet: add rsk_refcnt/ireq_refcnt to request socks

When request socks will be in ehash, they'll need to be refcounted.

This patch adds rsk_refcnt/ireq_refcnt macros, and adds
reqsk_put() function, but nothing yet use them.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoinet: add ireq_state field to inet_request_sock
Eric Dumazet [Thu, 12 Mar 2015 23:44:05 +0000 (16:44 -0700)]
inet: add ireq_state field to inet_request_sock

We need to identify request sock when they'll be visible in
global ehash table.

ireq_state is an alias to req.__req_common.skc_state.

Its value is set to TCP_NEW_SYN_RECV

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoinet: add TCP_NEW_SYN_RECV state
Eric Dumazet [Thu, 12 Mar 2015 23:44:04 +0000 (16:44 -0700)]
inet: add TCP_NEW_SYN_RECV state

TCP_SYN_RECV state is currently used by fast open sockets.

Initial TCP requests (the pseudo sockets created when a SYN is received)
are not yet associated to a state. They are attached to their parent,
and the parent is in TCP_LISTEN state.

This commit adds TCP_NEW_SYN_RECV state, so that we can convert
TCP stack to a different schem gradually.

This state is not exported to user space.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoipv6: add missing ireq_net & ir_cookie initializations
Eric Dumazet [Thu, 12 Mar 2015 23:44:03 +0000 (16:44 -0700)]
ipv6: add missing ireq_net & ir_cookie initializations

I forgot to update dccp_v6_conn_request() & cookie_v6_check().
They both need to set ireq->ireq_net and ireq->ir_cookie

Lets clear ireq->ir_cookie in inet_reqsk_alloc()

Signed-off-by: Eric Dumazet <edumazet@google.com>
Fixes: 33cf7c90fe2f ("net: add real socket cookies")
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agocls_bpf: do eBPF invocation under non-bh RCU lock variant for maps
Daniel Borkmann [Thu, 12 Mar 2015 19:03:12 +0000 (20:03 +0100)]
cls_bpf: do eBPF invocation under non-bh RCU lock variant for maps

Currently, it is possible in cls_bpf to access eBPF maps only under
rcu_read_lock_bh() variants: while on ingress side, that is, handle_ing(),
the classifier would be called from __netif_receive_skb_core() under
rcu_read_lock(); on egress side, however, it's rcu_read_lock_bh() via
__dev_queue_xmit().

This rcu/rcu_bh mix doesn't work together with eBPF maps as they require
soley to be called under rcu_read_lock(). eBPF maps could also be shared
among various other eBPF programs (possibly even with other eBPF program
types, f.e. tracing) and user space processes, so any context is assumed.

Therefore, a possible fix for cls_bpf is to wrap/nest eBPF program
invocation under non-bh RCU lock variant.

Fixes: e2e9b6541dd4 ("cls_bpf: add initial eBPF support for programmable classifiers")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'fib_trie_table_merge_fixes'
David S. Miller [Thu, 12 Mar 2015 22:26:58 +0000 (18:26 -0400)]
Merge branch 'fib_trie_table_merge_fixes'

Alexander Duyck says:

====================
fib_trie: Minor fixes for table merge

This patch set addresses two issues reported with the tables merged, the
first is a NULL pointer dereference, and the other is to remove a WARN_ON
and set the ordering for aliases from different tables with the same slen
values.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Provide a deterministic order for fib_alias w/ tables merged
Alexander Duyck [Thu, 12 Mar 2015 21:46:29 +0000 (14:46 -0700)]
fib_trie: Provide a deterministic order for fib_alias w/ tables merged

This change makes it so that we should always have a deterministic ordering
for the main and local aliases within the merged table when two leaves
overlap.

So for example if we have a leaf with a key of 192.168.254.0.  If we
previously added two aliases with a prefix length of 24 from both local and
main the first entry would be first and the second would be second.  When I
was coding this I had added a WARN_ON should such a situation occur as I
wasn't sure how likely it would be.  However this WARN_ON has been
triggered so this is something that should be addressed.

With this patch the ordering of the aliases is as follows.  First they are
sorted on prefix length, then on their table ID, then tos, and finally
priority.  This way what we end up doing is essentially interleaving the
two tables on what used to be leaf_info structure boundaries.

Fixes: 0ddcf43d5 ("ipv4: FIB Local/MAIN table collapse")
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Avoid NULL pointer if local table is not allocated
Alexander Duyck [Thu, 12 Mar 2015 21:46:23 +0000 (14:46 -0700)]
fib_trie: Avoid NULL pointer if local table is not allocated

The function fib_unmerge assumed the local table had already been
allocated.  If that is not the case however when custom rules are applied
then this can result in a NULL pointer dereference.

In order to prevent this we must check the value of the local table pointer
and if it is NULL simply return 0 as there is no local table to separate
from the main.

Fixes: 0ddcf43d5 ("ipv4: FIB Local/MAIN table collapse")
Reported-by: Madhu Challa <challa@noironetworks.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoebpf: verifier: check that call reg with ARG_ANYTHING is initialized
Daniel Borkmann [Thu, 12 Mar 2015 16:21:42 +0000 (17:21 +0100)]
ebpf: verifier: check that call reg with ARG_ANYTHING is initialized

I noticed that a helper function with argument type ARG_ANYTHING does
not need to have an initialized value (register).

This can worst case lead to unintented stack memory leakage in future
helper functions if they are not carefully designed, or unintended
application behaviour in case the application developer was not careful
enough to match a correct helper function signature in the API.

The underlying issue is that ARG_ANYTHING should actually be split
into two different semantics:

  1) ARG_DONTCARE for function arguments that the helper function
     does not care about (in other words: the default for unused
     function arguments), and

  2) ARG_ANYTHING that is an argument actually being used by a
     helper function and *guaranteed* to be an initialized register.

The current risk is low: ARG_ANYTHING is only used for the 'flags'
argument (r4) in bpf_map_update_elem() that internally does strict
checking.

Fixes: 17a5267067f3 ("bpf: verifier (add verifier core)")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'possible_net_t'
David S. Miller [Thu, 12 Mar 2015 18:39:44 +0000 (14:39 -0400)]
Merge branch 'possible_net_t'

Eric W. Biederman says:

====================
Introduce possible_net_t

The current usage of write_pnet and read_pnet is a little laborious and
error prone as you only notice if you failed to include them if are
compiling with network namespaces enabled.

possible_net_t remedies that by using a type that is 0 bytes when
network namespaces are disabled and can only be read and written to with
read_pnet and write_pnet.

Aka less work and safer for the same effect.

I kill hold_net and release_net first as are they are haven't been used
since 2008 and are noise at the points where write_pnet and read_pnet
are used.

I have folded in Eric Dumazets suggestions to improve the killing of
hold_net and release net.  And respon.  I had to respin anyway as
there was enough changes elsewhere in the tree the previous version
of these patches did not quite apply cleanly.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Introduce possible_net_t
Eric W. Biederman [Thu, 12 Mar 2015 04:06:44 +0000 (23:06 -0500)]
net: Introduce possible_net_t

Having to say
> #ifdef CONFIG_NET_NS
>  struct net *net;
> #endif

in structures is a little bit wordy and a little bit error prone.

Instead it is possible to say:
> typedef struct {
> #ifdef CONFIG_NET_NS
>       struct net *net;
> #endif
> } possible_net_t;

And then in a header say:

>  possible_net_t net;

Which is cleaner and easier to use and easier to test, as the
possible_net_t is always there no matter what the compile options.

Further this allows read_pnet and write_pnet to be functions in all
cases which is better at catching typos.

This change adds possible_net_t, updates the definitions of read_pnet
and write_pnet, updates optional struct net * variables that
write_pnet uses on to have the type possible_net_t, and finally fixes
up the b0rked users of read_pnet and write_pnet.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Kill hold_net release_net
Eric W. Biederman [Thu, 12 Mar 2015 04:04:08 +0000 (23:04 -0500)]
net: Kill hold_net release_net

hold_net and release_net were an idea that turned out to be useless.
The code has been disabled since 2008.  Kill the code it is long past due.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'rhashtable-cleanups'
David S. Miller [Thu, 12 Mar 2015 18:35:35 +0000 (14:35 -0400)]
Merge branch 'rhashtable-cleanups'

Herbert Xu says:

====================
rhashtable hash cleanups

This is a rebase on top of the nested lock annotation fix.

Nothing to see here, just a bunch of simple clean-ups before
I move onto something more substantial (hopefully).
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agorhashtable: Remove obj_raw_hashfn
Herbert Xu [Thu, 12 Mar 2015 03:49:41 +0000 (14:49 +1100)]
rhashtable: Remove obj_raw_hashfn

Now that the only caller of obj_raw_hashfn is head_hashfn, we can
simply kill it and fold it into the latter.

This patch also moves the common shift from head_hashfn/key_hashfn
into rht_bucket_index.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agorhashtable: Remove key length argument to key_hashfn
Herbert Xu [Thu, 12 Mar 2015 03:49:40 +0000 (14:49 +1100)]
rhashtable: Remove key length argument to key_hashfn

key_hashfn has only one caller and it doesn't really need to supply
the key length as an extra parameter.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agorhashtable: Use head_hashfn instead of obj_raw_hashfn
Herbert Xu [Thu, 12 Mar 2015 03:49:39 +0000 (14:49 +1100)]
rhashtable: Use head_hashfn instead of obj_raw_hashfn

Now that we don't have cross-table hashes, we no longer need to
keep the entire hash value so all users of obj_raw_hashfn can
use head_hashfn instead.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agorhashtable: Move masking back into key_hashfn
Herbert Xu [Thu, 12 Mar 2015 03:49:38 +0000 (14:49 +1100)]
rhashtable: Move masking back into key_hashfn

This patch reverts commit c88455ce50ae4224d84960ce2baa53e61580df27
("rhashtable: key_hashfn() must return full hash value") because
the only user of it always masks the hash value.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'iwlwifi-fixes' into iwlwifi-next
Emmanuel Grumbach [Thu, 12 Mar 2015 12:38:26 +0000 (14:38 +0200)]
Merge branch 'iwlwifi-fixes' into iwlwifi-next

9 years agoiwlwifi: mvm: simplify iwl_mvm_get_wakeup_status() return
Johannes Berg [Tue, 3 Mar 2015 19:23:47 +0000 (20:23 +0100)]
iwlwifi: mvm: simplify iwl_mvm_get_wakeup_status() return

The return value in iwl_mvm_get_wakeup_status() is a bit unclear in
that it's not obvious that we don't leak fw_status in some cases.
Use fw_status directly with ERR_PTR() and return only it, that way
the compiler has a chance of proving that it's uninitialized (if it
ever is due to new changes.)

Additionally, this removes a smatch warning since smatch couldn't
figure out that fw_status can't, in fact, leak here.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: don't double unlock the mutex in __iwl_mvm_resume()
Luciano Coelho [Thu, 12 Mar 2015 07:25:15 +0000 (09:25 +0200)]
iwlwifi: mvm: don't double unlock the mutex in __iwl_mvm_resume()

When IWLWIFI_DEBUGFS is not set, we should not unlock the mutex after
calling iwl_mvm_query_wakeup_reasons(), because this function unlocks
it already.  Move the goto out_iterate outside the #ifdef.

Change-Id: I13d86402aecf0eeec44b1abbe2b244fbc706a5eb
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
9 years agoiwlwifi: mvm: clarify time event end handling
Johannes Berg [Wed, 11 Mar 2015 19:27:06 +0000 (20:27 +0100)]
iwlwifi: mvm: clarify time event end handling

The code here is a little confusing, the iwl_mvm_te_check_disconnect()
will check that the interface is a station, but going into it after
already having processed the time even end for P2P seems strange at
first look.

Put a switch statement there to distinguish the interface types and
make this more readable.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: Always enable the smart FIFO
Eran Harary [Sun, 8 Feb 2015 11:58:50 +0000 (13:58 +0200)]
iwlwifi: mvm: Always enable the smart FIFO

We previously enabled the smart FIFO (SF) in BSS only after
association.
This cause interrupt latency on P2P on certain devices.
Change the working model to enable the SF all the time and
play with the timeout values based on the association state.
This change was not tested on older firwmares, so make it
happen only on -13.ucode and up.

Signed-off-by: Eran Harary <eran.harary@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: update copyright to include 2015
Emmanuel Grumbach [Sun, 8 Mar 2015 12:18:17 +0000 (14:18 +0200)]
iwlwifi: update copyright to include 2015

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: add more new 8260 series PCI IDs
Oren Givon [Mon, 9 Mar 2015 09:25:59 +0000 (11:25 +0200)]
iwlwifi: add more new 8260 series PCI IDs

More sub system IDs were introduced for the 8260 series.
Add the new sub system IDs so the cards can be recognized.

Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: BT Coex - update the new API
Emmanuel Grumbach [Thu, 19 Feb 2015 13:00:18 +0000 (15:00 +0200)]
iwlwifi: mvm: BT Coex - update the new API

The firmware was not using the new API, so we don't need to
differentiate between the different stages of this new API.
The main difference here is that most of the hard coded
values are not sent through the command anymore.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: fix force NMI for 8000
Emmanuel Grumbach [Mon, 9 Mar 2015 10:37:59 +0000 (12:37 +0200)]
iwlwifi: mvm: fix force NMI for 8000

The newer devices will enable a new register for this
(DEVICE_SET_NMI_8000B_REG), but the interrupt handler
isn't wired yet.
Keep the old register for now.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: freeze the non-shared queues when a station goes to sleep
Emmanuel Grumbach [Thu, 22 Jan 2015 11:15:15 +0000 (13:15 +0200)]
iwlwifi: mvm: freeze the non-shared queues when a station goes to sleep

When a station goes to sleep, we can't transmit any frame
to it. This means that until that station will wake up, a
queue that is dedicated to this station won't progress at
all. Take this into account when monitoring stuck queues
and don't account for the time the station was asleep.
This allows to mask false positives where the queues are
stuck not because of a bug, but because of the station
being asleep.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: pcie: allow the op_mode to freeze the stuck queue timer
Emmanuel Grumbach [Tue, 20 Jan 2015 15:02:40 +0000 (17:02 +0200)]
iwlwifi: pcie: allow the op_mode to freeze the stuck queue timer

This allows the op_mode to let the transport know that a
queue is currently frozen and that its timer should be
stopped.
When the queue is unfrozen, its timer should be set to
expire after the remainder of the timeout has elapsed.
This can be used when stations go to sleep. When a station
goes to sleep, the op_mode can freeze the timer so that the
queue will never be considered as stuck. When the station
wakes up, the queue will be unfrozen.
This is meant to avoid false positives that would happen if
a buggy station goes to sleep for a very long time. In case
we have a dedicated queue for this station (BA agreement)
and it goes to sleep for a very long time, the queue would
rightfully be stopped during all that time. In this case,
the stuck queue timer could fire and that would be a false
positive.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: rs: update Tx statistics when using fixed rate
Eyal Shapira [Sun, 8 Mar 2015 17:43:41 +0000 (19:43 +0200)]
iwlwifi: mvm: rs: update Tx statistics when using fixed rate

The Tx statistics weren't updated when using fixed rate for
debugging. Fix this as Tx statistics are useful in this use case.

Signed-off-by: Eyal Shapira <eyalx.shapira@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: don't init MCC during CT-kill
Arik Nemtsov [Wed, 4 Mar 2015 13:08:00 +0000 (15:08 +0200)]
iwlwifi: mvm: don't init MCC during CT-kill

RTNL is not taken during CT-kill so regulatory APIs cannot be invoked.
That's fine, since the HW is only brought up to check the temperature
during CT-kill. We don't expect Tx or scanning.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Reviewed-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: remove warning on station exhaustion
Johannes Berg [Tue, 10 Mar 2015 19:32:08 +0000 (20:32 +0100)]
iwlwifi: mvm: remove warning on station exhaustion

When using IBSS, it's easily possible to exhaust the number
of available stations in the driver, so don't warn on it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: trans: Take ownership on secure machine before FW load
Eran Harary [Tue, 3 Mar 2015 11:53:28 +0000 (13:53 +0200)]
iwlwifi: trans: Take ownership on secure machine before FW load

When we load the firmware for the 8000 B step device, it'll
verify its signature. In the current version of the
hardware, there can be a race between the WiFi firmware
being loaded and the Bluetooth firmware being loaded.

Check that WiFi is authenticated, if not, take ownership
on the authentication machine to make sure that the WiFi
firmware will be authenticated.

Signed-off-by: Eran Harary <eran.harary@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: add new 8260 series PCI IDs
Oren Givon [Wed, 4 Mar 2015 14:26:45 +0000 (16:26 +0200)]
iwlwifi: add new 8260 series PCI IDs

New sub system IDs were introduced for the 8260 series.
This patch adds them so new 8260 cards can be recognized.

Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: rs: improve ss_params debug print
Eyal Shapira [Mon, 2 Mar 2015 08:35:19 +0000 (10:35 +0200)]
iwlwifi: mvm: rs: improve ss_params debug print

Make the print a bit more readable.

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Eyal Shapira <eyalx.shapira@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: don't allow the FW to return invalid ch indices
Arik Nemtsov [Sun, 1 Mar 2015 16:24:57 +0000 (18:24 +0200)]
iwlwifi: don't allow the FW to return invalid ch indices

If the FW returns an invalid channels count in response to an MCC request,
make sure we don't reference invalid indices in the channels array.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: reflect TDLS pm state in mvmvif->pm_enabled
Arik Nemtsov [Sun, 22 Feb 2015 17:15:04 +0000 (19:15 +0200)]
iwlwifi: mvm: reflect TDLS pm state in mvmvif->pm_enabled

When entering D0i3, the MVM mutex cannot be grabbed. This interferes
with the calculation of the number of connected TDLS stations during
the setup of the power cmd.
The goal is to disable power saving for all vifs while any TDLS station
is connected. For this purpose it is enough to keep the pm_enabled
member of all mvmvifs as false. An update of the power state already
occurs when a TDLS station is added/removed, so the values are correctly
updated.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: fix identation
Emmanuel Grumbach [Mon, 2 Mar 2015 12:39:03 +0000 (14:39 +0200)]
iwlwifi: mvm: fix identation

mvm->fw->dbg_dest_tlv really needs to be under the right
parenthesis.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: remove unneeded include iwl-fw-error-dump.h
Emmanuel Grumbach [Mon, 2 Mar 2015 12:35:41 +0000 (14:35 +0200)]
iwlwifi: mvm: remove unneeded include iwl-fw-error-dump.h

The functions related to firmware error dump moved. No need
for this unclude anymore.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: use correct NVM offset for LAR enable for new NVMs
Arik Nemtsov [Wed, 4 Feb 2015 13:38:56 +0000 (15:38 +0200)]
iwlwifi: use correct NVM offset for LAR enable for new NVMs

New NVM versions in LnP platforms have the lar_enable bits in a different
offset.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: fix smatch warning: warn: inconsistent indenting
Emmanuel Grumbach [Sun, 1 Mar 2015 15:18:00 +0000 (17:18 +0200)]
iwlwifi: fix smatch warning:  warn: inconsistent indenting

While at it, fix a few checkpatch issues.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: pcie: include more registers in the prph dump
Emmanuel Grumbach [Wed, 25 Feb 2015 14:06:46 +0000 (16:06 +0200)]
iwlwifi: pcie: include more registers in the prph dump

This adds BT Coex data to the prph register list.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: pcie: speed up the Tx DMA stop flow
Emmanuel Grumbach [Wed, 25 Feb 2015 13:49:39 +0000 (15:49 +0200)]
iwlwifi: pcie: speed up the Tx DMA stop flow

We don't need to acquire MAC access for each access, it
makes much more sense to keep the MAC access. This speeds
up the Tx DMA stop flow significantly.
Moreover, if one channel can't be stopped, stop the others
but don't poll for them to avoid being stuck there for a
long time.

This solves a situation in which we were stuck in that flow
for way too long with a spinlock held which led to a kernel
panic.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: support family 8000 B2/C steps
Eran Harary [Wed, 25 Feb 2015 12:24:51 +0000 (14:24 +0200)]
iwlwifi: mvm: support family 8000 B2/C steps

In-order to recognize newer step of the device, the driver
must read the chip_version_id from the AUX bus MISC address
space. This will determine what firmware file will be
loaded.

Signed-off-by: Eran Harary <eran.harary@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: always update the quota after association
Emmanuel Grumbach [Thu, 26 Feb 2015 13:14:35 +0000 (15:14 +0200)]
iwlwifi: mvm: always update the quota after association

When we associate we always need to update the quotas. This
fixes a bug for cases in which quotas weren't udapted after
association.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: BT Coex - disable RRC by default
Emmanuel Grumbach [Thu, 26 Feb 2015 14:54:24 +0000 (16:54 +0200)]
iwlwifi: mvm: BT Coex - disable RRC by default

Enable this feature only if the firmware advertises support
for it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: remove IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF
Emmanuel Grumbach [Thu, 26 Feb 2015 14:40:56 +0000 (16:40 +0200)]
iwlwifi: mvm: remove IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF

All the supported firmwares support this API.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: remove IWL_UCODE_TLV_API_DISABLE_STA_TX
Emmanuel Grumbach [Thu, 26 Feb 2015 14:39:36 +0000 (16:39 +0200)]
iwlwifi: mvm: remove IWL_UCODE_TLV_API_DISABLE_STA_TX

All the supported firwmares have this new API.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: bump API to 13 for devices that use iwlmvm
Emmanuel Grumbach [Sun, 1 Mar 2015 08:46:58 +0000 (10:46 +0200)]
iwlwifi: bump API to 13 for devices that use iwlmvm

This new firmware will come out soon.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: set LAR MCC on D3/D0 transitions
Jonathan Doron [Thu, 27 Nov 2014 14:55:25 +0000 (16:55 +0200)]
iwlwifi: mvm: set LAR MCC on D3/D0 transitions

When moving to the D3 FW give it the valid MCC from the D0 FW. When
returning from D3 to D0, query the D3 FW for the latest MCC, as
it might have changed internally. This MCC will be replayed to the D0 FW
when it boots.

Signed-off-by: Jonathan Doron <jonathanx.doron@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: support LAR updates from BIOS
Jonathan Doron [Thu, 27 Nov 2014 14:57:55 +0000 (16:57 +0200)]
iwlwifi: mvm: support LAR updates from BIOS

When booting the card, check for a dedicated regulatory ACPI entry. If
such exists, read it and give the information to FW with the appropriate
source.

Signed-off-by: Jonathan Doron <jonathanx.doron@intel.com>
Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: take the MAC address from HW registers
Eran Harary [Sun, 8 Feb 2015 09:41:43 +0000 (11:41 +0200)]
iwlwifi: mvm: take the MAC address from HW registers

For some configurations, the driver should get the MAC
address from the hardware registers and not from the
regular locations. Since the parsing of the MAC address
is the same regardless of its source, continue the regular
code path (parsing) after we read the registers.

Signed-off-by: Eran Harary <eran.harary@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: allow disabling LAR via module param
Arik Nemtsov [Sun, 28 Dec 2014 07:23:16 +0000 (09:23 +0200)]
iwlwifi: allow disabling LAR via module param

This module parameter is useful for debugging NVM and LAR related issues.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: support new PHY_SKU nvm section for family 8000 B0
Eran Harary [Mon, 1 Dec 2014 15:53:53 +0000 (17:53 +0200)]
iwlwifi: mvm: support new PHY_SKU nvm section for family 8000 B0

Starting from family 8000 B0 step the radio_cfg parameters
and the get_sku parameters moved from SW section to PHY_SKU section.

Signed-off-by: Eran Harary <eran.harary@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: disable 11ac if 11n is disabled
Eliad Peller [Thu, 23 Oct 2014 13:29:10 +0000 (16:29 +0300)]
iwlwifi: disable 11ac if 11n is disabled

11ac depends on 11n, so disable it if 11n is disabled.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: iwlmvm: LAR: disable LAR support due to NVM vs TLV conflict
Matti Gottlieb [Thu, 31 Jul 2014 06:16:25 +0000 (09:16 +0300)]
iwlwifi: iwlmvm: LAR: disable LAR support due to NVM vs TLV conflict

If LAR is supported in TLV, but the NVM does not enable it, then disable
LAR support and ignore the TLV's bit that enabled LAR.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: use IWL_DEFAULT_MAX_TX_POWER for max_eirp
Eliad Peller [Sun, 7 Sep 2014 14:45:11 +0000 (17:45 +0300)]
iwlwifi: use IWL_DEFAULT_MAX_TX_POWER for max_eirp

max_eirp affects the txpower configured to the power,
so use the max tx power (22) instead of some other
value.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: change last 5ghz channel to 165 & add support for 8000 family
Matti Gottlieb [Thu, 26 Jun 2014 08:10:57 +0000 (11:10 +0300)]
iwlwifi: change last 5ghz channel to 165 & add support for 8000 family

Fix the last 5ghz channel to 165 instead of 161
Add support for 8000 family, until channel 181.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: nvm: init correct nvm channel list for 8000 devices
Arik Nemtsov [Tue, 10 Jun 2014 08:25:35 +0000 (11:25 +0300)]
iwlwifi: nvm: init correct nvm channel list for 8000 devices

Otherwise the regulatory data will mistakenly contain only 7000 series
channels.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: LAR: Add chub mcc change notify command
Arik Nemtsov [Wed, 5 Mar 2014 10:26:15 +0000 (12:26 +0200)]
iwlwifi: mvm: LAR: Add chub mcc change notify command

Chub (Communication Hub, CommsHUB) is a HW component that connects to the cellular
and connectivity cores that gets updates of mcc changes, and then notifies the FW
directly of any mcc change.

The ucode notifies the driver (via this command) that it should ask for an mcc update,
and the driver sends the ucode the update mcc command to set the updated regulatory info.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: don't declare support for 5ghz if not supported
Eliad Peller [Mon, 26 May 2014 15:11:37 +0000 (18:11 +0300)]
iwlwifi: don't declare support for 5ghz if not supported

Remove a useless debug print about unsupported channels.
Also add a comment about the LAR special case where channels
might become valid later.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: ignore IBSS flag as regulatory NO-IR indication
Arik Nemtsov [Thu, 30 Oct 2014 13:12:39 +0000 (15:12 +0200)]
iwlwifi: ignore IBSS flag as regulatory NO-IR indication

According to updated regulatory guidelines, the ACTIVE bit in the NVM
also allows ibss activity on the channel. The IBSS NVM bit is not updated
when LAR is active and is deprecated. Using this bit for NO-IR incorrectly
causes all 5Ghz channels to be marked as passive.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: consider LAR support during NVM parse
Arik Nemtsov [Sun, 23 Mar 2014 14:18:40 +0000 (16:18 +0200)]
iwlwifi: mvm: consider LAR support during NVM parse

Register to cfg80211 with all channels enabled when LAR is supported.
Appropriate channels will later be disabled when a specific regulatory
domain is defined.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: create regdomain from mcc_update_cmd response
Arik Nemtsov [Wed, 5 Mar 2014 10:19:10 +0000 (12:19 +0200)]
iwlwifi: create regdomain from mcc_update_cmd response

Parse the NVM channel data and create a regulatory domain with a rule
for every 20Mhz channel. Use the AUTO_BW flag so the regulatory core
can unify single-channel rules into ranges.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: init country code on init/recovery
Arik Nemtsov [Tue, 4 Mar 2014 17:58:46 +0000 (19:58 +0200)]
iwlwifi: mvm: init country code on init/recovery

During init queue a regulatory update to retrieve the default
regulatory settings from FW. If we're during recovery, only replay the
current country code to FW, if it exists.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: add MCC update FW API
Arik Nemtsov [Tue, 4 Mar 2014 17:54:12 +0000 (19:54 +0200)]
iwlwifi: mvm: add MCC update FW API

The new API sets an MCC (mobile country code) to FW and receives a
channel structure to be used as a basis for an updated regulatory domain.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: fix max_ht_ampdu_exponent for older devices
Emmanuel Grumbach [Mon, 23 Feb 2015 00:40:07 +0000 (02:40 +0200)]
iwlwifi: fix max_ht_ampdu_exponent for older devices

The commit below didn't update the max_ht_ampdu_exponent
for the devices listed in iwl-[1-6]000.c which, in result,
became 0 instead of 8K. This reduced the size of the Rx
AMPDU from 64K to 8K which had an impact in the Rx
throughput. One user reported that because of this, his
downstream throughput droppped by a half.

CC: <stable@vger.kernel.org> [3.19]
Fixes: c064ddf318aa ("iwlwifi: change max HT and VHT A-MPDU exponent")
Reported-and-tested-by: Valentin Manea <linux-wireless@mrs.ro>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: mvm: disconnect if CSA time event fails scheduling
Johannes Berg [Tue, 10 Mar 2015 09:47:57 +0000 (10:47 +0100)]
iwlwifi: mvm: disconnect if CSA time event fails scheduling

If this situation ever happens, the mac80211 state machine gets
confused because it never clears csa_active. There was a separate
bug that lead to this happening with a working connection, but it
isn't very robust to try to keep the connection up in this case.

When removing the time event the CSA essentially procedure stops,
so the safest thing to do is to disconnect in this case.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agoiwlwifi: dvm: drop VO packets when mac80211 tells us to
Emmanuel Grumbach [Tue, 10 Mar 2015 20:42:50 +0000 (22:42 +0200)]
iwlwifi: dvm: drop VO packets when mac80211 tells us to

mac80211 now informs the driver when to drop the packets
upon flush(). This will happen before disconnecting, or
before we shut down the interface. We can now rely on this
to drop all the packets including the VO queues.
When mac80211 sets drop to false, wait for all the queues
to be empty.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9 years agonet/mlx5_core: don't export static symbol
Julia Lawall [Wed, 11 Mar 2015 16:56:25 +0000 (17:56 +0100)]
net/mlx5_core: don't export static symbol

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

// <smpl>
@r@
type T;
identifier f;
@@

static T f (...) { ... }

@@
identifier r.f;
declarer name EXPORT_SYMBOL;
@@

-EXPORT_SYMBOL(f);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agorhashtable: Add annotation to nested lock
Herbert Xu [Thu, 12 Mar 2015 03:47:13 +0000 (14:47 +1100)]
rhashtable: Add annotation to nested lock

Commit aa34a6cb0478842452bac58edb50d3ef9e178c92 ("rhashtable:
Add arbitrary rehash function") killed the annotation on the
nested lock which leads to bitching from lockdep.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fix CONFIG_NET_NS=n compilation
Eric Dumazet [Thu, 12 Mar 2015 03:27:52 +0000 (20:27 -0700)]
net: fix CONFIG_NET_NS=n compilation

I forgot to use write_pnet() in three locations.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Fixes: 33cf7c90fe2f9 ("net: add real socket cookies")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoipv6: expose RFC4191 route preference via rtnetlink
Lubomir Rintel [Wed, 11 Mar 2015 14:39:21 +0000 (15:39 +0100)]
ipv6: expose RFC4191 route preference via rtnetlink

This makes it possible to retain the route preference when RAs are handled in
userspace.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoswitchdev: correct spelling of notifier in comments
Simon Horman [Thu, 12 Mar 2015 01:42:50 +0000 (10:42 +0900)]
switchdev: correct spelling of notifier in comments

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agovxlan: Correct path typo in comment
Simon Horman [Thu, 12 Mar 2015 02:00:10 +0000 (11:00 +0900)]
vxlan: Correct path typo in comment

Flags are used in the return path rather than the return patch.

Fixes: af33c1adae1e ("vxlan: Eliminate dependency on UDP socket in transmit path")
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: add real socket cookies
Eric Dumazet [Thu, 12 Mar 2015 01:53:14 +0000 (18:53 -0700)]
net: add real socket cookies

A long standing problem in netlink socket dumps is the use
of kernel socket addresses as cookies.

1) It is a security concern.

2) Sockets can be reused quite quickly, so there is
   no guarantee a cookie is used once and identify
   a flow.

3) request sock, establish sock, and timewait socks
   for a given flow have different cookies.

Part of our effort to bring better TCP statistics requires
to switch to a different allocator.

In this patch, I chose to use a per network namespace 64bit generator,
and to use it only in the case a socket needs to be dumped to netlink.
(This might be refined later if needed)

Note that I tried to carry cookies from request sock, to establish sock,
then timewait sockets.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Eric Salo <salo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Only display main table in /proc/net/route
Alexander Duyck [Wed, 11 Mar 2015 23:36:08 +0000 (16:36 -0700)]
fib_trie: Only display main table in /proc/net/route

When we merged the tries for local and main I had overlooked the iterator
for /proc/net/route.  As a result it was outputting both local and main
when the two tries were merged.

This patch resolves that by only providing output for aliases that are
actually in the main trie.  As a result we should go back to the original
behavior which I assume will be necessary to maintain legacy support.

Fixes: 0ddcf43d5 ("ipv4: FIB Local/MAIN table collapse")
Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'dsa_phy_divert'
David S. Miller [Wed, 11 Mar 2015 21:56:39 +0000 (17:56 -0400)]
Merge branch 'dsa_phy_divert'

Florian Fainelli says:

====================
net: dsa: support PHY reads/writes diversion

This patch series completes the PHY reads/writes diversion when we need to use
the slave MII bus provided by DSA and the underlying switch drivers to
implement the real PHY reads and writes. This is particularly useful when they
are conflicting MDIO bus addresses as in the case of multiple Broadcom switches
connected to each other (internal and external, or just external).
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: dsa: fully divert PHY reads/writes if requested
Florian Fainelli [Tue, 10 Mar 2015 23:57:13 +0000 (16:57 -0700)]
net: dsa: fully divert PHY reads/writes if requested

In case a PHY is found via Device Tree, and is also flagged by the
switch driver as needing indirect reads/writes using the switch driver
implemented MDIO bus, make sure that we bind this PHY to the slave MII
bus in order for this to happen.

Without this, we would succeed in having the PHY driver probe()'s
function to use slave MII bus read/write functions, because this is done
during dsa_slave_mii_init(), but past that point, the PHY driver would
not go through these diverted reads and writes.

Fixes: 0d8bcdd383b88 ("net: dsa: allow for more complex PHY setups")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: dsa: move PHY setup on DSA MII bus to its own function
Florian Fainelli [Tue, 10 Mar 2015 23:57:12 +0000 (16:57 -0700)]
net: dsa: move PHY setup on DSA MII bus to its own function

In preparation for dealing with indirect reads and writes towards
certain PHY devices, move the code which deals with binding the PHY
device to the slave MII bus created by DSA to its own function:
dsa_slave_phy_connect().

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoof: mdio: export of_mdio_parse_addr
Florian Fainelli [Tue, 10 Mar 2015 23:57:11 +0000 (16:57 -0700)]
of: mdio: export of_mdio_parse_addr

Export of_mdio_parse_addr() which allows parsing a given Ethernet PHY
node MDIO address, verify it is within the allowed range, and return
its value. This is going to be useful for the DSA code which needs to
deal with multiple layers of MDIO buses.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: bcmgenet: collect Rx discarded packet count
Petri Gynther [Tue, 10 Mar 2015 22:55:00 +0000 (15:55 -0700)]
net: bcmgenet: collect Rx discarded packet count

Bits 31:16 of RDMA_PROD_INDEX contain Rx discarded packet count, which
are the Rx packets that had to be dropped by MAC hardware since there
was no room on the Rx queue. Add code to collect this information into
the netdev stats.

Signed-off-by: Petri Gynther <pgynther@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agofib_trie: Fix uninitialized variable warning
Alexander Duyck [Wed, 11 Mar 2015 21:02:16 +0000 (14:02 -0700)]
fib_trie: Fix uninitialized variable warning

The 0-day kernel test infrastructure reported a use of uninitialized
variable warning for local_table due to the fact that the local and main
allocations had been swapped from the original setup.  This change corrects
that by making it so that we free the main table if the local table
allocation fails.

Fixes: 0ddcf43d5 ("ipv4: FIB Local/MAIN table collapse")

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>