Commit Graph

680852 Commits

Author SHA1 Message Date
Arvind Yadav
cddbb79f7a net: bridge: constify attribute_group structures.
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work with const
attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   2645	    896	      0	   3541	    dd5	net/bridge/br_sysfs_br.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   2701	    832	      0	   3533	    dcd	net/bridge/br_sysfs_br.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:48:52 -04:00
Arvind Yadav
38ef00cc33 net: constify attribute_group structures.
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/device.h> work with const
attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   9968	   3168	     16	  13152	   3360	net/core/net-sysfs.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
  10160	   2976	     16	  13152	   3360	net/core/net-sysfs.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:48:51 -04:00
Arvind Yadav
ee27244b66 net: freescale: gianfar : constify dev_pm_ops structures.
dev_pm_ops are not supposed to change at runtime. All functions
working with dev_pm_ops provided by <linux/device.h> work with const
dev_pm_ops. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
  19057	    392	      0	  19449	   4bf9	drivers/net/ethernet/freescale/gianfar.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
  19249	    192	      0	  19441	   4bf1	drivers/net/ethernet/freescale/gianfar.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:48:51 -04:00
Arvind Yadav
d19724ec7b net: smc91x: constify dev_pm_ops structures.
dev_pm_ops are not supposed to change at runtime. All functions
working with dev_pm_ops provided by <linux/device.h> work with const
dev_pm_ops. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
  18709	    401	      0	  19110	   4aa6	drivers/net/ethernet/smsc/smc91x.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
  18901	    201	      0	  19102	   4a9e	drivers/net/ethernet/smsc/smc91x.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:48:50 -04:00
Arvind Yadav
eb60a73d00 net: ibm: ibmveth: constify dev_pm_ops structures.
dev_pm_ops are not supposed to change at runtime. All functions
working with dev_pm_ops provided by <linux/device.h> work with const
dev_pm_ops. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
  15426	   1256	      0	  16682	   412a	drivers/net/ethernet/ibm/ibmveth.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
  15618	   1064	      0	  16682	   412a	drivers/net/ethernet/ibm/ibmveth.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:48:49 -04:00
Thomas Falcon
5df969c3b0 ibmvnic: Fix assignment of RX/TX IRQ's
The driver currently creates RX/TX queues during device probe, but
assigns IRQ's to them during device open. On reset, however,
IRQ's are assigned when resetting the queues. If there is a reset
while the device is closed and the device is later opened, the driver will
request IRQ's twice, causing the open to fail. This patch assigns
the IRQ's in the ibmvnic_init function after the queues are reset or
initialized, ensuring IRQ's are only requested once.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:40:59 -04:00
Donald Sharp
4f75ba6982 net: ipmr: Add ipmr_rtm_getroute
Add to RTNL_FAMILY_IPMR, RTM_GETROUTE the ability
to retrieve one S,G mroute from a specified table.

*,G will return mroute information for just that
particular mroute if it exists.  This is because
it is entirely possible to have more S's then
can fit in one skb to return to the requesting
process.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:37:48 -04:00
Martin KaFai Lau
8007e40a24 bpf: Fix out-of-bound access on interpreters[]
The index is off-by-one when fp->aux->stack_depth
has already been rounded up to 32.  In particular,
if stack_depth is 512, the index will be 16.

The fix is to round_up and then takes -1 instead of round_down.

