platform/kernel/linux-rpi.git
4 years agohandle the group_source_req options directly
Al Viro [Mon, 27 Apr 2020 15:37:02 +0000 (11:37 -0400)]
handle the group_source_req options directly

Native ->setsockopt() handling of these options (MCAST_..._SOURCE_GROUP
and MCAST_{,UN}BLOCK_SOURCE) consists of copyin + call of a helper that
does the actual work.  The only change needed for ->compat_setsockopt()
is a slightly different copyin - the helpers can be reused as-is.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agoipv6: take handling of group_source_req options into a helper
Al Viro [Mon, 27 Apr 2020 15:00:01 +0000 (11:00 -0400)]
ipv6: take handling of group_source_req options into a helper

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agoipv4: take handling of group_source_req options into a helper
Al Viro [Mon, 27 Apr 2020 14:49:26 +0000 (10:49 -0400)]
ipv4: take handling of group_source_req options into a helper

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agoipv[46]: do compat setsockopt for MCAST_{JOIN,LEAVE}_GROUP directly
Al Viro [Sun, 26 Apr 2020 23:56:22 +0000 (19:56 -0400)]
ipv[46]: do compat setsockopt for MCAST_{JOIN,LEAVE}_GROUP directly

direct parallel to the way these two are handled in the native
->setsockopt() instances - the helpers that do the real work
are already separated and can be reused as-is in this case.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agoipv6: do compat setsockopt for MCAST_MSFILTER directly
Al Viro [Mon, 30 Mar 2020 20:40:04 +0000 (16:40 -0400)]
ipv6: do compat setsockopt for MCAST_MSFILTER directly

similar to the ipv4 counterpart of that patch - the same
trick used to align the tail array properly.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agoip6_mc_msfilter(): pass the address list separately
Al Viro [Mon, 30 Mar 2020 19:43:10 +0000 (15:43 -0400)]
ip6_mc_msfilter(): pass the address list separately

that way we'll be able to reuse it for compat case

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agoipv4: do compat setsockopt for MCAST_MSFILTER directly
Al Viro [Mon, 30 Mar 2020 19:39:43 +0000 (15:39 -0400)]
ipv4: do compat setsockopt for MCAST_MSFILTER directly

Parallel to what the native setsockopt() does, except that unlike
the native setsockopt() we do not use memdup_user() - we want
the sockaddr_storage fields properly aligned, so we allocate
4 bytes more and copy compat_group_filter at the offset 4,
which yields the proper alignments.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agoset_mcast_msfilter(): take the guts of setsockopt(MCAST_MSFILTER) into a helper
Al Viro [Mon, 30 Mar 2020 02:37:56 +0000 (22:37 -0400)]
set_mcast_msfilter(): take the guts of setsockopt(MCAST_MSFILTER) into a helper

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agoget rid of compat_mc_getsockopt()
Al Viro [Mon, 30 Mar 2020 02:08:59 +0000 (22:08 -0400)]
get rid of compat_mc_getsockopt()

now we can do MCAST_MSFILTER in compat ->getsockopt() without
playing silly buggers with copying things back and forth.
We can form a native struct group_filter (sans the variable-length
tail) on stack, pass that + pointer to the tail of original request
to the helper doing the bulk of the work, then do the rest of
copyout - same as the native getsockopt() does.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agoip*_mc_gsfget(): lift copyout of struct group_filter into callers
Al Viro [Sun, 29 Mar 2020 21:18:30 +0000 (17:18 -0400)]
ip*_mc_gsfget(): lift copyout of struct group_filter into callers

pass the userland pointer to the array in its tail, so that part
gets copied out by our functions; copyout of everything else is
done in the callers.  Rationale: reuse for compat; the array
is the same in native and compat, the layout of parts before it
is different for compat.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agocompat_ip{,v6}_setsockopt(): enumerate MCAST_... options explicitly
Al Viro [Sun, 10 May 2020 01:16:36 +0000 (21:16 -0400)]
compat_ip{,v6}_setsockopt(): enumerate MCAST_... options explicitly

We want to check if optname is among the MCAST_... ones; do that as
an explicit switch.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agolift compat definitions of mcast [sg]etsockopt requests into net/compat.h
Al Viro [Sun, 10 May 2020 00:58:17 +0000 (20:58 -0400)]
lift compat definitions of mcast [sg]etsockopt requests into net/compat.h

We want to get rid of compat_mc_[sg]etsockopt() and to have that stuff
handled without compat_alloc_user_space(), extra copying through
userland, etc.  To do that we'll need ipv4 and ipv6 instances of
->compat_[sg]etsockopt() to manipulate the 32bit variants of mcast
requests, so we need to move the definitions of those out of net/compat.c
and into a public header.

This patch just does a mechanical move to include/net/compat.h

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agords: fix crash in rds_info_getsockopt()
John Hubbard [Wed, 20 May 2020 19:41:47 +0000 (12:41 -0700)]
rds: fix crash in rds_info_getsockopt()

The conversion to pin_user_pages() had a bug: it overlooked
the case of allocation of pages failing. Fix that by restoring
an equivalent check.

Reported-by: syzbot+118ac0af4ac7f785a45b@syzkaller.appspotmail.com
Fixes: dbfe7d74376e ("rds: convert get_user_pages() --> pin_user_pages()")

Cc: David S. Miller <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
Cc: linux-rdma@vger.kernel.org
Cc: rds-devel@oss.oracle.com
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: unexport skb_gro_receive()
Eric Dumazet [Tue, 19 May 2020 22:50:12 +0000 (15:50 -0700)]
net: unexport skb_gro_receive()

skb_gro_receive() used to be used by SCTP, it is no longer the case.

skb_gro_receive_list() is in the same category : never used from modules.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'ndo_tunnel_ioctl'
David S. Miller [Tue, 19 May 2020 22:45:12 +0000 (15:45 -0700)]
Merge branch 'ndo_tunnel_ioctl'

Christoph Hellwig says:

====================
add a new ->ndo_tunnel_ctl method to avoid a few set_fs calls v2

both the ipv4 and ipv6 code have an ioctl each that can be used to create
a tunnel using code that doesn't live in the core kernel or ipv6 module.
Currently they call ioctls on the tunnel devices to create these, for
which the code needs to override the address limit, which is a "feature"
I plan to get rid of.

