OSDN Git Service

tomoyo/tomoyo-test1.git
3 years agonet: dsa: bcm_sf2: recalculate switch clock rate based on ports
Florian Fainelli [Tue, 1 Sep 2020 22:59:13 +0000 (15:59 -0700)]
net: dsa: bcm_sf2: recalculate switch clock rate based on ports

Whenever a port gets enabled/disabled, recalcultate the required switch
clock rate to make sure it always gets set to the expected rate
targeting our switch use case. This is only done for the BCM7445 switch
as there is no clocking profile available for BCM7278.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: dsa: bcm_sf2: request and handle clocks
Florian Fainelli [Tue, 1 Sep 2020 22:59:12 +0000 (15:59 -0700)]
net: dsa: bcm_sf2: request and handle clocks

Fetch the corresponding clock resource and enable/disable it during
suspend/resume if and only if we have no ports defined for Wake-on-LAN.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agodt-bindings: net: Document Broadcom SF2 switch clocks
Florian Fainelli [Tue, 1 Sep 2020 22:59:11 +0000 (15:59 -0700)]
dt-bindings: net: Document Broadcom SF2 switch clocks

Describe the two possible clocks feeding into the Broadcom SF2
integrated Ethernet switch. BCM7445 systems have two clocks, one for the
main switch core clock, and another for controlling the switch clock
divider whereas BCM7278 systems only have the first kind.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'net-systemport-Clock-support'
David S. Miller [Thu, 3 Sep 2020 22:06:03 +0000 (15:06 -0700)]
Merge branch 'net-systemport-Clock-support'

Florian Fainelli says:

====================
net: systemport: Clock support

This patch series makes the SYSTEMPORT driver request and manage its
main and Wake-on-LAN clocks appropriately.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: systemport: Manage Wake-on-LAN clock
Florian Fainelli [Tue, 1 Sep 2020 21:43:48 +0000 (14:43 -0700)]
net: systemport: Manage Wake-on-LAN clock

It is necessary to manage the Wake-on-LAN clock to turn on the
appropriate blocks for MPD or CFP-based packet matching to work
otherwise we will not be able to reliably match packets during suspend.

Reported-by: Blair Prescott <blair.prescott@broadcom.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: systemport: fetch and use clock resources
Florian Fainelli [Tue, 1 Sep 2020 21:43:47 +0000 (14:43 -0700)]
net: systemport: fetch and use clock resources

We disable clocks shortly after probing the device to save as much power as
possible in case the interface is never used. When bcm_sysport_open() is
invoked, clocks are enabled, and disabled in bcm_sysport_stop().

A similar scheme is applied to the suspend/resume functions.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agodt-bindings: net: Document Broadcom SYSTEMPORT clocks
Florian Fainelli [Tue, 1 Sep 2020 21:43:46 +0000 (14:43 -0700)]
dt-bindings: net: Document Broadcom SYSTEMPORT clocks

The Broadcom SYSTEMPORT adapters require the use of two clocks for
normal operations and during Wake-on-LAN, document those in the binding
document.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoethtool: fix error handling in ethtool_phys_id
Edward Cree [Tue, 1 Sep 2020 17:52:32 +0000 (18:52 +0100)]
ethtool: fix error handling in ethtool_phys_id

If ops->set_phys_id() returned an error, previously we would only break
 out of the inner loop, which neither stopped the outer loop nor returned
 the error to the user (since 'rc' would be overwritten on the next pass
 through the loop).
Thus, rewrite it to use a single loop, so that the break does the right
 thing.  Use u64 for 'count' and 'i' to prevent overflow in case of
 (unreasonably) large values of id.data and n.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoselftests/net: improve descriptions for XFAIL cases in psock_snd.sh
Po-Hsu Lin [Tue, 1 Sep 2020 15:09:23 +0000 (23:09 +0800)]
selftests/net: improve descriptions for XFAIL cases in psock_snd.sh

Before changing this it's a bit confusing to read test output:
  raw csum_off with bad offset (fails)
  ./psock_snd: write: Invalid argument

Change "fails" in the test case description to "expected to fail", so
that the test output can be more understandable.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agochelsio/chtls: CHELSIO_INLINE_CRYPTO should depend on CHELSIO_T4
Geert Uytterhoeven [Tue, 1 Sep 2020 14:58:41 +0000 (16:58 +0200)]
chelsio/chtls: CHELSIO_INLINE_CRYPTO should depend on CHELSIO_T4

While CHELSIO_INLINE_CRYPTO is a guard symbol, and just enabling it does
not cause any additional code to be compiled in, all configuration
options protected by it depend on CONFIG_CHELSIO_T4.  Hence it doesn't
make much sense to bother the user with the guard symbol question when
CONFIG_CHELSIO_T4 is disabled.

Fix this by moving the dependency from the individual config options to
the guard symbol.