[   22.318680] ==================================================================
[   22.319745] BUG: KASAN: global-out-of-bounds in bpf_prog_select_runtime+0x48a/0x670
[   22.320737] Read of size 8 at addr ffffffff82aadae0 by task sockex3/1946
[   22.321646]
[   22.321858] CPU: 1 PID: 1946 Comm: sockex3 Tainted: G        W       4.12.0-rc6-01680-g2ee87db3a287 #22
[   22.323061] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.3-1.el7.centos 04/01/2014
[   22.324260] Call Trace:
[   22.324612]  dump_stack+0x67/0x99
[   22.325081]  print_address_description+0x1e8/0x290
[   22.325734]  ? bpf_prog_select_runtime+0x48a/0x670
[   22.326360]  kasan_report+0x265/0x350
[   22.326860]  __asan_report_load8_noabort+0x19/0x20
[   22.327484]  bpf_prog_select_runtime+0x48a/0x670
[   22.328109]  bpf_prog_load+0x626/0xd40
[   22.328637]  ? __bpf_prog_charge+0xc0/0xc0
[   22.329222]  ? check_nnp_nosuid.isra.61+0x100/0x100
[   22.329890]  ? __might_fault+0xf6/0x1b0
[   22.330446]  ? lock_acquire+0x360/0x360
[   22.331013]  SyS_bpf+0x67c/0x24d0
[   22.331491]  ? trace_hardirqs_on+0xd/0x10
[   22.332049]  ? __getnstimeofday64+0xaf/0x1c0
[   22.332635]  ? bpf_prog_get+0x20/0x20
[   22.333135]  ? __audit_syscall_entry+0x300/0x600
[   22.333770]  ? syscall_trace_enter+0x540/0xdd0
[   22.334339]  ? exit_to_usermode_loop+0xe0/0xe0
[   22.334950]  ? do_syscall_64+0x48/0x410
[   22.335446]  ? bpf_prog_get+0x20/0x20
[   22.335954]  do_syscall_64+0x181/0x410
[   22.336454]  entry_SYSCALL64_slow_path+0x25/0x25
[   22.337121] RIP: 0033:0x7f263fe81f19
[   22.337618] RSP: 002b:00007ffd9a3440c8 EFLAGS: 00000202 ORIG_RAX: 0000000000000141
[   22.338619] RAX: ffffffffffffffda RBX: 0000000000aac5fb RCX: 00007f263fe81f19
[   22.339600] RDX: 0000000000000030 RSI: 00007ffd9a3440d0 RDI: 0000000000000005
[   22.340470] RBP: 0000000000a9a1e0 R08: 0000000000a9a1e0 R09: 0000009d00000001
[   22.341430] R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000010000
[   22.342411] R13: 0000000000a9a023 R14: 0000000000000001 R15: 0000000000000003
[   22.343369]
[   22.343593] The buggy address belongs to the variable:
[   22.344241]  interpreters+0x80/0x980
[   22.344708]
[   22.344908] Memory state around the buggy address:
[   22.345556]  ffffffff82aad980: 00 00 00 04 fa fa fa fa 04 fa fa fa fa fa fa fa
[   22.346449]  ffffffff82aada00: 00 00 00 00 00 fa fa fa fa fa fa fa 00 00 00 00
[   22.347361] >ffffffff82aada80: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
[   22.348301]                                                        ^
[   22.349142]  ffffffff82aadb00: 00 01 fa fa fa fa fa fa 00 00 00 00 00 00 00 00
[   22.350058]  ffffffff82aadb80: 00 00 07 fa fa fa fa fa 00 00 05 fa fa fa fa fa
[   22.350984] ==================================================================

Fixes: b870aa901f ("bpf: use different interpreter depending on required stack size")
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Alexei Starovoitov <ast@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:37:04 -04:00
Colin Ian King
beef8516a4 amd-xgbe: fix spelling mistake: "avialable" -> "available"
Trivial fix to spelling mistake in netdev_err message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:35:50 -04:00
David S. Miller
8ac6e2a3b8 Merge branch 'arcnet-features'
Michael Grzeschik says:

====================
arcnet: Collection of latest features

Here we sum up the latest features to improve the arcnet framework. One
patch is used to get feedback from the transfer queue about failed xfers
by adding the err_skb message queue. Beside that we improve the
backplane status that can be read by the PCI-based cards and offer that
status via an extra sysfs attribute. In the last patch we add another
card type PCIFB2.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:26:14 -04:00
Michael Grzeschik
a356ab1c3d arcnet: com20020-pci: add support for PCIFB2 card
We add support for the PCIFB2 card from EAE.

Beside other cards, this card has the backplane mode enabled by default.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:26:14 -04:00
Michael Grzeschik
52ab12e4f9 arcnet: com20020-pci: handle backplane mode depending on card type
We read the backplane mode of each subcard from bits 2 and 3 of the misc
register.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:26:13 -04:00
Michael Grzeschik
ede07a1fc7 arcnet: com20020-pci: add attribute to readback backplane status
We add the sysfs interface the read back the backplane
status of the interface.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:26:13 -04:00
Michael Grzeschik
05fcd31cc4 arcnet: add err_skb package for package status feedback
We need to track the status of our queued packages. This way the driving
process knows if failed packages need to be retransmitted. For this
purpose we queue the transferred/failed packages back into the err_skb
message queue added with some status information.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:26:13 -04:00
David S. Miller
65344ba998 Merge branch 'amd-xgbe-updates'
Tom Lendacky says:

