]> git.kernelconcepts.de Git - karo-tx-linux.git/log
karo-tx-linux.git
8 years agoiwlwifi: mvm: Implement per vif frame registration API
Andrei Otcheretianski [Tue, 30 Jun 2015 09:08:28 +0000 (12:08 +0300)]
iwlwifi: mvm: Implement per vif frame registration API

Implement config_iface_filter() driver op. Currently support only
probe request registration for p2p client vifs, by setting
MAC_FILTER_IN_PROBE_REQUEST flag in MAC_CONTEXT_CMD.
This is needed since WFDS spec and certification require a P2P client
to be discoverable on its operating channel.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: avoid read/write operations if the bus is dead
Eliad Peller [Thu, 10 Sep 2015 12:00:22 +0000 (15:00 +0300)]
iwlwifi: avoid read/write operations if the bus is dead

Recovery takes too much time if the bus is dead (each timeout
is 2000ms, etc.).
Explicitly skip fw dump in this case, as it will result in
garbage data (and might take signifcant time)

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: Add support for two scheduled scan plans
Avraham Stern [Wed, 19 Aug 2015 09:46:12 +0000 (12:46 +0300)]
iwlwifi: mvm: Add support for two scheduled scan plans

Add support for two scan plans for scheduled scan. The first plan
will run for a limited number of iterations, then the second plan
will run infinitely.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: let any command flag be passed to iwl_mvm_flushtx_path()
Luca Coelho [Tue, 6 Oct 2015 06:54:57 +0000 (09:54 +0300)]
iwlwifi: mvm: let any command flag be passed to iwl_mvm_flushtx_path()

Instead of only allowing the caller to decide whether the CMD_ASYNC
flag is set, let it pass the entire flags bitmask.  This allows more
flexibility and will be needed when we call this function in the
suspend flow (where other flags are needed).

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: Allow setting ctrl-chnl-position in FTM responder
Assaf Krauss [Wed, 12 Aug 2015 14:52:12 +0000 (17:52 +0300)]
iwlwifi: mvm: Allow setting ctrl-chnl-position in FTM responder

This patch enables the debugfs user to configure an FTM responder
with the appropriate control channel position.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: use short timeouts in P2P low latency if supported
Johannes Berg [Tue, 6 Oct 2015 12:07:44 +0000 (14:07 +0200)]
iwlwifi: mvm: use short timeouts in P2P low latency if supported

Those timeouts are used for AM-to-PSM transition.
We already have those pairs defined for default and WOWLAN use cases.
We expect that by using shorter threshold for low latency P2P,
e.g. for Miracast video scenario, we might save a considerable amount of power.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Avri Altman <avri.altman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: use wowlan RX/TX timeouts in D0i3
Johannes Berg [Tue, 6 Oct 2015 11:28:48 +0000 (13:28 +0200)]
iwlwifi: mvm: use wowlan RX/TX timeouts in D0i3

In "hostless" mode (D3 or D0i3) the same parameters were intended
to be used, but the code doesn't do that properly. Fix it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Avri Altman <avri.altman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: correctly request DTS-measure for new cards
Arik Nemtsov [Tue, 6 Oct 2015 09:22:47 +0000 (12:22 +0300)]
iwlwifi: mvm: correctly request DTS-measure for new cards

Since the 8000 series, the DTS measurement request command has been
changed. Use an ucode capability flag to determine which version is
supported and send the extended command when needed.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: fix (again) prepare card flow
Emmanuel Grumbach [Wed, 21 Oct 2015 16:55:32 +0000 (19:55 +0300)]
iwlwifi: pcie: fix (again) prepare card flow

The hardware bug in the commit mentioned below forces us
not to re-enable the clock gating in the Host Cluster.
The impact on the power consumption is minimal and it allows
the WAKE_ME interrupt to propagate.

CC: <stable@vger.kernel.org> [4.1+]
Fixes: c9fdec9f3970 ("iwlwifi: pcie: fix prepare card flow")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: Dump FW's virtual image in the case of a NIC error
Matti Gottlieb [Mon, 20 Jul 2015 14:55:51 +0000 (17:55 +0300)]
iwlwifi: mvm: Dump FW's virtual image in the case of a NIC error

When paging is enabled the driver stores part of the FW's
image in the DRAM.

Dump FW's virtual image in the case of a NIC error.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: rs: Remove workaround that disables MIMO on P2P
Alexander Bondar [Thu, 3 Sep 2015 12:42:09 +0000 (15:42 +0300)]
iwlwifi: rs: Remove workaround that disables MIMO on P2P

Remove an old workaround that's no longer needed and
enable MIMO on P2P interfaces.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoMerge remote-tracking branch 'mac80211-next/master' into next
Emmanuel Grumbach [Sun, 25 Oct 2015 10:38:20 +0000 (12:38 +0200)]
Merge remote-tracking branch 'mac80211-next/master' into next

8 years agomac80211: move station statistics into sub-structs
Johannes Berg [Fri, 16 Oct 2015 15:54:47 +0000 (17:54 +0200)]
mac80211: move station statistics into sub-structs

Group station statistics by where they're (mostly) updated
(TX, RX and TX-status) and group them into sub-structs of
the struct sta_info.

Also rename the variables since the grouping now makes it
obvious where they belong.

This makes it easier to identify where the statistics are
updated in the code, and thus easier to think about them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: move beacon_loss_count into ifmgd
Johannes Berg [Fri, 16 Oct 2015 15:18:11 +0000 (17:18 +0200)]
mac80211: move beacon_loss_count into ifmgd

There's little point in keeping (and even sending to userspace)
the beacon_loss_count value per station, since it can only apply
to the AP on a managed-mode connection. Move the value to ifmgd,
advertise it only in managed mode, and remove it from ethtool as
it's available through better interfaces.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: remove sta->last_ack_signal
Johannes Berg [Fri, 16 Oct 2015 14:55:51 +0000 (16:55 +0200)]
mac80211: remove sta->last_ack_signal

This file only feeds a debugfs file that isn't very useful, so remove
it. If necessary, we can add other ways to get this information, for
example in the NL80211_CMD_PROBE_CLIENT response.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: reg: fix reg_ignore_cell_hint return type
Johannes Berg [Thu, 15 Oct 2015 12:28:56 +0000 (14:28 +0200)]
cfg80211: reg: fix reg_ignore_cell_hint return type

The return type should be enum reg_request_treatment for both
branches of the #ifdef.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: reg: reduce chan_reg_rule_print_dbg() ifdef
Johannes Berg [Thu, 15 Oct 2015 12:27:04 +0000 (14:27 +0200)]
cfg80211: reg: reduce chan_reg_rule_print_dbg() ifdef

The function is void and static, so just ifdef its contents
instead of duplicating the declaration.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: reg: fix antenna gain in chan_reg_rule_print_dbg()
Johannes Berg [Thu, 15 Oct 2015 11:35:45 +0000 (13:35 +0200)]
cfg80211: reg: fix antenna gain in chan_reg_rule_print_dbg()