Instead this patchset adds a new ->ndo_tunnel_ctl that can be used for
the tunnel configuration using struct ip_tunnel_parm.  The method is
either invoked from a helper that does the uaccess and can be wired up
as ndo_do_ioctl method, or directly from the magic IPV4/6 ioctls that
create tunnels with kernel space arguments.

Changes since v2:
 - properly propagate errors in ipip6_tunnel_prl_ctl
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv6: use ->ndo_tunnel_ctl in addrconf_set_dstaddr
Christoph Hellwig [Tue, 19 May 2020 13:03:19 +0000 (15:03 +0200)]
ipv6: use ->ndo_tunnel_ctl in addrconf_set_dstaddr

Use the new ->ndo_tunnel_ctl instead of overriding the address limit
and using ->ndo_do_ioctl just to do a pointless user copy.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv6: streamline addrconf_set_dstaddr
Christoph Hellwig [Tue, 19 May 2020 13:03:18 +0000 (15:03 +0200)]
ipv6: streamline addrconf_set_dstaddr

Factor out a addrconf_set_sit_dstaddr helper for the actual work if we
found a SIT device, and only hold the rtnl lock around the device lookup
and that new helper, as there is no point in holding it over a
copy_from_user call.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv6: stub out even more of addrconf_set_dstaddr if SIT is disabled
Christoph Hellwig [Tue, 19 May 2020 13:03:17 +0000 (15:03 +0200)]
ipv6: stub out even more of addrconf_set_dstaddr if SIT is disabled

There is no point in copying the structure from userspace or looking up
a device if SIT support is not disabled and we'll eventually return
-ENODEV anyway.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosit: impement ->ndo_tunnel_ctl
Christoph Hellwig [Tue, 19 May 2020 13:03:16 +0000 (15:03 +0200)]
sit: impement ->ndo_tunnel_ctl

Implement the ->ndo_tunnel_ctl method, and use ip_tunnel_ioctl to
handle userspace requests for the SIOCGETTUNNEL, SIOCADDTUNNEL,
SIOCCHGTUNNEL and SIOCDELTUNNEL ioctls.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosit: refactor ipip6_tunnel_ioctl
Christoph Hellwig [Tue, 19 May 2020 13:03:15 +0000 (15:03 +0200)]
sit: refactor ipip6_tunnel_ioctl

Split the ioctl handler into one function per command instead of having
a all the logic sit in one giant switch statement.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoimpr: use ->ndo_tunnel_ctl in ipmr_new_tunnel
Christoph Hellwig [Tue, 19 May 2020 13:03:14 +0000 (15:03 +0200)]
impr: use ->ndo_tunnel_ctl in ipmr_new_tunnel

Use the new ->ndo_tunnel_ctl instead of overriding the address limit
and using ->ndo_do_ioctl just to do a pointless user copy.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: add a new ndo_tunnel_ioctl method
Christoph Hellwig [Tue, 19 May 2020 13:03:13 +0000 (15:03 +0200)]
net: add a new ndo_tunnel_ioctl method

This method is used to properly allow kernel callers of the IPv4 route
management ioctls.  The exsting ip_tunnel_ioctl helper is renamed to
ip_tunnel_ctl to better reflect that it doesn't directly implement ioctls
touching user memory, and is used for the guts of ndo_tunnel_ctl
implementations. A new ip_tunnel_ioctl helper is added that can be wired
up directly to the ndo_do_ioctl method and takes care of the copy to and
from userspace.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv4: consolidate the VIFF_TUNNEL handling in ipmr_new_tunnel
Christoph Hellwig [Tue, 19 May 2020 13:03:12 +0000 (15:03 +0200)]
ipv4: consolidate the VIFF_TUNNEL handling in ipmr_new_tunnel

Also move the dev_set_allmulti call and the error handling into the
ioctl helper.  This allows reusing already looked up tunnel_dev pointer
and the set up argument structure for the deletion in the error handler.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv4: streamline ipmr_new_tunnel
Christoph Hellwig [Tue, 19 May 2020 13:03:11 +0000 (15:03 +0200)]
ipv4: streamline ipmr_new_tunnel

Reduce a few level of indentation to simplify the function.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'realtek-ethernet-use-generic-power-management'
David S. Miller [Tue, 19 May 2020 22:32:24 +0000 (15:32 -0700)]
Merge branch 'realtek-ethernet-use-generic-power-management'

Vaibhav Gupta says:

====================
realtek ethernet : use generic power management.

The purpose of this patch series is to remove legacy power management callbacks
from realtek ethernet drivers.

The callbacks performing suspend() and resume() operations are still calling
pci_save_state(), pci_set_power_state(), etc. and handling the powermanagement
themselves, which is not recommended.

The conversion requires the removal of the those function calls and change the
callback definition accordingly.

All Changes are compile-tested only.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agorealtek/8139cp: use generic power management
Vaibhav Gupta [Mon, 18 May 2020 15:02:14 +0000 (20:32 +0530)]
realtek/8139cp: use generic power management

compile-tested only

With legacy PM hooks, it was the responsibility
of a driver to manage PCI states and also
device's power state. The generic approach is
to let PCI core handle the work.

The suspend callback enables/disables PCI wake
on the basis of "cp->wol_enabled" variable
which is unknown to PCI core. To utilise its
need, call device_set_wakeup_enable().

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agorealtek/8139too: use generic power management
Vaibhav Gupta [Mon, 18 May 2020 15:02:13 +0000 (20:32 +0530)]
realtek/8139too: use generic power management

compile-tested only

With legacy PM hooks, it was the responsibility
of a driver to manage PCI states and also
device's power state. The generic approach is
to let PCI core handle the work.

PCI core passes "struct device*" as an argument
to the .suspend() and .resume() callbacks. As
these callabcks work with "struct net_device*",
extract it from "struct device*" using
dev_get_drv_data().

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'nfp-flower-feature-bit-updates'
David S. Miller [Tue, 19 May 2020 22:27:22 +0000 (15:27 -0700)]
Merge branch 'nfp-flower-feature-bit-updates'

Simon Horman says:

====================
nfp: flower: feature bit updates

this short series has two parts.