====================
amd-xgbe: AMD XGBE driver updates 2016-06-28

The following updates and fixes are included in this driver update series:

- Simplify mailbox interface code
- Fix SFP supported and advertising settings
- Fix PTP initialization register usage
- Insure there is timestamp skb present before using it
- Add a timeout to timestamp register updates
- Handle return code from software reset function
- Some fixes for handling 2.5Gbps rates
- Limit I2C error messages
- Fix non-DMA interrupt handling through tasklet usage
- Add NUMA affinity support for memory allocations
- Add NUMA affinity support for interrupts
- Prepare for more fine-grained cache coherency controls
- Simplify setting the DMA burst length programming
- Performance improvements

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

Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:20 -04:00
Lendacky, Thomas
6f595959c0 amd-xgbe: Adjust register settings to improve performance
Add support to change some general performance settings and to provide
some performance settings based on the device that is probed.

This includes:

- Setting the maximum read/write outstanding request limit
- Reducing the AXI interface burst length size
- Selectively setting the Tx and Rx descriptor pre-fetch threshold
- Selectively setting additional cache coherency controls

Tested and verified on all versions of the hardware.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:19 -04:00
Lendacky, Thomas
7e1e6b86a5 amd-xgbe: Simplify the burst length settings
Currently the driver hardcodes the PBLx8 setting.  Remove the need for
specifying the PBLx8 setting and automatically calculate based on the
specified PBL value. Since the PBLx8 setting applies to both Tx and Rx
use the same PBL value for both of them.

Also, the driver currently uses a bit field to set the AXI master burst
len setting. Change to the full bit field range and set the burst length
based on the specified value.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:19 -04:00
Lendacky, Thomas
9916716a1b amd-xgbe: Prepare for more fine grained cache coherency controls
In prep for setting fine grained read and write DMA cache coherency
controls, allow specific values to be used to set the cache coherency
registers.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:18 -04:00
Lendacky, Thomas
f00ba49d8e amd-xgbe: Add NUMA affinity support for IRQ hints
For IRQ affinity, set the affinity hints for the IRQs to be (initially) on
the processors corresponding to the NUMA node of the device.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:18 -04:00
Lendacky, Thomas
18f9f0ac55 amd-xgbe: Add NUMA affinity support for memory allocations
Add support to perform memory allocations on the node of the device. The
original allocation or the ring structure and Tx/Rx queues allocated all
of the memory at once and then carved it up for each channel and queue.
To best ensure that we get as much memory from the NUMA node as we can,
break the channel and ring allocations into individual allocations.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:18 -04:00
Lendacky, Thomas
85b85c8534 amd-xgbe: Re-issue interrupt if interrupt status not cleared
Some of the device interrupts should function as level interrupts. For
some hardware configurations this requires setting some control bits
so that if the interrupt status has not been cleared the interrupt
should be reissued.

