openwrt/staging/blogic.git
7 years agonet/mlx5e: Add PCIe outbound stalls counters
Gal Pressman [Thu, 15 Jun 2017 15:29:32 +0000 (18:29 +0300)]
net/mlx5e: Add PCIe outbound stalls counters

outbound_pci_stalled_rd - The percentage of time within the last second
that the NIC had outbound non-posted read requests but could not perform
the operation due to insufficient non-posted credits.

outbound_pci_stalled_wr - The percentage of time within the
last second that the NIC had outbound posted writes requests but could
not perform the operation due to insufficient posted credits.

outbound_pci_stalled_rd_events - The number of events where
outbound_pci_stalled_rd was above the threshold.

outbound_pci_stalled_wr_events - The number of events where
outbound_pci_stalled_wr was above the threshold.

Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
7 years agonet/mlx5: Add PCIe outbound stalls counters infrastructure
Gal Pressman [Thu, 15 Jun 2017 15:29:23 +0000 (18:29 +0300)]
net/mlx5: Add PCIe outbound stalls counters infrastructure

Add capability bit in MCAM register and counters to MPCNT register.

Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
7 years agonet/mlx5e: IPoIB, Add support for get_link_ksettings in ethtool
Shalom Lagziel [Sun, 28 May 2017 13:40:24 +0000 (16:40 +0300)]
net/mlx5e: IPoIB, Add support for get_link_ksettings in ethtool

Add support for "ethtool DEVNAME" over ipoib ports,
Display standard port information for IPoIB netdevices using ethtool
For example:
$ ethtool ib2
> Settings for ib2:
        Supported ports: [ ]
        Supported link modes:   Not reported
        Supported pause frame use: No
        Supports auto-negotiation: No
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Speed: 100000Mb/s
        Duplex: Full
        Port: Other
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: off
        Link detected: yes

Signed-off-by: Shalom Lagziel <shaloml@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
7 years agonet/mlx5e: IPoIB, Fix driver name retrieved by ethtool
Feras Daoud [Mon, 10 Jul 2017 15:35:06 +0000 (18:35 +0300)]
net/mlx5e: IPoIB, Fix driver name retrieved by ethtool

Printing an enhanced IPoIB device information using
"ethtool -i DEVNAME", prints the low level driver name: mlx5_core.
This commit changes the name to mlx5_core [ib_ipoib], to include the
ipoib device driver infromation.

Fixes: 076b0936e5fb ("net/mlx5e: IPoIB, Add ethtool support")
Signed-off-by: Feras Daoud <ferasda@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
7 years agonet/mlx5e: Send PAOS command on interface up/down
Eran Ben Elisha [Sun, 5 Feb 2017 15:57:40 +0000 (17:57 +0200)]
net/mlx5e: Send PAOS command on interface up/down

Upon interface up/down, driver will send PAOS (Ports Administrative and
Operational Status Register) in order to inform the Firmware on the
desired status of the port by the driver.

Since now we might change physical link status on mlx5e_open/close,
logical VF representor should not use mlx5e_open/close ndos as is, and
should call the logical version mlx5e_open/closed_locked.

Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
7 years agobpf: linux/bpf.h needs linux/numa.h
David S. Miller [Sun, 20 Aug 2017 06:34:03 +0000 (23:34 -0700)]
bpf: linux/bpf.h needs linux/numa.h

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'BPF-inline-improvements'
David S. Miller [Sun, 20 Aug 2017 04:56:34 +0000 (21:56 -0700)]
Merge branch 'BPF-inline-improvements'

Daniel Borkmann says:

====================
BPF inline improvements

First one makes htab inlining more robust wrt future jits and
second one inlines map in map lookups through map_gen_lookup()
callback.

v1 -> v2:
  - BITS_PER_LONG guard in patch 1
  - BPF_EMIT_CALL is on __htab_map_lookup_elem
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: inline map in map lookup functions for array and htab
Daniel Borkmann [Sat, 19 Aug 2017 01:12:46 +0000 (03:12 +0200)]
bpf: inline map in map lookup functions for array and htab

Avoid two successive functions calls for the map in map lookup, first
is the bpf_map_lookup_elem() helper call, and second the callback via
map->ops->map_lookup_elem() to get to the map in map implementation.
Implementation inlines array and htab flavor for map in map lookups.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: make htab inlining more robust wrt assumptions
Daniel Borkmann [Sat, 19 Aug 2017 01:12:45 +0000 (03:12 +0200)]
bpf: make htab inlining more robust wrt assumptions

Commit 9015d2f59535 ("bpf: inline htab_map_lookup_elem()") was
making the assumption that a direct call emission to the function
__htab_map_lookup_elem() will always work out for JITs.

This is currently true since all JITs we have are for 64 bit archs,
but in case of 32 bit JITs like upcoming arm32, we get a NULL pointer
dereference when executing the call to __htab_map_lookup_elem()
since passed arguments are of a different size (due to pointer args)
than what we do out of BPF. Guard and thus limit this for now for
the current 64 bit JITs only.

Reported-by: Shubham Bansal <illusionist.neo@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'bpf-Allow-selecting-numa-node-during-map-creation'
David S. Miller [Sun, 20 Aug 2017 04:35:44 +0000 (21:35 -0700)]
Merge branch 'bpf-Allow-selecting-numa-node-during-map-creation'

Martin KaFai Lau says:

====================
bpf: Allow selecting numa node during map creation

This series allows user to pick the numa node during map creation.
The first patch has the details
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: Allow numa selection in INNER_LRU_HASH_PREALLOC test of map_perf_test
Martin KaFai Lau [Fri, 18 Aug 2017 18:28:01 +0000 (11:28 -0700)]
bpf: Allow numa selection in INNER_LRU_HASH_PREALLOC test of map_perf_test