Fixes: 44fd1c1fd8219551 ("chelsio/chtls: separate chelsio tls driver from crypto driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'Convert-mvpp2-to-split-PCS-support'
David S. Miller [Thu, 3 Sep 2020 21:52:33 +0000 (14:52 -0700)]
Merge branch 'Convert-mvpp2-to-split-PCS-support'

Russell King says:

====================
Convert mvpp2 to split PCS support

This series converts the mvpp2 driver to use the split PCS support
that has been merged into phylink last time around. I've been running
this for some time here and, apart from the recent bug fix sent to
net-next, have not seen any issues on DT based systems. I have not
tested ACPI setups, although I've tried to preserve the workaround.

Patch 1 formalises the ACPI workaround.
Patch 2 moves some of mac_config() to the mac_prepare() and
  mac_finish() callbacks so we can keep the ordering when we split
  the PCS bits out.
Patch 3 ensures that the port is forced down while changing the
  interface mode - when in in-band mode, doing this in mac_prepare()
  and mac_finish().
Patch 4 moves the reset handling to mac_prepare() and mac_finish()
Patch 5 does a straight conversion to use PCS operations.
Patch 6 splits the PCS operations into a GMAC PCS operations and
  XLG PCS operations, selecting the appropriate set during
  mac_prepare().  This eliminates a bunch of conditionals from the
  code.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: mvpp2: split xlg and gmac pcs
Russell King [Tue, 1 Sep 2020 13:48:37 +0000 (14:48 +0100)]
net: mvpp2: split xlg and gmac pcs

Split the XLG and GMAC PCS implementations and switch between them
during the mac_prepare() method.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: mvpp2: convert to phylink pcs operations
Russell King [Tue, 1 Sep 2020 13:48:32 +0000 (14:48 +0100)]
net: mvpp2: convert to phylink pcs operations

Convert mvpp2 to phylink's new pcs support.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: mvpp2: move GMAC reset handling into mac_prepare()/mac_finish()
Russell King [Tue, 1 Sep 2020 13:48:27 +0000 (14:48 +0100)]
net: mvpp2: move GMAC reset handling into mac_prepare()/mac_finish()

Move the GMAC reset handling into mac_prepare() / mac_finish()

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: mvpp2: ensure the port is forced down while changing modes
Russell King [Tue, 1 Sep 2020 13:48:22 +0000 (14:48 +0100)]
net: mvpp2: ensure the port is forced down while changing modes

Ensure that the port is forced down while reconfiguring, controlling
this via mac_prepare() and mac_finish() so that it is down while we
are configuring our (future) PCS.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: mvpp2: convert to use mac_prepare()/mac_finish()
Russell King [Tue, 1 Sep 2020 13:48:17 +0000 (14:48 +0100)]
net: mvpp2: convert to use mac_prepare()/mac_finish()

Convert mvpp2 to use the mac_prepare() and mac_finish() methods in
preparation to converting mvpp2 to split-PCS support.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: mvpp2: tidy up ACPI hack
Russell King [Tue, 1 Sep 2020 13:48:12 +0000 (14:48 +0100)]
net: mvpp2: tidy up ACPI hack

Tidy up the ACPI hack so that we can minimise the function prototypes
for this.  This avoids adding further prototypes unnecessarily.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'l2tp-miscellaneous-cleanups'
David S. Miller [Thu, 3 Sep 2020 19:19:04 +0000 (12:19 -0700)]
Merge branch 'l2tp-miscellaneous-cleanups'

Tom Parkin says:

====================
l2tp: miscellaneous cleanups

This series of patches makes the following cleanups and improvements to
the l2tp code:

 * various API tweaks to remove unused parameters from function calls
 * lightly refactor the l2tp transmission path to capture more error
   conditions in the data plane statistics
 * repurpose the "magic feather" validation in l2tp to check for
   sk_user_data (ab)use as opposed to refcount debugging
 * remove some duplicated code
====================

Reviewed-by: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agol2tp: avoid duplicated code in l2tp_tunnel_closeall
Tom Parkin [Thu, 3 Sep 2020 08:54:52 +0000 (09:54 +0100)]
l2tp: avoid duplicated code in l2tp_tunnel_closeall

l2tp_tunnel_closeall is called as a part of tunnel shutdown in order to
close all the sessions held by the tunnel.  The code it uses to close a
session duplicates what l2tp_session_delete does.

Rather than duplicating the code, have l2tp_tunnel_closeall call
l2tp_session_delete instead.

This involves a very minor change to locking in l2tp_tunnel_closeall.
Previously, l2tp_tunnel_closeall checked the session "dead" flag while
holding tunnel->hlist_lock.  This allowed for the code to step to the
next session in the list without releasing the lock if the current
session happened to be in the process of closing already.

By calling l2tp_session_delete instead, l2tp_tunnel_closeall must now
drop and regain the hlist lock for each session in the tunnel list.
Given that the likelihood of a session being in the process of closing
when the tunnel is closed, it seems worth this very minor potential
loss of efficiency to avoid duplication of the session delete code.

Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agol2tp: make magic feather checks more useful
Tom Parkin [Thu, 3 Sep 2020 08:54:51 +0000 (09:54 +0100)]
l2tp: make magic feather checks more useful

The l2tp tunnel and session structures contain a "magic feather" field
which was originally intended to help trace lifetime bugs in the code.

Since the introduction of the shared kernel refcount code in refcount.h,
and l2tp's porting to those APIs, we are covered by the refcount code's
checks and warnings.  Duplicating those checks in the l2tp code isn't
useful.

However, magic feather checks are still useful to help to detect bugs
stemming from misuse/trampling of the sk_user_data pointer in struct
sock.  The l2tp code makes extensive use of sk_user_data to stash
pointers to the tunnel and session structures, and if another subsystem
overwrites sk_user_data it's important to detect this.

As such, rework l2tp's magic feather checks to focus on validating the
tunnel and session data structures when they're extracted from
sk_user_data.

 * Add a new accessor function l2tp_sk_to_tunnel which contains a magic
   feather check, and is used by l2tp_core and l2tp_ip[6]
 * Comment l2tp_udp_encap_recv which doesn't use this new accessor function
   because of the specific nature of the codepath it is called in
 * Drop l2tp_session_queue_purge's check on the session magic feather:
   it is called from code which is walking the tunnel session list, and
   hence doesn't need validation
 * Drop l2tp_session_free's check on the tunnel magic feather: the
   intention of this check is covered by refcount.h's reference count
   sanity checking
 * Add session magic validation in pppol2tp_ioctl.  On failure return
   -EBADF, which mirrors the approach in pppol2tp_[sg]etsockopt.

Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agol2tp: capture more tx errors in data plane stats
Tom Parkin [Thu, 3 Sep 2020 08:54:50 +0000 (09:54 +0100)]
l2tp: capture more tx errors in data plane stats

l2tp_xmit_skb has a number of failure paths which are not reflected in
the tunnel and session statistics because the stats are updated by
l2tp_xmit_core.  Hence any errors occurring before l2tp_xmit_core is
called are missed from the statistics.

Refactor the transmit path slightly to capture all error paths.

l2tp_xmit_skb now leaves all the actual work of transmission to
l2tp_xmit_core, and updates the statistics based on l2tp_xmit_core's
return code.

Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agol2tp: drop net argument from l2tp_tunnel_create
Tom Parkin [Thu, 3 Sep 2020 08:54:49 +0000 (09:54 +0100)]
l2tp: drop net argument from l2tp_tunnel_create

The argument is unused, so remove it.

Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agol2tp: drop data_len argument from l2tp_xmit_core
Tom Parkin [Thu, 3 Sep 2020 08:54:48 +0000 (09:54 +0100)]
l2tp: drop data_len argument from l2tp_xmit_core

The data_len argument passed to l2tp_xmit_core is no longer used, so
remove it.

Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agol2tp: remove header length param from l2tp_xmit_skb
Tom Parkin [Thu, 3 Sep 2020 08:54:47 +0000 (09:54 +0100)]
l2tp: remove header length param from l2tp_xmit_skb

All callers pass the session structure's hdr_len field as the header
length parameter to l2tp_xmit_skb.

Since we're passing a pointer to the session structure to l2tp_xmit_skb
anyway, there's not much point breaking the header length out as a
separate argument.

Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'mlxsw-Expose-critical-and-emergency-module-alarms'
David S. Miller [Thu, 3 Sep 2020 19:12:05 +0000 (12:12 -0700)]
Merge branch 'mlxsw-Expose-critical-and-emergency-module-alarms'

Ido Schimmel says:

====================
mlxsw: Expose critical and emergency module alarms

Amit says:

Extend hwmon interface with critical and emergency module alarms.

In case that current module temperature is higher than emergency
threshold, EMERGENCY alarm will be reported in sensors utility:

$ sensors
...
front panel 025:  +55.0°C  (crit = +35.0°C, emerg = +40.0°C) ALARM(EMERGENCY)

In case that current module temperature is higher than critical
threshold, CRIT alarm will be reported in sensors utility:

$ sensors
...
front panel 025:  +54.0°C  (crit = +35.0°C, emerg = +80.0°C) ALARM(CRIT)

Patch set overview:

Patches #1-#2 make several changes to make the code easier to change.

Patch #3 extends the hwmon interface with the new module alarms.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agomlxsw: core_hwmon: Extend hwmon interface with critical and emergency alarms
Amit Cohen [Thu, 3 Sep 2020 13:41:46 +0000 (16:41 +0300)]
mlxsw: core_hwmon: Extend hwmon interface with critical and emergency alarms

Add new attributes to hwmon object for exposing critical and emergency
alarms.

In case that current temperature is higher than emergency threshold,
EMERGENCY alarm will be reported in sensors utility:

$ sensors
...
front panel 025:  +55.0°C  (crit = +35.0°C, emerg = +40.0°C) ALARM(EMERGENCY)

In case that current temperature is higher than critical threshold,
CRIT alarm will be reported in sensors utility:

$ sensors
...
front panel 025:  +54.0°C  (crit = +35.0°C, emerg = +80.0°C) ALARM(CRIT)

Signed-off-by: Amit Cohen <amitc@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Acked-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agomlxsw: core_hwmon: Calculate MLXSW_HWMON_ATTR_COUNT more accurately
Amit Cohen [Thu, 3 Sep 2020 13:41:45 +0000 (16:41 +0300)]
mlxsw: core_hwmon: Calculate MLXSW_HWMON_ATTR_COUNT more accurately

Currently the value of MLXSW_HWMON_ATTR_COUNT is calculated not really
accurate.

Add several defines to make the calculation clearer and easier to
change.

Calculate the precise high bound of number of attributes that may be
needed.

Signed-off-by: Amit Cohen <amitc@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agomlxsw: core_hwmon: Split temperature querying from show functions
Amit Cohen [Thu, 3 Sep 2020 13:41:44 +0000 (16:41 +0300)]
mlxsw: core_hwmon: Split temperature querying from show functions

mlxsw_hwmon_module_temp_show(), mlxsw_hwmon_module_temp_critical_show()
and mlxsw_hwmon_module_temp_emergency_show() query the relevant
temperature from firmware and fill the value in provided buffers.

Split the temperature querying functionality to individual get()
functions and call them from the show() functions.

The get() functions will be used by subsequent patches in the set.

Signed-off-by: Amit Cohen <amitc@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'Minor-improvements-to-b53-dmesg-output'
David S. Miller [Thu, 3 Sep 2020 19:07:29 +0000 (12:07 -0700)]
Merge branch 'Minor-improvements-to-b53-dmesg-output'

Paul Barker says:

====================
Minor improvements to b53 dmesg output

These changes were made while debugging the b53 driver for use on a
custom board. They've been runtime tested on a patched 4.14.y kernel
which supports this board as well as build tested with 5.9-rc3. The
changes are straightforward enough that I think this testing is
sufficient but let me know if further testing is required.

Unfortunately I don't have a board to hand which boots with a more
recent kernel and has a switch supported by the b53 driver. I'd still
like to upstream these patches if possible though.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: dsa: b53: Print err message on SW_RST timeout
Paul Barker [Thu, 3 Sep 2020 11:26:21 +0000 (12:26 +0100)]
net: dsa: b53: Print err message on SW_RST timeout

This allows us to differentiate between the possible failure modes of
b53_switch_reset() by looking at the dmesg output.

Signed-off-by: Paul Barker <pbarker@konsulko.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: dsa: b53: Use dev_{err,info} instead of pr_*
Paul Barker [Thu, 3 Sep 2020 11:26:20 +0000 (12:26 +0100)]
net: dsa: b53: Use dev_{err,info} instead of pr_*

This change allows us to see which device the err or info messages are
referring to if we have multiple b53 compatible devices on a board.

As this removes the only pr_*() calls in this file we can drop the
definition of pr_fmt().

Signed-off-by: Paul Barker <pbarker@konsulko.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'ionic-struct-cleanups'
David S. Miller [Wed, 2 Sep 2020 22:47:01 +0000 (15:47 -0700)]
Merge branch 'ionic-struct-cleanups'

Shannon Nelson says:

====================
ionic: struct cleanups

This patchset has a few changes for better cacheline use,
to cleanup a page handling API, and to streamline the
Adminq/Notifyq queue handling.  Lastly, we also have a couple
of fixes pointed out by the friendly kernel test robot.

v2: dropped change to irq coalesce default
    fixed Neel's attributions to Co-developed-by
    dropped the unnecessary new call to dma_sync_single_for_cpu()
    added 2 patches from kernel test robot results
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoionic: clarify boolean precedence
Shannon Nelson [Tue, 1 Sep 2020 18:20:24 +0000 (11:20 -0700)]
ionic: clarify boolean precedence

Add parenthesis to clarify a boolean usage.

Pointed out in https://lore.kernel.org/lkml/202008060413.VgrMuqLJ%25lkp@intel.com/

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoionic: remove unused variable
Shannon Nelson [Tue, 1 Sep 2020 18:20:23 +0000 (11:20 -0700)]
ionic: remove unused variable

Remove a vestigial variable.

Pointed out in https://lore.kernel.org/lkml/20200806143735.GA9232@xsang-OptiPlex-9020/

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoionic: clean adminq service routine
Shannon Nelson [Tue, 1 Sep 2020 18:20:22 +0000 (11:20 -0700)]
ionic: clean adminq service routine

The only thing calling ionic_napi any more is the adminq
processing, so combine and simplify.

Co-developed-by: Neel Patel <neel@pensando.io>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoionic: clean up desc_info and cq_info structs
Shannon Nelson [Tue, 1 Sep 2020 18:20:21 +0000 (11:20 -0700)]
ionic: clean up desc_info and cq_info structs

Remove some unnecessary struct fields and related code.

Co-developed-by: Neel Patel <neel@pensando.io>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoionic: struct reorder for faster access
Shannon Nelson [Tue, 1 Sep 2020 18:20:20 +0000 (11:20 -0700)]
ionic: struct reorder for faster access

Move a few active struct fields to the front of the struct
for a little better cache use and performance.

Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoionic: clean up page handling code
Shannon Nelson [Tue, 1 Sep 2020 18:20:19 +0000 (11:20 -0700)]
ionic: clean up page handling code

The internal page handling can be cleaned up by passing our
local page struct rather than dma addresses, and by putting
more of the mgmt code into the alloc and free routines.

Co-developed-by: Neel Patel <neel@pensando.io>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'RTL8366-stabilization'
David S. Miller [Wed, 2 Sep 2020 21:13:35 +0000 (14:13 -0700)]
Merge branch 'RTL8366-stabilization'

Linus Walleij says:

====================
RTL8366 stabilization

This stabilizes the RTL8366 driver by checking validity
of the passed VLANs and refactoring the member config
(MC) code so we do not require strict call order and
de-duplicate some code.

Changes from v1: incorporate review comments on patch
2.

Changes from v2: a oneline bug fix in patch 2.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: dsa: rtl8366: Refactor VLAN/PVID init
Linus Walleij [Tue, 1 Sep 2020 22:09:35 +0000 (00:09 +0200)]
net: dsa: rtl8366: Refactor VLAN/PVID init

The VLANs and PVIDs on the RTL8366 utilizes a "member
configuration" (MC) which is largely unexplained in the
code.

This set-up requires a special ordering: rtl8366_set_pvid()
must be called first, followed by rtl8366_set_vlan(),
else the MC will not be properly allocated. Relax this
by factoring out the code obtaining an MC and reuse
the helper in both rtl8366_set_pvid() and
rtl8366_set_vlan() so we remove this strict ordering
requirement.

In the process, add some better comments and debug prints
so people who read the code understand what is going on.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: dsa: rtl8366: Check validity of passed VLANs
Linus Walleij [Tue, 1 Sep 2020 22:09:34 +0000 (00:09 +0200)]
net: dsa: rtl8366: Check validity of passed VLANs

The rtl8366_set_vlan() and rtl8366_set_pvid() get invalid
VLANs tossed at it, especially VLAN0, something the hardware
and driver cannot handle. Check validity and bail out like
we do in the other callbacks.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoselftests: mptcp: fix typo in mptcp_connect usage
Davide Caratti [Wed, 2 Sep 2020 11:44:24 +0000 (13:44 +0200)]
selftests: mptcp: fix typo in mptcp_connect usage

in mptcp_connect, 's' selects IPPROTO_MPTCP / IPPROTO_TCP as the value of
'protocol' in socket(), and 'm' switches between different send / receive
modes. Fix die_usage(): swap 'm' and 's' and add missing 'sendfile' mode.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoocteontx2-pf: Add UDP segmentation offload support
Sunil Goutham [Tue, 1 Sep 2020 09:31:42 +0000 (15:01 +0530)]
octeontx2-pf: Add UDP segmentation offload support

Defines UDP segmentation algorithm in hardware and supports
offloading UDP segmentation.

Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: dsa: mv88e6xxx: Fix W=1 warning with !CONFIG_OF
Andrew Lunn [Tue, 1 Sep 2020 02:32:57 +0000 (04:32 +0200)]
net: dsa: mv88e6xxx: Fix W=1 warning with !CONFIG_OF

When building on platforms without device tree, e.g. amd64, W=1 gives
a warning about mv88e6xxx_mdio_external_match being unused. Replace
of_match_node() with of_device_is_compatible() to prevent this
warning.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'dpaa2-eth-add-a-dpaa2_eth_-prefix-to-all-functions'
David S. Miller [Tue, 1 Sep 2020 20:23:58 +0000 (13:23 -0700)]
Merge branch 'dpaa2-eth-add-a-dpaa2_eth_-prefix-to-all-functions'

Ioana Ciornei says:

====================
dpaa2-eth: add a dpaa2_eth_ prefix to all functions

This is just a quick cleanup that aims at adding a dpaa2_eth_ prefix to
all functions within the dpaa2-eth driver even if those are static and
private to the driver. The main reason for doing this is that looking a
perf top, for example, is becoming an inconvenience because one cannot
easily determine which entries are dpaa2-eth related or not.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agodpaa2-eth: add a dpaa2_eth_ prefix to all functions in dpaa2-eth-dcb.c
Ioana Ciornei [Mon, 31 Aug 2020 18:12:40 +0000 (21:12 +0300)]
dpaa2-eth: add a dpaa2_eth_ prefix to all functions in dpaa2-eth-dcb.c

Some static functions in the dpaa2-eth driver don't have the dpaa2_eth_
prefix and this is becoming an inconvenience when looking at, for
example, a perf top output and trying to determine easily which entries
are dpaa2-eth related. Ammend this by adding the prefix to all the
functions.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agodpaa2-eth: add a dpaa2_eth_ prefix to all functions in dpaa2-eth.c
Ioana Ciornei [Mon, 31 Aug 2020 18:12:39 +0000 (21:12 +0300)]
dpaa2-eth: add a dpaa2_eth_ prefix to all functions in dpaa2-eth.c

Some static functions in the dpaa2-eth driver don't have the dpaa2_eth_
prefix and this is becoming an inconvenience when looking at, for
example, a perf top output and trying to determine easily which entries
are dpaa2-eth related. Ammend this by adding the prefix to all the
functions.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agodpaa2-eth: add a dpaa2_eth_ prefix to all functions in dpaa2-ethtool.c
Ioana Ciornei [Mon, 31 Aug 2020 18:12:38 +0000 (21:12 +0300)]
dpaa2-eth: add a dpaa2_eth_ prefix to all functions in dpaa2-ethtool.c

Some static functions in the dpaa2-eth driver don't have the dpaa2_eth_
prefix and this is becoming an inconvenience when looking at, for
example, a perf top output and trying to determine easily which entries
are dpaa2-eth related. Ammend this by adding the prefix to all the
functions.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: openvswitch: fixes crash if nf_conncount_init() fails
Eelco Chaudron [Mon, 31 Aug 2020 09:57:57 +0000 (11:57 +0200)]
net: openvswitch: fixes crash if nf_conncount_init() fails

If nf_conncount_init fails currently the dispatched work is not canceled,
causing problems when the timer fires. This change fixes this by not
scheduling the work until all initialization is successful.

Fixes: a65878d6f00b ("net: openvswitch: fixes potential deadlock in dp cleanup code")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoibmvnic: Harden device Command Response Queue handshake
Thomas Falcon [Mon, 31 Aug 2020 16:59:57 +0000 (11:59 -0500)]
ibmvnic: Harden device Command Response Queue handshake

In some cases, the device or firmware may be busy when the
driver attempts to perform the CRQ initialization handshake.
If the partner is busy, the hypervisor will return the H_CLOSED
return code. The aim of this patch is that, if the device is not
ready, to query the device a number of times, with a small wait
time in between queries. If all initialization requests fail,
the driver will remain in a dormant state, awaiting a signal
from the device that it is ready for operation.

Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
David S. Miller [Tue, 1 Sep 2020 20:05:08 +0000 (13:05 -0700)]
Merge git://git./linux/kernel/git/bpf/bpf-next

Daniel Borkmann says:

====================
pull-request: bpf-next 2020-09-01

The following pull-request contains BPF updates for your *net-next* tree.

There are two small conflicts when pulling, resolve as follows:

1) Merge conflict in tools/lib/bpf/libbpf.c between 88a82120282b ("libbpf: Factor
   out common ELF operations and improve logging") in bpf-next and 1e891e513e16
   ("libbpf: Fix map index used in error message") in net-next. Resolve by taking
   the hunk in bpf-next:

        [...]
        scn = elf_sec_by_idx(obj, obj->efile.btf_maps_shndx);
        data = elf_sec_data(obj, scn);
        if (!scn || !data) {
                pr_warn("elf: failed to get %s map definitions for %s\n",
                        MAPS_ELF_SEC, obj->path);
                return -EINVAL;
        }
        [...]

2) Merge conflict in drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c between
   9647c57b11e5 ("xsk: i40e: ice: ixgbe: mlx5: Test for dma_need_sync earlier for
   better performance") in bpf-next and e20f0dbf204f ("net/mlx5e: RX, Add a prefetch
   command for small L1_CACHE_BYTES") in net-next. Resolve the two locations by retaining
   net_prefetch() and taking xsk_buff_dma_sync_for_cpu() from bpf-next. Should look like:

        [...]
        xdp_set_data_meta_invalid(xdp);
        xsk_buff_dma_sync_for_cpu(xdp, rq->xsk_pool);
        net_prefetch(xdp->data);
        [...]

We've added 133 non-merge commits during the last 14 day(s) which contain
a total of 246 files changed, 13832 insertions(+), 3105 deletions(-).

The main changes are:

1) Initial support for sleepable BPF programs along with bpf_copy_from_user() helper
   for tracing to reliably access user memory, from Alexei Starovoitov.

