]> git.proxmox.com Git - mirror_ubuntu-kernels.git/log
mirror_ubuntu-kernels.git
6 years agotg3: Mark expected switch fall-throughs
Gustavo A. R. Silva [Thu, 28 Jun 2018 01:45:24 +0000 (20:45 -0500)]
tg3: Mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'ila-Cleanup'
David S. Miller [Fri, 29 Jun 2018 02:32:55 +0000 (11:32 +0900)]
Merge branch 'ila-Cleanup'

Tom Herbert says:

====================
ila: Cleanup

Perform some cleanup in ILA code. This includes:

- Fix rhashtable walk for cases where nl dumps are done with muliple
  function calls. Add a skip index to skip over entries in
  a node that have been previously visitied. Call rhashtable_walk_peek
  to avoid dropping items between calls to ila_nl_dump.
- Call alloc_bucket_spinlocks to create bucket locks.
- Split out module initialization and netlink definitions into
  separate files.
- Add ILA_CMD_FLUSH netlink command to clear the ILA translation table.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoila: Flush netlink command to clear xlat table
Tom Herbert [Wed, 27 Jun 2018 21:39:02 +0000 (14:39 -0700)]
ila: Flush netlink command to clear xlat table

Add ILA_CMD_FLUSH netlink command to clear the ILA translation table.

Signed-off-by: Tom Herbert <tom@quantonium.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoila: Create main ila source file
Tom Herbert [Wed, 27 Jun 2018 21:39:01 +0000 (14:39 -0700)]
ila: Create main ila source file

Create a main ila file that contains the module initialization functions
as well as netlink definitions. Previously these were defined in
ila_xlat and ila_common. This approach allows better extensibility.

Signed-off-by: Tom Herbert <tom@quantonium.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoila: Call library function alloc_bucket_locks
Tom Herbert [Wed, 27 Jun 2018 21:39:00 +0000 (14:39 -0700)]
ila: Call library function alloc_bucket_locks

To allocate the array of bucket locks for the hash table we now
call library function alloc_bucket_spinlocks.

Signed-off-by: Tom Herbert <tom@quantonium.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoila: Fix use of rhashtable walk in ila_xlat.c
Tom Herbert [Wed, 27 Jun 2018 21:38:59 +0000 (14:38 -0700)]
ila: Fix use of rhashtable walk in ila_xlat.c

Perform better EAGAIN handling, handle case where ila_dump_info
fails and we missed objects in the dump, and add a skip index
to skip over ila entires in a list on a rhashtable node that have
already been visited (by a previous call to ila_nl_dump).

Signed-off-by: Tom Herbert <tom@quantonium.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'hns3-a-few-code-improvements'
David S. Miller [Fri, 29 Jun 2018 02:06:35 +0000 (11:06 +0900)]
Merge branch 'hns3-a-few-code-improvements'

Peng Li says:

====================
net: hns3: a few code improvements

This patchset fixes a few code stylistic issues from
concentrated review, no functional changes introduced.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: hns3: use lower_32_bits and upper_32_bits
Huazhong Tan [Thu, 28 Jun 2018 04:12:29 +0000 (12:12 +0800)]
net: hns3: use lower_32_bits and upper_32_bits

MACRO lower_32_bits and upper_32_bits can help to get bits 0-31
and bits 32-63 of a number, so just use it.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: hns3: remove back in struct hclge_hw
Huazhong Tan [Thu, 28 Jun 2018 04:12:28 +0000 (12:12 +0800)]
net: hns3: remove back in struct hclge_hw

hclge_hw is embedded in hclge_dev, so use container_of instead of
back to get hclge_dev.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: hns3: remove the Redundant put_vector in hns3_client_uninit
Peng Li [Thu, 28 Jun 2018 04:12:27 +0000 (12:12 +0800)]
net: hns3: remove the Redundant put_vector in hns3_client_uninit

The interface h->ae_algo->ops->put_vector is called in both
hns3_nic_dealloc_vector_data and hns3_nic_uninit_vector_data in
hns3_client_uninit, this will cause vector freed twice.
This patch remove the Redundant put_vector to make vector freed
only once.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: hns3: print the ret value in error information
Peng Li [Thu, 28 Jun 2018 04:12:26 +0000 (12:12 +0800)]
net: hns3: print the ret value in error information

Print the ret value in error information can help find the reason.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: hns3: extraction an interface for state init|uninit
Peng Li [Thu, 28 Jun 2018 04:12:25 +0000 (12:12 +0800)]
net: hns3: extraction an interface for state init|uninit

Extraction an interface for state init|uninit to make the code
easier to read.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: hns3: remove unused head file in hnae3.c
Peng Li [Thu, 28 Jun 2018 04:12:24 +0000 (12:12 +0800)]
net: hns3: remove unused head file in hnae3.c

linux/slab.h is not used in hnae3.h, this patch removes it.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: hns3: add unlikely for error check
Peng Li [Thu, 28 Jun 2018 04:12:23 +0000 (12:12 +0800)]
net: hns3: add unlikely for error check

The first bd of a packet is invalid and invalid ring head for tx
IRQ is not offen, they may occur when there is error,
Add unlikely for error check branch is better for performance.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: hns3: add l4_type check for both ipv4 and ipv6
Peng Li [Thu, 28 Jun 2018 04:12:22 +0000 (12:12 +0800)]
net: hns3: add l4_type check for both ipv4 and ipv6

HW supports UDP, TCP and SCTP packets checksum for both ipv4 and
ipv6,  but do not support other type packets checksum for ipv4 or
ipv6.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: hns3: add vector status check before free vector
Peng Li [Thu, 28 Jun 2018 04:12:21 +0000 (12:12 +0800)]
net: hns3: add vector status check before free vector

If the hdev->vector_status[vector_id] is already HCLGE_INVALID_VPORT,
should log the error and return.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: hns3: rename the interface for init_client_instance and uninit_client_instance
Peng Li [Thu, 28 Jun 2018 04:12:20 +0000 (12:12 +0800)]
net: hns3: rename the interface for init_client_instance and uninit_client_instance

The interface init_client_instance and uninit_client_instance
do not register anything, only initialize the client instance.
This patch rename the related interface to make the function
name to indicate the purpose.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: hns3: remove hclge_get_vector_index from hclge_bind_ring_with_vector
Peng Li [Thu, 28 Jun 2018 04:12:19 +0000 (12:12 +0800)]
net: hns3: remove hclge_get_vector_index from hclge_bind_ring_with_vector