This patch makes the needed changes to allow each process of
the INNER_LRU_HASH_PREALLOC test to provide its numa node id
when creating the lru map.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: Allow selecting numa node during map creation
Martin KaFai Lau [Fri, 18 Aug 2017 18:28:00 +0000 (11:28 -0700)]
bpf: Allow selecting numa node during map creation

The current map creation API does not allow to provide the numa-node
preference.  The memory usually comes from where the map-creation-process
is running.  The performance is not ideal if the bpf_prog is known to
always run in a numa node different from the map-creation-process.

One of the use case is sharding on CPU to different LRU maps (i.e.
an array of LRU maps).  Here is the test result of map_perf_test on
the INNER_LRU_HASH_PREALLOC test if we force the lru map used by
CPU0 to be allocated from a remote numa node:

[ The machine has 20 cores. CPU0-9 at node 0. CPU10-19 at node 1 ]

># taskset -c 10 ./map_perf_test 512 8 1260000 8000000
5:inner_lru_hash_map_perf pre-alloc 1628380 events per sec
4:inner_lru_hash_map_perf pre-alloc 1626396 events per sec
3:inner_lru_hash_map_perf pre-alloc 1626144 events per sec
6:inner_lru_hash_map_perf pre-alloc 1621657 events per sec
2:inner_lru_hash_map_perf pre-alloc 1621534 events per sec
1:inner_lru_hash_map_perf pre-alloc 1620292 events per sec
7:inner_lru_hash_map_perf pre-alloc 1613305 events per sec
0:inner_lru_hash_map_perf pre-alloc 1239150 events per sec  #<<<

After specifying numa node:
># taskset -c 10 ./map_perf_test 512 8 1260000 8000000
5:inner_lru_hash_map_perf pre-alloc 1629627 events per sec
3:inner_lru_hash_map_perf pre-alloc 1628057 events per sec
1:inner_lru_hash_map_perf pre-alloc 1623054 events per sec
6:inner_lru_hash_map_perf pre-alloc 1616033 events per sec
2:inner_lru_hash_map_perf pre-alloc 1614630 events per sec
4:inner_lru_hash_map_perf pre-alloc 1612651 events per sec
7:inner_lru_hash_map_perf pre-alloc 1609337 events per sec
0:inner_lru_hash_map_perf pre-alloc 1619340 events per sec #<<<

This patch adds one field, numa_node, to the bpf_attr.  Since numa node 0
is a valid node, a new flag BPF_F_NUMA_NODE is also added.  The numa_node
field is honored if and only if the BPF_F_NUMA_NODE flag is set.

Numa node selection is not supported for percpu map.

This patch does not change all the kmalloc.  F.e.
'htab = kzalloc()' is not changed since the object
is small enough to stay in the cache.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: fix spelling mistake: "swtichdev" -> "switchdev"
Colin Ian King [Fri, 18 Aug 2017 15:40:00 +0000 (16:40 +0100)]
bnxt_en: fix spelling mistake: "swtichdev" -> "switchdev"

Trivial fix to spelling mistake in a netdev_info message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: hns3: fix a handful of spelling mistakes
Colin Ian King [Fri, 18 Aug 2017 15:30:00 +0000 (16:30 +0100)]
net: hns3: fix a handful of spelling mistakes

Trival fix to spelling mistakes:

firware -> firmware
invald -> invalid
mutilcast -> multicast

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'net-const-eisa_device_id'
David S. Miller [Sun, 20 Aug 2017 00:13:41 +0000 (17:13 -0700)]
Merge branch 'net-const-eisa_device_id'

Arvind Yadav says:

====================
constify net eisa_device_id

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

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: defxx: constify eisa_device_id
Arvind Yadav [Sat, 19 Aug 2017 06:53:34 +0000 (12:23 +0530)]
net: defxx: constify eisa_device_id

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

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: hp100: constify eisa_device_id
Arvind Yadav [Sat, 19 Aug 2017 06:53:14 +0000 (12:23 +0530)]
net: hp100: constify eisa_device_id

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

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: de4x5: constify eisa_device_id
Arvind Yadav [Sat, 19 Aug 2017 06:52:44 +0000 (12:22 +0530)]
net: de4x5: constify eisa_device_id

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

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: 3c59x: constify eisa_device_id
Arvind Yadav [Sat, 19 Aug 2017 06:52:13 +0000 (12:22 +0530)]
net: 3c59x: constify eisa_device_id

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

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: 3c509: constify eisa_device_id
Arvind Yadav [Sat, 19 Aug 2017 06:51:43 +0000 (12:21 +0530)]
net: 3c509: constify eisa_device_id

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

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'nfp-add-basic-ethtool-callbacks-to-representors'
David S. Miller [Sat, 19 Aug 2017 05:39:34 +0000 (22:39 -0700)]
Merge branch 'nfp-add-basic-ethtool-callbacks-to-representors'

Jakub Kicinski says:

====================
nfp: add basic ethtool callbacks to representors

This set extends the basic ethtool functionality to representor
netdevs.  I start with providing link state via ethtool and then
move on to functions such as driver information, statistics and
FW log dump.  The series contains a number of clean ups to the
ethtool stats code too, some of the logic is simplified by making
better use of the nfp_port abstraction.  The stats we expose on
representors are only the PCIe and MAC port statistics firmware
maintains for us.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: don't reuse pointers in ring dumping
Jakub Kicinski [Fri, 18 Aug 2017 22:48:22 +0000 (15:48 -0700)]
nfp: don't reuse pointers in ring dumping