2) Add BPF infra for writing and parsing TCP header options, from Martin KaFai Lau.

3) bpf_d_path() helper for returning full path for given 'struct path', from Jiri Olsa.

4) AF_XDP support for shared umems between devices and queues, from Magnus Karlsson.

5) Initial prep work for full BPF-to-BPF call support in libbpf, from Andrii Nakryiko.

6) Generalize bpf_sk_storage map & add local storage for inodes, from KP Singh.

7) Implement sockmap/hash updates from BPF context, from Lorenz Bauer.

8) BPF xor verification for scalar types & add BPF link iterator, from Yonghong Song.

9) Use target's prog type for BPF_PROG_TYPE_EXT prog verification, from Udip Pant.

10) Rework BPF tracing samples to use libbpf loader, from Daniel T. Lee.

11) Fix xdpsock sample to really cycle through all buffers, from Weqaar Janjua.

12) Improve type safety for tun/veth XDP frame handling, from Maciej Żenczykowski.

13) Various smaller cleanups and improvements all over the place.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoliquidio: Remove unneeded cast from memory allocation
YueHaibing [Tue, 1 Sep 2020 14:11:15 +0000 (22:11 +0800)]
liquidio: Remove unneeded cast from memory allocation

Remove unneeded return value cast.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: sungem: Remove unneeded cast from memory allocation
YueHaibing [Tue, 1 Sep 2020 14:10:28 +0000 (22:10 +0800)]
net: sungem: Remove unneeded cast from memory allocation

