platform/kernel/linux-rpi.git
4 years agoMerge branch 'provide-KAPI-for-SQI'
David S. Miller [Fri, 22 May 2020 00:18:00 +0000 (17:18 -0700)]
Merge branch 'provide-KAPI-for-SQI'

Oleksij Rempel says:

====================
provide KAPI for SQI

This patches are extending ethtool netlink interface to export Signal
Quality Index (SQI). SQI provided by 100Base-T1 PHYs and can be used for
cable diagnostic. Compared to a typical cable tests, this value can be
only used after link is established.

changes v3:
- rename __ethtool_get_sqi* to linkstate_get_sqi*. And move this
  functions to the net/ethtool/linkstate.c
- protect linkstate_get_sqi* with locking

changes v2:
- use u32 instead of u8 for SQI
- add SQI_MAX field and callbacks
- some style fixes in the rst.
- do not convert index to shifted index.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: tja11xx: add SQI support
Oleksij Rempel [Wed, 20 May 2020 06:29:15 +0000 (08:29 +0200)]
net: phy: tja11xx: add SQI support

This patch implements reading of the Signal Quality Index for better
cable/link troubleshooting.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoethtool: provide UAPI for PHY Signal Quality Index (SQI)
Oleksij Rempel [Wed, 20 May 2020 06:29:14 +0000 (08:29 +0200)]
ethtool: provide UAPI for PHY Signal Quality Index (SQI)

Signal Quality Index is a mandatory value required by "OPEN Alliance
SIG" for the 100Base-T1 PHYs [1]. This indicator can be used for cable
integrity diagnostic and investigating other noise sources and
implement by at least two vendors: NXP[2] and TI[3].

[1] http://www.opensig.org/download/document/218/Advanced_PHY_features_for_automotive_Ethernet_V1.0.pdf
[2] https://www.nxp.com/docs/en/data-sheet/TJA1100.pdf
[3] https://www.ti.com/product/DP83TC811R-Q1

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'qed-next'
David S. Miller [Fri, 22 May 2020 00:08:25 +0000 (17:08 -0700)]
Merge branch 'qed-next'

Yuval Basson says:

====================
qed: Add xrc core support for RoCE

This patch adds support for configuring XRC and provides the necessary
APIs for rdma upper layer driver (qedr) to enable the XRC feature.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoqed: Add XRC to RoCE
Yuval Basson [Tue, 19 May 2020 20:51:26 +0000 (23:51 +0300)]
qed: Add XRC to RoCE

Add support for XRC-SRQ's and XRC-QP's for upper layer driver.

We maintain separate bitmaps for resource management for srq and
xrc-srq, However, the range in FW is one, The xrc-srq's are first
and then the srq's follow. Therefore we maintain a srq-id offset.

v2: perform cleanups if XRC bitmpas allocation fail.

Signed-off-by: Michal Kalderon <mkalderon@marvell.com>
Signed-off-by: Yuval Bason <ybason@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoqed: changes to ILT to support XRC
Yuval Basson [Tue, 19 May 2020 20:51:25 +0000 (23:51 +0300)]
qed: changes to ILT to support XRC

First ILT page for TSDM client is allocated for XRC-SRQ's.
For regular SRQ's skip first ILT page that is reserved for
XRC-SRQ's.

Signed-off-by: Michal Kalderon <mkalderon@marvell.com>
Signed-off-by: Yuval Bason <ybason@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: psample: Add tunnel support
Chris Mi [Tue, 19 May 2020 14:45:20 +0000 (22:45 +0800)]
net: psample: Add tunnel support

Currently, psample can only send the packet bits after decapsulation.
The tunnel information is lost. Add the tunnel support.

If the sampled packet has no tunnel info, the behavior is the same as
before. If it has, add a nested metadata field named PSAMPLE_ATTR_TUNNEL
and include the tunnel subfields if applicable.

Increase the metadata length for sampled packet with the tunnel info.
If new subfields of tunnel info should be included, update the metadata
length accordingly.

Signed-off-by: Chris Mi <chrism@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.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 [Thu, 21 May 2020 02:27:57 +0000 (19:27 -0700)]
Merge branch '1GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

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

This series contains updates to igc only.

Sasha cleans up the igc driver code that is not used or needed.

Vitaly cleans up driver code that was used to support Virtualization on
a device that is not supported by igc, so remove the dead code.