* The first patch cleans up the treatment of existing feature bits.
  There are two distinct methods used and the code now reflects this
  more clearly.
* The second patch informs firmware of flower features. This allows
  the firmware to disable certain features in the absence of of host support.

Changes since v1
- Add now-first patch to clean up existing implementation
- Address Jakub's feedback
====================

Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonfp: flower: inform firmware of flower features
Louis Peens [Tue, 19 May 2020 14:15:02 +0000 (16:15 +0200)]
nfp: flower: inform firmware of flower features

For backwards compatibility it may be required for the firmware to
disable certain features depending on the features supported by
the host. Combine the host feature bits and firmware feature bits
and write this back to the firmware.

Signed-off-by: Louis Peens <louis.peens@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonfp: flower: renaming of feature bits
Louis Peens [Tue, 19 May 2020 14:15:01 +0000 (16:15 +0200)]
nfp: flower: renaming of feature bits

Clean up name aliasing. Some features gets enabled using a slightly
different method, but the bitmap for these were stored in the same
field. Rename their #defines and move the bitmap to a new variable.

Signed-off-by: Louis Peens <louis.peens@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'iucv-next'
David S. Miller [Tue, 19 May 2020 19:50:14 +0000 (12:50 -0700)]
Merge branch 'iucv-next'

Julian Wiedmann says:

====================
net/iucv: updates 2020-05-19

please apply the following patch series for iucv to netdev's net-next
tree.

s390 dropped its support for power management, this removes the relevant
iucv code. Also, some easy cleanups I found mouldering in an old branch.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/af_iucv: clean up function prototypes
Julian Wiedmann [Tue, 19 May 2020 19:10:12 +0000 (21:10 +0200)]
net/af_iucv: clean up function prototypes

Remove a bunch of forward declarations (trivially shifting code around
where needed), and make a few functions static.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/af_iucv: remove a redundant zero initialization
Julian Wiedmann [Tue, 19 May 2020 19:10:11 +0000 (21:10 +0200)]
net/af_iucv: remove a redundant zero initialization

txmsg is declared as {0}, no need to clear individual fields later on.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/af_iucv: replace open-coded U16_MAX
Julian Wiedmann [Tue, 19 May 2020 19:10:10 +0000 (21:10 +0200)]
net/af_iucv: replace open-coded U16_MAX

Improve the readability of a range check.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/af_iucv: remove pm support
Julian Wiedmann [Tue, 19 May 2020 19:10:09 +0000 (21:10 +0200)]
net/af_iucv: remove pm support

commit 394216275c7d ("s390: remove broken hibernate / power management support")
removed support for ARCH_HIBERNATION_POSSIBLE from s390.

So drop the unused pm ops from the s390-only af_iucv socket code.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/iucv: remove pm support
Julian Wiedmann [Tue, 19 May 2020 19:10:08 +0000 (21:10 +0200)]
net/iucv: remove pm support

commit 394216275c7d ("s390: remove broken hibernate / power management support")
removed support for ARCH_HIBERNATION_POSSIBLE from s390.

So drop the unused pm ops from the s390-only iucv bus driver.

CC: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 's390-next'
David S. Miller [Tue, 19 May 2020 19:48:39 +0000 (12:48 -0700)]
Merge branch 's390-next'

Julian Wiedmann says:

====================
s390/net: updates 2020-05-19

please apply the following patch series to netdev's net-next tree.

s390 dropped its support for power management, this removes the relevant
code from the s390 network drivers.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/net: remove pm support from iucv drivers
Julian Wiedmann [Tue, 19 May 2020 19:09:04 +0000 (21:09 +0200)]
s390/net: remove pm support from iucv drivers

Commit 394216275c7d ("s390: remove broken hibernate / power management support")
removed support for ARCH_HIBERNATION_POSSIBLE on s390.
So drop the unused pm ops from the iucv drivers.

CC: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/net: remove pm ops from ccwgroup drivers
Julian Wiedmann [Tue, 19 May 2020 19:09:03 +0000 (21:09 +0200)]
s390/net: remove pm ops from ccwgroup drivers

commit 5e1fb45ec8e2 ("s390/ccwgroup: remove pm support") removed power
management support from the ccwgroup bus driver. So remove the
associated callbacks from all ccwgroup drivers.

CC: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Tue, 19 May 2020 19:02:29 +0000 (12:02 -0700)]
Merge branch '1GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
1GbE Intel Wired LAN Driver Updates 2020-05-18

This series contains updates to igc driver only.

Sasha adds ECN support for TSO by adding the NETIF_F_TSO_ECN flag, which
aligns with other Intel drivers.  Also cleaned up defines that are not
supported or used in the igc driver.

Andre does most of the changes with updating the log messages for igc
driver.

Vitaly adds support for EEPROM, register and link ethtool
self-tests.

v2: Fixed up the added ethtool self-tests based on feedback from the
    community.  Dropped the four patches that removed '\n' from log
    messages.
v3: Reverted the debug message changes in patch 2 for messages in
    igc_probe, also made reg_test[] static in patch 3 based on community
    feedback
v4: Updated the patch description for patch 2, which referred to changes
    that no longer existed in the patch
v5: Scrubbed patches 4-7 patch description, which also referred to
    changes that no longer existed in the patch
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: work around an irq coalescing related tx timeout
Heiner Kallweit [Mon, 18 May 2020 20:47:16 +0000 (22:47 +0200)]
r8169: work around an irq coalescing related tx timeout

In [0] a user reported reproducible tx timeouts on RTL8168f except
PktCntrDisable is set and irq coalescing is enabled.
Realtek told me that they are not aware of any related hw issue on
this chip version, therefore root cause is still unknown. It's not
clear whether the issue affects one or more chip versions in general,
or whether issue is specific to reporter's system.
Due to this level of uncertainty, and due to the fact that I'm aware
of this one report only, let's apply the workaround on net-next only.
After this change setting irq coalescing via ethtool can reliably
avoid the issue on the affected system.

[0] https://bugzilla.kernel.org/show_bug.cgi?id=207205

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: improve rtl8169_mark_to_asic
Heiner Kallweit [Mon, 18 May 2020 20:22:09 +0000 (22:22 +0200)]
r8169: improve rtl8169_mark_to_asic