Remove dma_alloc_coherent return value cast.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet/tls: Implement getsockopt SOL_TLS TLS_RX
Yutaro Hayakawa [Tue, 1 Sep 2020 13:59:45 +0000 (22:59 +0900)]
net/tls: Implement getsockopt SOL_TLS TLS_RX

Implement the getsockopt SOL_TLS TLS_RX which is currently missing. The
primary usecase is to use it in conjunction with TCP_REPAIR to
checkpoint/restore the TLS record layer state.

TLS connection state usually exists on the user space library. So
basically we can easily extract it from there, but when the TLS
connections are delegated to the kTLS, it is not the case. We need to
have a way to extract the TLS state from the kernel for both of TX and
RX side.

The new TLS_RX getsockopt copies the crypto_info to user in the same
way as TLS_TX does.

We have described use cases in our research work in Netdev 0x14
Transport Workshop [1].

Also, there is an TLS implementation called tlse [2] which supports
TLS connection migration. They have support of kTLS and their code
shows that they are expecting the future support of this option.

[1] https://speakerdeck.com/yutarohayakawa/prism-proxies-without-the-pain
[2] https://github.com/eduardsui/tlse

Signed-off-by: Yutaro Hayakawa <yhayakawa3720@gmail.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'net-openvswitch-improve-the-codes'
David S. Miller [Tue, 1 Sep 2020 18:42:15 +0000 (11:42 -0700)]
Merge branch 'net-openvswitch-improve-the-codes'