Additionally, when using MSI or MSI-X interrupts, run the interrupt
service routine as a tasklet so that the re-issuance of the interrupt
is handled properly.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:18 -04:00
Lendacky, Thomas
45a2005e93 amd-xgbe: Limit the I2C error messages that are output
When I2C communication fails, it tends to always fail. Rather than
continuously issue an error message (once per second in most cases),
change the message to be issued just once.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:17 -04:00
Lendacky, Thomas
ed3333fa6f amd-xgbe: Fixes for working with PHYs that support 2.5GbE
The driver has some missing functionality when operating in the mode that
supports 2.5GbE.  Fix the driver to fully recognize and support this speed.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:17 -04:00
Lendacky, Thomas
42d452dc4a amd-xgbe: Handle return code from software reset function
Currently the function that performs a software reset of the hardware
provides a return code.  During driver probe check this return code and
exit with an error if the software reset fails.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:17 -04:00
Lendacky, Thomas
9018ff5331 amd-xgbe: Prevent looping forever if timestamp update fails
Just to be on the safe side, should the update of the timestamp registers
not complete, issue a warning rather than looping forever waiting for the
update to complete.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:16 -04:00
Lendacky, Thomas
93845d5f1b amd-xgbe: Add a check for an skb in the timestamp path
Spurious Tx timestamp interrupts can cause an oops in the Tx timestamp
processing function if a Tx timestamp skb is NULL. Add a check to insure
a Tx timestamp skb is present before attempting to use it.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:16 -04:00
Lendacky, Thomas
3abc7cff67 amd-xgbe: Use the proper register during PTP initialization
During PTP initialization, the Timestamp Control register should be
cleared and not the Tx Configuration register.  While this typo causes
the wrong register to be cleared, the default value of each register and
and the fact that the Tx Configuration register is programmed afterwards
doesn't result in a bug, hence only fixing in net-next.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:16 -04:00
Lendacky, Thomas
56503d55cc amd-xgbe: Fix SFP PHY supported/advertised settings
When using SFPs, the supported and advertised settings should be initially
based on the SFP that has been detected.  The code currently indicates the
overall support of the device as opposed to what the SFP is capable of.
Update the code to change the supported link modes, auto-negotiation, etc.
to be based on the installed SFP.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:15 -04:00
Lendacky, Thomas
549b32af9f amd-xgbe: Simplify mailbox interface rate change code
Simplify and centralize the mailbox command rate change interface by
having a single function perform the writes to the mailbox registers
to issue the request.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 15:14:15 -04:00
David S. Miller
e3ef6983cc Merge branch 'bpf-Add-syscall-lookup-support-for-fd-array-and-htab'
Martin KaFai Lau says:

====================
bpf: Add syscall lookup support for fd array and htab

This patchset adds BPF_MAP_LOOKUP_ELEM syscall support for
BPF_MAP_TYPE_PROG_ARRAY,
BPF_MAP_TYPE_ARRAY_OF_MAPS and
BPF_MAP_TYPE_HASH_OF_MAPS
====================

Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 13:13:26 -04:00
Martin KaFai Lau
a8744f2528 bpf: Add test for syscall on fd array/htab lookup
Checks are added to the existing sockex3 and test_map_in_map test.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 13:13:26 -04:00
Martin KaFai Lau
14dc6f04f4 bpf: Add syscall lookup support for fd array and htab
This patch allows userspace to do BPF_MAP_LOOKUP_ELEM on
BPF_MAP_TYPE_PROG_ARRAY,
BPF_MAP_TYPE_ARRAY_OF_MAPS and
BPF_MAP_TYPE_HASH_OF_MAPS.

The lookup returns a prog-id or map-id to the userspace.
The userspace can then use the BPF_PROG_GET_FD_BY_ID
or BPF_MAP_GET_FD_BY_ID to get a fd.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 13:13:25 -04:00
Thor Thayer
77b0d36177 net: stmmac: Add additional registers for dwmac1000_dma ethtool
Version 3.70a of the Designware has additional DMA registers so
add those to the ethtool DMA Register dump.
Offset 9  - Receive Interrupt Watchdog Timer Register
Offset 10 - AXI Bus Mode Register
Offset 11 - AHB or AXI Status Register
Offset 22 - HW Feature Register