We were reusing skb pointer when reading page frag, since ring
entries contain a union of a skb and frag pointer.  This can
be confusing to people reading the code.  Refactor the code
to read frag pointer directly.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: fix copy paste in names and messages regarding vNICs
Jakub Kicinski [Fri, 18 Aug 2017 22:48:21 +0000 (15:48 -0700)]
nfp: fix copy paste in names and messages regarding vNICs

Data and control vNICs currently use the same area name and
error message.  This could lead to confusion.  Make sure
the error message says "ctrl" in case of control and the
data area is called "nfp.bar0".

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: add ethtool statistics for representors
Jakub Kicinski [Fri, 18 Aug 2017 22:48:20 +0000 (15:48 -0700)]
nfp: add ethtool statistics for representors

Representors may be associated with both VFs or more importantly
with physical ports.  Allow vNIC and MAC statistics to be read
with ethtool -S on representors.  In case of vNICs we reuse
the vNIC statistic helper, we just need to swap RX and TX to
give statistics the "switch perspective."

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: add pointer to vNIC config memory to nfp_port structure
Jakub Kicinski [Fri, 18 Aug 2017 22:48:19 +0000 (15:48 -0700)]
nfp: add pointer to vNIC config memory to nfp_port structure

Simplify the statistics handling code by keeping pointer to vNIC's
config memory in nfp_port.  Note that this is referring to the
representor side of vNICs, vNIC side has the pointer in nfp_net.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: report MAC statistics in ethtool
Jakub Kicinski [Fri, 18 Aug 2017 22:48:18 +0000 (15:48 -0700)]
nfp: report MAC statistics in ethtool

Add reporting of MAC statistics in ethtool.  MAC statistics
are read out from the MAC IP and accumulated by application
FW, therefore their presence depends on the application FW.

Add missing defines and string names for the statistics and
dump them in ethtool -S.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: store pointer to MAC statistics in nfp_port
Jakub Kicinski [Fri, 18 Aug 2017 22:48:17 +0000 (15:48 -0700)]
nfp: store pointer to MAC statistics in nfp_port

Store pointer to device memory containing MAC statistics
in nfp_port.  This simplifies representor code and will
be used to dump those statistics in ethtool as well.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: split software and hardware vNIC statistics
Jakub Kicinski [Fri, 18 Aug 2017 22:48:16 +0000 (15:48 -0700)]
nfp: split software and hardware vNIC statistics

In preparation for reporting vNIC HW stats on representors
split handling of the SW and HW stats in ethtool -S.
Representors don't have SW stats (since vNIC is assigned
to the VM).

Remove the questionable defines which assume nn variable
exists in the scope.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: add helper for printing ethtool strings
Jakub Kicinski [Fri, 18 Aug 2017 22:48:15 +0000 (15:48 -0700)]
nfp: add helper for printing ethtool strings

Add a helper for printing ethtool strings and advancing the
pointer correctly.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: don't report standard netdev statistics in ethtool
Jakub Kicinski [Fri, 18 Aug 2017 22:48:14 +0000 (15:48 -0700)]
nfp: don't report standard netdev statistics in ethtool

We have been recently called out as a bad example for reporting
standard netdev statistics as part of ethtool.  Fix that :)

Removing standard statistics allows us to simplify the structure
holding definitions since we no longer have to mux different types
of statistics.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: allow retreiving management FW logs on representors
Jakub Kicinski [Fri, 18 Aug 2017 22:48:13 +0000 (15:48 -0700)]
nfp: allow retreiving management FW logs on representors

Users should be able to dump the management FW logs on any
of the driver's netdevs.  Make the code only depend on the
nfp_app and share it between vNICs and representors.

Storing the dump flag is simply dropped for now, since we
only support the argument being set to 0.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: provide ethtool_drvinfo on representors
Jakub Kicinski [Fri, 18 Aug 2017 22:48:12 +0000 (15:48 -0700)]
nfp: provide ethtool_drvinfo on representors

Extend representors' ethtool ops to show basic info like firmware
version, driver version, and driver name.

While at it don't set drvinfo.n_stats and drvinfo.regdump_len,
core will invoke appropriate handlers to get those.

A helper is added to turn a netdev into nfp_app for convenience.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: link basic ethtool ops to representors
Jakub Kicinski [Fri, 18 Aug 2017 22:48:11 +0000 (15:48 -0700)]
nfp: link basic ethtool ops to representors

Start linking ethtool ops to representors.  Begin by adding
a separate ops structure and providing link state.  Next
patches will convert appropriate functions to only use nfp_port,
which will make them reusable on representors.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'net-sysfs-related-cleanups'
David S. Miller [Sat, 19 Aug 2017 05:38:55 +0000 (22:38 -0700)]
Merge branch 'net-sysfs-related-cleanups'

Stephen Hemminger says:

====================
net: sysfs related cleanups

Network sysfs infrastructure changes. Mostly related to using ro_after_init
to make function tables immutable.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: style cleanups
stephen hemminger [Fri, 18 Aug 2017 20:46:28 +0000 (13:46 -0700)]
net: style cleanups

Make code closer to current style. Mostly whitespace changes.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: mark receive queue attributes ro_after_init
stephen hemminger [Fri, 18 Aug 2017 20:46:27 +0000 (13:46 -0700)]
net: mark receive queue attributes ro_after_init

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: make queue attributes ro_after_init
stephen hemminger [Fri, 18 Aug 2017 20:46:26 +0000 (13:46 -0700)]
net: make queue attributes ro_after_init

The XPS queue attributes can be ro_after_init.
Also use __ATTR_RX macros to simplify initialization.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: make BQL sysfs attributes ro_after_init
stephen hemminger [Fri, 18 Aug 2017 20:46:25 +0000 (13:46 -0700)]
net: make BQL sysfs attributes ro_after_init