Tonghao Zhang says:

====================
net: openvswitch: improve the codes

This series patches are not bug fix, just improve codes.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: openvswitch: remove unused keep_flows
Tonghao Zhang [Tue, 1 Sep 2020 12:26:14 +0000 (20:26 +0800)]
net: openvswitch: remove unused keep_flows

keep_flows was introduced by [1], which used as flag to delete flows or not.
When rehashing or expanding the table instance, we will not flush the flows.
Now don't use it anymore, remove it.

[1] - https://github.com/openvswitch/ovs/commit/acd051f1761569205827dc9b037e15568a8d59f8
Cc: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: openvswitch: refactor flow free function
Tonghao Zhang [Tue, 1 Sep 2020 12:26:13 +0000 (20:26 +0800)]
net: openvswitch: refactor flow free function

Decrease table->count and ufid_count unconditionally,
because we only don't use count or ufid_count to count
when flushing the flows. To simplify the codes, we
remove the "count" argument of table_instance_flow_free.

To avoid a bug when deleting flows in the future, add
WARN_ON in flush flows function.

Cc: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: openvswitch: improve the coding style
Tonghao Zhang [Tue, 1 Sep 2020 12:26:12 +0000 (20:26 +0800)]
net: openvswitch: improve the coding style

Not change the logic, just improve the coding style.

Cc: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agobpf: {cpu,dev}map: Change various functions return type from int to void
Björn Töpel [Tue, 1 Sep 2020 08:39:28 +0000 (10:39 +0200)]
bpf: {cpu,dev}map: Change various functions return type from int to void

The functions bq_enqueue(), bq_flush_to_queue(), and bq_xmit_all() in
{cpu,dev}map.c always return zero. Changing the return type from int
to void makes the code easier to follow.

Suggested-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/bpf/20200901083928.6199-1-bjorn.topel@gmail.com
3 years agobpf: Remove bpf_lsm_file_mprotect from sleepable list.
Alexei Starovoitov [Mon, 31 Aug 2020 20:16:51 +0000 (13:16 -0700)]
bpf: Remove bpf_lsm_file_mprotect from sleepable list.

Technically the bpf programs can sleep while attached to bpf_lsm_file_mprotect,
but such programs need to access user memory. So they're in might_fault()
category. Which means they cannot be called from file_mprotect lsm hook that
takes write lock on mm->mmap_lock.
Adjust the test accordingly.

Also add might_fault() to __bpf_prog_enter_sleepable() to catch such deadlocks early.

Fixes: 1e6c62a88215 ("bpf: Introduce sleepable BPF programs")
Fixes: e68a144547fc ("selftests/bpf: Add sleepable tests")
Reported-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200831201651.82447-1-alexei.starovoitov@gmail.com
3 years agosamples/bpf: Fix to xdpsock to avoid recycling frames
Weqaar Janjua [Fri, 28 Aug 2020 16:17:17 +0000 (00:17 +0800)]
samples/bpf: Fix to xdpsock to avoid recycling frames