Signed-off-by: Thor Thayer <thor.thayer@linux.intel.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:49:54 -04:00
David S. Miller
5185ad616b mlx5-updates-2017-06-27 (Innova IPsec offload support)
This patchset adds support for Innova IPSec network interface card.
 
 About Innova device:
 --------------------
 Innova is a network card with a ConnectX chip and an FPGA chip as a
  bump-on-the-wire.
 
                Internal
 +----------+   Link       +-----------------+
 |          +--------------+      FPGA       |  +------+
 | ConnectX |              |  Shell          +--+ QSFP |
 |          +--------------+    +-------+    |  | Port |
 +----------+      I2C     |    |  SBU  |    |  +------+
                           |    +-------+    |
                           +--+----------+---+
                              |          |
                           +--+--+   +---+---+
                           | DDR |   | Flash |
                           +-----+   +-------+
 
 The FPGA synthesized logic is loaded from dedicated flash storage and has
  access to its own dedicated DDR RAM.
 The ConnectX chip firmware programs the FPGA by accessing its configuration
 space over either the slow internal I2C link or the high-speed internal link.
 
 The FPGA logic is divided into a "Shell" and a "Sandbox Unit" (SBU).
 mlx5_core driver (with CONFIG_MLX5_FPGA) handles all shell functionality,
 while other components may handle the various SBU functionalities.
 
 The driver opens high-speed reliable communication channels with the shell and
 the SBU over the internal link.
 These channels may be used for high-bandwidth configuration or for SBU-specific
 out-of-band data paths.
 
 About Innova IPSec device:
 --------------------------
 Innova IPSec is a network card that allows offloading IPSec cryptography operations
 from the host CPU to the NIC. It is an Innova card with an IPSec SBU.
 The hardware keeps the database of IPSec Security Associations (SADB) in the FPGA's
 DDR memory.
 
                Internal
 +----------+   Link       +-----------------+
 |          +--------------+      FPGA       |  +------+
 | ConnectX |              |  Shell          +--+ QSFP |
 |          +--------------+    +-------+    |  | Port |
 +----------+ Internal I2C |    | IPSec |    |  +------+
                           |    |  SBU  |    |
                           |    +-------+    |
                           +--+----------+---+
                              |          |
                           +--+--+   +---+---+
                           | DDR |   |       |
                           |     |   | Flash |
                           |SADB |   |       |
                           +-----+   +-------+
 
 Modes and ciphers:
 Currently the following modes and ciphers are supported:
 IPv4 and IPv6
 ESP tunnel and transport modes
 AES 128 and 256 bit encryption, with GCM authentication (RFC4106)
 
 IV is generated using seqiv, in sync with Linux's geniv.
 
 More modes and ciphers may be added later.
 
 Notes:
 In the future similar functionality will be included in a single-chip NIC.
 
 About the driver:
 -----------------
 Patches 1-4 prepare some existing driver code for the new feature:
   * Add support for reserved GIDs in the hardware GID table
   * Allow multiple modules to enable hardware RoCE support independently
 Patches 5-6 define structs and helper functions for QP work-queues.
 Patches 7-11 add various FPGA-related features required for Innova.
 IPSec.
 Patch 12 adds abstraction layer for Mellanox IPSec-offload capable devices.
 atches 13-16 add IPSec offload support to the mlx5 netdevice.
 
 This driver services the new IPSec offload API introduced in commit
 d77e38e612 ("xfrm: Add an IPsec hardware offloading API")
 
 Configuration Path:
 If Innova IPSec device is detected, the mlx5e netdevice gets the new
 NETIF_F_HW_ESP feature and the xdo callbacks, indicating ESP offload
 capabilities, and also the matching TX checksum and GSO features.
 
 The driver configures offloaded Security Associations (SAs) by sending
 an ADD_SA or DEL_SA message to the IPSec SBU, which updates the SADB in DDR.
 These messages and their responses are sent over a high-speed channel.
 Counters for ethtool are retrieved by the driver from the SBU.
 
 Data path:
 On receive path, the SBU decrypts ESP packets which match the offloaded SADB,
 but keeps them encapsulated.
 The SBU injects metadata (Mellanox owned ethertype) indicating that crypto-offload
 has taken place, the SA with which it was done, and the authentication result.
 
 The ConnectX chip performs RX checksum offload on the packet, and RSS using the
 ESP SPI value.  The driver detects the special ethertype, and attaches a struct
 secpath to the RX SKB, including flags to indicate that crypto offload took place,
 the authentication result, and which xfrm_state was used for decryption, in the
 olen and ovec members. The RX SKB may have useful CHECKSUM_COMPLETE. A separate
 patchset will add support for that in the xfrm stack.
 
 On transmit path, the stack encapsulates the packet but does not encrypt it, and
 indicates in the SKB's secpath that crypto offload is to be performed and the SA
 to use to do so.
 The driver avoids performing crypto-offload for ESP fragments, and packets with
 IP options, as the SBU cannot currently do that.  For eligible packets, the driver
 prepends a special ethertype with metadata instructing the hardware to perform crypto offload.
 The stack builds regular (non-GSO) SKBs so that they contain a placeholder for the ESP trailer.
 The driver trims it off, because the SBU automatically appends the trailer for offloaded packets.
 The ConnectX chip performs TX checksum offload on inner UDP or TCP packets,
 and GSO for TCP packets (duplicating the prepended metadata).
 The segmented packets then undergo encryption in the SBU before going on the wire.
 
 Performance:
 We measure single stream of TCP on Intel(R) Xeon(R) CPU E5-2643 v2 @3.50GHz
 Using AES-NI with ESP GSO we get constant 4.1 Gbps.
 Using crypto offload we get constant 18 Gbps.
 
 Note that these numbers require CHECKSUM_COMPLETE support in XFRM, which we submit separately.
 
 -  Ilan Tayari
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJZUmf1AAoJEEg/ir3gV/o+ukIIALp/5+E1W0cC9xvY1X9dTETW
 cKsHvDJ7G1CxUy18W8Mf9z+WOqC6hGCqS+yicOb+umfIqkTcLHDb2irlqprYLC+F
 oYl1HqgHTaiAYByqL90qiyPcFbfsaNIqA9KOsED2qdZ1yxjoYBiJnSDZDAdO/0lN
 Lt1czNswFc5ovnEUGn8bkjLZZH2pJoJWEI4g4hN9cq33BLLq8A795F/ZjwCJTQ1X
 qXdKcEmktBrgZiSiTVFxxpQVhO/uB0HmzaZzrY1k1P5e6yhHEr422mcOcF9KcSL4
 aeyRYHjoIh51vPMbScPjvfbO/PwooU3LWLlxLVNLG0MmkSaGyJeUXg/wHsGI910=
 =JN0A
 -----END PGP SIGNATURE-----