Let the compiler decide about inlining, and as confirmed by Eric it's
better to use WRITE_ONCE here to ensure that the descriptor ownership
is transferred to NIC immediately.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: make rtl_rx better readable
Heiner Kallweit [Mon, 18 May 2020 20:14:21 +0000 (22:14 +0200)]
r8169: make rtl_rx better readable

Avoid the goto from the rx error handling branch into the else branch,
and in general avoid having the main rx work in the else branch.
In addition ensure proper reverse xmas tree order of variables in the
for loop.

No functional change intended.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: seeq: Use %pM format specifier for MAC addresses
Andy Shevchenko [Mon, 18 May 2020 19:21:28 +0000 (22:21 +0300)]
net: seeq: Use %pM format specifier for MAC addresses

Convert to %pM instead of using custom code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agocxgb4: Use %pM format specifier for MAC addresses
Andy Shevchenko [Mon, 18 May 2020 19:18:31 +0000 (22:18 +0300)]
cxgb4: Use %pM format specifier for MAC addresses

Convert to %pM instead of using custom code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'move-the-SIOCDELRT-and-SIOCADDRT-compat_ioctl-handlers-v3'
David S. Miller [Tue, 19 May 2020 00:35:02 +0000 (17:35 -0700)]
Merge branch 'move-the-SIOCDELRT-and-SIOCADDRT-compat_ioctl-handlers-v3'

Christoph Hellwig says:

====================
move the SIOCDELRT and SIOCADDRT compat_ioctl handlers v3

this series moves the compat_ioctl handlers into the protocol handlers,
avoiding the need to override the address space limited as in the current
handler.

Changes since v3:
 - moar variable reordering

Changes since v1:
 - reorder a bunch of variable declarations
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv4,appletalk: move SIOCADDRT and SIOCDELRT handling into ->compat_ioctl
Christoph Hellwig [Mon, 18 May 2020 06:28:08 +0000 (08:28 +0200)]
ipv4,appletalk: move SIOCADDRT and SIOCDELRT handling into ->compat_ioctl

To prepare removing the global routing_ioctl hack start lifting the code
into the ipv4 and appletalk ->compat_ioctl handlers.  Unlike the existing
handler we don't bother copying in the name - there are no compat issues for
char arrays.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoappletalk: factor out a atrtr_ioctl_addrt helper
Christoph Hellwig [Mon, 18 May 2020 06:28:07 +0000 (08:28 +0200)]
appletalk: factor out a atrtr_ioctl_addrt helper

Add a helper than can be shared with the upcoming compat ioctl handler.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv6: move SIOCADDRT and SIOCDELRT handling into ->compat_ioctl
Christoph Hellwig [Mon, 18 May 2020 06:28:06 +0000 (08:28 +0200)]
ipv6: move SIOCADDRT and SIOCDELRT handling into ->compat_ioctl

To prepare removing the global routing_ioctl hack start lifting the code
into a newly added ipv6 ->compat_ioctl handler.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv6: lift copy_from_user out of ipv6_route_ioctl
Christoph Hellwig [Mon, 18 May 2020 06:28:05 +0000 (08:28 +0200)]
ipv6: lift copy_from_user out of ipv6_route_ioctl

Prepare for better compat ioctl handling by moving the user copy out
of ipv6_route_ioctl.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoigc: Remove unneeded register
Sasha Neftin [Sun, 29 Mar 2020 11:35:54 +0000 (14:35 +0300)]
igc: Remove unneeded register

Flow control status register not applicable for i225 parts
so clean up the unneeded define.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Remove unneeded definition
Sasha Neftin [Sun, 29 Mar 2020 09:01:51 +0000 (12:01 +0300)]
igc: Remove unneeded definition

PHY_FORCE_LIMIT definition not in use and could be removed
i225 parts support auto negotiation mechanism

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Use netdev log helpers in igc_base.c
Andre Guedes [Wed, 25 Mar 2020 00:38:19 +0000 (17:38 -0700)]
igc: Use netdev log helpers in igc_base.c

This patch coverts one pr_debug() call to hw_dbg() in order to keep log
output aligned with the rest of the driver. hw_dbg() is actually a macro
defined in igc_hw.h that expands to netdev_dbg().

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Use netdev log helpers in igc_dump.c
Andre Guedes [Wed, 25 Mar 2020 00:38:18 +0000 (17:38 -0700)]
igc: Use netdev log helpers in igc_dump.c

In igc_dump.c we print log messages using dev_* and pr_* helpers,
generating inconsistent output with the rest of the driver. Since this
is a network device driver, we should preferably use netdev_* helpers
because they append the interface name to the message, helping making
sense out of the logs.

This patch converts all dev_* and pr_* calls to netdev_*.

Quick note about igc_rings_dump(): This function is always called with
valid adapter->netdev so there is not need to check it.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Use netdev log helpers in igc_ptp.c
Andre Guedes [Wed, 25 Mar 2020 00:38:17 +0000 (17:38 -0700)]
igc: Use netdev log helpers in igc_ptp.c

In igc_ptp.c we print log messages using dev_* helpers, generating
inconsistent output with the rest of the driver. Since this is a network
device driver, we should preferably use netdev_* helpers because they
append the interface name to the message, helping making sense out of
the logs.

This patch converts all dev_* calls to netdev_*.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Use netdev log helpers in igc_ethtool.c
Andre Guedes [Wed, 25 Mar 2020 00:38:16 +0000 (17:38 -0700)]
igc: Use netdev log helpers in igc_ethtool.c

In igc_ethtool.c we print log messages using dev_* helpers, generating
inconsistent output with the rest of the driver. Since this is a network
device driver, we should preferably use netdev_* helpers because they
append the interface name to the message, helping making sense the of
the logs.

This patch converts all dev_* calls to netdev_*.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agonet: phy: simplify phy_link_change arguments
Doug Berger [Mon, 18 May 2020 22:23:59 +0000 (15:23 -0700)]
net: phy: simplify phy_link_change arguments

This function was introduced to allow for different handling of
link up and link down events particularly with regard to the
netif_carrier. The third argument do_carrier allowed the flag to
be left unchanged.

Since then the phylink has introduced an implementation that
completely ignores the third parameter since it never wants to
change the flag and the phylib always sets the third parameter
to true so the flag is always changed.