In hclge_unmap_ring_frm_vector, there are 2 steps:
step 1: get vector index.
step 2 unbind ring with vector.

But it gets vector id again in step 2 interface. This patch
removes hclge_get_vector_index from hclge_bind_ring_with_vector,
and make the step the same with hns3 PF driver.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'net-preserve-sock-reference-when-scrubbing-the-skb'
David S. Miller [Thu, 28 Jun 2018 13:21:33 +0000 (22:21 +0900)]
Merge branch 'net-preserve-sock-reference-when-scrubbing-the-skb'

Flavio Leitner says:

====================
net: preserve sock reference when scrubbing the skb.

The sock reference is lost when scrubbing the packet and that breaks
TSQ (TCP Small Queues) and XPS (Transmit Packet Steering) causing
performance impacts of about 50% in a single TCP stream when crossing
network namespaces.

XPS breaks because the queue mapping stored in the socket is not
available, so another random queue might be selected when the stack
needs to transmit something like a TCP ACK, or TCP Retransmissions.
That causes packet re-ordering and/or performance issues.

TSQ breaks because it orphans the packet while it is still in the
host, so packets are queued contributing to the buffer bloat problem.

Preserving the sock reference fixes both issues. The socket is
orphaned anyways in the receiving path before any relevant action,
but the transmit side needs some extra checking included in the
first patch.

The first patch will update netfilter to check if the socket
netns is local before use it.

The second patch removes the skb_orphan() from the skb_scrub_packet()
and improve the documentation.

ChangeLog:
- split into two (Eric)
- addressed Paolo's offline feedback to swap the checks in xt_socket.c
  to preserve original behavior.
- improved ip-sysctl.txt (reported by Cong)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoskbuff: preserve sock reference when scrubbing the skb.
Flavio Leitner [Wed, 27 Jun 2018 13:34:26 +0000 (10:34 -0300)]
skbuff: preserve sock reference when scrubbing the skb.

The sock reference is lost when scrubbing the packet and that breaks
TSQ (TCP Small Queues) and XPS (Transmit Packet Steering) causing
performance impacts of about 50% in a single TCP stream when crossing
network namespaces.

XPS breaks because the queue mapping stored in the socket is not
available, so another random queue might be selected when the stack
needs to transmit something like a TCP ACK, or TCP Retransmissions.
That causes packet re-ordering and/or performance issues.

TSQ breaks because it orphans the packet while it is still in the
host, so packets are queued contributing to the buffer bloat problem.

Preserving the sock reference fixes both issues. The socket is
orphaned anyways in the receiving path before any relevant action
and on TX side the netfilter checks if the reference is local before
use it.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonetfilter: check if the socket netns is correct.
Flavio Leitner [Wed, 27 Jun 2018 13:34:25 +0000 (10:34 -0300)]
netfilter: check if the socket netns is correct.

Netfilter assumes that if the socket is present in the skb, then
it can be used because that reference is cleaned up while the skb
is crossing netns.

We want to change that to preserve the socket reference in a future
patch, so this is a preparation updating netfilter to check if the
socket netns matches before use it.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'net-sched-actions-code-style-cleanup-and-fixes'
David S. Miller [Thu, 28 Jun 2018 13:12:03 +0000 (22:12 +0900)]
Merge branch 'net-sched-actions-code-style-cleanup-and-fixes'

Roman Mashak says:

====================
net sched actions: code style cleanup and fixes

The patchset fixes a few code stylistic issues and typos, as well as one
detected by sparse semantic checker tool.

No functional changes introduced.

Patch 1 & 2 fix coding style bits caught by the checkpatch.pl script
Patch 3 fixes an issue with a shadowed variable
Patch 4 adds sizeof() operator instead of magic number for buffer length
Patch 5 fixes typos in diagnostics messages
Patch 6 explicitly sets unsigned char for bitwise operation

v2:
   - submit for net-next
   - added Reviewed-by tags
   - use u8* instead of char* as per Davide Caratti suggestion
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet sched actions: avoid bitwise operation on signed value in pedit
Roman Mashak [Wed, 27 Jun 2018 17:33:35 +0000 (13:33 -0400)]
net sched actions: avoid bitwise operation on signed value in pedit

Since char can be unsigned or signed, and bitwise operators may have
implementation-dependent results when performed on signed operands,
declare 'u8 *' operand instead.

Suggested-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet sched actions: fix misleading text strings in pedit action
Roman Mashak [Wed, 27 Jun 2018 17:33:34 +0000 (13:33 -0400)]
net sched actions: fix misleading text strings in pedit action

Change "tc filter pedit .." to "tc actions pedit .." in error
messages to clearly refer to pedit action.

Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet sched actions: use sizeof operator for buffer length
Roman Mashak [Wed, 27 Jun 2018 17:33:33 +0000 (13:33 -0400)]
net sched actions: use sizeof operator for buffer length

Replace constant integer with sizeof() to clearly indicate
the destination buffer length in skb_header_pointer() calls.

Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet sched actions: fix sparse warning
Roman Mashak [Wed, 27 Jun 2018 17:33:32 +0000 (13:33 -0400)]
net sched actions: fix sparse warning

The variable _data in include/asm-generic/sections.h defines sections,
this causes sparse warning in pedit:

net/sched/act_pedit.c:293:35: warning: symbol '_data' shadows an earlier one
./include/asm-generic/sections.h:36:13: originally declared here

Therefore rename the variable.

Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet sched actions: fix coding style in pedit headers
Roman Mashak [Wed, 27 Jun 2018 17:33:31 +0000 (13:33 -0400)]
net sched actions: fix coding style in pedit headers

Fix coding style issues in tc pedit headers detected by the
checkpatch script.

Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet sched actions: fix coding style in pedit action
Roman Mashak [Wed, 27 Jun 2018 17:33:30 +0000 (13:33 -0400)]
net sched actions: fix coding style in pedit action

Fix coding style issues in tc pedit action detected by the
checkpatch script.

Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonetem: slotting with non-uniform distribution
Yousuk Seung [Wed, 27 Jun 2018 17:32:19 +0000 (10:32 -0700)]
netem: slotting with non-uniform distribution

Extend slotting with support for non-uniform distributions. This is
similar to netem's non-uniform distribution delay feature.