Andre renames a few macros to align with register and field names
described in the data sheet.  Also adds the VLAN Priority Queue Fliter
and EType Queue Filter registers to the list of registers dumped by
igc_get_regs().  Added additional debug messages and updated return codes
for unsupported features.  Refactored the VLAN priority filtering code to
move the core logic into igc_main.c.  Cleaned up duplicate code and
useless code.
====================

Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'uaccess.net' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
David S. Miller [Thu, 21 May 2020 02:07:25 +0000 (19:07 -0700)]
Merge branch 'uaccess.net' of git://git./linux/kernel/git/viro/vfs

Al Viro says:

====================
uaccess-related stuff in net/*

Assorted uaccess-related work in net/*.  First, there's
getting rid of compat_alloc_user_space() mess in MCAST_...
[gs]etsockopt() - no need to play with copying to/from temporary
object on userland stack, etc., when ->compat_[sg]etsockopt()
instances in question can easly do everything without that.
That's the first 13 patches.  Then there's a trivial bit in
net/batman-adv (completely unrelated to everything else) and
finally getting the atm compat ioctls into simpler shape.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoatm: switch do_atmif_sioc() to direct use of atm_dev_ioctl()
Al Viro [Sun, 10 May 2020 22:13:56 +0000 (18:13 -0400)]
atm: switch do_atmif_sioc() to direct use of atm_dev_ioctl()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agoatm: lift copyin from atm_dev_ioctl()
Al Viro [Sun, 10 May 2020 21:53:35 +0000 (17:53 -0400)]
atm: lift copyin from atm_dev_ioctl()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agoatm: switch do_atm_iobuf() to direct use of atm_getnames()
Al Viro [Sun, 10 May 2020 21:41:51 +0000 (17:41 -0400)]
atm: switch do_atm_iobuf() to direct use of atm_getnames()

... and sod the compat_alloc_user_space() with its complications

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agoatm: move copyin from atm_getnames() into the caller
Al Viro [Sun, 10 May 2020 21:34:20 +0000 (17:34 -0400)]
atm: move copyin from atm_getnames() into the caller

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agoatm: separate ATM_GETNAMES handling from the rest of atm_dev_ioctl()
Al Viro [Sun, 10 May 2020 21:20:49 +0000 (17:20 -0400)]
atm: separate ATM_GETNAMES handling from the rest of atm_dev_ioctl()

atm_dev_ioctl() does copyin in two different ways - one for
ATM_GETNAMES, another for everything else.  Start with separating
the former into a new helper (atm_getnames()).  The next step
will be to lift the copyin into the callers.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agobatadv_socket_read(): get rid of pointless access_ok()
Al Viro [Thu, 23 Apr 2020 14:19:04 +0000 (10:19 -0400)]
batadv_socket_read(): get rid of pointless access_ok()

address is passed only to copy_to_user()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
4 years agoget rid of compat_mc_setsockopt()
Al Viro [Mon, 27 Apr 2020 15:37:02 +0000 (11:37 -0400)]
get rid of compat_mc_setsockopt()

not used anymore

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
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 agoigc: Remove unused registers
Sasha Neftin [Sun, 12 Apr 2020 14:21:58 +0000 (17:21 +0300)]
igc: Remove unused registers

Tx data FIFO Head/Tail, Saved and Packet Count registers
not applicable for i225 LAN controller.
This patch comes to clean up these registers.

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 unused IGC_ICS_DRSTA define
Sasha Neftin [Sun, 12 Apr 2020 06:28:29 +0000 (09:28 +0300)]
igc: Remove unused IGC_ICS_DRSTA define

Device reset assert for interrupt cause register not in
use for i225 device.
This patch comes to clean up this 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: Dump ETQF registers
Andre Guedes [Tue, 7 Apr 2020 21:07:11 +0000 (14:07 -0700)]
igc: Dump ETQF registers

This patch adds the EType Queue Filter (ETQF) registers to the list of
registers dumped by igc_get_regs().

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: Refactor ethertype filtering code
Andre Guedes [Tue, 7 Apr 2020 21:07:10 +0000 (14:07 -0700)]
igc: Refactor ethertype filtering code

The whole ethertype filtering code is implemented in igc_ethtool.c and
mixes logic from ethtool and core parts. This patch refactors it so core
logic is moved to igc_main.c, aligning the ethertype filtering code
organization with the rest of the filtering code from the driver (MAC
address and VLAN priority).

Besides moving code to igc_main.c, this patch also does some minor
improvements to the code. Below are some highlights.

In case all filters are already in use and the user tries to add another
filter, we return -ENOSPC instead of -EINVAL so a more meaningful error
code is provided. This also aligns with the behavior implemented in MAC
address filtering code.

With this code refactoring, 'etype_bitmap' array in struct igc_adapter
and 'etype_reg_index' in struct igc_nfc_filter are not needed anymore
and are removed.

Log messages are added to help debugging the ethertype filtering code.

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 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 agoigc: Fix MAX_ETYPE_FILTER value
Andre Guedes [Tue, 7 Apr 2020 21:07:09 +0000 (14:07 -0700)]
igc: Fix MAX_ETYPE_FILTER value

The I225 controller has 8 ethertype filters, not 4. This patch fixes the
MAX_ETYPE_FILTER macro accordingly.

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: Remove ethertype filter in PTP code
Andre Guedes [Tue, 7 Apr 2020 21:07:08 +0000 (14:07 -0700)]
igc: Remove ethertype filter in PTP code

The driver only supports hardware timestamping for all incoming
traffic (HWTSTAMP_FILTER_ALL) which is enabled via Rx Time Sync
Control (TSYNCRXCTL) register already. Therefore, the ethertype
filter set in in igc_ptp_set_timestamp_mode() is useless so this
patch removes 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: Remove duplicated IGC_RXPBS macro
Andre Guedes [Tue, 7 Apr 2020 21:07:07 +0000 (14:07 -0700)]
igc: Remove duplicated IGC_RXPBS macro

This patch remove the IGC_RXPBS macro defined in line 233 since it is
already defined in line 18 with the exactly same value.

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 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 agoigc: Refactor VLAN priority filtering code
Andre Guedes [Fri, 24 Apr 2020 01:11:19 +0000 (18:11 -0700)]
igc: Refactor VLAN priority filtering code

The whole VLAN priority filtering code is implemented in igc_ethtool.c
and mixes logic from ethtool and core parts. This patch refactors it so
core logic is moved to igc_main.c, aligning the VLAN priority filtering
code organization with the MAC address filtering code.

This patch also takes the opportunity to add some log messages to ease
debugging.

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 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 agoigc: Return -EOPNOTSUPP when VLAN mask doesn't match
Andre Guedes [Fri, 3 Apr 2020 18:17:42 +0000 (11:17 -0700)]
igc: Return -EOPNOTSUPP when VLAN mask doesn't match

The I225 controller supports Rx queue assignment based on VLAN priority
only. Other Tag Control Information (TCI) are valid, but not supported
by the driver. So this patch changes the returning code from igc_add_
ethtool_nfc_entry() to -EOPNOTSUPP in order to provide more meaningful
information on why the function failed.

It also adds a debug messages to give the user a hint about what went
wrong with the NFC setup.

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: Dump VLANPQF register
Andre Guedes [Fri, 3 Apr 2020 18:17:41 +0000 (11:17 -0700)]
igc: Dump VLANPQF register

This patch adds the VLAN Priority Queue Filter Register (VLANPQF) to the
list of registers dumped by igc_get_regs().

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: Rename IGC_VLAPQF macro
Andre Guedes [Fri, 3 Apr 2020 18:17:40 +0000 (11:17 -0700)]
igc: Rename IGC_VLAPQF macro

This patch renames the IGC_VLAPQF macro to IGC_VLANPQF as well as
related macros so they match the register name and fields described in
the data sheet.

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: Clean up obsolete NVM defines
Sasha Neftin [Wed, 1 Apr 2020 11:38:44 +0000 (14:38 +0300)]
igc: Clean up obsolete NVM defines

Packet buffer allocation, reserved word and pointer guard
not applicable for i225 parts.
This patch comes to clean up these obsolete defines

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 IGC_REMOVED function
Vitaly Lifshits [Wed, 1 Apr 2020 09:16:44 +0000 (12:16 +0300)]
igc: remove IGC_REMOVED function

igc driver has leftovers from the previous device that supported
Virtualization. This can be found in the function IGC_REMOVED which
became obsolete, and can be removed.

Signed-off-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
Acked-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 PCIe Control register
Sasha Neftin [Wed, 1 Apr 2020 08:43:20 +0000 (11:43 +0300)]
igc: Remove PCIe Control register

GCR (PCIe Control) register not in use and should be removed
This patch clean up this register

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 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>