The txpush program in the xdpsock sample application is supposed
to send out all packets in the umem in a round-robin fashion.
The problem is that it only cycled through the first BATCH_SIZE
worth of packets. Fixed this so that it cycles through all buffers
in the umem as intended.

Fixes: 248c7f9c0e21 ("samples/bpf: convert xdpsock to use libbpf for AF_XDP access")
Signed-off-by: Weqaar Janjua <weqaar.a.janjua@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Link: https://lore.kernel.org/bpf/20200828161717.42705-1-weqaar.a.janjua@intel.com
3 years agosamples/bpf: Optimize l2fwd performance in xdpsock
Magnus Karlsson [Fri, 28 Aug 2020 12:51:05 +0000 (14:51 +0200)]
samples/bpf: Optimize l2fwd performance in xdpsock

Optimize the throughput performance of the l2fwd sub-app in the
xdpsock sample application by removing a duplicate syscall and
increasing the size of the fill ring.

The latter needs some further explanation. We recommend that you set
the fill ring size >= HW RX ring size + AF_XDP RX ring size. Make sure
you fill up the fill ring with buffers at regular intervals, and you
will with this setting avoid allocation failures in the driver. These
are usually quite expensive since drivers have not been written to
assume that allocation failures are common. For regular sockets,
kernel allocated memory is used that only runs out in OOM situations
that should be rare.

These two performance optimizations together lead to a 6% percent
improvement for the l2fwd app on my machine.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/1598619065-1944-1-git-send-email-magnus.karlsson@intel.com
3 years agonet: ipv4: remove unused arg exact_dif in compute_score
Miaohe Lin [Mon, 31 Aug 2020 06:26:34 +0000 (02:26 -0400)]
net: ipv4: remove unused arg exact_dif in compute_score

The arg exact_dif is not used anymore, remove it. inet_exact_dif_match()
is no longer needed after the above is removed, so remove it too.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: ipv6: remove unused arg exact_dif in compute_score
Miaohe Lin [Mon, 31 Aug 2020 06:26:10 +0000 (02:26 -0400)]
net: ipv6: remove unused arg exact_dif in compute_score

The arg exact_dif is not used anymore, remove it. inet6_exact_dif_match()
is no longer needed after the above is removed, remove it too.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'net-phy-add-Lynx-PCS-MDIO-module'
David S. Miller [Mon, 31 Aug 2020 19:52:33 +0000 (12:52 -0700)]
Merge branch 'net-phy-add-Lynx-PCS-MDIO-module'

Ioana Ciornei says:

====================
net: phy: add Lynx PCS MDIO module

Add support for the Lynx PCS as a separate module in drivers/net/phy/.
The advantage of this structure is that multiple ethernet or switch
drivers used on NXP hardware (ENETC, Seville, Felix DSA switch etc) can
share the same implementation of PCS configuration and runtime
management.

The module implements phylink_pcs_ops and exports a phylink_pcs
(incorporated into a lynx_pcs) which can be directly passed to phylink
through phylink_pcs_set.

The first 3 patches add some missing pieces in phylink and the locked
mdiobus write accessor. Next, the Lynx PCS MDIO module is added as a
standalone module. The majority of the code is extracted from the Felix
DSA driver. The last patch makes the necessary changes in the Felix and
Seville drivers in order to use the new common PCS implementation.

At the moment, USXGMII (only with in-band AN), SGMII, QSGMII (with and
without in-band AN) and 2500Base-X (only w/o in-band AN) are supported
by the Lynx PCS MDIO module since these were also supported by Felix and
no functional change is intended at this time.

Changes in v2:
 * got rid of the mdio_lynx_pcs structure and directly exported the
 functions without the need of an indirection
 * made the necessary adjustments for this in the Felix DSA driver
 * solved the broken allmodconfig build test by making the module
 tristate instead of bool
 * fixed a memory leakage in the Felix driver (the pcs structure was
 allocated twice)

Changes in v3:
 * added support for PHYLINK PCS ops in DSA (patch 5/9)
 * cleanup in Felix PHYLINK operations and migrate to
 phylink_mac_link_up() being the callback of choice for applying MAC
 configuration (patches 6-8)

Changes in v4:
 * use the newly introduced phylink PCS mechanism
 * install the phylink_pcs in the phylink_mac_config DSA ops
 * remove the direct implementations of the PCS ops
 * do no use the SGMII_ prefix when referring to the IF_MORE register
 * add a phylink helper to decode the USXGMII code word
 * remove cleanup patches for Felix (these have been already accepted)
 * Seville (recently introduced) now has PCS support through the same
 Lynx PCS module

Changes in v5:
 - move the pcs-lynx driver to drivers/net/pcs
 - reword the commit message a bit in 4/5
 - add error checking and error propagation in 4/5
 - s/IF_MODE_DUPLEX/IF_MODE_HALF_DUPLEX in 4/5
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: dsa: ocelot: use the Lynx PCS helpers in Felix and Seville
Ioana Ciornei [Sun, 30 Aug 2020 08:34:02 +0000 (11:34 +0300)]
net: dsa: ocelot: use the Lynx PCS helpers in Felix and Seville

Use the helper functions introduced by the newly added
Lynx PCS MDIO module in the Felix VSC9959 and Seville VSC9953.

Instead of representing the PCS as a phy_device, a mdio_device structure
will be passed to the Lynx module which is now actually implementing all
the PCS configuration and status reporting.

All code previously used for PCS monitoring and runtime configuration
is removed and replaced will calls to the Lynx PCS operations.

Tested on the following SERDES protocols of LS1028A: 0x7777
(2500Base-X), 0x85bb (QSGMII), 0x9999 (SGMII) and 0x13bb (USXGMII).

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: phy: add Lynx PCS module
Ioana Ciornei [Sun, 30 Aug 2020 08:34:01 +0000 (11:34 +0300)]
net: phy: add Lynx PCS module

Add a Lynx PCS module which exposes the necessary operations to drive
the PCS using phylink.

The majority of the code is extracted from the Felix DSA driver, which
will be also modified in a later patch, and exposed as a separate module
for code reusability purposes.
As such, this aims at feature and bug parity with the existing Felix DSA
driver, and thus USXGMII, SGMII, QSGMII and 2500Base-X (only w/o in-band
AN) are supported by the Lynx PCS module since these were also supported
by Felix.

The module can only be enabled by the drivers in need and not user
selectable.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: mdiobus: add clause 45 mdiobus write accessor
Ioana Ciornei [Sun, 30 Aug 2020 08:34:00 +0000 (11:34 +0300)]
net: mdiobus: add clause 45 mdiobus write accessor

Add the locked variant of the clause 45 mdiobus write accessor -
mdiobus_c45_write().

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: phylink: consider QSGMII interface mode in phylink_mii_c22_pcs_get_state
Ioana Ciornei [Sun, 30 Aug 2020 08:33:59 +0000 (11:33 +0300)]
net: phylink: consider QSGMII interface mode in phylink_mii_c22_pcs_get_state