Merge tag 'mlx5-updates-2017-06-27' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5-updates-2017-06-27 (Innova IPsec offload support)

This patchset adds support for Innova IPSec network interface card.

About Innova device:
--------------------
Innova is a network card with a ConnectX chip and an FPGA chip as a
 bump-on-the-wire.

               Internal
+----------+   Link       +-----------------+
|          +--------------+      FPGA       |  +------+
| ConnectX |              |  Shell          +--+ QSFP |
|          +--------------+    +-------+    |  | Port |
+----------+      I2C     |    |  SBU  |    |  +------+
                          |    +-------+    |
                          +--+----------+---+
                             |          |
                          +--+--+   +---+---+
                          | DDR |   | Flash |
                          +-----+   +-------+

The FPGA synthesized logic is loaded from dedicated flash storage and has
 access to its own dedicated DDR RAM.
The ConnectX chip firmware programs the FPGA by accessing its configuration
space over either the slow internal I2C link or the high-speed internal link.

The FPGA logic is divided into a "Shell" and a "Sandbox Unit" (SBU).
mlx5_core driver (with CONFIG_MLX5_FPGA) handles all shell functionality,
while other components may handle the various SBU functionalities.

The driver opens high-speed reliable communication channels with the shell and
the SBU over the internal link.
These channels may be used for high-bandwidth configuration or for SBU-specific
out-of-band data paths.

About Innova IPSec device:
--------------------------
Innova IPSec is a network card that allows offloading IPSec cryptography operations
from the host CPU to the NIC. It is an Innova card with an IPSec SBU.
The hardware keeps the database of IPSec Security Associations (SADB) in the FPGA's
DDR memory.

               Internal
+----------+   Link       +-----------------+
|          +--------------+      FPGA       |  +------+
| ConnectX |              |  Shell          +--+ QSFP |
|          +--------------+    +-------+    |  | Port |
+----------+ Internal I2C |    | IPSec |    |  +------+
                          |    |  SBU  |    |
                          |    +-------+    |
                          +--+----------+---+
                             |          |
                          +--+--+   +---+---+
                          | DDR |   |       |
                          |     |   | Flash |
                          |SADB |   |       |
                          +-----+   +-------+

Modes and ciphers:
Currently the following modes and ciphers are supported:
IPv4 and IPv6
ESP tunnel and transport modes
AES 128 and 256 bit encryption, with GCM authentication (RFC4106)

IV is generated using seqiv, in sync with Linux's geniv.

More modes and ciphers may be added later.

Notes:
In the future similar functionality will be included in a single-chip NIC.