Therefore the third argument (i.e. do_carrier) is no longer
necessary and can be removed. This also means that the phylib
phy_link_down() function no longer needs its second argument.

Signed-off-by: Doug Berger <opendmb@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoigc: add support to eeprom, registers and link self-tests
Vitaly Lifshits [Tue, 5 May 2020 14:06:38 +0000 (17:06 +0300)]
igc: add support to eeprom, registers and link self-tests

Introduced igc_diag.c and igc_diag.h, these files have the
diagnostics functionality of igc driver. For the time being
these files are being used by ethtool self-test callbacks.
Which mean that eeprom, registers and link self-tests for
ethtool were implemented.

Signed-off-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Use netdev log helpers in igc_main.c
Andre Guedes [Wed, 25 Mar 2020 00:38:15 +0000 (17:38 -0700)]
igc: Use netdev log helpers in igc_main.c

In igc_main.c we print log messages using both dev_* and netdev_*
helpers, generating inconsistent output. Since this is a network device
driver, we should preferably use netdev_* helpers because they append
the interface name to the message, helping making sense out of the logs.

This patch converts all dev_* calls to netdev_*. There is only two
exceptions:
  1) calls wihtin igc_probe (net_device has not been registered yet)
  2) calls in igc_init_module (module initialization).

It also takes this opportunity to improve some messages.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Add ECN support for TSO
Sasha Neftin [Sun, 22 Mar 2020 07:58:46 +0000 (09:58 +0200)]
igc: Add ECN support for TSO

Align with other Intel drivers and add ECN support for TSO.

Add NETIF_F_TSO_ECN flag

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agords: convert get_user_pages() --> pin_user_pages()
John Hubbard [Sun, 17 May 2020 01:23:36 +0000 (18:23 -0700)]
rds: convert get_user_pages() --> pin_user_pages()

This code was using get_user_pages_fast(), in a "Case 2" scenario
(DMA/RDMA), using the categorization from [1]. That means that it's
time to convert the get_user_pages_fast() + put_page() calls to
pin_user_pages_fast() + unpin_user_pages() calls.

There is some helpful background in [2]: basically, this is a small
part of fixing a long-standing disconnect between pinning pages, and
file systems' use of those pages.

[1] Documentation/core-api/pin_user_pages.rst

[2] "Explicit pinning of user-space pages":
    https://lwn.net/Articles/807108/

Cc: David S. Miller <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
Cc: linux-rdma@vger.kernel.org
Cc: rds-devel@oss.oracle.com
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'mptcp-do-not-block-on-subflow-socket'
David S. Miller [Sun, 17 May 2020 19:35:35 +0000 (12:35 -0700)]
Merge branch 'mptcp-do-not-block-on-subflow-socket'

Florian Westphal says:

====================
mptcp: do not block on subflow socket

This series reworks mptcp_sendmsg logic to avoid blocking on the subflow
socket.

It does so by removing the wait loop from mptcp_sendmsg_frag helper.

In order to do that, it moves prerequisites that are currently
handled in mptcp_sendmsg_frag (and cause it to wait until they are
met, e.g. frag cache refill) into the callers.

The worker can just reschedule in case no subflow socket is ready,
since it can't wait -- doing so would block other work items and
doesn't make sense anyway because we should not (re)send data
in case resources are already low.

The sendmsg path can use the existing wait logic until memory
becomes available.

Because large send requests can result in multiple mptcp_sendmsg_frag
calls from mptcp_sendmsg, we may need to restart the socket lookup in
case subflow can't accept more data or memory is low.

Doing so blocks on the mptcp socket, and existing wait handling
releases the msk lock while blocking.

Lastly, no need to use GFP_ATOMIC for extension allocation:
extend __skb_ext_alloc with gfp_t arg instead of hard-coded ATOMIC and
then relax the allocation constraints for mptcp case: those requests
occur in process context.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: allow __skb_ext_alloc to sleep
Florian Westphal [Sat, 16 May 2020 08:46:23 +0000 (10:46 +0200)]
net: allow __skb_ext_alloc to sleep

mptcp calls this from the transmit side, from process context.
Allow a sleeping allocation instead of unconditional GFP_ATOMIC.

Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: remove inner wait loop from mptcp_sendmsg_frag
Florian Westphal [Sat, 16 May 2020 08:46:22 +0000 (10:46 +0200)]
mptcp: remove inner wait loop from mptcp_sendmsg_frag

previous patches made sure we only call into this function
when these prerequisites are met, so no need to wait on the
subflow socket anymore.

Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/7
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: fill skb page frag cache outside of mptcp_sendmsg_frag
Florian Westphal [Sat, 16 May 2020 08:46:21 +0000 (10:46 +0200)]
mptcp: fill skb page frag cache outside of mptcp_sendmsg_frag

The mptcp_sendmsg_frag helper contains a loop that will wait on the
subflow sk.

It seems preferrable to only wait in mptcp_sendmsg() when blocking io is
requested.  mptcp_sendmsg already has such a wait loop that is used when
no subflow socket is available for transmission.

This is another preparation patch that makes sure we call
mptcp_sendmsg_frag only if the page frag cache has been refilled.

Followup patch will remove the wait loop from mptcp_sendmsg_frag().

The retransmit worker doesn't need to do this refill as it won't
transmit new mptcp-level data.

Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: fill skb extension cache outside of mptcp_sendmsg_frag
Florian Westphal [Sat, 16 May 2020 08:46:20 +0000 (10:46 +0200)]
mptcp: fill skb extension cache outside of mptcp_sendmsg_frag

The mptcp_sendmsg_frag helper contains a loop that will wait on the
subflow sk.

It seems preferrable to only wait in mptcp_sendmsg() when blocking io is
requested.  mptcp_sendmsg already has such a wait loop that is used when
no subflow socket is available for transmission.

This is a preparation patch that makes sure we call
mptcp_sendmsg_frag only if a skb extension has been allocated.

Moreover, such allocation currently uses GFP_ATOMIC while it
could use sleeping allocation instead.

Followup patches will remove the wait loop from mptcp_sendmsg_frag()
and will allow to do a sleeping allocation for the extension.

Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: avoid blocking in tcp_sendpages
Florian Westphal [Sat, 16 May 2020 08:46:19 +0000 (10:46 +0200)]
mptcp: avoid blocking in tcp_sendpages