Also fix macro to not have ; at end.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: drop unused attribute argument from sysfs queue funcs
stephen hemminger [Fri, 18 Aug 2017 20:46:24 +0000 (13:46 -0700)]
net: drop unused attribute argument from sysfs queue funcs

The show and store functions don't need/use the attribute.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: make net sysfs attributes ro_after_init
stephen hemminger [Fri, 18 Aug 2017 20:46:23 +0000 (13:46 -0700)]
net: make net sysfs attributes ro_after_init

The attributes of net devices are immutable.

Ideally, attribute groups would contain const attributes
but there are too many places that do modifications of list
during startup (in other code) to allow that.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: constify net_ns_type_operations
stephen hemminger [Fri, 18 Aug 2017 20:46:22 +0000 (13:46 -0700)]
net: constify net_ns_type_operations

This can be const.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: make net_class ro_after_init
stephen hemminger [Fri, 18 Aug 2017 20:46:21 +0000 (13:46 -0700)]
net: make net_class ro_after_init

The net_class in sysfs is only modified on init.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: constify netdev_class_file
stephen hemminger [Fri, 18 Aug 2017 20:46:20 +0000 (13:46 -0700)]
net: constify netdev_class_file

These functions are wrapper arount class_create_file which can take a
const attribute.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: don't decrement kobj reference count on init failure
stephen hemminger [Fri, 18 Aug 2017 20:46:19 +0000 (13:46 -0700)]
net: don't decrement kobj reference count on init failure

If kobject_init_and_add failed, then the failure path would
decrement the reference count of the queue kobject whose reference
count was already zero.

Fixes: 114cf5802165 ("bql: Byte queue limits")
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'amd-xgbe-next'
David S. Miller [Fri, 18 Aug 2017 23:30:17 +0000 (16:30 -0700)]
Merge branch 'amd-xgbe-next'

Tom Lendacky says:

====================
amd-xgbe: AMD XGBE driver updates 2017-08-17

The following updates are included in this driver update series:

- Set the MDIO mode to clause 45 for the 10GBase-T configuration
- Set the MII control width to 8-bits for speeds less than 1Gbps
- Fix an issue to related to module removal when the devices are up
- Fix ethtool statistics related to packet counting of TSO packets
- Add support for device renaming
- Add additional dynamic debug output for the PCS window calculation
- Optimize reading of DMA channel interrupt enablement register
- Add additional dynamic debug output about the hardware features
- Add per queue Tx and Rx ethtool statistics
- Add a macro to clear ethtool_link_ksettings modes
- Convert the driver to use the ethtool_link_ksettings
- Add support for VXLAN offload capabilities
- Add additional ethtool statistics related to VXLAN

This patch series is based on net-next.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoamd-xgbe: Add additional ethtool statistics
Lendacky, Thomas [Fri, 18 Aug 2017 14:04:14 +0000 (09:04 -0500)]
amd-xgbe: Add additional ethtool statistics

Add some additional statistics for tracking VXLAN packets and checksum
errors.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoamd-xgbe: Add support for VXLAN offload capabilities
Lendacky, Thomas [Fri, 18 Aug 2017 14:04:04 +0000 (09:04 -0500)]
amd-xgbe: Add support for VXLAN offload capabilities

The hardware has the capability to perform checksum offload support
(both Tx and Rx) and TSO support for VXLAN packets. Add the support
required to enable this.

The hardware can only support a single VXLAN port for offload. If more
than one VXLAN port is added then the offload capabilities have to be
disabled and can no longer be advertised.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoamd-xgbe: Convert to using the new link mode settings
Lendacky, Thomas [Fri, 18 Aug 2017 14:03:55 +0000 (09:03 -0500)]
amd-xgbe: Convert to using the new link mode settings

Convert from using the old u32 supported, advertising, etc. link settings
to the new link mode settings that support bit positions / settings
greater than 32 bits.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: ethtool: Add macro to clear a link mode setting
Lendacky, Thomas [Fri, 18 Aug 2017 14:03:44 +0000 (09:03 -0500)]
net: ethtool: Add macro to clear a link mode setting

There are currently macros to set and test an ETHTOOL_LINK_MODE_ setting,
but not to clear one. Add a macro to clear an ETHTOOL_LINK_MODE_ setting.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoamd-xgbe: Add per queue Tx and Rx statistics
Lendacky, Thomas [Fri, 18 Aug 2017 14:03:35 +0000 (09:03 -0500)]
amd-xgbe: Add per queue Tx and Rx statistics

Add per queue Tx and Rx packet and byte counts.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoamd-xgbe: Add hardware features debug output
Lendacky, Thomas [Fri, 18 Aug 2017 14:03:26 +0000 (09:03 -0500)]
amd-xgbe: Add hardware features debug output

Use the dynamic debug support to output information about the hardware
features reported by the device.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoamd-xgbe: Optimize DMA channel interrupt enablement
Lendacky, Thomas [Fri, 18 Aug 2017 14:03:17 +0000 (09:03 -0500)]
amd-xgbe: Optimize DMA channel interrupt enablement

Currently whenever the driver needs to enable or disable interrupts for
a DMA channel it reads the interrupt enable register (IER), updates the
value and then writes the new value back to the IER. Since the hardware
does not change the IER, software can track this value and elimiate the
need to read it each time.

Add the IER value to the channel related data structure and use that as
the base for enabling and disabling interrupts, thus removing the need
for the MMIO read.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoamd-xgbe: Add additional dynamic debug messages
Lendacky, Thomas [Fri, 18 Aug 2017 14:03:08 +0000 (09:03 -0500)]
amd-xgbe: Add additional dynamic debug messages