Commit f043efeae2f1 ("netem: support delivering packets in delayed
time slots") added the slotting feature to approximate the behaviors
of media with packet aggregation but only supported a uniform
distribution for delays between transmission attempts. Tests with TCP
BBR with emulated wifi links with non-uniform distributions produced
more useful results.

Syntax:
   slot dist DISTRIBUTION DELAY JITTER [packets MAX_PACKETS] \
      [bytes MAX_BYTES]

The syntax and use of the distribution table is the same as in the
non-uniform distribution delay feature. A file DISTRIBUTION must be
present in TC_LIB_DIR (e.g. /usr/lib/tc) containing numbers scaled by
NETEM_DIST_SCALE. A random value x is selected from the table and it
takes DELAY + ( x * JITTER ) as delay. Correlation between values is not
supported.

Examples:
  Normal distribution delay with mean = 800us and stdev = 100us.
  > tc qdisc add dev eth0 root netem slot dist normal 800us 100us

  Optionally set the max slot size in bytes and/or packets.
  > tc qdisc add dev eth0 root netem slot dist normal 800us 100us \
    bytes 64k packets 42

Signed-off-by: Yousuk Seung <ysseung@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonetlink: Return extack message if attribute validation fails
David Ahern [Tue, 26 Jun 2018 19:39:18 +0000 (12:39 -0700)]
netlink: Return extack message if attribute validation fails

Have one extack message for parsing and validating.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: phy: xgmiitorgmii: Check read_status results
Brandon Maier [Tue, 26 Jun 2018 17:50:50 +0000 (12:50 -0500)]
net: phy: xgmiitorgmii: Check read_status results

We're ignoring the result of the attached phy device's read_status().
Return it so we can detect errors.

Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: phy: xgmiitorgmii: Use correct mdio bus
Brandon Maier [Tue, 26 Jun 2018 17:50:49 +0000 (12:50 -0500)]
net: phy: xgmiitorgmii: Use correct mdio bus

The xgmiitorgmii is using the mii_bus of the device it's attached to,
instead of the bus it was given during probe.

Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: phy: xgmiitorgmii: Check phy_driver ready before accessing
Brandon Maier [Tue, 26 Jun 2018 17:50:48 +0000 (12:50 -0500)]
net: phy: xgmiitorgmii: Check phy_driver ready before accessing

Since a phy_device is added to the global mdio_bus list during
phy_device_register(), but a phy_device's phy_driver doesn't get
attached until phy_probe(). It's possible of_phy_find_device() in
xgmiitorgmii will return a valid phy with a NULL phy_driver. Leading to
a NULL pointer access during the memcpy().

Fixes this Oops:

Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.14.40 #1
Hardware name: Xilinx Zynq Platform
task: ce4c8d00 task.stack: ce4ca000
PC is at memcpy+0x48/0x330
LR is at xgmiitorgmii_probe+0x90/0xe8
pc : [<c074bc68>]    lr : [<c0529548>]    psr: 20000013
sp : ce4cbb54  ip : 00000000  fp : ce4cbb8c
r10: 00000000  r9 : 00000000  r8 : c0c49178
r7 : 00000000  r6 : cdc14718  r5 : ce762800  r4 : cdc14710
r3 : 00000000  r2 : 00000054  r1 : 00000000  r0 : cdc14718
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 18c5387d  Table: 0000404a  DAC: 00000051
Process swapper/0 (pid: 1, stack limit = 0xce4ca210)
...
[<c074bc68>] (memcpy) from [<c0529548>] (xgmiitorgmii_probe+0x90/0xe8)
[<c0529548>] (xgmiitorgmii_probe) from [<c0526a94>] (mdio_probe+0x28/0x34)
[<c0526a94>] (mdio_probe) from [<c04db98c>] (driver_probe_device+0x254/0x414)
[<c04db98c>] (driver_probe_device) from [<c04dbd58>] (__device_attach_driver+0xac/0x10c)
[<c04dbd58>] (__device_attach_driver) from [<c04d96f4>] (bus_for_each_drv+0x84/0xc8)
[<c04d96f4>] (bus_for_each_drv) from [<c04db5bc>] (__device_attach+0xd0/0x134)
[<c04db5bc>] (__device_attach) from [<c04dbdd4>] (device_initial_probe+0x1c/0x20)
[<c04dbdd4>] (device_initial_probe) from [<c04da8fc>] (bus_probe_device+0x98/0xa0)
[<c04da8fc>] (bus_probe_device) from [<c04d8660>] (device_add+0x43c/0x5d0)
[<c04d8660>] (device_add) from [<c0526cb8>] (mdio_device_register+0x34/0x80)
[<c0526cb8>] (mdio_device_register) from [<c0580b48>] (of_mdiobus_register+0x170/0x30c)
[<c0580b48>] (of_mdiobus_register) from [<c05349c4>] (macb_probe+0x710/0xc00)
[<c05349c4>] (macb_probe) from [<c04dd700>] (platform_drv_probe+0x44/0x80)
[<c04dd700>] (platform_drv_probe) from [<c04db98c>] (driver_probe_device+0x254/0x414)
[<c04db98c>] (driver_probe_device) from [<c04dbc58>] (__driver_attach+0x10c/0x118)
[<c04dbc58>] (__driver_attach) from [<c04d9600>] (bus_for_each_dev+0x8c/0xd0)
[<c04d9600>] (bus_for_each_dev) from [<c04db1fc>] (driver_attach+0x2c/0x30)
[<c04db1fc>] (driver_attach) from [<c04daa98>] (bus_add_driver+0x50/0x260)
[<c04daa98>] (bus_add_driver) from [<c04dc440>] (driver_register+0x88/0x108)
[<c04dc440>] (driver_register) from [<c04dd6b4>] (__platform_driver_register+0x50/0x58)
[<c04dd6b4>] (__platform_driver_register) from [<c0b31248>] (macb_driver_init+0x24/0x28)
[<c0b31248>] (macb_driver_init) from [<c010203c>] (do_one_initcall+0x60/0x1a4)
[<c010203c>] (do_one_initcall) from [<c0b00f78>] (kernel_init_freeable+0x15c/0x1f8)
[<c0b00f78>] (kernel_init_freeable) from [<c0763d10>] (kernel_init+0x18/0x124)
[<c0763d10>] (kernel_init) from [<c0112d74>] (ret_from_fork+0x14/0x20)
Code: ba000002 f5d1f03c f5d1f05c f5d1f07c (e8b151f8)
---[ end trace 3e4ec21905820a1f ]---

Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'ipsec-selftests-updates'
David S. Miller [Thu, 28 Jun 2018 07:10:08 +0000 (16:10 +0900)]
Merge branch 'ipsec-selftests-updates'

Shannon Nelson says:

====================
Updates for ipsec selftests

Fix up the existing ipsec selftest and add tests for
the ipsec offload driver API.

v2: addressed formatting nits in netdevsim from Jakub Kicinski
v3: a couple more nits from Jakub
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoselftests: rtnetlink: add ipsec offload API test
Shannon Nelson [Tue, 26 Jun 2018 17:07:55 +0000 (10:07 -0700)]
selftests: rtnetlink: add ipsec offload API test

Using the netdevsim as a device for testing, try out the XFRM commands
for setting up IPsec hardware offloads.

Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonetdevsim: add ipsec offload testing
Shannon Nelson [Tue, 26 Jun 2018 17:07:54 +0000 (10:07 -0700)]
netdevsim: add ipsec offload testing

Implement the IPsec/XFRM offload API for testing.

Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoselftests: rtnetlink: use dummydev as a test device
Shannon Nelson [Tue, 26 Jun 2018 17:07:53 +0000 (10:07 -0700)]
selftests: rtnetlink: use dummydev as a test device

We really shouldn't mess with local system settings, so let's
use the already created dummy device instead for ipsec testing.
Oh, and let's put the temp file into a proper directory.

Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoselftests: rtnetlink: clear the return code at start of ipsec test
Shannon Nelson [Tue, 26 Jun 2018 17:07:52 +0000 (10:07 -0700)]
selftests: rtnetlink: clear the return code at start of ipsec test

Following the custom from the other functions, clear the global
ret code before starting the test so as to not have previously
failed tests cause us to thing this test has failed.

Reported-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agol2tp: define helper for parsing struct sockaddr_pppol2tp*
Guillaume Nault [Tue, 26 Jun 2018 16:41:36 +0000 (18:41 +0200)]
l2tp: define helper for parsing struct sockaddr_pppol2tp*

'sockaddr_len' is checked against various values when entering
pppol2tp_connect(), to verify its validity. It is used again later, to
find out which sockaddr structure was passed from user space. This
patch combines these two operations into one new function in order to
simplify pppol2tp_connect().

A new structure, l2tp_connect_info, is used to pass sockaddr data back
to pppol2tp_connect(), to avoid passing too many parameters to
l2tp_sockaddr_get_info(). Also, the first parameter is void* in order
to avoid casting between all sockaddr_* structures manually.

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agotcp: remove one indentation level in tcp_create_openreq_child
Eric Dumazet [Tue, 26 Jun 2018 15:45:49 +0000 (08:45 -0700)]
tcp: remove one indentation level in tcp_create_openreq_child

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agosh_eth: fix *enum* {A|M}PR_BIT
Sergei Shtylyov [Tue, 26 Jun 2018 15:42:33 +0000 (18:42 +0300)]
sh_eth: fix *enum* {A|M}PR_BIT

The *enum* {A|M}PR_BIT were declared in the commit 86a74ff21a7a ("net:
sh_eth: add support for  Renesas SuperH Ethernet") adding SH771x support,
however the SH771x manual  doesn't have the APR/MPR registers described
and the code writing to them for SH7710 was later removed by the commit
380af9e390ec ("net: sh_eth: CPU dependency code collect to "struct
sh_eth_cpu_data""). All the newer SoC manuals have these registers
documented as having a 16-bit TIME parameter of the PAUSE frame, not
1-bit -- update the *enum* accordingly, fixing up the APR/MPR writes...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agotc-tests: add an extreme-case csum action test
Keara Leibovitz [Tue, 26 Jun 2018 14:16:28 +0000 (10:16 -0400)]
tc-tests: add an extreme-case csum action test

Added an extreme-case test for all 7 csum action headers.

Signed-off-by: Keara Leibovitz <kleib@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'mscc-ocelot-add-more-features'
David S. Miller [Thu, 28 Jun 2018 05:18:49 +0000 (14:18 +0900)]
Merge branch 'mscc-ocelot-add-more-features'

Alexandre Belloni says:

====================
net: mscc: ocelot: add more features

This series adds link aggregation and VLAN filtering hardware offload
support to the ocelot driver.

PTP support will be sent later.

changes in v2:
 - rebased on v4.18-rc1
 - check for aggregation type and only offload it when type is hash (balance-xor
   or 802.3ad)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: mscc: ocelot: add VLAN filtering
Antoine Tenart [Tue, 26 Jun 2018 12:28:49 +0000 (14:28 +0200)]
net: mscc: ocelot: add VLAN filtering

Add hardware VLAN filtering offloading on ocelot.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: mscc: ocelot: add bonding support
Alexandre Belloni [Tue, 26 Jun 2018 12:28:48 +0000 (14:28 +0200)]
net: mscc: ocelot: add bonding support

Add link aggregation hardware offload support for Ocelot.

ocelot_get_link_ksettings() is not great but it does work until the driver
is reworked to switch to phylink.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agocxgb4: Add new T5 PCI device id 0x50ae
Ganesh Goudar [Tue, 26 Jun 2018 09:21:13 +0000 (14:51 +0530)]
cxgb4: Add new T5 PCI device id 0x50ae

Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agocxgb4: Add flag tc_flower_initialized
Casey Leedom [Tue, 26 Jun 2018 09:18:48 +0000 (14:48 +0530)]
cxgb4: Add flag tc_flower_initialized

Add flag tc_flower_initialized to indicate the
completion if tc flower initialization.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoneighbour: force neigh_invalidate when NUD_FAILED update is from admin
Roopa Prabhu [Tue, 26 Jun 2018 03:32:53 +0000 (20:32 -0700)]
neighbour: force neigh_invalidate when NUD_FAILED update is from admin

In systems where neigh gc thresh holds are set to high values,
admin deleted neigh entries (eg ip neigh flush or ip neigh del) can
linger around in NUD_FAILED state for a long time until periodic gc kicks
in. This patch forces neigh_invalidate when NUD_FAILED neigh_update is
from an admin.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'Multipath-tests-for-tunnel-devices'
David S. Miller [Wed, 27 Jun 2018 01:42:13 +0000 (10:42 +0900)]
Merge branch 'Multipath-tests-for-tunnel-devices'

Petr Machata says:

====================
Multipath tests for tunnel devices

This patchset adds a test for ECMP and weighted ECMP between two GRE
tunnels.

In patches #1 and #2, the function multipath_eval() is first moved from
router_multipath.sh to lib.sh for ease of reuse, and then fixed up.

In patch #3, the function tc_rule_stats_get() is parameterized to be
useful for egress rules as well.

In patch #4, a new function __simple_if_init() is extracted from
simple_if_init(). This covers the logic that needs to be done for the
usual interface: VRF migration, upping and installation of IP addresses.

Patch #5 then adds the test itself.

Additionally in patch #6, a requirement to add diagrams to selftests is
documented.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoselftests: forwarding: README: Require diagrams
Petr Machata [Tue, 26 Jun 2018 00:08:17 +0000 (02:08 +0200)]
selftests: forwarding: README: Require diagrams

ASCII art diagrams are well suited for presenting the topology that a
test uses while being easy to embed directly in the test file iteslf.
They make the information very easy to grasp even for simple topologies,
and for more complex ones they are almost essential, as figuring out the
interconnects from the script itself proves to be difficult.

Therefore state the requirement for topology ASCII art in README.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoselftests: forwarding: Test multipath tunneling
Petr Machata [Tue, 26 Jun 2018 00:08:05 +0000 (02:08 +0200)]
selftests: forwarding: Test multipath tunneling

Add a GRE-tunneling test such that there are two tunnels involved, with
a multipath route listing both as next hops. Similarly to
router_multipath.sh, test that the distribution of traffic to the
tunnels honors the configured weights.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoselftests: forwarding: lib: Extract interface-init functions
Petr Machata [Tue, 26 Jun 2018 00:08:00 +0000 (02:08 +0200)]
selftests: forwarding: lib: Extract interface-init functions

The function simple_if_init() does two things: it creates a VRF, then
moves an interface into this VRF and configures addresses. The latter
comes in handy when adding more interfaces into a VRF later on. The
situation is similar for simple_if_fini().

Therefore split the interface remastering and address de/initialization
logic to a new pair of helpers __simple_if_init() / __simple_if_fini(),
and defer to these helpers from simple_if_init() and simple_if_fini().

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoselftests: forwarding: tc_rule_stats_get: Parameterize direction
Petr Machata [Tue, 26 Jun 2018 00:07:45 +0000 (02:07 +0200)]
selftests: forwarding: tc_rule_stats_get: Parameterize direction

The GRE multipath tests need stats on an egress counter. Change
tc_rule_stats_get() to take direction as an optional argument, with
default of ingress.

Take the opportunity to change line continuation character from | to \.
Move the | to the next line, which indent.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoselftests: forwarding: multipath_eval(): Improve style
Petr Machata [Tue, 26 Jun 2018 00:07:08 +0000 (02:07 +0200)]
selftests: forwarding: multipath_eval(): Improve style

- Change the indentation of the function body from 7 spaces to one tab.
- Move initialization of weights_ratio up so that it can be referenced
  from the error message about packet difference being zero.
- Move |'s consistently to continuation line, which reindent.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoselftests: forwarding: Move multipath_eval() to lib.sh
Petr Machata [Tue, 26 Jun 2018 00:06:06 +0000 (02:06 +0200)]
selftests: forwarding: Move multipath_eval() to lib.sh

This function will be useful for the GRE multipath test that is coming
later.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet/tls: Remove VLA usage on nonce
Kees Cook [Mon, 25 Jun 2018 23:55:05 +0000 (16:55 -0700)]
net/tls: Remove VLA usage on nonce

It looks like the prior VLA removal, commit b16520f7493d ("net/tls: Remove
VLA usage"), and a new VLA addition, commit c46234ebb4d1e ("tls: RX path
for ktls"), passed in the night. This removes the newly added VLA, which
happens to have its bounds based on the same max value.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoselftests: forwarding: mirror_gre_vlan_bridge_1q: Unset rp_filter
Petr Machata [Mon, 25 Jun 2018 23:20:32 +0000 (01:20 +0200)]
selftests: forwarding: mirror_gre_vlan_bridge_1q: Unset rp_filter

The IP addresses of tunnel endpoint at H3 are set at the VLAN device
$h3.555. Therefore when test_gretap_untagged_egress() sets vlan 555 to
egress untagged at $swp3, $h3's rp_filter rejects these packets. The
test then spuriously fails.

Therefore turn off net.ipv4.conf.{all, $h3}.rp_filter.

Fixes: 9c7c8a82442c ("selftests: forwarding: mirror_gre_vlan_bridge_1q: Add more tests")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agomdio-mux-gpio: Remove VLA usage
Kees Cook [Mon, 25 Jun 2018 22:49:49 +0000 (15:49 -0700)]
mdio-mux-gpio: Remove VLA usage

In the quest to remove all stack VLA usage from the kernel[1], this
allocates the values buffer during the callback instead of putting it
on the stack.

[1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'net-sched-support-replay-of-filter-offload-when-binding-to-block'
David S. Miller [Tue, 26 Jun 2018 14:21:33 +0000 (23:21 +0900)]
Merge branch 'net-sched-support-replay-of-filter-offload-when-binding-to-block'

Jakub Kicinski says:

====================
net: sched: support replay of filter offload when binding to block

This series from John adds the ability to replay filter offload requests
when new offload callback is being registered on a TC block.  This is most
likely to take place for shared blocks today, when a block which already
has rules is bound to another interface.  Prior to this patch set if any
of the rules were offloaded the block bind would fail.

A new tcf_proto_op is added to generate a filter-specific offload request.
The new 'offload' op is supporting extack from day 0, hence we need to
propagate extack to .ndo_setup_tc TC_BLOCK_BIND/TC_BLOCK_UNBIND and
through tcf_block_cb_register() to tcf_block_playback_offloads().

The immediate use of this patch set is to simplify life of drivers which
require duplicating rules when sharing blocks.  Switch drivers (mlxsw)
can bind ports to rule lists dynamically, NIC drivers generally don't
have that ability and need the rules to be duplicated for each ingress
they match on.  In code terms this means that switch drivers don't
register multiple callbacks for each port.  NIC drivers do, and get a
separate request and hance rule per-port, as if the block was not shared.
The registration fails today, however, if some rules were already present.

As John notes in description of patch 7, drivers which register multiple
callbacks to shared blocks will likely need to flush the rules on block
unbind.  This set makes the core not only replay the the offload add
requests but also offload remove requests when callback is unregistered.

v2:
 - name parameters in patch 2;
 - use unsigned int instead of u32 for in_hw_coun;
 - improve extack message in patch 7.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: sched: call reoffload op on block callback reg
John Hurley [Mon, 25 Jun 2018 21:30:10 +0000 (14:30 -0700)]
net: sched: call reoffload op on block callback reg

Call the reoffload tcf_proto_op on all tcf_proto nodes in all chains of a
block when a callback tries to register to a block that already has
offloaded rules. If all existing rules cannot be offloaded then the
registration is rejected. This replaces the previous policy of rejecting
such callback registration outright.

On unregistration of a callback, the rules are flushed for that given cb.
The implementation of block sharing in the NFP driver, for example,
duplicates shared rules to all devs bound to a block. This meant that
rules could still exist in hw even after a device is unbound from a block
(assuming the block still remains active).

Signed-off-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: sched: cls_bpf: implement offload tcf_proto_op
John Hurley [Mon, 25 Jun 2018 21:30:09 +0000 (14:30 -0700)]
net: sched: cls_bpf: implement offload tcf_proto_op

Add the offload tcf_proto_op in cls_bpf to generate an offload message for
each bpf prog in the given tcf_proto. Call the specified callback with
this new offload message. The function only returns an error if the
callback rejects adding a 'hardware only' prog.

A prog contains a flag to indicate if it is in hardware or not. To
ensure the offload function properly maintains this flag, keep a reference
counter for the number of instances of the prog that are in hardware. Only
update the flag when this counter changes from or to 0.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: sched: cls_u32: implement offload tcf_proto_op
John Hurley [Mon, 25 Jun 2018 21:30:08 +0000 (14:30 -0700)]
net: sched: cls_u32: implement offload tcf_proto_op

Add the offload tcf_proto_op in cls_u32 to generate an offload message for
each filter and the hashtable in the given tcf_proto. Call the specified
callback with this new offload message. The function only returns an error
if the callback rejects adding a 'hardware only' rule.

A filter contains a flag to indicate if it is in hardware or not. To
ensure the offload function properly maintains this flag, keep a reference
counter for the number of instances of the filter that are in hardware.
Only update the flag when this counter changes from or to 0.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: sched: cls_matchall: implement offload tcf_proto_op
John Hurley [Mon, 25 Jun 2018 21:30:07 +0000 (14:30 -0700)]
net: sched: cls_matchall: implement offload tcf_proto_op

Add the reoffload tcf_proto_op in matchall to generate an offload message
for each filter in the given tcf_proto. Call the specified callback with
this new offload message. The function only returns an error if the
callback rejects adding a 'hardware only' rule.

Ensure matchall flags correctly report if the rule is in hw by keeping a
reference counter for the number of instances of the rule offloaded. Only
update the flag when this counter changes from or to 0.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: sched: cls_flower: implement offload tcf_proto_op
John Hurley [Mon, 25 Jun 2018 21:30:06 +0000 (14:30 -0700)]
net: sched: cls_flower: implement offload tcf_proto_op

Add the reoffload tcf_proto_op in flower to generate an offload message
for each filter in the given tcf_proto. Call the specified callback with
this new offload message. The function only returns an error if the
callback rejects adding a 'hardware only' rule.

A filter contains a flag to indicate if it is in hardware or not. To
ensure the reoffload function properly maintains this flag, keep a
reference counter for the number of instances of the filter that are in
hardware. Only update the flag when this counter changes from or to 0. Add
a generic helper function to implement this behaviour.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: sched: add tcf_proto_op to offload a rule
John Hurley [Mon, 25 Jun 2018 21:30:05 +0000 (14:30 -0700)]
net: sched: add tcf_proto_op to offload a rule

Create a new tcf_proto_op called 'reoffload' that generates a new offload
message for each node in a tcf_proto. Pointers to the tcf_proto and
whether the offload request is to add or delete the node are included.
Also included is a callback function to send the offload message to and
the option of priv data to go with the cb.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: sched: pass extack pointer to block binds and cb registration
John Hurley [Mon, 25 Jun 2018 21:30:04 +0000 (14:30 -0700)]
net: sched: pass extack pointer to block binds and cb registration

Pass the extact struct from a tc qdisc add to the block bind function and,
in turn, to the setup_tc ndo of binding device via the tc_block_offload
struct. Pass this back to any block callback registrations to allow
netlink logging of fails in the bind process.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'sh_eth-RPADIR-related-clean-ups'
David S. Miller [Tue, 26 Jun 2018 14:15:43 +0000 (23:15 +0900)]
Merge branch 'sh_eth-RPADIR-related-clean-ups'

Sergei Shtylyov says:

====================
sh_eth: RPADIR related clean-ups

Here's a set of 2 patches against DaveM's 'net-next.git' repo. They are
clean-ups related to RPADIR (DMA padding to NET_IP_ALIGN)...
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agosh_eth: remove sh_eth_cpu_data::rpadir_value
Sergei Shtylyov [Mon, 25 Jun 2018 20:37:06 +0000 (23:37 +0300)]
sh_eth: remove sh_eth_cpu_data::rpadir_value

If RPADIR exists, the value written to it is always the same for all SoCs
(and derived from NET_IP_ALIGN), so there has not  been any need to store
it in the *struct* sh_eth_cpu_data...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agosh_eth: fix *enum* RPADIR_BIT
Sergei Shtylyov [Mon, 25 Jun 2018 20:36:21 +0000 (23:36 +0300)]
sh_eth: fix *enum* RPADIR_BIT

The *enum*  RPADIR_BIT  was declared in the commit 86a74ff21a7a ("net:
sh_eth: add support for Renesas SuperH Ethernet") adding SH771x support,
however the SH771x manual doesn't have the RPADIR register described and,
moreover, tells why the padding insertion must not be used. The newer SoC
manuals do have RPADIR documented, though with somewhat different layout --
update the *enum* according to these manuals...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agor8169: reject unsupported WoL options
Heiner Kallweit [Mon, 25 Jun 2018 18:34:41 +0000 (20:34 +0200)]
r8169: reject unsupported WoL options

So far unsupported WoL options are silently ignored. Change this and
reject attempts to set unsupported options. This prevents situations
where a user tries to set an unsupported WoL option and is under the
impression it was successful because ethtool doesn't complain.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoselftests: net: Test headroom handling of ip6_gre devices
Petr Machata [Mon, 25 Jun 2018 14:43:55 +0000 (16:43 +0200)]
selftests: net: Test headroom handling of ip6_gre devices

Commit 5691484df961 ("net: ip6_gre: Fix headroom request in
ip6erspan_tunnel_xmit()") and commit 01b8d064d58b ("net: ip6_gre:
Request headroom in __gre6_xmit()") fix problems in reserving headroom
in the packets tunneled through ip6gre/tap and ip6erspan netdevices.

These two patches included snippets that reproduced the issues. This
patch elevates the snippets to a full-fledged test case.

Suggested-by: David Miller <davem@davemloft.net>
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'l2tp-trivial-cleanups'
David S. Miller [Tue, 26 Jun 2018 13:55:52 +0000 (22:55 +0900)]
Merge branch 'l2tp-trivial-cleanups'

Guillaume Nault says:

====================
l2tp: trivial cleanups

Just a set of unrelated trivial cleanups (remove unused code, make
local functions static, etc.).
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agol2tp: make l2tp_xmit_core() return void
Guillaume Nault [Mon, 25 Jun 2018 14:07:25 +0000 (16:07 +0200)]
l2tp: make l2tp_xmit_core() return void

It always returns 0, and nobody reads the return value anyway.

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agol2tp: avoid duplicate l2tp_pernet() calls
Guillaume Nault [Mon, 25 Jun 2018 14:07:24 +0000 (16:07 +0200)]
l2tp: avoid duplicate l2tp_pernet() calls

Replace 'l2tp_pernet(tunnel->l2tp_net)' with 'pn', which has been set
on the preceding line.

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agol2tp: don't export l2tp_tunnel_closeall()
Guillaume Nault [Mon, 25 Jun 2018 14:07:23 +0000 (16:07 +0200)]
l2tp: don't export l2tp_tunnel_closeall()

This function is only used in l2tp_core.c.

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agol2tp: don't export l2tp_session_queue_purge()
Guillaume Nault [Mon, 25 Jun 2018 14:07:22 +0000 (16:07 +0200)]
l2tp: don't export l2tp_session_queue_purge()

This function is only used in l2tp_core.c.

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agol2tp: remove l2tp_tunnel_priv()
Guillaume Nault [Mon, 25 Jun 2018 14:07:20 +0000 (16:07 +0200)]
l2tp: remove l2tp_tunnel_priv()

This function, and the associated .priv field, are unused.

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agol2tp: remove .show from struct l2tp_tunnel
Guillaume Nault [Mon, 25 Jun 2018 14:07:19 +0000 (16:07 +0200)]
l2tp: remove .show from struct l2tp_tunnel

This callback has never been implemented.

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agol2tp: remove pppol2tp_session_close()
Guillaume Nault [Mon, 25 Jun 2018 14:07:18 +0000 (16:07 +0200)]
l2tp: remove pppol2tp_session_close()

l2tp_core.c verifies that ->session_close() is defined before calling
it. There's no need for a stub.

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'DPAA-PTP-clock-and-timestamping'
David S. Miller [Tue, 26 Jun 2018 13:15:15 +0000 (22:15 +0900)]
Merge branch 'DPAA-PTP-clock-and-timestamping'

Yangbo Lu says:

====================
Support DPAA PTP clock and timestamping

This patchset is to support DPAA FMAN PTP clock and HW timestamping.
It had been verified on both ARM platform and PPC platform.
- The patch #1 to patch #5 are to support DPAA FMAN 1588 timer in
  ptp_qoriq driver.
- The patch #6 to patch #10 are to add HW timestamping support in
  DPAA ethernet driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agodpaa_eth: add the get_ts_info interface for ethtool
Yangbo Lu [Mon, 25 Jun 2018 12:37:16 +0000 (20:37 +0800)]
dpaa_eth: add the get_ts_info interface for ethtool

Added the get_ts_info interface for ethtool to check
the timestamping capability.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agodpaa_eth: add support for hardware timestamping
Yangbo Lu [Mon, 25 Jun 2018 12:37:15 +0000 (20:37 +0800)]
dpaa_eth: add support for hardware timestamping

This patch is to add hardware timestamping support
for dpaa_eth. On Rx, timestamping is enabled for
all frames. On Tx, we only instruct the hardware
to timestamp the frames marked accordingly by the
stack.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agofsl/fman: define frame description command UPD
Yangbo Lu [Mon, 25 Jun 2018 12:37:14 +0000 (20:37 +0800)]
fsl/fman: define frame description command UPD

Defined frame description command FM_FD_CMD_UPD for
prepended data updating.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agofsl/fman_port: support getting timestamp
Yangbo Lu [Mon, 25 Jun 2018 12:37:13 +0000 (20:37 +0800)]
fsl/fman_port: support getting timestamp

This patch is to add fman_port_get_tstamp() interface
to get timestamp.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agofsl/fman: add set_tstamp interface
Yangbo Lu [Mon, 25 Jun 2018 12:37:12 +0000 (20:37 +0800)]
fsl/fman: add set_tstamp interface

This patch is to add set_tstamp interface for memac,
dtsec, and 10GEC controllers to configure HW timestamping.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoarm64: dts: fsl: move ptp timer out of fman
Yangbo Lu [Mon, 25 Jun 2018 12:37:11 +0000 (20:37 +0800)]
arm64: dts: fsl: move ptp timer out of fman

This patch is to move ptp timer node out of fman.
Because ptp timer will be probed by ptp_qoriq driver,
it should be an independent device in case of conflict
memory mapping.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agopowerpc/mpc85xx: move ptp timer out of fman in dts
Yangbo Lu [Mon, 25 Jun 2018 12:37:10 +0000 (20:37 +0800)]
powerpc/mpc85xx: move ptp timer out of fman in dts

This patch is to move ptp timer node out of fman.
Because ptp timer will be probed by ptp_qoriq driver,
it should be an independent device in case of conflict
memory mapping.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agodt-binding: ptp_qoriq: add DPAA FMan support
Yangbo Lu [Mon, 25 Jun 2018 12:37:09 +0000 (20:37 +0800)]
dt-binding: ptp_qoriq: add DPAA FMan support

This patch is to add bindings description for DPAA
FMan 1588 timer, and also remove its description in
fsl-fman dt-bindings document.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoptp: support DPAA FMan 1588 timer in ptp_qoriq
Yangbo Lu [Mon, 25 Jun 2018 12:37:08 +0000 (20:37 +0800)]
ptp: support DPAA FMan 1588 timer in ptp_qoriq

This patch is to support DPAA (Data Path Acceleration Architecture)
1588 timer by adding "fsl,fman-ptp-timer" compatible, sharing
interrupt with FMan, adding FSL_DPAA_ETH dependency, and fixing
up register offset.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agofsl/fman: share the event interrupt
Yangbo Lu [Mon, 25 Jun 2018 12:37:07 +0000 (20:37 +0800)]
fsl/fman: share the event interrupt

This patch is to share fman event interrupt because
the 1588 timer driver will also use this interrupt.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'mlxsw-Support-bridge-router-interfaces-with-non-default-VLAN'
David S. Miller [Tue, 26 Jun 2018 09:05:32 +0000 (18:05 +0900)]
Merge branch 'mlxsw-Support-bridge-router-interfaces-with-non-default-VLAN'

Ido Schimmel says:

====================
mlxsw: Support bridge router interfaces with non-default VLAN

Petr says:

When traffic is inserted on a router interface associated with an 802.1q
bridge, the VLAN that the traffic appears on is determined by PVID of
the bridge device itself. However currently mlxsw always configures such
traffic to be forwarded to VLAN 1, regardless of the bridge PVID.

Fix the problem by modifying the FID-handling code to assign such
traffic not to FID that corresponds to VLAN 1, but to a FID that
corresponds to the configured PVID. Bail out if there is no PVID. This
is implemented in patches #1 and #2.

From that point on, also forbid any changes to bridge device PVID,
because such changes would not be reflected. This is implemented in
patches #3, #4 and #5.

Finally in patch #6, introduce tests that use bridge as a routed
interface, and test mlxsw in both the currently-supported scenario of
using PVID 1, and the newly-supported one of using a custom PVID.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoselftests: forwarding: Test routed bridge interface
Petr Machata [Mon, 25 Jun 2018 07:48:18 +0000 (10:48 +0300)]
selftests: forwarding: Test routed bridge interface

Add test for cases where bridge itself acts as a router interface, with
front panel port attached to the bridge in question.

In the first test (router_bridge.sh), VLAN memberships are not
configured in any way, and everything uses default PVID of 1. Thus
traffic in $h1 and $h2 is untagged. This test ensures that the previous
patches didn't break a currently working scenario.

In the second test (router_bridge_vlan.sh), a VLAN 555 pvid untagged is
added to the bridge CPU port, with that VLAN leaving the bridge tagged
through its sole member port. The traffic is therefore expected to come
out tagged at $h1. This tests the fix introduced in the previous
patches.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agomlxsw: spectrum_switchdev: Ban PVID change if bridge has a RIF
Petr Machata [Mon, 25 Jun 2018 07:48:17 +0000 (10:48 +0300)]
mlxsw: spectrum_switchdev: Ban PVID change if bridge has a RIF

When traffic passes through a router port, it needs to be assigned a FID
for ASIC to forward correctly. For bridges, this FID used to be the one
corresponding to VLAN 1. In a previous patch, this was changed to
instead use the PVID at the time that the RIF is created. This patch
guards PVID changes after the RIF was introduced.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agomlxsw: spectrum_router: Add mlxsw_sp_rif_fid()
Petr Machata [Mon, 25 Jun 2018 07:48:16 +0000 (10:48 +0300)]
mlxsw: spectrum_router: Add mlxsw_sp_rif_fid()

In order to allow querying of the VID for which a RIF was created, add
a new function that returns a FID for a given RIF.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agomlxsw: spectrum_router: Publish mlxsw_sp_rif_find_by_dev()
Petr Machata [Mon, 25 Jun 2018 07:48:15 +0000 (10:48 +0300)]
mlxsw: spectrum_router: Publish mlxsw_sp_rif_find_by_dev()

In order to guard against removal of a PVID for which a FID was
allocated, spectrum_switchdev needs to first determine whether there is
a RIF associated with a given bridge. To that end, publish a preexisting
function mlxsw_sp_rif_find_by_dev().

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agomlxsw: spectrum_router: Allocate FID according to PVID
Petr Machata [Mon, 25 Jun 2018 07:48:14 +0000 (10:48 +0300)]
mlxsw: spectrum_router: Allocate FID according to PVID

For bridge netdevices, instead of assuming that the router traffic is on
VLAN 1, look at the bridge PVID.

This patch assumes that the PVID doesn't change after the router
interface is created (i.e. after the IP address is assigned).

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agomlxsw: spectrum_router: Propagate extack to .fid_get()
Petr Machata [Mon, 25 Jun 2018 07:48:13 +0000 (10:48 +0300)]
mlxsw: spectrum_router: Propagate extack to .fid_get()

In the follow-up patch, mlxsw_sp_rif_vlan_fid_get() will be changed in a
way that could fail. Give that function a possibility to explain the
failure through extack.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agotcp: add SNMP counter for zero-window drops
Yafang Shao [Sun, 24 Jun 2018 14:02:54 +0000 (10:02 -0400)]
tcp: add SNMP counter for zero-window drops

It will be helpful if we could display the drops due to zero window or no
enough window space.
So a new SNMP MIB entry is added to track this behavior.
This entry is named LINUX_MIB_TCPZEROWINDOWDROP and published in
/proc/net/netstat in TcpExt line as TCPZeroWindowDrop.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'NAPI-gro-hash'
David S. Miller [Tue, 26 Jun 2018 02:33:04 +0000 (11:33 +0900)]
Merge branch 'NAPI-gro-hash'

Convert GRO receive over to hash table.

When many parallel flows are present and being received on the same
RX queue, GRO processing can become expensive because each incoming
frame must traverse the per-NAPI GRO list at each protocol layer
of GRO receive (eth --> ipv{4,6} --> tcp).

Use the already computed hash to chain these SKBs in a hash table
instead of a simple list.

The first patch makes the GRO list a true list_head.

The second patch implements the hash table.

This series patches basic testing and I added some diagnostics
to make sure we really were aggregating GRO frames :-)

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: Convert NAPI gro list into a small hash table.
David Miller [Sun, 24 Jun 2018 05:14:02 +0000 (14:14 +0900)]
net: Convert NAPI gro list into a small hash table.

Improve the performance of GRO receive by splitting flows into
multiple hash chains.

Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>