About the driver:
-----------------
Patches 1-4 prepare some existing driver code for the new feature:
  * Add support for reserved GIDs in the hardware GID table
  * Allow multiple modules to enable hardware RoCE support independently
Patches 5-6 define structs and helper functions for QP work-queues.
Patches 7-11 add various FPGA-related features required for Innova.
IPSec.
Patch 12 adds abstraction layer for Mellanox IPSec-offload capable devices.
atches 13-16 add IPSec offload support to the mlx5 netdevice.

This driver services the new IPSec offload API introduced in commit
d77e38e612 ("xfrm: Add an IPsec hardware offloading API")

Configuration Path:
If Innova IPSec device is detected, the mlx5e netdevice gets the new
NETIF_F_HW_ESP feature and the xdo callbacks, indicating ESP offload
capabilities, and also the matching TX checksum and GSO features.

The driver configures offloaded Security Associations (SAs) by sending
an ADD_SA or DEL_SA message to the IPSec SBU, which updates the SADB in DDR.
These messages and their responses are sent over a high-speed channel.
Counters for ethtool are retrieved by the driver from the SBU.

Data path:
On receive path, the SBU decrypts ESP packets which match the offloaded SADB,
but keeps them encapsulated.
The SBU injects metadata (Mellanox owned ethertype) indicating that crypto-offload
has taken place, the SA with which it was done, and the authentication result.

The ConnectX chip performs RX checksum offload on the packet, and RSS using the
ESP SPI value.  The driver detects the special ethertype, and attaches a struct
secpath to the RX SKB, including flags to indicate that crypto offload took place,
the authentication result, and which xfrm_state was used for decryption, in the
olen and ovec members. The RX SKB may have useful CHECKSUM_COMPLETE. A separate
patchset will add support for that in the xfrm stack.

On transmit path, the stack encapsulates the packet but does not encrypt it, and
indicates in the SKB's secpath that crypto offload is to be performed and the SA
to use to do so.
The driver avoids performing crypto-offload for ESP fragments, and packets with
IP options, as the SBU cannot currently do that.  For eligible packets, the driver
prepends a special ethertype with metadata instructing the hardware to perform crypto offload.
The stack builds regular (non-GSO) SKBs so that they contain a placeholder for the ESP trailer.
The driver trims it off, because the SBU automatically appends the trailer for offloaded packets.
The ConnectX chip performs TX checksum offload on inner UDP or TCP packets,
and GSO for TCP packets (duplicating the prepended metadata).
The segmented packets then undergo encryption in the SBU before going on the wire.

Performance:
We measure single stream of TCP on Intel(R) Xeon(R) CPU E5-2643 v2 @3.50GHz
Using AES-NI with ESP GSO we get constant 4.1 Gbps.
Using crypto offload we get constant 18 Gbps.

Note that these numbers require CHECKSUM_COMPLETE support in XFRM, which we submit separately.

-  Ilan Tayari
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:30:16 -04:00
David S. Miller
869684a70d Merge branch 'net-fix-sw-timestamping'
Ivan Khoronzhuk says:

====================
net: fix sw timestamping for non PTP packets

This series contains several corrections connected with timestamping
for cpsw and netcp drivers based on same cpts module.

Based on net/next
====================

Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:28:57 -04:00
Ivan Khoronzhuk
0ccf59ba07 net: ethernet: ti: netcp_ethss: use cpts to check if packet needs timestamping
There is cpts function to check if packet can be timstamped with cpts.
Seems that ptp_classify_raw cover all cases listed with "case".

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:28:57 -04:00
Ivan Khoronzhuk
f44f8417ba net: ethernet: ti: cpsw: fix sw timestamping for non PTP packets
The cpts can timestmap only ptp packets at this moment, so driver
cannot mark every packet as though it's going to be timestamped,
only because h/w timestamping for given skb is enabled with
SKBTX_HW_TSTAMP. It doesn't allow to use sw timestamping, as result
outgoing packet is not timestamped at all if it's not PTP and h/w
timestamping is enabled. So, fix it by setting SKBTX_IN_PROGRESS
only for PTP packets.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:28:57 -04:00
Ivan Khoronzhuk
98fdd857a3 net: ethernet: ti: cpsw: move skb timestamp to packet_submit
Move sw timestamp function close to channel submit function.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:28:56 -04:00
Joe Perches
bf24e136a3 cavium: thunder: Remove duplicate "netdev->name" logging output
Using netdev_<level>(netdev, "%s: ...", netdev->name) duplicates the
name in the output.  Remove those uses.