Add some additional dynamic debug message to the driver. The new messages
will provide additional information about the PCS window calculation.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoamd-xgbe: Add support to handle device renaming
Lendacky, Thomas [Fri, 18 Aug 2017 14:02:57 +0000 (09:02 -0500)]
amd-xgbe: Add support to handle device renaming

Many of the names used by the driver are based upon the name of the device
found during device probe.  Move the formatting of the names into the
device open function so that any renaming that occurs before the device is
brought up will be accounted for.  This also means moving the creation of
some named workqueues into the device open path.

Add support to register for net events so that if a device is renamed
the corresponding debugfs directory can be renamed.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoamd-xgbe: Update TSO packet statistics accuracy
Lendacky, Thomas [Fri, 18 Aug 2017 14:02:49 +0000 (09:02 -0500)]
amd-xgbe: Update TSO packet statistics accuracy

When transmitting a TSO packet, the driver only increments the TSO packet
statistic by one rather than the number of total packets that were sent.
Update the driver to record the total number of packets that resulted from
TSO transmit.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoamd-xgbe: Be sure driver shuts down cleanly on module removal
Lendacky, Thomas [Fri, 18 Aug 2017 14:02:40 +0000 (09:02 -0500)]
amd-xgbe: Be sure driver shuts down cleanly on module removal

Sometimes when the driver is being unloaded while the devices are still
up the driver can issue errors.  This is based on timing and the double
invocation of some routines.  The phy_exit() call needs to be run after
the network device has been closed and unregistered from the system.
Also, the phy_exit() does not need to invoke phy_stop() since that will
be called as part of the device closing, so remove that call.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoamd-xgbe: Set the MII control width for the MAC interface
Lendacky, Thomas [Fri, 18 Aug 2017 14:02:27 +0000 (09:02 -0500)]
amd-xgbe: Set the MII control width for the MAC interface

When running in SGMII mode at speeds below 1000Mbps, the auto-negotition
control register must set the MII control width for the MAC interface
to be 8-bits wide.  By default the width is 4-bits.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoamd-xgbe: Set the MDIO mode for 10000Base-T configuration
Lendacky, Thomas [Fri, 18 Aug 2017 14:02:18 +0000 (09:02 -0500)]
amd-xgbe: Set the MDIO mode for 10000Base-T configuration

Currently the MDIO mode is set to none for the 10000Base-T, which is
incorrect.  The MDIO mode should for this configuration should be
clause 45.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agomlx5: ensure 0 is returned when vport is zero
Colin Ian King [Fri, 18 Aug 2017 13:49:25 +0000 (14:49 +0100)]
mlx5: ensure 0 is returned when vport is zero

Currently, if vport is zero then then an uninialized return status
in err is returned.  Since the only return status at the end of the
function esw_add_uc_addr is zero for the current set of return paths
we may as well just return 0 rather than err to fix this issue.

Detected by CoverityScan, CID#1452698 ("Uninitialized scalar variable")

Fixes: eeb66cdb6826 ("net/mlx5: Separate between E-Switch and MPFS")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: Fix map-in-map checking in the verifier
Martin KaFai Lau [Fri, 18 Aug 2017 01:14:43 +0000 (18:14 -0700)]
bpf: Fix map-in-map checking in the verifier

In check_map_func_compatibility(), a 'break' has been accidentally
removed for the BPF_MAP_TYPE_ARRAY_OF_MAPS and BPF_MAP_TYPE_HASH_OF_MAPS
cases.  This patch adds it back.

Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'xdp-adjust-xdp-redirect-tracepoint'
David S. Miller [Fri, 18 Aug 2017 23:18:47 +0000 (16:18 -0700)]
Merge branch 'xdp-adjust-xdp-redirect-tracepoint'

Jesper Dangaard Brouer says:

====================
xdp: adjust xdp redirect tracepoint

Working on streamlining the tracepoints for XDP.  The eBPF programs
and XDP have no flow-control or queueing.  Investigating using
tracepoint to provide a feedback on XDP_REDIRECT xmit overflow events.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoxdp: adjust xdp redirect tracepoint to include return error code
Jesper Dangaard Brouer [Thu, 17 Aug 2017 16:22:37 +0000 (18:22 +0200)]
xdp: adjust xdp redirect tracepoint to include return error code

The return error code need to be included in the tracepoint
xdp:xdp_redirect, else its not possible to distinguish successful or
failed XDP_REDIRECT transmits.

XDP have no queuing mechanism. Thus, it is fairly easily to overrun a
NIC transmit queue.  The eBPF program invoking helpers (bpf_redirect
or bpf_redirect_map) to redirect a packet doesn't get any feedback
whether the packet was actually transmitted.

Info on failed transmits in the tracepoint xdp:xdp_redirect, is
interesting as this opens for providing a feedback-loop to the
receiving XDP program.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoixgbe: change ndo_xdp_xmit return code on xmit errors
Jesper Dangaard Brouer [Thu, 17 Aug 2017 16:22:32 +0000 (18:22 +0200)]
ixgbe: change ndo_xdp_xmit return code on xmit errors

Use errno -ENOSPC ("No space left on device") when the XDP xmit
have no space left on the TX ring buffer, instead of -ENOMEM.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoliquidio: remove support for deprecated f/w cmd OCTNET_CMD_RESET_PF
Rick Farrington [Thu, 17 Aug 2017 01:30:13 +0000 (18:30 -0700)]
liquidio: remove support for deprecated f/w cmd OCTNET_CMD_RESET_PF

Signed-off-by: Rick Farrington <ricardo.farrington@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: inet: diag: expose sockets cgroup classid
Levin, Alexander (Sasha Levin) [Thu, 17 Aug 2017 00:35:11 +0000 (00:35 +0000)]
net: inet: diag: expose sockets cgroup classid