The same link partner advertisement word is used for both QSGMII and
SGMII, thus treat both interface modes using the same
phylink_decode_sgmii_word() function.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: phylink: add helper function to decode USXGMII word
Ioana Ciornei [Sun, 30 Aug 2020 08:33:58 +0000 (11:33 +0300)]
net: phylink: add helper function to decode USXGMII word

With the new addition of the USXGMII link partner ability constants we
can now introduce a phylink helper that decodes the USXGMII word and
populates the appropriate fields in the phylink_link_state structure
based on them.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet/wan/fsl_ucc_hdlc: Add MODULE_DESCRIPTION
YueHaibing [Sat, 29 Aug 2020 11:58:23 +0000 (19:58 +0800)]
net/wan/fsl_ucc_hdlc: Add MODULE_DESCRIPTION

Add missing MODULE_DESCRIPTION.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: hns: Remove unused macro AE_NAME_PORT_ID_IDX
YueHaibing [Sat, 29 Aug 2020 11:57:37 +0000 (19:57 +0800)]
net: hns: Remove unused macro AE_NAME_PORT_ID_IDX

There is no caller in tree.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: dl2k: Remove unused macro DRV_NAME
YueHaibing [Sat, 29 Aug 2020 11:56:23 +0000 (19:56 +0800)]
net: dl2k: Remove unused macro DRV_NAME

There is no caller in tree any more.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: wan: slic_ds26522: Remove unused macro DRV_NAME
YueHaibing [Sat, 29 Aug 2020 11:55:49 +0000 (19:55 +0800)]
net: wan: slic_ds26522: Remove unused macro DRV_NAME

There is no caller in tree any more.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agotipc: Remove unused macro TIPC_NACK_INTV
YueHaibing [Sat, 29 Aug 2020 11:52:14 +0000 (19:52 +0800)]
tipc: Remove unused macro TIPC_NACK_INTV

There is no caller in tree any more.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agotipc: Remove unused macro TIPC_FWD_MSG
YueHaibing [Sat, 29 Aug 2020 11:50:26 +0000 (19:50 +0800)]
tipc: Remove unused macro TIPC_FWD_MSG

There is no caller in tree any more.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agomptcp: Remove unused macro MPTCP_SAME_STATE
YueHaibing [Sat, 29 Aug 2020 11:42:26 +0000 (19:42 +0800)]
mptcp: Remove unused macro MPTCP_SAME_STATE

There is no caller in tree any more.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: clean up codestyle
Miaohe Lin [Sat, 29 Aug 2020 09:21:30 +0000 (05:21 -0400)]
net: clean up codestyle

This is a pure codestyle cleanup patch. No functional change intended.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: Use helper macro IP_MAX_MTU in __ip_append_data()
Miaohe Lin [Sat, 29 Aug 2020 09:09:18 +0000 (05:09 -0400)]
net: Use helper macro IP_MAX_MTU in __ip_append_data()

What 0xFFFF means here is actually the max mtu of a ip packet. Use help
macro IP_MAX_MTU here.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: ethernet: ti: am65-cpts: fix i2083 genf (and estf) Reconfiguration Issue
Grygorii Strashko [Fri, 28 Aug 2020 20:33:25 +0000 (23:33 +0300)]
net: ethernet: ti: am65-cpts: fix i2083 genf (and estf) Reconfiguration Issue

The new bit TX_GENF_CLR_EN has been added in AM65x SR2.0 to fix i2083
errata, which can be just set unconditionally for all SoCs.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'sfc-clean-up-some-W-1-build-warnings'
David S. Miller [Mon, 31 Aug 2020 19:28:50 +0000 (12:28 -0700)]
Merge branch 'sfc-clean-up-some-W-1-build-warnings'

Edward Cree says:

====================
sfc: clean up some W=1 build warnings

A collection of minor fixes to issues flagged up by W=1.
After this series, the only remaining warnings in the sfc driver are
 some 'member missing in kerneldoc' warnings from ptp.c.
Tested by building on x86_64 and running 'ethtool -p' on an EF10 NIC;
 there was no error, but I couldn't observe the actual LED as I'm
 working remotely.

[ Incidentally, ethtool_phys_id()'s behaviour on an error return
  looks strange — if I'm reading it right, it will break out of the
  inner loop but not the outer one, and eventually return the rc
  from the last run of the inner loop.  Is this intended? ]
====================

Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agosfc: return errors from efx_mcdi_set_id_led, and de-indirect
Edward Cree [Fri, 28 Aug 2020 17:51:04 +0000 (18:51 +0100)]
sfc: return errors from efx_mcdi_set_id_led, and de-indirect

W=1 warnings indicated that 'rc' was unused in efx_mcdi_set_id_led();
 change the function to return int instead of void and plumb the rc
 through the caller efx_ethtool_phys_id().
Since (post-Falcon) all sfc NICs use MCDI for this, there's no point in
 indirecting through a nic_type method, so remove that and just call
 efx_mcdi_set_id_led() directly.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agosfc: fix kernel-doc on struct efx_loopback_state
Edward Cree [Fri, 28 Aug 2020 17:50:39 +0000 (18:50 +0100)]
sfc: fix kernel-doc on struct efx_loopback_state

Missing 'struct' keyword caused "cannot understand function prototype"
 warnings.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agosfc: fix unused-but-set-variable warning in efx_farch_filter_remove_safe
Edward Cree [Fri, 28 Aug 2020 17:50:24 +0000 (18:50 +0100)]
sfc: fix unused-but-set-variable warning in efx_farch_filter_remove_safe

Thanks to some past refactor, 'spec' is not actually used in this
 function; the code using it moved to the callee efx_farch_filter_remove.
Remove the variable to fix a W=1 warning.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agosfc: fix W=1 warnings in efx_farch_handle_rx_not_ok
Edward Cree [Fri, 28 Aug 2020 17:50:02 +0000 (18:50 +0100)]
sfc: fix W=1 warnings in efx_farch_handle_rx_not_ok

Some of these RX-event flags aren't used at all, so remove them.
Others are used only #ifdef DEBUG to log a message; suppress the
 unused-var warnings #ifndef DEBUG with a void cast.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'Add-ip6_fragment-in-ipv6_stub'
David S. Miller [Mon, 31 Aug 2020 19:26:39 +0000 (12:26 -0700)]
Merge branch 'Add-ip6_fragment-in-ipv6_stub'

wenxu says:

====================
Add ip6_fragment in ipv6_stub

Add ip6_fragment in ipv6_stub and use it in openvswitch
This version add default function eafnosupport_ipv6_fragment
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoopenvswitch: using ip6_fragment in ipv6_stub
wenxu [Fri, 28 Aug 2020 15:14:32 +0000 (23:14 +0800)]
openvswitch: using ip6_fragment in ipv6_stub

Using ipv6_stub->ipv6_fragment to avoid the netfilter dependency