Printing "N/A mBi" is strange - print just "N/A" instead.

Also add a missing opening parenthesis.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: reg: centralize freeing ignored requests
Johannes Berg [Thu, 15 Oct 2015 11:05:55 +0000 (13:05 +0200)]
cfg80211: reg: centralize freeing ignored requests

Instead of having a lot of places that free ignored requests
and then return REG_REQ_OK, make reg_process_hint() process
REG_REQ_IGNORE by freeing the request, and let functions it
calls return that instead of freeing.

This also fixes a leak when a second (different) country IE
hint was ignored.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: reg: clarify 'treatment' handling in reg_process_hint()
Johannes Berg [Thu, 15 Oct 2015 10:58:58 +0000 (12:58 +0200)]
cfg80211: reg: clarify 'treatment' handling in reg_process_hint()

This function can only deal with treatment values OK and ALREADY_SET
so make the callees not return anything else and warn if they do.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: reg: rename reg_regdb_query() to reg_query_builtin()
Johannes Berg [Thu, 15 Oct 2015 08:22:12 +0000 (10:22 +0200)]
cfg80211: reg: rename reg_regdb_query() to reg_query_builtin()

The new name better reflects the functionality.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: reg: make CRDA support optional
Johannes Berg [Thu, 15 Oct 2015 07:25:18 +0000 (09:25 +0200)]
cfg80211: reg: make CRDA support optional

If there's a built-in regulatory database, there may be little point
in also calling out to CRDA and failing if the system is configured
that way. Allow removing CRDA support to save ~1K kernel size.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: reg: remove useless reg_timeout scheduling
Johannes Berg [Thu, 15 Oct 2015 07:12:49 +0000 (09:12 +0200)]
cfg80211: reg: remove useless reg_timeout scheduling