The transmit loop continues to xmit new data until an error is returned
or all data was transmitted.

For the blocking i/o case, this means that tcp_sendpages() may block on
the subflow until more space becomes available, i.e. we end up sleeping
with the mptcp socket lock held.

Instead we should check if a different subflow is ready to be used.

This restarts the subflow sk lookup when the tx operation succeeded
and the tcp subflow can't accept more data or if tcp_sendpages
indicates -EAGAIN on a blocking mptcp socket.

In that case we also need to set the NOSPACE bit to make sure we get
notified once memory becomes available.

In case all subflows are busy, the existing logic will wait until a
subflow is ready, releasing the mptcp socket lock while doing so.

The mptcp worker already sets DONTWAIT, so no need to make changes there.

v2:
 * set NOSPACE bit
 * add a comment to clarify that mptcp-sk sndbuf limits need to
   be checked as well.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: break and restart in case mptcp sndbuf is full
Florian Westphal [Sat, 16 May 2020 08:46:18 +0000 (10:46 +0200)]
mptcp: break and restart in case mptcp sndbuf is full

Its not enough to check for available tcp send space.

We also hold on to transmitted data for mptcp-level retransmits.
Right now we will send more and more data if the peer can ack data
at the tcp level fast enough, since that frees up tcp send buffer space.

But we also need to check that data was acked and reclaimed at the mptcp
level.

Therefore add needed check in mptcp_sendmsg, flush tcp data and
wait until more mptcp snd space becomes available if we are over the
limit.  Before we wait for more data, also make sure we start the
retransmit timer if we ran out of sndbuf space.

Otherwise there is a very small chance that we wait forever:

 * receiver is waiting for data
 * sender is blocked because mptcp socket buffer is full
 * at tcp level, all data was acked
 * mptcp-level snd_una was not updated, because last ack
   that acknowledged the last data packet carried an older
   MPTCP-ack.

Restarting the retransmit timer avoids this problem: if TCP
subflow is idle, data is retransmitted from the RTX queue.

New data will make the peer send a new, updated MPTCP-Ack.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: move common nospace-pattern to a helper
Florian Westphal [Sat, 16 May 2020 08:46:17 +0000 (10:46 +0200)]
mptcp: move common nospace-pattern to a helper

Paolo noticed that ssk_check_wmem() has same pattern, so add/use
common helper for both places.

Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: Drop 'pref medium' in route checks
David Ahern [Sun, 17 May 2020 18:00:33 +0000 (12:00 -0600)]
selftests: Drop 'pref medium' in route checks

The 'pref medium' attribute was moved in iproute2 to be near the prefix
which is where it applies versus after the last nexthop. The nexthop
tests were updated to drop the string from route checking, but it crept
in again with the compat tests.

Fixes: 4dddb5be136a ("selftests: net: add new testcases for nexthop API compat mode sysctl")
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-ipa-sc7180-suspend-resume'
David S. Miller [Sat, 16 May 2020 23:47:19 +0000 (16:47 -0700)]
Merge branch 'net-ipa-sc7180-suspend-resume'

Alex Elder says:

====================
net: ipa: sc7180 suspend/resume

This series permits suspend/resume to work for the IPA driver
on the Qualcomm SC7180 SoC.  The IPA version on this SoC requires
interrupts to be enabled when the suspend and resume callbacks are
made, and the first patch moves away from using the noirq variants.
The second patch fixes a problem with resume that occurs because
pending interrupts were being cleared before starting a channel.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: do not clear interrupt in gsi_channel_start()
Alex Elder [Fri, 15 May 2020 20:07:31 +0000 (15:07 -0500)]
net: ipa: do not clear interrupt in gsi_channel_start()

In gsi_channel_start() there is harmless-looking comment "Clear the
channel's event ring interrupt in case it's pending".  The intent
was to avoid getting spurious interrupts when first bringing up a
channel.

However we now use channel stop/start to implement suspend and
resume, and an interrupt pending at the time we resume is actually
something we don't want to ignore.

The very first time we bring up the channel we do not expect an
interrupt to be pending, and even if it were, the effect would
simply be to schedule NAPI on that channel, which would find nothing
to do, which is not a problem.

Stop clearing any pending IEOB interrupt in gsi_channel_start().
That leaves one caller of the trivial function gsi_isr_ieob_clear().
Get rid of that function and just open-code it in gsi_isr_ieob()
instead.

This fixes a problem where suspend/resume IPA v4.2 would get stuck
when resuming after a suspend.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: don't use noirq suspend/resume callbacks
Alex Elder [Fri, 15 May 2020 20:07:30 +0000 (15:07 -0500)]
net: ipa: don't use noirq suspend/resume callbacks

Use the suspend and resume callbacks rather than suspend_noirq and
resume_noirq.  With IPA v4.2, we use the CHANNEL_STOP command to
implement a suspend, and without interrupts enabled, that command
won't complete.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'mlxsw-Reorganize-trap-data'
David S. Miller [Sat, 16 May 2020 23:42:32 +0000 (16:42 -0700)]
Merge branch 'mlxsw-Reorganize-trap-data'

Ido Schimmel says:

====================
mlxsw: Reorganize trap data

This patch set does not include any functional changes. It merely
reworks the internal storage of traps, trap groups and trap policers in
mlxsw to each use a single array.

These changes allow us to get rid of the multiple arrays we currently
have for traps, which make the trap data easier to validate and extend
with more per-trap information in the future. It will also allow us to
more easily add per-ASIC traps in future submissions.

Last two patches include minor changes to devlink-trap selftests.

Tested with existing devlink-trap selftests.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: mlxsw: Do not hard code trap group name
Ido Schimmel [Sat, 16 May 2020 22:43:10 +0000 (01:43 +0300)]
selftests: mlxsw: Do not hard code trap group name

It can be derived dynamically from the trap's name, so drop it.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: devlink_lib: Remove double blank line
Ido Schimmel [Sat, 16 May 2020 22:43:09 +0000 (01:43 +0300)]
selftests: devlink_lib: Remove double blank line

One blank line is enough.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_trap: Store all trap data in one array
Ido Schimmel [Sat, 16 May 2020 22:43:08 +0000 (01:43 +0300)]
mlxsw: spectrum_trap: Store all trap data in one array