Signed-off-by: wenxu <wenxu@ucloud.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoipv6: add ipv6_fragment hook in ipv6_stub
wenxu [Fri, 28 Aug 2020 15:14:31 +0000 (23:14 +0800)]
ipv6: add ipv6_fragment hook in ipv6_stub

Add ipv6_fragment to ipv6_stub to avoid calling netfilter when
access ip6_fragment.

Signed-off-by: wenxu <wenxu@ucloud.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'gtp-minor-enhancements'
David S. Miller [Mon, 31 Aug 2020 19:24:35 +0000 (12:24 -0700)]
Merge branch 'gtp-minor-enhancements'

Nicolas Dichtel says:

====================
gtp: minor enhancements

The first patch removes a useless rcu lock and the second relax alloc
constraints when a PDP context is added.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agogtp: relax alloc constraint when adding a pdp
Nicolas Dichtel [Fri, 28 Aug 2020 13:30:56 +0000 (15:30 +0200)]
gtp: relax alloc constraint when adding a pdp

When a PDP context is added, the rtnl lock is held, thus no need to force
a GFP_ATOMIC.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agogtp: remove useless rcu_read_lock()
Nicolas Dichtel [Fri, 28 Aug 2020 13:30:55 +0000 (15:30 +0200)]
gtp: remove useless rcu_read_lock()

The rtnl lock is taken just the line above, no need to take the rcu also.

Fixes: 1788b8569f5d ("gtp: fix use-after-free in gtp_encap_destroy()")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: phylink: avoid oops during initialisation
Russell King [Fri, 28 Aug 2020 10:53:53 +0000 (11:53 +0100)]
net: phylink: avoid oops during initialisation

If we intend to use PCS operations, mac_pcs_get_state() will not be
implemented, so will be NULL. If we also intend to register the PCS
operations in mac_prepare() or mac_config(), then this leads to an
attempt to call NULL function pointer during phylink_start(). Avoid
this, but we must report the link is down.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'hinic-add-debugfs-support'
David S. Miller [Mon, 31 Aug 2020 19:21:27 +0000 (12:21 -0700)]
Merge branch 'hinic-add-debugfs-support'

Luo bin says:

====================
hinic: add debugfs support

add debugfs node for querying sq/rq info and function table
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agohinic: add support to query function table
Luo bin [Fri, 28 Aug 2020 03:37:48 +0000 (11:37 +0800)]
hinic: add support to query function table

add debugfs node for querying function table, for example:
cat /sys/kernel/debug/hinic/0000:15:00.0/func_table/valid

Signed-off-by: Luo bin <luobin9@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agohinic: add support to query rq info
Luo bin [Fri, 28 Aug 2020 03:37:47 +0000 (11:37 +0800)]
hinic: add support to query rq info

add debugfs node for querying rq info, for example:
cat /sys/kernel/debug/hinic/0000:15:00.0/RQs/0x0/rq_hw_pi

Signed-off-by: Luo bin <luobin9@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agohinic: add support to query sq info
Luo bin [Fri, 28 Aug 2020 03:37:46 +0000 (11:37 +0800)]
hinic: add support to query sq info

add debugfs node for querying sq info, for example:
cat /sys/kernel/debug/hinic/0000:15:00.0/SQs/0x0/sq_pi

Signed-off-by: Luo bin <luobin9@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoxsk: Documentation for XDP_SHARED_UMEM between queues and netdevs
Magnus Karlsson [Fri, 28 Aug 2020 08:26:29 +0000 (10:26 +0200)]
xsk: Documentation for XDP_SHARED_UMEM between queues and netdevs

Add documentation for the XDP_SHARED_UMEM feature when a UMEM is
shared between different queues and/or netdevs.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Link: https://lore.kernel.org/bpf/1598603189-32145-16-git-send-email-magnus.karlsson@intel.com
3 years agosamples/bpf: Add new sample xsk_fwd.c
Cristian Dumitrescu [Fri, 28 Aug 2020 08:26:28 +0000 (10:26 +0200)]
samples/bpf: Add new sample xsk_fwd.c

This sample code illustrates the packet forwarding between multiple
AF_XDP sockets in multi-threading environment. All the threads and
sockets are sharing a common buffer pool, with each socket having
its own private buffer cache. The sockets are created with the
xsk_socket__create_shared() function, which allows multiple AF_XDP
sockets to share the same UMEM object.

Example 1: Single thread handling two sockets. Packets received
from socket A (on top of interface IFA, queue QA) are forwarded
to socket B (on top of interface IFB, queue QB) and vice-versa.
The thread is affinitized to CPU core C:

./xsk_fwd -i IFA -q QA -i IFB -q QB -c C

Example 2: Two threads, each handling two sockets. Packets from
socket A are sent to socket B (by thread X), packets
from socket B are sent to socket A (by thread X); packets from
socket C are sent to socket D (by thread Y), packets from socket
D are sent to socket C (by thread Y). The two threads are bound
to CPU cores CX and CY:

./xdp_fwd -i IFA -q QA -i IFB -q QB -i IFC -q QC -i IFD -q QD -c CX -c CY

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Link: https://lore.kernel.org/bpf/1598603189-32145-15-git-send-email-magnus.karlsson@intel.com
3 years agolibbpf: Support shared umems between queues and devices
Magnus Karlsson [Fri, 28 Aug 2020 08:26:27 +0000 (10:26 +0200)]
libbpf: Support shared umems between queues and devices

Add support for shared umems between hardware queues and devices to
the AF_XDP part of libbpf. This so that zero-copy can be achieved in
applications that want to send and receive packets between HW queues
on one device or between different devices/netdevs.

In order to create sockets that share a umem between hardware queues
and devices, a new function has been added called
xsk_socket__create_shared(). It takes the same arguments as
xsk_socket_create() plus references to a fill ring and a completion
ring. So for every socket that share a umem, you need to have one more
set of fill and completion rings. This in order to maintain the
single-producer single-consumer semantics of the rings.

You can create all the sockets via the new xsk_socket__create_shared()
call, or create the first one with xsk_socket__create() and the rest
with xsk_socket__create_shared(). Both methods work.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Link: https://lore.kernel.org/bpf/1598603189-32145-14-git-send-email-magnus.karlsson@intel.com
3 years agoxsk: Add shared umem support between devices
Magnus Karlsson [Fri, 28 Aug 2020 08:26:26 +0000 (10:26 +0200)]
xsk: Add shared umem support between devices

Add support to share a umem between different devices. This mode
can be invoked with the XDP_SHARED_UMEM bind flag. Previously,
sharing was only supported within the same device. Note that when
sharing a umem between devices, just as in the case of sharing a
umem between queue ids, you need to create a fill ring and a
completion ring and tie them to the socket (with two setsockopts,
one for each ring) before you do the bind with the
XDP_SHARED_UMEM flag. This so that the single-producer
single-consumer semantics of the rings can be upheld.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Link: https://lore.kernel.org/bpf/1598603189-32145-13-git-send-email-magnus.karlsson@intel.com