This is useful for directly looking up a task based on class id rather than
having to scan through all open file descriptors.

Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agomacvlan: add offload features for encapsulation
Dimitris Michailidis [Wed, 16 Aug 2017 21:34:46 +0000 (14:34 -0700)]
macvlan: add offload features for encapsulation

Currently macvlan devices do not set their hw_enc_features making
encapsulated Tx packets resort to SW fallbacks. Add encapsulation GSO
offloads to ->features as is done for the other GSOs and set
->hw_enc_features.

Signed-off-by: Dimitris Michailidis <dmichail@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoliquidio: fix Smatch error
Intiyaz Basha [Fri, 18 Aug 2017 20:07:19 +0000 (13:07 -0700)]
liquidio: fix Smatch error

Fix Smatch error by not dereferencing iq pointer if it's NULL.

See http://marc.info/?l=kernel-janitors&m=150296723301129&w=2

Also, remove unnecessary parentheses.

Fixes: d314ac222829 ("liquidio: moved liquidio_napi_poll to lio_core.c")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Intiyaz Basha <intiyaz.basha@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoipv4: convert dst_metrics.refcnt from atomic_t to refcount_t
Eric Dumazet [Fri, 18 Aug 2017 19:08:07 +0000 (12:08 -0700)]
ipv4: convert dst_metrics.refcnt from atomic_t to refcount_t

refcount_t type and corresponding API should be
used instead of atomic_t when the variable is used as
a reference counter. This allows to avoid accidental
refcounter overflows that might lead to use-after-free
situations.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
David S. Miller [Fri, 18 Aug 2017 18:07:46 +0000 (11:07 -0700)]
Merge branch 'for-upstream' of git://git./linux/kernel/git/bluetooth/bluetooth-next

Johan Hedberg says:

====================
pull request: bluetooth-next 2017-08-18

Here's one more bluetooth-next pull request for the 4.14 kernel:

 - Multiple fixes for Broadcom controllers
 - Fixes to the bluecard HCI driver
 - New USB ID for Realtek RTL8723BE controller
 - Fix static analyzer warning with kfree

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

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoipv6: fix false-postive maybe-uninitialized warning
Arnd Bergmann [Fri, 18 Aug 2017 11:34:22 +0000 (13:34 +0200)]
ipv6: fix false-postive maybe-uninitialized warning

Adding a lock around one of the assignments prevents gcc from
tracking the state of the local 'fibmatch' variable, so it can no
longer prove that 'dst' is always initialized, leading to a bogus
warning:

net/ipv6/route.c: In function 'inet6_rtm_getroute':
net/ipv6/route.c:3659:2: error: 'dst' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This moves the other assignment into the same lock to shut up the
warning.

Fixes: 121622dba8da ("ipv6: route: make rtm_getroute not assume rtnl is locked")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'hns3-bug-fixes'
David S. Miller [Fri, 18 Aug 2017 17:31:56 +0000 (10:31 -0700)]
Merge branch 'hns3-bug-fixes'

Salil Mehta says:

====================
Misc. Bug fixes for HNS3 Ethernet Driver

This patch-set fixes various bugs reported by community.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: hns3: Fixes the static check warning due to missing unsupp L3 proto check
Salil [Fri, 18 Aug 2017 11:31:39 +0000 (12:31 +0100)]
net: hns3: Fixes the static check warning due to missing unsupp L3 proto check

This patch fixes the static check warning due to missing handling leg of
unsupported L3 protocol type in the hns3_get_l4_protocol() function.

Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for
hip08 SoC")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: hns3: Fixes the static checker error warning in hns3_get_link_ksettings()
Salil [Fri, 18 Aug 2017 11:31:38 +0000 (12:31 +0100)]
net: hns3: Fixes the static checker error warning in hns3_get_link_ksettings()

This patch fixes the static check error warning in hns3_get_link_ksettings()
function by re-arranging the code.

Fixes: 496d03e960ae ("net: hns3: Add Ethtool support to HNS3 Driver")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: hns3: Fixes the missing u64_stats_fetch_begin_irq in 64-bit stats fetch
Salil [Fri, 18 Aug 2017 11:31:37 +0000 (12:31 +0100)]
net: hns3: Fixes the missing u64_stats_fetch_begin_irq in 64-bit stats fetch

This patch fixes the missing u64_stats_fetch_begin_irq() while trying to
atomically do 64-bit RX/TX fetch. We did not get any error during test
as our SoC is 64-bit so all of these seq/lock operations results in NOOP.

As such, this seq lock supports has been added for the sake of completion
if this code ever runs on 32-bit platform and we are trying to do 64-bit
stats fetch.

Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for
hip08 SoC")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/sched: Fix the logic error to decide the ingress qdisc
Chris Mi [Fri, 18 Aug 2017 11:24:20 +0000 (07:24 -0400)]
net/sched: Fix the logic error to decide the ingress qdisc

The offending commit used a newly added helper function.
But the logic is wrong. Without this fix, the affected NICs
can't do HW offload. Error -EOPNOTSUPP will be returned directly.

Fixes: a2e8da9378cc ("net/sched: use newly added classid identity helpers")
Signed-off-by: Chris Mi <chrism@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 's390-qeth-next'
David S. Miller [Fri, 18 Aug 2017 17:21:31 +0000 (10:21 -0700)]
Merge branch 's390-qeth-next'

Julian Wiedmann says:

====================
s390/net: more updates for 4.14