When the functions reg_set_rd_driver() and reg_set_rd_country_ie()
return with an error, the calling function already restores data
by calling restore_regulatory_settings(), so there's no need to
also schedule a timeout (which would lead to other side effects
such as indicating CRDA failed, which clearly isn't true.) Remove
the scheduling.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: reg: search built-in database directly
Johannes Berg [Thu, 15 Oct 2015 07:03:05 +0000 (09:03 +0200)]
cfg80211: reg: search built-in database directly

Instead of searching the built-in database only in the worker,
search it directly and return an error if the entry cannot be
found (or memory cannot be allocated.) This means that builtin
database queries no longer rely on the timeout.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: reg: rename reg_call_crda to reg_query_database
Johannes Berg [Thu, 15 Oct 2015 06:47:34 +0000 (08:47 +0200)]
cfg80211: reg: rename reg_call_crda to reg_query_database

The new name is more appropriate since in the case of a built-in
database it may not really rely on CRDA.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: reg: fix reg_call_crda() return value bug
Johannes Berg [Thu, 15 Oct 2015 10:05:05 +0000 (12:05 +0200)]
cfg80211: reg: fix reg_call_crda() return value bug

The function reg_call_crda() can't actually validly return
REG_REQ_IGNORE as it does now when calling CRDA fails since
that return value isn't handled properly. Fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: reg: remove useless non-NULL check
Johannes Berg [Thu, 15 Oct 2015 06:44:32 +0000 (08:44 +0200)]
cfg80211: reg: remove useless non-NULL check

There's no way that the alpha2 pointer can be NULL, so
no point in checking that it isn't.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: fix gHz to GHz
Johannes Berg [Thu, 15 Oct 2015 14:16:09 +0000 (16:16 +0200)]
cfg80211: fix gHz to GHz

There's no "g" prefix, only "G" (1e9) that was clearly intended here.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: remove event.c
Johannes Berg [Wed, 14 Oct 2015 16:40:10 +0000 (18:40 +0200)]
mac80211: remove event.c

That file contains just a single function, which itself is just a
single statement to call a different function. Remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: remove cfg.h
Johannes Berg [Wed, 14 Oct 2015 16:36:43 +0000 (18:36 +0200)]
mac80211: remove cfg.h

The file contains just a single declaration that can easily
move to another file - remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: move sta_set_rate_info_rx() and make it static
Johannes Berg [Wed, 14 Oct 2015 16:31:30 +0000 (18:31 +0200)]
mac80211: move sta_set_rate_info_rx() and make it static

There's only a single caller of this function, so it can
be moved to the same file and made static.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: clean up ieee80211_rx_h_check_dup code
Johannes Berg [Wed, 14 Oct 2015 16:27:07 +0000 (18:27 +0200)]
mac80211: clean up ieee80211_rx_h_check_dup code

Reduce indentation a bit to make the condition more readable.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: remove PM-QoS listener
Johannes Berg [Wed, 14 Oct 2015 16:02:43 +0000 (18:02 +0200)]
mac80211: remove PM-QoS listener

As this API has never really seen any use and most drivers don't
ever use the value derived from it, remove it.

Change the only driver using it (rt2x00) to simply use the DTIM
period instead of the "max sleep" time.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: use new cfg80211_inform_bss_frame_data() API
Johannes Berg [Tue, 13 Oct 2015 09:36:21 +0000 (11:36 +0200)]
mac80211: use new cfg80211_inform_bss_frame_data() API

The new API is more easily extensible with a metadata struct
passed to it, use it in mac80211.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: Do not restart scheduled scan if multiple scan plans are set
Avraham Stern [Mon, 12 Oct 2015 06:51:35 +0000 (09:51 +0300)]
mac80211: Do not restart scheduled scan if multiple scan plans are set

If multiple scan plans were set for scheduled scan, do not restart
scheduled scan on reconfig because it is possible that some scan
plans were already completed and there is no need to run them all
over again. Instead, notify userspace that scheduled scan stopped
so it can configure new scan plans for scheduled scan.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: Add multiple scan plans for scheduled scan
Avraham Stern [Mon, 12 Oct 2015 06:51:34 +0000 (09:51 +0300)]
cfg80211: Add multiple scan plans for scheduled scan

Add the option to configure multiple 'scan plans' for scheduled scan.
Each 'scan plan' defines the number of scan cycles and the interval
between scans. The scan plans are executed in the order they were
configured. The last scan plan will always run infinitely and thus
defines only the interval between scans.
The maximum number of scan plans supported by the device and the
maximum number of iterations in a single scan plan are advertised
to userspace so it can configure the scan plans appropriately.

When scheduled scan results are received there is no way to know which
scan plan is being currently executed, so there is no way to know when
the next scan iteration will start. This is not a problem, however.
The scan start timestamp is only used for flushing old scan results,
and there is no difference between flushing all results received until
the end of the previous iteration or the start of the current one,
since no results will be received in between.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agowireless: add WNM action frame categories
Johannes Berg [Wed, 7 Oct 2015 13:48:26 +0000 (15:48 +0200)]
wireless: add WNM action frame categories

Add the WNM and unprotected WNM categories and mark the latter
as not robust.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agowireless: update robust action frame list
Johannes Berg [Wed, 7 Oct 2015 13:48:25 +0000 (15:48 +0200)]
wireless: update robust action frame list

Unprotected DMG and VHT action frames are not protected, reflect
that in the list.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agonl80211: allow BSS data to include CLOCK_BOOTTIME timestamp
Dmitry Shmidt [Wed, 7 Oct 2015 09:32:53 +0000 (11:32 +0200)]
nl80211: allow BSS data to include CLOCK_BOOTTIME timestamp

For location and connectivity services, userspace would often like
to know the time when the BSS was last seen. The current "last seen"
value is calculated in a way that makes it less useful, especially
if the system suspended in the meantime.

Add the ability for the driver to report a real CLOCK_BOOTTIME stamp
that can then be reported to userspace (if present).

Drivers wishing to use this must be converted to the new API to call
cfg80211_inform_bss_data() or cfg80211_inform_bss_frame_data(). They
need to ensure the reported value is accurate enough even when the
frame might have been buffered in the device (e.g. firmware.)

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
[modified to use struct, inlines]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agoRevert "mac80211: remove exposing 'mfp' to drivers"
Tamizh chelvam [Wed, 7 Oct 2015 05:10:04 +0000 (10:40 +0530)]
Revert "mac80211: remove exposing 'mfp' to drivers"

This reverts commit 5c48f1201744233d4f235c7dd916d5196ed20716.

Some device drivers (ath10k) offload part of aggregation including AddBA/DelBA
negotiations to firmware. In such scenario, the PMF configuration of
the station needs to be provided to driver to enable encryption of
AddBA/DelBA action frames.

Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agoMerge remote-tracking branch 'net-next/master' into mac80211-next
Johannes Berg [Tue, 13 Oct 2015 08:28:16 +0000 (10:28 +0200)]
Merge remote-tracking branch 'net-next/master' into mac80211-next

Merge net-next to get some driver changes that patches depend
on (in order to avoid conflicts).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agobridge: vlan: enforce no pvid flag in vlan ranges
Nikolay Aleksandrov [Sun, 11 Oct 2015 10:49:56 +0000 (12:49 +0200)]
bridge: vlan: enforce no pvid flag in vlan ranges

Currently it's possible for someone to send a vlan range to the kernel
with the pvid flag set which will result in the pvid bouncing from a
vlan to vlan and isn't correct, it also introduces problems for hardware
where it doesn't make sense having more than 1 pvid. iproute2 already
enforces this, so let's enforce it on kernel-side as well.

Reported-by: Elad Raz <eladr@mellanox.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoatm: iphase: fix misleading indention
Tillmann Heidsieck [Sat, 10 Oct 2015 19:47:19 +0000 (21:47 +0200)]
atm: iphase: fix misleading indention

Fix a smatch warning:
drivers/atm/iphase.c:1178 rx_pkt() warn: curly braces intended?

The code is correct, the indention is misleading. In case the allocation
of skb fails, we want to skip to the end.

Signed-off-by: Tillmann Heidsieck <theidsieck@leenox.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoatm: iphase: return -ENOMEM instead of -1 in case of failed kmalloc()
Tillmann Heidsieck [Sat, 10 Oct 2015 19:47:18 +0000 (21:47 +0200)]
atm: iphase: return -ENOMEM instead of -1 in case of failed kmalloc()

Smatch complains about returning hard coded error codes, silence this
warning.

drivers/atm/iphase.c:115 ia_enque_rtn_q() warn: returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Tillmann Heidsieck <theidsieck@leenox.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoipv6 route: use err pointers instead of returning pointer by reference
Roopa Prabhu [Sat, 10 Oct 2015 15:26:36 +0000 (08:26 -0700)]
ipv6 route: use err pointers instead of returning pointer by reference

This patch makes ip6_route_info_create return err pointer instead of
returning the rt pointer by reference as suggested  by Dave

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: hns: fix the unknown phy_nterface_t type error
huangdaode [Sat, 10 Oct 2015 09:20:38 +0000 (17:20 +0800)]
net: hns: fix the unknown phy_nterface_t type error

This patch fix the building error reported by Jiri Pirko <jiri@resnulli.us>

drivers/net/ethernet/hisilicon/hns/hnae.h:465:2: error: unknown type
name 'phy_interface_t'
        phy_interface_t phy_if;
^
the full build log is on https://lists.01.org/pipermail/kbuild-all.

Signed-off-by: huangdaode <huangdaode@hisilicon.com>
Signed-off-by: yankejian <yankejian@huawei.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotun: use sk_fullsock() before reading sk->sk_tsflags
Eric Dumazet [Fri, 9 Oct 2015 22:42:21 +0000 (15:42 -0700)]
tun: use sk_fullsock() before reading sk->sk_tsflags

timewait or request sockets are small and do not contain sk->sk_tsflags

Without this fix, we might read garbage, and crash later in

__skb_complete_tx_timestamp()
 -> sock_queue_err_skb()

(These pseudo sockets do not have an error queue either)

Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of listener")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'netns-defrag'
David S. Miller [Tue, 13 Oct 2015 02:44:22 +0000 (19:44 -0700)]
Merge branch 'netns-defrag'

Eric W. Biederman says:

====================
net: Pass net into defragmentation

This is the next installment of my work to pass struct net through the
output path so the code does not need to guess how to figure out which
network namespace it is in, and ultimately routes can have output
devices in another network namespace.

In netfilter and af_packet we defragment packets in the output path,
and there is the usual amount of confusion about how to compute which
net we are processing the packets in.  This patchset clears that
confusion up by explicitly passing in struct net in ip_defrag,
ip_check_defrag, and nf_ct_frag6_gather.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoipv6: Pass struct net into nf_ct_frag6_gather
Eric W. Biederman [Fri, 9 Oct 2015 18:44:55 +0000 (13:44 -0500)]
ipv6: Pass struct net into nf_ct_frag6_gather

The function nf_ct_frag6_gather is called on both the input and the
output paths of the networking stack.  In particular ipv6_defrag which
calls nf_ct_frag6_gather is called from both the the PRE_ROUTING chain
on input and the LOCAL_OUT chain on output.

The addition of a net parameter makes it explicit which network
namespace the packets are being reassembled in, and removes the need
for nf_ct_frag6_gather to guess.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoipv4: Pass struct net into ip_defrag and ip_check_defrag
Eric W. Biederman [Fri, 9 Oct 2015 18:44:54 +0000 (13:44 -0500)]
ipv4: Pass struct net into ip_defrag and ip_check_defrag

The function ip_defrag is called on both the input and the output
paths of the networking stack.  In particular conntrack when it is
tracking outbound packets from the local machine calls ip_defrag.

So add a struct net parameter and stop making ip_defrag guess which
network namespace it needs to defragment packets in.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoipv4: Only compute net once in ip_call_ra_chain
Eric W. Biederman [Fri, 9 Oct 2015 18:44:53 +0000 (13:44 -0500)]
ipv4: Only compute net once in ip_call_ra_chain

ip_call_ra_chain is called early in the forwarding chain from
ip_forward and ip_mr_input, which makes skb->dev the correct
expression to get the input network device and dev_net(skb->dev) a
correct expression for the network namespace the packet is being
processed in.

Compute the network namespace and store it in a variable to make the
code clearer.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agopacket: fix match_fanout_group()
Eric Dumazet [Fri, 9 Oct 2015 18:29:32 +0000 (11:29 -0700)]
packet: fix match_fanout_group()

Recent TCP listener patches exposed a prior af_packet bug :
match_fanout_group() blindly assumes it is always safe
to cast sk to a packet socket to compare fanout with af_packet_priv

But SYNACK packets can be sent while attached to request_sock, which
are smaller than a "struct sock".

We can read non existent memory and crash.

Fixes: c0de08d04215 ("af_packet: don't emit packet on orig fanout group")
Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of listener")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Eric Leblond <eric@regit.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge tag 'wireless-drivers-next-for-davem-2015-10-09' of git://git.kernel.org/pub...
David S. Miller [Tue, 13 Oct 2015 02:39:18 +0000 (19:39 -0700)]
Merge tag 'wireless-drivers-next-for-davem-2015-10-09' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next

Kalle Valo says:

====================
Major changes:

iwlwifi

* some debugfs improvements
* fix signedness in beacon statistics
* deinline some functions to reduce size when device tracing is enabled
* filter beacons out in AP mode when no stations are associated
* deprecate firmwares version -12
* fix a runtime PM vs. legacy suspend race
* one-liner fix for a ToF bug
* clean-ups in the rx code
* small debugging improvement
* fix WoWLAN with new firmware versions
* more clean-ups towards multiple RX queues;
* some rate scaling fixes and improvements;
* some time-of-flight fixes;
* other generic improvements and clean-ups;

brcmfmac

* rework code dealing with multiple interfaces
* allow logging firmware console using debug level
* support for BCM4350, BCM4365, and BCM4366 PCIE devices
* fixed for legacy P2P and P2P device handling
* correct set and get tx-power

ath9k

* add support for Outside Context of a BSS (OCB) mode

mwifiex

* add USB multichannel feature
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoipv4/icmp: redirect messages can use the ingress daddr as source
Paolo Abeni [Fri, 9 Oct 2015 12:34:31 +0000 (14:34 +0200)]
ipv4/icmp: redirect messages can use the ingress daddr as source

This patch allows configuring how the source address of ICMP
redirect messages is selected; by default the old behaviour is
retained, while setting icmp_redirects_use_orig_daddr force the
usage of the destination address of the packet that caused the
redirect.

The new behaviour fits closely the RFC 5798 section 8.1.1, and fix the
following scenario:

Two machines are set up with VRRP to act as routers out of a subnet,
they have IPs x.x.x.1/24 and x.x.x.2/24, with VRRP holding on to
x.x.x.254/24.

If a host in said subnet needs to get an ICMP redirect from the VRRP
router, i.e. to reach a destination behind a different gateway, the
source IP in the ICMP redirect is chosen as the primary IP on the
interface that the packet arrived at, i.e. x.x.x.1 or x.x.x.2.

The host will then ignore said redirect, due to RFC 1122 section 3.2.2.2,
and will continue to use the wrong next-op.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobridge: try switchdev op first in __vlan_vid_add/del
Jiri Pirko [Fri, 9 Oct 2015 11:54:11 +0000 (13:54 +0200)]
bridge: try switchdev op first in __vlan_vid_add/del

Some drivers need to implement both switchdev vlan ops and
vid_add/kill ndos. For that to work in bridge code, we need to try
switchdev op first when adding/deleting vlan id.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoBNX2: free temp_stats_blk on error path
wangweidong [Tue, 13 Oct 2015 02:05:19 +0000 (10:05 +0800)]
BNX2: free temp_stats_blk on error path

In bnx2_init_board, missing free temp_stats_blk on error path when
some operations do failed. Just add the 'kfree' operation.

Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'setsockopt_incoming_cpu'
David S. Miller [Tue, 13 Oct 2015 02:28:32 +0000 (19:28 -0700)]
Merge branch 'setsockopt_incoming_cpu'

Eric Dumazet says:

====================
tcp: better smp listener behavior

As promised in last patch series, we implement a better SO_REUSEPORT
strategy, based on cpu hints if given by the application.

We also moved sk_refcnt out of the cache line containing the lookup
keys, as it was considerably slowing down smp operations because
of false sharing. This was simpler than converting listen sockets
to conventional RCU (to avoid sk_refcnt dirtying)

Could process 6.0 Mpps SYN instead of 4.2 Mpps on my test server.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotcp: shrink tcp_timewait_sock by 8 bytes
Eric Dumazet [Fri, 9 Oct 2015 02:33:24 +0000 (19:33 -0700)]
tcp: shrink tcp_timewait_sock by 8 bytes

Reducing tcp_timewait_sock from 280 bytes to 272 bytes
allows SLAB to pack 15 objects per page instead of 14 (on x86)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: shrink struct sock and request_sock by 8 bytes
Eric Dumazet [Fri, 9 Oct 2015 02:33:23 +0000 (19:33 -0700)]
net: shrink struct sock and request_sock by 8 bytes

One 32bit hole is following skc_refcnt, use it.
skc_incoming_cpu can also be an union for request_sock rcv_wnd.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: align sk_refcnt on 128 bytes boundary
Eric Dumazet [Fri, 9 Oct 2015 02:33:22 +0000 (19:33 -0700)]
net: align sk_refcnt on 128 bytes boundary

sk->sk_refcnt is dirtied for every TCP/UDP incoming packet.
This is a performance issue if multiple cpus hit a common socket,
or multiple sockets are chained due to SO_REUSEPORT.

By moving sk_refcnt 8 bytes further, first 128 bytes of sockets
are mostly read. As they contain the lookup keys, this has
a considerable performance impact, as cpus can cache them.

These 8 bytes are not wasted, we use them as a place holder
for various fields, depending on the socket type.

Tested:
 SYN flood hitting a 16 RX queues NIC.
 TCP listener using 16 sockets and SO_REUSEPORT
 and SO_INCOMING_CPU for proper siloing.

 Could process 6.0 Mpps SYN instead of 4.2 Mpps

 Kernel profile looked like :
    11.68%  [kernel]  [k] sha_transform
     6.51%  [kernel]  [k] __inet_lookup_listener
     5.07%  [kernel]  [k] __inet_lookup_established
     4.15%  [kernel]  [k] memcpy_erms
     3.46%  [kernel]  [k] ipt_do_table
     2.74%  [kernel]  [k] fib_table_lookup
     2.54%  [kernel]  [k] tcp_make_synack
     2.34%  [kernel]  [k] tcp_conn_request
     2.05%  [kernel]  [k] __netif_receive_skb_core
     2.03%  [kernel]  [k] kmem_cache_alloc

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: SO_INCOMING_CPU setsockopt() support
Eric Dumazet [Fri, 9 Oct 2015 02:33:21 +0000 (19:33 -0700)]
net: SO_INCOMING_CPU setsockopt() support

SO_INCOMING_CPU as added in commit 2c8c56e15df3 was a getsockopt() command
to fetch incoming cpu handling a particular TCP flow after accept()

This commits adds setsockopt() support and extends SO_REUSEPORT selection
logic : If a TCP listener or UDP socket has this option set, a packet is
delivered to this socket only if CPU handling the packet matches the specified
one.

This allows to build very efficient TCP servers, using one listener per
RX queue, as the associated TCP listener should only accept flows handled
in softirq by the same cpu.
This provides optimal NUMA behavior and keep cpu caches hot.

Note that __inet_lookup_listener() still has to iterate over the list of
all listeners. Following patch puts sk_refcnt in a different cache line
to let this iteration hit only shared and read mostly cache lines.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agopacket: support per-packet fwmark for af_packet sendmsg
Edward Jee [Thu, 8 Oct 2015 21:56:49 +0000 (14:56 -0700)]
packet: support per-packet fwmark for af_packet sendmsg

Signed-off-by: Edward Hyunkoo Jee <edjee@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosock: support per-packet fwmark
Edward Jee [Thu, 8 Oct 2015 21:56:48 +0000 (14:56 -0700)]
sock: support per-packet fwmark

It's useful to allow users to set fwmark for an individual packet,
without changing the socket state. The function this patch adds in
sock layer can be used by the protocols that need such a feature.

Signed-off-by: Edward Hyunkoo Jee <edjee@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'bpf-unprivileged'
David S. Miller [Tue, 13 Oct 2015 02:13:41 +0000 (19:13 -0700)]
Merge branch 'bpf-unprivileged'

Alexei Starovoitov says:

====================
bpf: unprivileged

v1-v2:
- this set logically depends on cb patch
  "bpf: fix cb access in socket filter programs":
  http://patchwork.ozlabs.org/patch/527391/
  which is must have to allow unprivileged programs.
  Thanks Daniel for finding that issue.
- refactored sysctl to be similar to 'modules_disabled'
- dropped bpf_trace_printk
- split tests into separate patch and added more tests
  based on discussion

v1 cover letter:
I think it is time to liberate eBPF from CAP_SYS_ADMIN.
As was discussed when eBPF was first introduced two years ago
the only piece missing in eBPF verifier is 'pointer leak detection'
to make it available to non-root users.
Patch 1 adds this pointer analysis.
The eBPF programs, obviously, need to see and operate on kernel addresses,
but with these extra checks they won't be able to pass these addresses
to user space.
Patch 2 adds accounting of kernel memory used by programs and maps.
It changes behavoir for existing root users, but I think it needs
to be done consistently for both root and non-root, since today
programs and maps are only limited by number of open FDs (RLIMIT_NOFILE).
Patch 2 accounts program's and map's kernel memory as RLIMIT_MEMLOCK.

Unprivileged eBPF is only meaningful for 'socket filter'-like programs.
eBPF programs for tracing and TC classifiers/actions will stay root only.

In parallel the bpf fuzzing effort is ongoing and so far
we've found only one verifier bug and that was already fixed.
The 'constant blinding' pass also being worked on.
It will obfuscate constant-like values that are part of eBPF ISA
to make jit spraying attacks even harder.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobpf: add unprivileged bpf tests
Alexei Starovoitov [Thu, 8 Oct 2015 05:23:23 +0000 (22:23 -0700)]
bpf: add unprivileged bpf tests

Add new tests samples/bpf/test_verifier:

unpriv: return pointer
  checks that pointer cannot be returned from the eBPF program

unpriv: add const to pointer
unpriv: add pointer to pointer
unpriv: neg pointer
  checks that pointer arithmetic is disallowed

unpriv: cmp pointer with const
unpriv: cmp pointer with pointer
  checks that comparison of pointers is disallowed
  Only one case allowed 'void *value = bpf_map_lookup_elem(..); if (value == 0) ...'

unpriv: check that printk is disallowed
  since bpf_trace_printk is not available to unprivileged

unpriv: pass pointer to helper function
  checks that pointers cannot be passed to functions that expect integers
  If function expects a pointer the verifier allows only that type of pointer.
  Like 1st argument of bpf_map_lookup_elem() must be pointer to map.
  (applies to non-root as well)

unpriv: indirectly pass pointer on stack to helper function
  checks that pointer stored into stack cannot be used as part of key
  passed into bpf_map_lookup_elem()

unpriv: mangle pointer on stack 1
unpriv: mangle pointer on stack 2
  checks that writing into stack slot that already contains a pointer
  is disallowed

unpriv: read pointer from stack in small chunks
  checks that < 8 byte read from stack slot that contains a pointer is
  disallowed

unpriv: write pointer into ctx
  checks that storing pointers into skb->fields is disallowed

unpriv: write pointer into map elem value
  checks that storing pointers into element values is disallowed
  For example:
  int bpf_prog(struct __sk_buff *skb)
  {
    u32 key = 0;
    u64 *value = bpf_map_lookup_elem(&map, &key);
    if (value)
       *value = (u64) skb;
  }
  will be rejected.

unpriv: partial copy of pointer
  checks that doing 32-bit register mov from register containing
  a pointer is disallowed

unpriv: pass pointer to tail_call
  checks that passing pointer as an index into bpf_tail_call
  is disallowed

unpriv: cmp map pointer with zero
  checks that comparing map pointer with constant is disallowed

unpriv: write into frame pointer
  checks that frame pointer is read-only (applies to root too)

unpriv: cmp of frame pointer
  checks that R10 cannot be using in comparison

unpriv: cmp of stack pointer
  checks that Rx = R10 - imm is ok, but comparing Rx is not

unpriv: obfuscate stack pointer
  checks that Rx = R10 - imm is ok, but Rx -= imm is not

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobpf: charge user for creation of BPF maps and programs
Alexei Starovoitov [Thu, 8 Oct 2015 05:23:22 +0000 (22:23 -0700)]
bpf: charge user for creation of BPF maps and programs

since eBPF programs and maps use kernel memory consider it 'locked' memory
from user accounting point of view and charge it against RLIMIT_MEMLOCK limit.
This limit is typically set to 64Kbytes by distros, so almost all
bpf+tracing programs would need to increase it, since they use maps,
but kernel charges maximum map size upfront.
For example the hash map of 1024 elements will be charged as 64Kbyte.
It's inconvenient for current users and changes current behavior for root,
but probably worth doing to be consistent root vs non-root.

Similar accounting logic is done by mmap of perf_event.

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobpf: enable non-root eBPF programs
Alexei Starovoitov [Thu, 8 Oct 2015 05:23:21 +0000 (22:23 -0700)]
bpf: enable non-root eBPF programs

In order to let unprivileged users load and execute eBPF programs
teach verifier to prevent pointer leaks.
Verifier will prevent
- any arithmetic on pointers
  (except R10+Imm which is used to compute stack addresses)
- comparison of pointers
  (except if (map_value_ptr == 0) ... )
- passing pointers to helper functions
- indirectly passing pointers in stack to helper functions
- returning pointer from bpf program
- storing pointers into ctx or maps

Spill/fill of pointers into stack is allowed, but mangling
of pointers stored in the stack or reading them byte by byte is not.

Within bpf programs the pointers do exist, since programs need to
be able to access maps, pass skb pointer to LD_ABS insns, etc
but programs cannot pass such pointer values to the outside
or obfuscate them.

Only allow BPF_PROG_TYPE_SOCKET_FILTER unprivileged programs,
so that socket filters (tcpdump), af_packet (quic acceleration)
and future kcm can use it.
tracing and tc cls/act program types still require root permissions,
since tracing actually needs to be able to see all kernel pointers
and tc is for root only.

For example, the following unprivileged socket filter program is allowed:
int bpf_prog1(struct __sk_buff *skb)
{
  u32 index = load_byte(skb, ETH_HLEN + offsetof(struct iphdr, protocol));
  u64 *value = bpf_map_lookup_elem(&my_map, &index);

  if (value)
*value += skb->len;
  return 0;
}

but the following program is not:
int bpf_prog1(struct __sk_buff *skb)
{
  u32 index = load_byte(skb, ETH_HLEN + offsetof(struct iphdr, protocol));
  u64 *value = bpf_map_lookup_elem(&my_map, &index);

  if (value)
*value += (u64) skb;
  return 0;
}
since it would leak the kernel address into the map.

Unprivileged socket filter bpf programs have access to the
following helper functions:
- map lookup/update/delete (but they cannot store kernel pointers into them)
- get_random (it's already exposed to unprivileged user space)
- get_smp_processor_id
- tail_call into another socket filter program
- ktime_get_ns

The feature is controlled by sysctl kernel.unprivileged_bpf_disabled.
This toggle defaults to off (0), but can be set true (1).  Once true,
bpf programs and maps cannot be accessed from unprivileged process,
and the toggle cannot be set back to false.

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: HNS: fix MDIO dependencies
Arnd Bergmann [Fri, 9 Oct 2015 12:53:54 +0000 (14:53 +0200)]
net: HNS: fix MDIO dependencies

The newly introduced HNS_MDIO Kconfig symbol selects 'MDIO', but
that is the wrong symbol as the code used by this driver is
provided by PHYLIB rather than the MDIO driver. Also, there is
no need to make this driver user selectable, because it is already
selected by all drivers that need it.

This changes the Kconfig file to select the correct library, and
to make the option silent.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 5b904d39406 ("net: add Hisilicon Network Subsystem MDIO support")
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosfc: fully reset if MC_REBOOT event received without warm_boot_count increment
Daniel Pieczko [Fri, 9 Oct 2015 09:40:35 +0000 (10:40 +0100)]
sfc: fully reset if MC_REBOOT event received without warm_boot_count increment

On EF10, MC_CMD_VPORT_RECONFIGURE can cause a CODE_MC_REBOOT event
to be sent to a function without incrementing the (adapter-wide)
warm_boot_count.  In this case, the reboot is not detected by the
loop on efx_mcdi_poll_reboot(), so prepare for recovery from an MC
reboot anyway.  When this codepath is run, the MC has always just
rebooted, so this recovery is valid.

The loop on efx_mcdi_poll_reboot() is still required for other MC
reboot cases, so that actions in response to an MC reboot are
performed, such as clearing locally calculated statistics.
Siena NICs are unaffected by this change as the above scenario
does not apply.

Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'switchdev_ageing_time'
David S. Miller [Mon, 12 Oct 2015 12:20:28 +0000 (05:20 -0700)]
Merge branch 'switchdev_ageing_time'

Scott Feldman says:

====================
switchdev: push bridge ageing_time attribute down

Push bridge-level attributes down to switchdev drivers.  This patchset
adds the infrastructure and then pushes, as an example, ageing_time attribute
down from bridge to switchdev (rocker) driver.  Add some range-checking
for ageing_time.

RTNETLINK answers: Numerical result out of range

Up until now, switchdev attrs where port-level attrs, so the netdev used in
switchdev_attr_set() would be a switch port or bond of switch ports.  With
bridge-level attrs, the netdev passed to switchdev_attr_set() is the bridge
netdev.  The same recusive algo is used to visit the leaves of the stacked
drivers to set the attr, it's just in this case we start one layer higher in
the stack.  One note is not all ports in the bridge may support setting a
bridge-level attribute, so rather than failing the entire set, we'll skip over
those ports returning -EOPNOTSUPP.

v2->v3: Per Jiri review: push only ageing_time attr down at this time, and
don't pass raw bridge IFLA_BR_* values; rather use new switchdev attr ID for
ageing_time.

v1->v2: rebase w/ net-next
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agorocker: handle setting bridge ageing_time
Scott Feldman [Fri, 9 Oct 2015 02:23:20 +0000 (19:23 -0700)]
rocker: handle setting bridge ageing_time

The FDB cleanup timer will get rescheduled to re-evaluate FDB entries
based on new ageing_time.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobridge: push bridge setting ageing_time down to switchdev
Scott Feldman [Fri, 9 Oct 2015 02:23:19 +0000 (19:23 -0700)]
bridge: push bridge setting ageing_time down to switchdev

Use SWITCHDEV_F_SKIP_EOPNOTSUPP to skip over ports in bridge that don't
support setting ageing_time (or setting bridge attrs in general).

If push fails, don't update ageing_time in bridge and return err to user.

If push succeeds, update ageing_time in bridge and run gc_timer now to
recalabrate when to run gc_timer next, based on new ageing_time.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoswitchdev: skip over ports returning -EOPNOTSUPP when recursing ports
Scott Feldman [Fri, 9 Oct 2015 02:23:18 +0000 (19:23 -0700)]
switchdev: skip over ports returning -EOPNOTSUPP when recursing ports

This allows us to recurse over all the ports, skipping over unsupporting
ports.  Without the change, the recursion would stop at first unsupported
port.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoswitchdev: add bridge ageing_time attribute
Scott Feldman [Fri, 9 Oct 2015 02:23:17 +0000 (19:23 -0700)]
switchdev: add bridge ageing_time attribute

Setting the stage to push bridge-level attributes down to port driver so
hardware can be programmed accordingly.  Bridge-level attribute example is
ageing_time.  This is a per-bridge attribute, not a per-bridge-port attr.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotcp: change type of alive from int to bool
Richard Sailer [Fri, 9 Oct 2015 00:41:37 +0000 (02:41 +0200)]
tcp: change type of alive from int to bool

The alive parameter of tcp_orphan_retries, indicates
whether the connection is assumed alive or not.
In the function and all places calling it is used as a boolean value.

Therefore this changes the type of alive to bool in the function
definition and all calling locations.

Since tcp_orphan_tries is a tcp_timer.c local function no change in
any other file or header is necessary.

Signed-off-by: Richard Sailer <richard@weltraumpflege.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobridge: allow adding of fdb entries pointing to the bridge device
Roopa Prabhu [Thu, 8 Oct 2015 17:38:52 +0000 (10:38 -0700)]
bridge: allow adding of fdb entries pointing to the bridge device

This patch enables adding of fdb entries pointing to the bridge device.
This can be used to propagate mac address of vlan interfaces
configured on top of the vlan filtering bridge.

Before:
$bridge fdb add 44:38:39:00:27:9f dev bridge
RTNETLINK answers: Invalid argument

After:
$bridge fdb add 44:38:39:00:27:9f dev bridge

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotcp: fix RFS vs lockless listeners
Eric Dumazet [Thu, 8 Oct 2015 18:16:48 +0000 (11:16 -0700)]
tcp: fix RFS vs lockless listeners

Before recent TCP listener patches, we were updating listener
sk->sk_rxhash before the cloning of master socket.

children sk_rxhash was therefore correct after the normal 3WHS.

But with lockless listener, we no longer dirty/change listener sk_rxhash
as it would be racy.

We need to correctly update the child sk_rxhash, otherwise first data
packet wont hit correct cpu if RFS is used.

Fixes: 079096f103fa ("tcp/dccp: install syn_recv requests into ehash table")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Willem de Bruijn <willemb@google.com>
Cc: Tom Herbert <tom@herbertland.com>
Acked-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'dsa-next'
David S. Miller [Sun, 11 Oct 2015 12:28:57 +0000 (05:28 -0700)]
Merge branch 'dsa-next'

Vivien Didelot says:

====================
net: dsa: push switchdev prepare phase in FDB ops

This patchset pushes the switchdev prepare phase for the FDB add and del
operations down to the DSA drivers. Currently only mv88e6xxx is affected.

Since the dump requires a bit of refactoring in the driver, it'll come in a
future patchset.

Changes in v2:
 * forward declare switchdev structs instead of fixing the dsa.h include.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: dsa: use switchdev obj in port_fdb_del
Vivien Didelot [Thu, 8 Oct 2015 15:35:14 +0000 (11:35 -0400)]
net: dsa: use switchdev obj in port_fdb_del

For consistency with the FDB add operation, propagate the
switchdev_obj_port_fdb structure in the DSA drivers.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: dsa: push prepare phase in port_fdb_add
Vivien Didelot [Thu, 8 Oct 2015 15:35:13 +0000 (11:35 -0400)]
net: dsa: push prepare phase in port_fdb_add

Now that the prepare phase is pushed down to the DSA drivers, propagate
it to the port_fdb_add function.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: dsa: add port_fdb_prepare
Vivien Didelot [Thu, 8 Oct 2015 15:35:12 +0000 (11:35 -0400)]
net: dsa: add port_fdb_prepare

Push the prepare phase for FDB operations down to the DSA drivers, with
a new port_fdb_prepare function. Currently only mv88e6xxx is affected.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: encx24j600: Fix typos in Kconfig
Jon Ringle [Thu, 8 Oct 2015 15:10:19 +0000 (11:10 -0400)]
net: encx24j600: Fix typos in Kconfig

Signed-off-by: Jon Ringle <jringle@gridpoint.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
David S. Miller [Sun, 11 Oct 2015 12:15:30 +0000 (05:15 -0700)]
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next

Johan Hedberg says:

====================
pull request: bluetooth-next 2015-10-08

Here's another set of Bluetooth & 802.15.4 patches for the 4.4 kernel.

802.15.4:
 - Many improvements & fixes to the mrf24j40 driver
 - Fixes and cleanups to nl802154, mac802154 & ieee802154 code

Bluetooth:
 - New chipset support in btmrvl driver
 - Fixes & cleanups to btbcm, btmrvl, bpa10x & btintel drivers
 - Support for vendor specific diagnostic data through common API
 - Cleanups to the 6lowpan code
 - New events & message types for monitor channel

Please let me know if there are any issues pulling. Thanks.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoBNX2: fix a Null Pointer for stats_blk
wangweidong [Thu, 8 Oct 2015 10:03:47 +0000 (18:03 +0800)]
BNX2: fix a Null Pointer for stats_blk

we have two processes to do:
P1#: ifconfig eth0 down; which will call bnx2_close, then will
, and set Null to stats_blk
P2#: ifconfig eth0; which will call bnx2_get_stats64, it will
use stats_blk.
In one case:
    --P1#--                   --P2#--
                              stats_blk(no null)
    bnx2_free_mem
    ->bp->stats_blk = NULL
                              GET_64BIT_NET_STATS

then it will cause 'NULL Pointer' Problem.
it is as well with 'ethtool -S ethx'.

Allocate the statistics block at probe time so that this problem is
impossible

Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: synack packets can be attached to request sockets
Eric Dumazet [Thu, 8 Oct 2015 12:01:55 +0000 (05:01 -0700)]
net: synack packets can be attached to request sockets

selinux needs few changes to accommodate fact that SYNACK messages
can be attached to a request socket, lacking sk_security pointer

(Only syncookies are still attached to a TCP_LISTEN socket)

Adds a new sk_listener() helper, and use it in selinux and sch_fq

Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of listener")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported by: kernel test robot <ying.huang@linux.intel.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Eric Paris <eparis@parisplace.org>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: Enhance driver to update FW, when FW is too old
Hariprasad Shenai [Thu, 8 Oct 2015 04:38:23 +0000 (10:08 +0530)]
cxgb4: Enhance driver to update FW, when FW is too old

t4_check_fw_version() can return several error codes (-EINVAL, -EBUSY,
-EAGAIN). The present code sets the adapter state to UNINIT only if its
an EFAULT. In all the error cases set the adapter to uninitialized state.

In t4_check_fw_version() if call to t4_get_fw_version() fails, repeat the
operation a few times before returning failure.

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobpf: fix cb access in socket filter programs
Alexei Starovoitov [Wed, 7 Oct 2015 17:55:41 +0000 (10:55 -0700)]
bpf: fix cb access in socket filter programs

eBPF socket filter programs may see junk in 'u32 cb[5]' area,
since it could have been used by protocol layers earlier.

For socket filter programs used in af_packet we need to clean
20 bytes of skb->cb area if it could be used by the program.
For programs attached to TCP/UDP sockets we need to save/restore
these 20 bytes, since it's used by protocol layers.

Remove SK_RUN_FILTER macro, since it's no longer used.

Long term we may move this bpf cb area to per-cpu scratch, but that
requires addition of new 'per-cpu load/store' instructions,
so not suitable as a short term fix.

Fixes: d691f9e8d440 ("bpf: allow programs to write to certain skb fields")
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'net-non-modular'
David S. Miller [Fri, 9 Oct 2015 14:52:35 +0000 (07:52 -0700)]
Merge branch 'net-non-modular'

Paul Gortmaker says:

====================
make non-modular code explicitly non-modular

[v2: drop m68k patches that Geert converted to modules; add one ARM
 driver patch ; update net-next baseline to today; switch to ARM
 for build testing.]

In a previous merge window, we made changes to allow better
delineation between modular and non-modular code in commit
0fd972a7d91d6e15393c449492a04d94c0b89351 ("module: relocate module_init
from init.h to module.h").  This allows us to now ensure module code
looks modular and non-modular code does not accidentally look modular
just to avoid suffering build breakage.

Here we target code that is, by nature of their Makefile and/or
Kconfig settings, only available to be built-in, but implicitly
presenting itself as being possibly modular by way of using modular
headers, macros, and functions.

The goal here is to remove that illusion of modularity from these
files, but in a way that leaves the actual runtime unchanged.
In doing so, we remove code that has never been tested and adds
no value to the tree.  And we continue the process of expecting a
level of consistency between the Kconfig/Makefile of code and the
code in use itself.

Fortuntately the net subsystem has relatively few instances, given
the overall amount of code and drivers it contains.  For comparison
there are over 300 instances tree wide, resulting in a possible net
removal of on the order of 5000 lines of unused code.

Build tested on net-next from today, on ARM, since that is the arch
where the one ethernet driver changed here is available.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agodrivers/net/ethernet: make ti/cpsw-phy-sel.c explicitly non-modular
Paul Gortmaker [Wed, 7 Oct 2015 21:27:46 +0000 (17:27 -0400)]
drivers/net/ethernet: make ti/cpsw-phy-sel.c explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/net/ethernet/ti/Kconfig:config TI_CPSW_PHY_SEL
drivers/net/ethernet/ti/Kconfig:        bool "TI CPSW Switch Phy sel Support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modularity so that when reading the
driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Varka Bhadram <varkabhadram@gmail.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/sched: make sch_blackhole.c explicitly non-modular
Paul Gortmaker [Wed, 7 Oct 2015 21:27:45 +0000 (17:27 -0400)]
net/sched: make sch_blackhole.c explicitly non-modular

The Kconfig currently controlling compilation of this code is:

net/sched/Kconfig:menuconfig NET_SCHED
net/sched/Kconfig:      bool "QoS and/or fair queueing"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.  We can
change to one of the other priority initcalls (subsys?) at any later
date, if desired.

We also delete the MODULE_LICENSE tag since all that information
is already contained at the top of the file in the comments.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/dcb: make dcbnl.c explicitly non-modular
Paul Gortmaker [Wed, 7 Oct 2015 21:27:44 +0000 (17:27 -0400)]
net/dcb: make dcbnl.c explicitly non-modular

The Kconfig currently controlling compilation of this code is:

net/dcb/Kconfig:config DCB
net/dcb/Kconfig:        bool "Data Center Bridging support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.  We can
change to one of the other priority initcalls (subsys?) at any later
date, if desired.

We also delete the MODULE_LICENSE tag etc. since all that information
is (or is now) already contained at the top of the file in the comments.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Cc: Anish Bhatt <anish@chelsio.com>
Cc: John Fastabend <john.r.fastabend@intel.com>
Cc: Shani Michaeli <shanim@mellanox.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/core: make sock_diag.c explicitly non-modular
Paul Gortmaker [Wed, 7 Oct 2015 21:27:43 +0000 (17:27 -0400)]
net/core: make sock_diag.c explicitly non-modular

The Makefile currently controlling compilation of this code lists
it under "obj-y" ...meaning that it currently is not being built as
a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.  We can
change to one of the other priority initcalls (subsys?) at any later
date, if desired.

We can't remove module.h since the file uses other module related
stuff even though it is not modular itself.

We move the information from the MODULE_LICENSE tag to the top of the
file, since that information is not captured anywhere else.  The
MODULE_ALIAS_NET_PF_PROTO becomes a no-op in the non modular case, so
it is removed.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Craig Gallek <kraig@google.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'net-bool'
David S. Miller [Fri, 9 Oct 2015 14:49:08 +0000 (07:49 -0700)]
Merge branch 'net-bool'

Yaowei Bai says:

====================
net: small improvement

This patchset makes several functions in net return bool to improve
readability and/or simplicity because these functions only use one
or zero as their return value.

No functional changes.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/core: lockdep_rtnl_is_held can be boolean
Yaowei Bai [Thu, 8 Oct 2015 13:29:02 +0000 (21:29 +0800)]
net/core: lockdep_rtnl_is_held can be boolean

This patch makes lockdep_rtnl_is_held return bool due to this
particular function only using either one or zero as its return
value.

In another patch lockdep_is_held is also made return bool.

No functional change.

Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/inetdevice: bad_mask can be boolean
Yaowei Bai [Thu, 8 Oct 2015 13:29:01 +0000 (21:29 +0800)]
net/inetdevice: bad_mask can be boolean

This patch makes bad_mask return bool due to this particular function
only using either one or zero as its return value.

No functional change.

Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/inetdevice: inet_ifa_match can be boolean
Yaowei Bai [Thu, 8 Oct 2015 13:29:00 +0000 (21:29 +0800)]
net/inetdevice: inet_ifa_match can be boolean

This patch makes inet_ifa_match return bool due to this
particular function only using either one or zero as its return
value.

No functional change.

Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/dccp: dccp_bad_service_code can be boolean
Yaowei Bai [Thu, 8 Oct 2015 13:28:59 +0000 (21:28 +0800)]
net/dccp: dccp_bad_service_code can be boolean

This patch makes dccp_bad_service_code return bool due to these
particular functions only using either one or zero as their return
value.

dccp_list_has_service is also been made return bool in this patchset.

No functional change.

Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/dccp: dccp_list_has_service can be boolean
Yaowei Bai [Thu, 8 Oct 2015 13:28:58 +0000 (21:28 +0800)]
net/dccp: dccp_list_has_service can be boolean

This patch makes dccp_list_has_service return bool due to this
particular function only using either one or zero as its return
value.

No functional change.

Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/can: can_dropped_invalid_skb can be boolean
Yaowei Bai [Thu, 8 Oct 2015 13:28:57 +0000 (21:28 +0800)]
net/can: can_dropped_invalid_skb can be boolean

This patch makes can_dropped_invalid_skb return bool due to this
particular function only using either one or zero as its return
value.

No functional change.

Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet/nfnetlink: lockdep_nfnl_is_held can be boolean
Yaowei Bai [Thu, 8 Oct 2015 13:28:56 +0000 (21:28 +0800)]
net/nfnetlink: lockdep_nfnl_is_held can be boolean

This patch makes lockdep_nfnl_is_held return bool to improve
readability due to this particular function only using either
one or zero as its return value.

No functional change.

Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>