Each trap registered with devlink is mapped to one or more Rx listeners.
These listeners allow the switch driver (e.g., mlxsw_spectrum) to
register a function that is called when a packet is received (trapped)
for a specific reason.

Currently, three arrays are used to describe the mapping between the
logical devlink traps and the Rx listeners.

Instead, get rid of these arrays and store all the information in one
array that is easier to validate and extend with more per-trap
information.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_trap: Store all trap group data in one array
Ido Schimmel [Sat, 16 May 2020 22:43:07 +0000 (01:43 +0300)]
mlxsw: spectrum_trap: Store all trap group data in one array

Use one array to store all the information about all the trap groups
instead of hard coding it in code. This will be used in future patches
to disable certain functionality (e.g., policer binding) on a trap group
basis.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_trap: Store all trap policer data in one array
Ido Schimmel [Sat, 16 May 2020 22:43:06 +0000 (01:43 +0300)]
mlxsw: spectrum_trap: Store all trap policer data in one array

Instead of maintaining an array of policers and a linked list, only
maintain an array.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_trap: Move struct definition out of header file
Ido Schimmel [Sat, 16 May 2020 22:43:05 +0000 (01:43 +0300)]
mlxsw: spectrum_trap: Move struct definition out of header file

'struct mlxsw_sp_trap_policer_item' is only used in one file, so move it
there.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: remove remaining call to mdiobus_unregister
Heiner Kallweit [Sat, 16 May 2020 22:05:08 +0000 (00:05 +0200)]
r8169: remove remaining call to mdiobus_unregister

After having switched to devm_mdiobus_register() also this remaining
call to mdiobus_unregister() can be removed.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'ethtool-set_channels-add-a-few-more-checks'
David S. Miller [Sat, 16 May 2020 20:56:30 +0000 (13:56 -0700)]
Merge branch 'ethtool-set_channels-add-a-few-more-checks'

Jakub Kicinski says:

====================
ethtool: set_channels: add a few more checks

There seems to be a few more things we can check in the core before
we call drivers' ethtool_ops->set_channels. Adding the checks to
the core simplifies the drivers. This set only includes changes
to the NFP driver as an example.

There is a small risk in the first patch that someone actually
purposefully accepts a strange configuration without RX or TX
channels, but I couldn't find such a driver in the tree.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoethtool: don't call set_channels in drivers if config didn't change
Jakub Kicinski [Fri, 15 May 2020 19:49:02 +0000 (12:49 -0700)]
ethtool: don't call set_channels in drivers if config didn't change

Don't call drivers if nothing changed. Netlink code already
contains this logic.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonfp: don't check lack of RX/TX channels
Jakub Kicinski [Fri, 15 May 2020 19:49:01 +0000 (12:49 -0700)]
nfp: don't check lack of RX/TX channels

Core will now perform this check.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoethtool: check if there is at least one channel for TX/RX in the core
Jakub Kicinski [Fri, 15 May 2020 19:49:00 +0000 (12:49 -0700)]
ethtool: check if there is at least one channel for TX/RX in the core

Having a channel config with no ability to RX or TX traffic is
clearly wrong. Check for this in the core so the drivers don't
have to.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: Use 32-bit DATA_ACK when possible
Christoph Paasch [Thu, 14 May 2020 15:53:03 +0000 (08:53 -0700)]
mptcp: Use 32-bit DATA_ACK when possible

RFC8684 allows to send 32-bit DATA_ACKs as long as the peer is not
sending 64-bit data-sequence numbers. The 64-bit DSN is only there for
extreme scenarios when a very high throughput subflow is combined with a
long-RTT subflow such that the high-throughput subflow wraps around the
32-bit sequence number space within an RTT of the high-RTT subflow.

It is thus a rare scenario and we should try to use the 32-bit DATA_ACK
instead as long as possible. It allows to reduce the TCP-option overhead
by 4 bytes, thus makes space for an additional SACK-block. It also makes
tcpdumps much easier to read when the DSN and DATA_ACK are both either
32 or 64-bit.

Signed-off-by: Christoph Paasch <cpaasch@apple.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonetns: enable to inherit devconf from current netns
Nicolas Dichtel [Wed, 13 May 2020 13:58:43 +0000 (15:58 +0200)]
netns: enable to inherit devconf from current netns

The goal is to be able to inherit the initial devconf parameters from the
current netns, ie the netns where this new netns has been created.

This is useful in a containers environment where /proc/sys is read only.
For example, if a pod is created with specifics devconf parameters and has
the capability to create netns, the user expects to get the same parameters
than his 'init_net', which is not the real init_net in this case.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa2-eth: add bulking to XDP_TX
Ioana Ciornei [Wed, 13 May 2020 13:55:46 +0000 (16:55 +0300)]
dpaa2-eth: add bulking to XDP_TX

Add driver level bulking to the XDP_TX action.

An array of frame descriptors is held for each Tx frame queue and
populated accordingly when the action returned by the XDP program is
XDP_TX. The frames will be actually enqueued only when the array is
filled. At the end of the NAPI cycle a flush on the queued frames is
performed in order to enqueue the remaining FDs.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: broadcom: fix checkpatch complains about tabs
Kevin Lo [Sat, 16 May 2020 02:09:26 +0000 (10:09 +0800)]
net: phy: broadcom: fix checkpatch complains about tabs

This patch makes checkpatch happy for tabs

Signed-off-by: Kevin Lo <kevlo@kevlo.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge tag 'mlx5-updates-2020-05-15' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Fri, 15 May 2020 23:36:46 +0000 (16:36 -0700)]
Merge tag 'mlx5-updates-2020-05-15' of git://git./linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5-updates-2020-05-15

mlx5 core and mlx5e (netdev) updates:

1) Two fixes for release all FW pages support.
2) Improvement in calculating the send queue stop room on tx
3) Flow steering auto-groups creation improvements
4) TC offload fix for Connection tracking with NAT action
5) IPoIB support for self looback to allow communication between ipoib
pkey child interfaces on the same host.
6) DCBNL cleanup to avoid #ifdef DCBNL all over the main mlx5e code
7) Small and trivial code cleanup
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoethernet: ti: am65-cpts: Add missing inline qualifier to stub functions
Nathan Chancellor [Fri, 15 May 2020 22:33:18 +0000 (15:33 -0700)]
ethernet: ti: am65-cpts: Add missing inline qualifier to stub functions