Miscellanea:

o Use the netif_<level> convenience macros at the same time

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:25:33 -04:00
Colin Ian King
46ccf725bf net/mlx4: fix spelling mistake: "enforcment" -> "enforcement"
Trivial fix to spelling mistake in mlx4_dbg debug message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:25:01 -04:00
Colin Ian King
62d4fd4733 net: atl1c: fix spelling mistake: "droppted" -> "dropped"
Trivial fix to spelling mistake in netif_info message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:24:26 -04:00
LABBE Corentin
5a79b4f2a5 arm: sun8i: orangepi-2: use internal phy-mode
Since the PHY used is internal, simply set phy-mode as internal.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:23:28 -04:00
LABBE Corentin
bdcc005bea arm: sun8i: nanopi-neo: use internal phy-mode
Since the PHY used is internal, simply set phy-mode as internal.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:23:28 -04:00
LABBE Corentin
4ac57180ea arm: sun8i: orangepi-one: use internal phy-mode
Since the PHY used is internal, simply set phy-mode as internal.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:23:28 -04:00
LABBE Corentin
6066de6848 arm: sun8i: orangepi-zero: use internal phy-mode
Since the PHY used is internal, simply set phy-mode as internal.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:23:27 -04:00
LABBE Corentin
3432a86e64 arm: sun8i: orangepipc: use internal phy-mode
Since the PHY used is internal, simply set phy-mode as internal.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:23:27 -04:00
LABBE Corentin
1c2fa5f846 net: stmmac: support future possible different internal phy mode
The current way to find if the phy is internal is to compare DT phy-mode
and emac_variant/internal_phy.
But it will negate a possible future SoC where an external PHY use the
same phy mode than the internal one.

By using phy-mode = "internal" we permit to have an external PHY with
the same mode than the internal one.

Reported-by: André Przywara <andre.przywara@arm.com>
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:23:27 -04:00
Michael Dilmore
eac306b4ad Bonding: Convert multiple netdev_info messages to netdev_dbg
The bond_options.c file contains multiple netdev_info statements that clutter kernel output.
This patch replaces all netdev_info with netdev_dbg and adds a netdev_dbg statement for the
packets per slave parameter. Also fixes misalignment at line 467.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Michael J Dilmore <michael.j.dilmore@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-29 12:21:37 -04:00
David S. Miller
2ee87db3a2 Merge branch 'nfp-get_phys_port_name-for-representors-and-SR-IOV-reorder'
Jakub Kicinski says:

====================
nfp: get_phys_port_name for representors and SR-IOV reorder

This series starts by making the error message if FW cannot be located
easier to understand.  Then I move some functions from PCI probe files
into library code (nfpcore) where they belong, and remove one function
which is never used.

Next few patches equip representors with nfp_port structure and make
their NDOs fully shared (not defined in apps), thanks to which we can
easily determine which netdevs are NFP's by comparing the NDO pointers.

10th patch makes use of the shared NDOs and nfp_ports to deliver
netdev-type independent .ndo_get_phys_port_name() implementation.

Patches 11 and 12 reorder the nfp_app SR-IOV callbacks with enabling
SR-IOV VFs.  Unfortunately due to how PCI subsystem works we can't
guarantee being able to disable SR-IOV at exit or that it will be
disabled when we first probe...  We must therefore make sure FW is
able to deal with being loaded while SR-IOV is already on.

Patch 13 fixes potential deadlock when enabling SR-IOV happens at
the same time as port state refresh.  Note that this can't happen
at this point, since Flower doesn't refresh ports... but lockdep
doesn't know about such details and we will have to deal with this
sooner or later anyway.

Last but not least a new Kconfig is added to make sure those who
don't care about flower offloads have a way of not including the
code in their kernels.  Thanks to nfp_app separation this costs us
a single ifdef and excluding flower files from the build.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-27 15:48:50 -04:00
Jakub Kicinski
57ae676ee6 nfp: flower: add Kconfig for flower app
Give users an option not to build the flower-offload related code.

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>
2017-06-27 15:48:50 -04:00