please apply another batch of qeth patches for net-next.
This reworks the xmit path for L2 OSAs to use skb_cow_head() instead of
skb_realloc_headroom().
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: use skb_cow_head() for L2 OSA xmit
Julian Wiedmann [Fri, 18 Aug 2017 08:19:10 +0000 (10:19 +0200)]
s390/qeth: use skb_cow_head() for L2 OSA xmit

Taking a full copy via skb_realloc_headroom() on every xmit is overkill
and wastes CPU time; all we actually need is to push on the qeth_hdr.
So rework the L2 OSA TX path to avoid the copy.
Minor complications arise because struct qeth_hdr must not cross a page
boundary. So add a new helper qeth_push_hdr() that catches this, and
falls back to the hdr cache that we already use for IQDs.

This change uncovered that qeth's TX completion takes rather long.
Now that we no longer free the original skb straight away and thus call
skb->destructor later than before, throughput regresses significantly.
For now, restore old behaviour by adding an explicit skb_orphan(),
and a big TODO to improve the TX completion time.

Tested-by: Nils Hoppmann <niho@de.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: unify code to build header elements
Julian Wiedmann [Fri, 18 Aug 2017 08:19:09 +0000 (10:19 +0200)]
s390/qeth: unify code to build header elements

After plenty of refactoring, use hd_len as single indication that
the skb needs a dedicated header element.

This preserves existing behaviour for TSO, as 'hdr' always points
to skb->data.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: pass full IQD header length to fill_buffer()
Julian Wiedmann [Fri, 18 Aug 2017 08:19:08 +0000 (10:19 +0200)]
s390/qeth: pass full IQD header length to fill_buffer()

This is a prerequisite for unifying the code to build header elements.
The TSO header has a different size, so we can no longer rely on implicitly
adding the size of a normal qeth_hdr.

No functional change.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: pass TSO data offset to fill_buffer()
Julian Wiedmann [Fri, 18 Aug 2017 08:19:07 +0000 (10:19 +0200)]
s390/qeth: pass TSO data offset to fill_buffer()

For TSO we need to skip the skb's qeth/IP/TCP headers when mapping
it into buffer elements. Instead of (mis)using skb_pull(), pass a
corresponding offset to fill_buffer() like we already do for IQDs.

No actual change in the resulting TSO buffers.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: pass TSO header length to fill_buffer()
Julian Wiedmann [Fri, 18 Aug 2017 08:19:06 +0000 (10:19 +0200)]
s390/qeth: pass TSO header length to fill_buffer()

The TSO code already calculates the length of its header element,
no need to duplicate this in the low-level code again.

Use this opportunity to make hd_len unsigned, and for TSO match
its calculation to what tso_fill_header() does.

No functional change.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: pass full data length to l2_fill_header()
Julian Wiedmann [Fri, 18 Aug 2017 08:19:05 +0000 (10:19 +0200)]
s390/qeth: pass full data length to l2_fill_header()

For IQD we already need to fix up the qeth_hdr's length field, and
future changes will require more flexibility for OSA as well. The
device-specific path knows best what header length it requires, so just
pass it from there.
While at it, remove the unused qeth_card parameter.

No functional change.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agos390/qeth: split L2 xmit paths
Julian Wiedmann [Fri, 18 Aug 2017 08:19:04 +0000 (10:19 +0200)]
s390/qeth: split L2 xmit paths

l2_hard_start_xmit() actually doesn't contain much shared code,
and having device-specific paths makes isolated changes a lot easier.
So split it into three routines for IQD, OSN and OSD/OSM/OSX.

No functional change.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: fix a return in sockmap_get_from_fd()
Dan Carpenter [Fri, 18 Aug 2017 07:27:02 +0000 (10:27 +0300)]
bpf: fix a return in sockmap_get_from_fd()

"map" is a valid pointer.  We wanted to return "err" instead.  Also
let's return a zero literal at the end.

Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'liquidio-initialization-fixes-for-embedded-firmware'
David S. Miller [Fri, 18 Aug 2017 17:14:26 +0000 (10:14 -0700)]
Merge branch 'liquidio-initialization-fixes-for-embedded-firmware'

Rick Farrington says:

====================
liquidio: initialization fixes for embedded firmware

Fix problems when using an adapter w/embedded f/w (param "fw_type=none").