When building with Clang:

In file included from drivers/net/ethernet/ti/am65-cpsw-ethtool.c:15:
drivers/net/ethernet/ti/am65-cpts.h:58:12: warning: unused function
'am65_cpts_ns_gettime' [-Wunused-function]
static s64 am65_cpts_ns_gettime(struct am65_cpts *cpts)
           ^
drivers/net/ethernet/ti/am65-cpts.h:63:12: warning: unused function
'am65_cpts_estf_enable' [-Wunused-function]
static int am65_cpts_estf_enable(struct am65_cpts *cpts,
           ^
drivers/net/ethernet/ti/am65-cpts.h:69:13: warning: unused function
'am65_cpts_estf_disable' [-Wunused-function]
static void am65_cpts_estf_disable(struct am65_cpts *cpts, int idx)
            ^
3 warnings generated.

These functions need to be marked as inline, which adds __maybe_unused,
to avoid these warnings, which is the pattern for stub functions.

Fixes: ec008fa2a9e5 ("ethernet: ti: am65-cpts: add routines to support taprio offload")
Link: https://github.com/ClangBuiltLinux/linux/issues/1026
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/mlx5e: Take DCBNL-related definitions into dedicated files
Tariq Toukan [Wed, 23 Oct 2019 12:00:52 +0000 (15:00 +0300)]
net/mlx5e: Take DCBNL-related definitions into dedicated files

Take DCBNL-related definitions out of the common en.h header,
Use a dedicated header file for exposing them.
Some need not to be exposed, use them locally in the .c file.
Use stubs to eliminate use of CONFIG_MLX5_CORE_EN_DCB in the
generic control flows.

Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5e: Calculate SQ stop room in a robust way
Maxim Mikityanskiy [Mon, 30 Mar 2020 13:28:34 +0000 (16:28 +0300)]
net/mlx5e: Calculate SQ stop room in a robust way

Currently, different formulas are used to estimate the space that may be
taken by WQEs in the SQ during a single packet transmit. This space is
called stop room, and it's checked in the end of packet transmit to find
out if the next packet could overflow the SQ. If it could, the driver
tells the kernel to stop sending next packets.

Many factors affect the stop room:

1. Padding with NOPs to avoid WQEs spanning over page boundaries.

2. Enabled and disabled offloads (TLS, upcoming MPWQE).

3. The maximum size of a WQE.

The padding is performed before every WQE if it doesn't fit the current
page.

The current formula assumes that only one padding will be required per
packet, and it doesn't take into account that the WQEs posted during the
transmission of a single packet might exceed the page size in very rare
circumstances. For example, to hit this condition with 4096-byte pages,
TLS offload will have to interrupt an almost-full MPWQE session, be in
the resync flow and try to transmit a near to maximum amount of data.

To avoid SQ overflows in such rare cases after MPWQE is added, this
patch introduces a more robust formula to estimate the stop room. The
new formula uses the fact that a WQE of size X will not require more
than X-1 WQEBBs of padding. More exact estimations are possible, but
they result in much more complex and error-prone code for little gain.

Before this patch, the TLS stop room included space for both INNOVA and
ConnectX TLS offloads that couldn't run at the same time anyway, so this
patch accounts only for the active one.

Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5e: IPoIB, Drop multicast packets that this interface sent
Erez Shitrit [Mon, 4 May 2020 08:46:25 +0000 (11:46 +0300)]
net/mlx5e: IPoIB, Drop multicast packets that this interface sent

After enabled loopback packets for IPoIB, we need to drop these packets
that this HCA has replicated and came back to the same interface that
sent them.

Fixes: 4c6c615e3f30 ("net/mlx5e: IPoIB, Add PKEY child interface nic profile")
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Reviewed-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5e: IPoIB, Enable loopback packets for IPoIB interfaces
Erez Shitrit [Sun, 3 May 2020 10:01:37 +0000 (13:01 +0300)]
net/mlx5e: IPoIB, Enable loopback packets for IPoIB interfaces

Enable loopback of unicast and multicast traffic for IPoIB enhanced
mode.
This will allow interfaces with the same pkey to communicate between
them e.g cloned interfaces that located in different namespaces.

Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Reviewed-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5e: CT: Fix offload with CT action after CT NAT action
Roi Dayan [Sun, 12 Apr 2020 12:39:15 +0000 (15:39 +0300)]
net/mlx5e: CT: Fix offload with CT action after CT NAT action

It could be a chain of rules will do action CT again after CT NAT
Before this fix matching will break as we get into the CT table
after NAT changes and not CT NAT.
Fix this by adding pre ct and pre ct nat tables to skip ct/ct_nat
tables and go straight to post_ct table if ct/nat was already done.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Move internal timer read function to clock library
Eran Ben Elisha [Thu, 7 May 2020 11:13:33 +0000 (14:13 +0300)]
net/mlx5: Move internal timer read function to clock library

Move mlx5_read_internal_timer() into lib/clock.c file as it is being
used there. As such, make this function a static one.

In addition, rearrange headers include to support function move.

Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Reviewed-by: Aya Levin <ayal@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Wait for inactive autogroups
Paul Blakey [Thu, 7 May 2020 09:01:39 +0000 (12:01 +0300)]
net/mlx5: Wait for inactive autogroups

Currently, if one thread tries to add an entry to an autogrouped table
with no free matching group, while another thread is in the process of
creating a new matching autogroup, it doesn't wait for the new group
creation, and creates an unnecessary new autogroup.

Instead of skipping inactive, wait on the write lock of those groups.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Drain wq first during PCI device removal
Parav Pandit [Fri, 1 May 2020 14:42:45 +0000 (09:42 -0500)]
net/mlx5: Drain wq first during PCI device removal

mlx5_unload_one() is done with cleanup = true only once.

So instead of doing health wq drain inside the if(), directly do
during PCI device removal.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Have single error unwinding path
Parav Pandit [Fri, 1 May 2020 15:20:01 +0000 (10:20 -0500)]
net/mlx5: Have single error unwinding path

Having multiple error unwinding path are error prone.
Lets have just one error unwinding path.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>