1. Add support for PF FLR when exiting.
2. Skip some initialization (don't try to load f/w, activate consoles).
3. Issue credits BEFORE enabling DROQs.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoliquidio: with embedded f/w, issue droq credits before enablement
Rick Farrington [Fri, 18 Aug 2017 06:11:30 +0000 (23:11 -0700)]
liquidio: with embedded f/w, issue droq credits before enablement

1. Issue credits BEFORE enabling DROQ's; this prevents PKTPF_ERR interrupt.

Signed-off-by: Rick Farrington <ricardo.farrington@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoliquidio: with embedded f/w, don't reload f/w, issue pf flr at exit
Rick Farrington [Fri, 18 Aug 2017 06:11:25 +0000 (23:11 -0700)]
liquidio: with embedded f/w, don't reload f/w, issue pf flr at exit

1. Add support for PF FLR when exiting
   (enables CORE_DRV_ACTIVE upon next driver init)
2. Skip some initialization (don't try to load f/w, activate consoles).

Signed-off-by: Rick Farrington <ricardo.farrington@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoBluetooth: hci_bcm: Handle empty packet after firmware loading
Marcel Holtmann [Thu, 17 Aug 2017 19:41:09 +0000 (21:41 +0200)]
Bluetooth: hci_bcm: Handle empty packet after firmware loading

The Broadcom controller on the Raspberry Pi3 sends an empty packet with
packet type 0x00 after launching the firmware. This will cause logging
of errors.

  Bluetooth: hci0: Frame reassembly failed (-84)

Since this seems to be an intented behaviour of the controller, handle
it gracefully by parsing that empty packet with packet type 0x00 and
then just simply report it as diagnostic packet.

With that change no errors are logging and the packet itself is actually
recorded in the Bluetooth monitor traces.

  < HCI Command: Broadcom Launch RAM (0x3f|0x004e) plen 4
         Address: 0xffffffff
  > HCI Event: Command Complete (0x0e) plen 4
       Broadcom Launch RAM (0x3f|0x004e) ncmd 1
         Status: Success (0x00)
  = Vendor Diagnostic (len 0)
  < HCI Command: Broadcom Update UART Baud Rate (0x3f|0x0018) plen 6
         00 00 00 10 0e 00                                ......
  > HCI Event: Command Complete (0x0e) plen 4
       Broadcom Update UART Baud Rate (0x3f|0x0018) ncmd 1
         Status: Success (0x00)
  < HCI Command: Reset (0x03|0x0003) plen 0
  > HCI Event: Command Complete (0x0e) plen 4
       Reset (0x03|0x0003) ncmd 1
         Status: Success (0x00)

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
7 years agodt-bindings: net: bluetooth: Add broadcom-bluetooth
Loic Poulain [Thu, 17 Aug 2017 17:59:48 +0000 (19:59 +0200)]
dt-bindings: net: bluetooth: Add broadcom-bluetooth

Add binding document for serial bluetooth chips using
Broadcom protocol.

Signed-off-by: Loic Poulain <loic.poulain@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
7 years agoBluetooth: hci_bcm: Add serdev support
Loic Poulain [Thu, 17 Aug 2017 17:59:51 +0000 (19:59 +0200)]
Bluetooth: hci_bcm: Add serdev support

Add basic support for Broadcom serial slave devices.
Probe the serial device, retrieve its maximum speed and
register a new hci uart device.

Tested/compatible with bcm43438 (RPi3).

Signed-off-by: Loic Poulain <loic.poulain@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
7 years agoMerge branch 'bpf-smap-followups'
David S. Miller [Thu, 17 Aug 2017 17:25:19 +0000 (10:25 -0700)]
Merge branch 'bpf-smap-followups'

Daniel Borkmann says:

====================
Two BPF smap related followups

Fixing preemption imbalance and consolidating prologue
generation. Thanks!
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: reuse tc bpf prologue for sk skb progs
Daniel Borkmann [Thu, 17 Aug 2017 15:22:37 +0000 (17:22 +0200)]
bpf: reuse tc bpf prologue for sk skb progs

Given both program types are effecitvely doing the same in the
prologue, just reuse the one that we had for tc and only adapt
to the corresponding drop verdict value. That way, we don't need
to have the duplicate from 8a31db561566 ("bpf: add access to sock
fields and pkt data from sk_skb programs") to maintain.

Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: don't enable preemption twice in smap_do_verdict
Daniel Borkmann [Thu, 17 Aug 2017 15:22:36 +0000 (17:22 +0200)]
bpf: don't enable preemption twice in smap_do_verdict

In smap_do_verdict(), the fall-through branch leads to call
preempt_enable() twice for the SK_REDIRECT, which creates an
imbalance. Only enable it for all remaining cases again.

Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: ibm: ibmvnic: constify vio_device_id
Arvind Yadav [Thu, 17 Aug 2017 13:22:54 +0000 (18:52 +0530)]
net: ibm: ibmvnic: constify vio_device_id

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

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: ibm: ibmveth: constify vio_device_id
Arvind Yadav [Thu, 17 Aug 2017 13:22:53 +0000 (18:52 +0530)]
net: ibm: ibmveth: constify vio_device_id

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

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: no need to nullify ri->map in xdp_do_redirect
Daniel Borkmann [Thu, 17 Aug 2017 13:07:22 +0000 (15:07 +0200)]
bpf: no need to nullify ri->map in xdp_do_redirect

We are guaranteed to have a NULL ri->map in this branch since
we test for it earlier, so we don't need to reset it here.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: fix liveness propagation to parent in spilled stack slots
Daniel Borkmann [Thu, 17 Aug 2017 12:59:40 +0000 (14:59 +0200)]
bpf: fix liveness propagation to parent in spilled stack slots

Using parent->regs[] when propagating REG_LIVE_READ for spilled regs
doesn't work since parent->regs[] denote the set of normal registers
but not spilled ones. Propagate to the correct regs.

Fixes: dc503a8ad984 ("bpf/verifier: track liveness for pruning")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: hns3: ensure media_type is unitialized
Colin Ian King [Thu, 17 Aug 2017 09:01:07 +0000 (10:01 +0100)]
net: hns3: ensure media_type is unitialized

Media type is only set if h->ae_algo->ops->get_media_type is called
so there is a possibility that media_type is uninitialized when it is
used a switch statement.  Fix this by initializing media_type to
HNAE3_MEDIA_TYPE_UNKNOWN.

Detected by CoverityScan, CID#1452624("Uninitialized scalar variable")

Fixes: 496d03e960ae ("net: hns3: Add Ethtool support to HNS3 driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoliquidio: fix spelling mistake: "interuupt" -> "interrupt"
Colin Ian King [Thu, 17 Aug 2017 08:19:30 +0000 (09:19 +0100)]
liquidio: fix spelling mistake: "interuupt" -> "interrupt"

Trivial fix to spelling mistake in dev_info message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoBluetooth: btbcm: Consolidate the controller information commands
Marcel Holtmann [Thu, 17 Aug 2017 09:02:40 +0000 (11:02 +0200)]
Bluetooth: btbcm: Consolidate the controller information commands

The commands that read the basic vendor information about the Broadcom
controller are duplicated for UART and USB devices. Combine them into a
single function to reduce the code complexity.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>