openwrt/staging/blogic.git
4 years agonet: ipa: remove endpoint delay mode feature
Alex Elder [Mon, 4 May 2020 23:37:13 +0000 (18:37 -0500)]
net: ipa: remove endpoint delay mode feature

A "delay mode" feature was put in place to work around a problem
that was observed during development of the upstream IPA driver.  It
used TX endpoint "delay mode" in order to prevent transmitting
packets toward the modem before it was ready.

A race condition that would explain the problem has long since been
fixed, and we have concluded that the "delay mode" feature is no
longer required.  So get rid of it.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: introduce ipa_endpoint_program_suspend()
Alex Elder [Mon, 4 May 2020 23:37:12 +0000 (18:37 -0500)]
net: ipa: introduce ipa_endpoint_program_suspend()

Create a new helper function that encapsulates enabling or disabling
suspend on an RX endpoint.  It returns the previous state of the
endpoint (true means suspend mode was enabled).

Create another function that handles enabling or disabling delay mode
on a TX endpoint.  Delay mode does not work correctly on IPA version
4.2, so we don't currently use it (and shouldn't).

We only set delay mode in one case, and although we don't expect an
endpoint to already be in delay mode, it doesn't really matter if it
was.  So the delay function doesn't return a value.

Stop issuing warnings if the previous suspend or delay mode state
differs from what is expected.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: have ipa_endpoint_init_ctrl() return previous state
Alex Elder [Mon, 4 May 2020 23:37:11 +0000 (18:37 -0500)]
net: ipa: have ipa_endpoint_init_ctrl() return previous state

Change ipa_endpoint_init_ctrl() so it returns the previous state
(whether suspend or delay mode was enabled) rather than indicating
whether the request caused a change in state.  This makes it easier
to understand what's happening where called.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-ipa-limit-special-reset-handling'
David S. Miller [Thu, 7 May 2020 00:36:04 +0000 (17:36 -0700)]
Merge branch 'net-ipa-limit-special-reset-handling'

Alex Elder says:

====================
net: ipa: limit special reset handling

Some special handling done during channel reset should only be done
for IPA hardare version 3.5.1.  This series generalizes the meaning
of a flag passed to indicate special behavior, then has the special
handling be used only when appropriate.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: only reset channel twice for IPA v3.5.1
Alex Elder [Mon, 4 May 2020 23:30:03 +0000 (18:30 -0500)]
net: ipa: only reset channel twice for IPA v3.5.1

In gsi_channel_reset(), RX channels are subjected to two consecutive
CHANNEL_RESET commands.  This workaround should only be used for IPA
version 3.5.1, and for newer hardware "can lead to unwanted behavior."

Only issue the second CHANNEL_RESET command for legacy hardware.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: rename db_enable flag
Alex Elder [Mon, 4 May 2020 23:30:02 +0000 (18:30 -0500)]
net: ipa: rename db_enable flag

In several places, a Boolean flag is used in the GSI code to
indicate whether the "doorbell engine" should be enabled or not
when a channel is configured.  This is basically done to abstract
this property from the IPA version; the GSI code doesn't otherwise
"know" what the IPA hardware version is.  The doorbell engine is
enabled only for IPA v3.5.1, not for IPA v4.0 and later.

The next patch makes another change that affects behavior during
channel reset (which also involves programming the channel).  It
also distinguishes IPA v3.5.1 hardware from newer hardware.

Rather than creating another flag whose value matches the "db_enable"
value, just rename "db_enable" to be "legacy" so it can be used to
signal more than just the special doorbell handling.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'tcp-minor-adjustments-for-low-pacing-rates'
David S. Miller [Thu, 7 May 2020 00:29:38 +0000 (17:29 -0700)]
Merge branch 'tcp-minor-adjustments-for-low-pacing-rates'

Eric Dumazet says:

====================
tcp: minor adjustments for low pacing rates

After pacing horizon addition, we have to adjust how we arm rto
timer, otherwise we might freeze very low pacing rate flows.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: defer xmit timer reset in tcp_xmit_retransmit_queue()
Eric Dumazet [Mon, 4 May 2020 18:27:50 +0000 (11:27 -0700)]
tcp: defer xmit timer reset in tcp_xmit_retransmit_queue()

As hinted in prior change ("tcp: refine tcp_pacing_delay()
for very low pacing rates"), it is probably best arming
the xmit timer only when all the packets have been scheduled,
rather than when the head of rtx queue has been re-sent.

This does matter for flows having extremely low pacing rates,
since their tp->tcp_wstamp_ns could be far in the future.

Note that the regular xmit path has a stronger limit
in tcp_small_queue_check(), meaning it is less likely to
go beyond the pacing horizon.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: refine tcp_pacing_delay() for very low pacing rates
Eric Dumazet [Mon, 4 May 2020 18:27:49 +0000 (11:27 -0700)]
tcp: refine tcp_pacing_delay() for very low pacing rates

With the addition of horizon feature to sch_fq, we noticed some
suboptimal behavior of extremely low pacing rate TCP flows, especially
when TCP is not aware of a drop happening in lower stacks.

Back in commit 3f80e08f40cd ("tcp: add tcp_reset_xmit_timer() helper"),
tcp_pacing_delay() was added to estimate an extra delay to add to standard
rto timers.

This patch removes the skb argument from this helper and
tcp_reset_xmit_timer() because it makes more sense to simply
consider the time at which next packet is allowed to be sent,
instead of the time of whatever packet has been sent.

This avoids arming RTO timer too soon and removes
spurious horizon drops.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoarm64: dts: sdm845: add IPA iommus property
Alex Elder [Mon, 4 May 2020 18:13:50 +0000 (13:13 -0500)]
arm64: dts: sdm845: add IPA iommus property

Add an "iommus" property to the IPA node in "sdm845.dtsi".  It is
required because there are two regions of memory the IPA accesses
through an SMMU.  The next few patches define and map those regions.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'timer-add-fsleep-for-flexible-sleeping'
David S. Miller [Thu, 7 May 2020 00:03:34 +0000 (17:03 -0700)]
Merge branch 'timer-add-fsleep-for-flexible-sleeping'
Heiner Kallweit says:

====================
timer: add fsleep for flexible sleeping

Sleeping for a certain amount of time requires use of different
functions, depending on the time period.
Documentation/timers/timers-howto.rst explains when to use which
function, and also checkpatch checks for some potentially
problematic cases.

So let's create a helper that automatically chooses the appropriate
sleep function -> fsleep(), for flexible sleeping
Not sure why such a helper doesn't exist yet, or where the pitfall is,
because it's a quite obvious idea.

If the delay is a constant, then the compiler should be able to ensure
that the new helper doesn't create overhead. If the delay is not
constant, then the new helper can save some code.

First user is the r8169 network driver. If nothing speaks against it,
then this series could go through the netdev tree.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: use fsleep in polling functions
Heiner Kallweit [Fri, 1 May 2020 21:29:12 +0000 (23:29 +0200)]
r8169: use fsleep in polling functions

Use new flexible sleep function fsleep() to merge the udelay and msleep
polling functions. We can safely do this because no polling function
is used in atomic context in this driver.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotimer: add fsleep for flexible sleeping
Heiner Kallweit [Fri, 1 May 2020 21:27:21 +0000 (23:27 +0200)]
timer: add fsleep for flexible sleeping

Sleeping for a certain amount of time requires use of different
functions, depending on the time period.
Documentation/timers/timers-howto.rst explains when to use which
function, and also checkpatch checks for some potentially
problematic cases.

So let's create a helper that automatically chooses the appropriate
sleep function -> fsleep(), for flexible sleeping

If the delay is a constant, then the compiler should be able to ensure
that the new helper doesn't create overhead. If the delay is not
constant, then the new helper can save some code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv6: Implement draft-ietf-6man-rfc4941bis
Fernando Gont [Fri, 1 May 2020 03:51:47 +0000 (00:51 -0300)]
ipv6: Implement draft-ietf-6man-rfc4941bis

Implement the upcoming rev of RFC4941 (IPv6 temporary addresses):
https://tools.ietf.org/html/draft-ietf-6man-rfc4941bis-09

* Reduces the default Valid Lifetime to 2 days
  The number of extra addresses employed when Valid Lifetime was
  7 days exacerbated the stress caused on network
  elements/devices. Additionally, the motivation for temporary
  addresses is indeed privacy and reduced exposure. With a
  default Valid Lifetime of 7 days, an address that becomes
  revealed by active communication is reachable and exposed for
  one whole week. The only use case for a Valid Lifetime of 7
  days could be some application that is expecting to have long
  lived connections. But if you want to have a long lived
  connections, you shouldn't be using a temporary address in the
  first place. Additionally, in the era of mobile devices, general
  applications should nevertheless be prepared and robust to
  address changes (e.g. nodes swap wifi <-> 4G, etc.)

* Employs different IIDs for different prefixes
  To avoid network activity correlation among addresses configured
  for different prefixes

* Uses a simpler algorithm for IID generation
  No need to store "history" anywhere

Signed-off-by: Fernando Gont <fgont@si6networks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'add-phy-shared-storage'
David S. Miller [Wed, 6 May 2020 21:53:30 +0000 (14:53 -0700)]
Merge branch 'add-phy-shared-storage'

Michael Walle says:

====================
add phy shared storage

Introduce the concept of a shared PHY storage which can be used by some
QSGMII PHYs to ease initialization and access to global per-package
registers.

Changes since v2:
 - restore page to standard after reading the base address in the mscc
   driver, thanks Antoine.

Changes since v1:
 - fix typos and add a comment, thanks Florian.
 - check for "addr < 0" in phy_package_join()
 - remove multiple blank lines and make "checkpatch.pl --strict" happy

Changes since RFC:
 - check return code of kzalloc()
 - fix local variable ordering (reverse christmas tree)
 - add priv_size argument to phy_package_join()
 - add Tested-by tag, thanks Vladimir.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: mscc: use phy_package_shared
Michael Walle [Wed, 6 May 2020 14:53:15 +0000 (16:53 +0200)]
net: phy: mscc: use phy_package_shared

Use the new phy_package_shared common storage to ease the package
initialization and to access the global registers.

Signed-off-by: Michael Walle <michael@walle.cc>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: bcm54140: use phy_package_shared
Michael Walle [Wed, 6 May 2020 14:53:14 +0000 (16:53 +0200)]
net: phy: bcm54140: use phy_package_shared

Use the new phy_package_shared common storage to ease the package
initialization and to access the global registers.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: add concept of shared storage for PHYs
Michael Walle [Wed, 6 May 2020 14:53:13 +0000 (16:53 +0200)]
net: phy: add concept of shared storage for PHYs

There are packages which contain multiple PHY devices, eg. a quad PHY
transceiver. Provide functions to allocate and free shared storage.

Usually, a quad PHY contains global registers, which don't belong to any
PHY. Provide convenience functions to access these registers.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoRevert "crypto: chelsio - Inline single pdu only"
Ayush Sawal [Wed, 6 May 2020 14:47:19 +0000 (20:17 +0530)]
Revert "crypto: chelsio - Inline single pdu only"

This reverts commit 27c6feb0fb33a665a746346e76714826a5be5d10.

For ipsec offload the chelsio's ethernet driver expects a single mtu
sized packet.

But when ipsec traffic is running using iperf, most of the packets in
that traffic are gso packets(large sized skbs) because GSO is enabled by
default in TCP, due to this commit 0a6b2a1dc2a2 ("tcp: switch to GSO
being always on"), so chcr_ipsec_offload_ok() receives a gso
skb(with gso_size non zero).

Due to the check in chcr_ipsec_offload_ok(), this function returns false
for most of the packet, then ipsec offload is skipped and the skb goes
out taking the coprocessor path which reduces the bandwidth for inline
ipsec.

If this check is removed then for most of the packets(large sized skbs)
the chcr_ipsec_offload_ok() returns true and then as GSO is on, the
segmentation of the packet happens in the kernel and then finally the
driver_xmit is called, which receives a segmented mtu sized packet which
is what the driver expects for ipsec offload. So this case becomes
unnecessary here, therefore removing it.

Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: 7990: Fix use correct return type for ndo_start_xmit()
Yunjian Wang [Wed, 6 May 2020 12:55:52 +0000 (20:55 +0800)]
net: 7990: Fix use correct return type for ndo_start_xmit()

The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix
the ndo function to use the correct type.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: cpmac: Fix use correct return type for ndo_start_xmit()
Yunjian Wang [Wed, 6 May 2020 12:21:45 +0000 (20:21 +0800)]
net: cpmac: Fix use correct return type for ndo_start_xmit()

The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix
the ndo function to use the correct type.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: moxa: Fix use correct return type for ndo_start_xmit()
Yunjian Wang [Wed, 6 May 2020 12:10:28 +0000 (20:10 +0800)]
net: moxa: Fix use correct return type for ndo_start_xmit()

The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix
the ndo function to use the correct type.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: lantiq: Fix use correct return type for ndo_start_xmit()
Yunjian Wang [Wed, 6 May 2020 11:38:46 +0000 (19:38 +0800)]
net: lantiq: Fix use correct return type for ndo_start_xmit()

The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix
the ndo function to use the correct type.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: enetc: Make some symbols static
ChenTao [Wed, 6 May 2020 11:22:17 +0000 (19:22 +0800)]
net: enetc: Make some symbols static

Fix the following warning:

drivers/net/ethernet/freescale/enetc/enetc_qos.c:427:20: warning:
symbol 'enetc_act_fwd' was not declared. Should it be static?
drivers/net/ethernet/freescale/enetc/enetc_qos.c:966:20: warning:
symbol 'enetc_check_flow_actions' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: ChenTao <chentao107@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mediatek: Fix use correct return type for ndo_start_xmit()
Yunjian Wang [Wed, 6 May 2020 11:13:08 +0000 (19:13 +0800)]
net: mediatek: Fix use correct return type for ndo_start_xmit()

The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix
the ndo function to use the correct type.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: socionext: Fix use correct return type for ndo_start_xmit()
Yunjian Wang [Wed, 6 May 2020 11:04:59 +0000 (19:04 +0800)]
net: socionext: Fix use correct return type for ndo_start_xmit()

The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix
the ndo function to use the correct type.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: renesas: Fix use correct return type for ndo_start_xmit()
Yunjian Wang [Wed, 6 May 2020 09:25:14 +0000 (17:25 +0800)]
net: renesas: Fix use correct return type for ndo_start_xmit()

The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix
the ndo function to use the correct type.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 's390-qeth-next'
David S. Miller [Wed, 6 May 2020 21:11:26 +0000 (14:11 -0700)]
Merge branch 's390-qeth-next'

Julian Wiedmann says:

====================
s390/qeth: updates 2020-05-06

please apply the following patch series for qeth to netdev's net-next
tree.
Same patches as yesterday, except that the ethtool reset has been
dropped for now.

This primarily adds infrastructure to deal with HW offloads when the
packets get forwarded over the adapter's internal switch.
Aside from that, just some minor tweaking for the TX code.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/qeth: clean up Kconfig help text
Julian Wiedmann [Wed, 6 May 2020 08:09:49 +0000 (10:09 +0200)]
s390/qeth: clean up Kconfig help text

Remove a stale doc link. While at it also reword the help text to get
rid of an outdated marketing term.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/qeth: return error when starting a reset fails
Julian Wiedmann [Wed, 6 May 2020 08:09:48 +0000 (10:09 +0200)]
s390/qeth: return error when starting a reset fails

When starting the reset worker via sysfs is unsuccessful, return an
error to the user.
Modernize the sysfs input parsing while at it.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/qeth: set TX IRQ marker on last buffer in a group
Julian Wiedmann [Wed, 6 May 2020 08:09:47 +0000 (10:09 +0200)]
s390/qeth: set TX IRQ marker on last buffer in a group

When qeth_flush_buffers() gets called for a group of TX buffers
(currently up to 2 for OSA-style devices), the code iterates over each
buffer for some final processing.

During this processing, it sets the TX IRQ marker on the leading buffer
rather than the last one. This can result in delayed TX completion of
the trailing buffers. So pull the IRQ marker code out of the loop, and
apply it to the final buffer.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/qeth: indicate contiguous TX buffer elements
Julian Wiedmann [Wed, 6 May 2020 08:09:46 +0000 (10:09 +0200)]
s390/qeth: indicate contiguous TX buffer elements

The TX path usually maps the full content of a page into a buffer
element. But there's specific skb layouts (ie. linearized TSO skbs)
where the HW header (1) requires a separate buffer element, and (2) is
page-contiguous with the packet data that's mapped into the next buffer
element.
Flag such buffer elements accordingly, so that HW can optimize its data
access for them.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/qeth: merge TX skb mapping code
Julian Wiedmann [Wed, 6 May 2020 08:09:45 +0000 (10:09 +0200)]
s390/qeth: merge TX skb mapping code

Merge the __qeth_fill_buffer() helper into its only caller. This way all
mapping-related context is in one place, and we can make some more use
of it in a subsequent patch.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/qeth: don't use restricted offloads for local traffic
Julian Wiedmann [Wed, 6 May 2020 08:09:44 +0000 (10:09 +0200)]
s390/qeth: don't use restricted offloads for local traffic

Current OSA models don't support TSO for traffic to local next-hops, and
some old models didn't offer TX CSO for such packets either.

So as part of .ndo_features_check, check if a packet's next-hop resides
on the same OSA Adapter. Opt out from affected HW offloads accordingly.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/qeth: extract helpers for next-hop lookup
Julian Wiedmann [Wed, 6 May 2020 08:09:43 +0000 (10:09 +0200)]
s390/qeth: extract helpers for next-hop lookup

These will be used in a subsequent patch.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/qeth: add debugfs file for local IP addresses
Julian Wiedmann [Wed, 6 May 2020 08:09:42 +0000 (10:09 +0200)]
s390/qeth: add debugfs file for local IP addresses

For debugging purposes, provide read access to the local_addr caches
via debug/qeth/<dev_name>/local_addrs.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/qeth: process local address events
Julian Wiedmann [Wed, 6 May 2020 08:09:41 +0000 (10:09 +0200)]
s390/qeth: process local address events

In configurations where specific HW offloads are in use, OSA adapters
will raise notifications to their virtual devices about the IP addresses
that currently reside on the same adapter.
Cache these addresses in two RCU-enabled hash tables, and flush the
tables once the relevant HW offload(s) get disabled.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agos390/qeth: keep track of LP2LP capability for csum offload
Julian Wiedmann [Wed, 6 May 2020 08:09:40 +0000 (10:09 +0200)]
s390/qeth: keep track of LP2LP capability for csum offload

When enabling TX CSO, make a note of whether the device has support for
LP2LP offloading. This will become relevant in subsequent patches.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: mediatek: Make mtk_m32 static
Samuel Zou [Wed, 6 May 2020 06:27:30 +0000 (14:27 +0800)]
net: ethernet: mediatek: Make mtk_m32 static

Fix the following sparse warning:

drivers/net/ethernet/mediatek/mtk_eth_soc.c:68:5: warning:
symbol 'mtk_m32' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Samuel Zou <zou_wei@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mlx4: remove unneeded variable "err" in mlx4_en_get_rxfh()
Jason Yan [Wed, 6 May 2020 06:16:30 +0000 (14:16 +0800)]
net: mlx4: remove unneeded variable "err" in mlx4_en_get_rxfh()

Fix the following coccicheck warning:

drivers/net/ethernet/mellanox/mlx4/en_ethtool.c:1238:5-8: Unneeded
variable: "err". Return "0" on line 1252

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: bridge: return false in br_mrp_enabled()
Jason Yan [Wed, 6 May 2020 06:16:16 +0000 (14:16 +0800)]
net: bridge: return false in br_mrp_enabled()

Fix the following coccicheck warning:

net/bridge/br_private.h:1334:8-9: WARNING: return of 0/1 in function
'br_mrp_enabled' with return type bool

Fixes: 6536993371fab ("bridge: mrp: Integrate MRP into the bridge")
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: cortina: Fix use correct return type for ndo_start_xmit()
Yunjian Wang [Wed, 6 May 2020 06:10:41 +0000 (14:10 +0800)]
net: cortina: Fix use correct return type for ndo_start_xmit()

The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix
the ndo function to use the correct type.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: ti: Use PTR_ERR_OR_ZERO() to simplify code
Samuel Zou [Wed, 6 May 2020 02:54:58 +0000 (10:54 +0800)]
net: ethernet: ti: Use PTR_ERR_OR_ZERO() to simplify code

Fixes coccicheck warning:

drivers/net/ethernet/ti/am65-cpts.c:1017:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Samuel Zou <zou_wei@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: ti: am65-cpts: fix build
Grygorii Strashko [Tue, 5 May 2020 16:21:23 +0000 (19:21 +0300)]
net: ethernet: ti: am65-cpts: fix build

It's possible to have build configuration which will force PTP_1588_CLOCK=m
and so TI_K3_AM65_CPTS=m while still have TI_K3_AM65_CPSW_NUSS=y. This will
cause build failures:

aarch64-linux-gnu-ld: ../drivers/net/ethernet/ti/am65-cpsw-nuss.o: in function `am65_cpsw_init_cpts':
../drivers/net/ethernet/ti/am65-cpsw-nuss.c:1685: undefined reference to `am65_cpts_create'
aarch64-linux-gnu-ld: ../drivers/net/ethernet/ti/am65-cpsw-nuss.c:1685:(.text+0x2e20):
relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `am65_cpts_create'

Fix it by adding dependencies from CPTS in TI_K3_AM65_CPSW_NUSS as below:
   config TI_K3_AM65_CPSW_NUSS
   ...
     depends on TI_K3_AM65_CPTS || !TI_K3_AM65_CPTS

Note. This will create below dependencies and for NFS boot + CPTS all of them
have to be built-in.
  PTP_1588_CLOCK -> TI_K3_AM65_CPTS -> TI_K3_AM65_CPSW_NUSS

While here, clean up TI_K3_AM65_CPTS definition.

Fixes: b1f66a5bee07 ("net: ethernet: ti: am65-cpsw-nuss: enable packet timestamping support")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reported-by: Anders Roxell <anders.roxell@linaro.org>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoerspan: Add type I version 0 support.
William Tu [Tue, 5 May 2020 16:05:06 +0000 (09:05 -0700)]
erspan: Add type I version 0 support.

The Type I ERSPAN frame format is based on the barebones
IP + GRE(4-byte) encapsulation on top of the raw mirrored frame.
Both type I and II use 0x88BE as protocol type. Unlike type II
and III, no sequence number or key is required.
To creat a type I erspan tunnel device:
  $ ip link add dev erspan11 type erspan \
            local 172.16.1.100 remote 172.16.1.200 \
            erspan_ver 0

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agocxgb4/cxgb4vf: Remove superfluous void * cast in debugfs_create_file() call
Geert Uytterhoeven [Tue, 5 May 2020 13:34:00 +0000 (15:34 +0200)]
cxgb4/cxgb4vf: Remove superfluous void * cast in debugfs_create_file() call

There is no need to cast a typed pointer to a void pointer when calling
a function that accepts the latter.  Remove it, as the cast prevents
further compiler checks.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'smc-log-state-changes-and-cleanup'
David S. Miller [Tue, 5 May 2020 19:56:52 +0000 (12:56 -0700)]
Merge branch 'smc-log-state-changes-and-cleanup'

Karsten Graul says:

====================
smc: log state changes and cleanup

Patch 1 adds the logging of important state changes to enable SMC-R
users to detect SMC-R link groups that are not redundant and require
user actions. Patch 2 is a contribution to clean up an unused inline
function.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: remove unused inline function smc_curs_read
YueHaibing [Tue, 5 May 2020 13:01:21 +0000 (15:01 +0200)]
net/smc: remove unused inline function smc_curs_read

commit bac6de7b6370 ("net/smc: eliminate cursor read and write calls")
left behind this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: log important pnetid and state change events
Karsten Graul [Tue, 5 May 2020 13:01:20 +0000 (15:01 +0200)]
net/smc: log important pnetid and state change events

Print to system log when SMC links are available or go down, link group
state changes or pnetids are applied to and removed from devices.
The log entries are triggered by either user configuration actions or
adapter activation/deactivation events and are not expected to happen
often. The entries help SMC users to keep track of the SMC link group
status and to detect when actions are needed (like to add replacements
for failed adapters).

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodt-binding: net: ti: am65x-cpts: fix dt_binding_check fail
Grygorii Strashko [Tue, 5 May 2020 10:19:35 +0000 (13:19 +0300)]
dt-binding: net: ti: am65x-cpts: fix dt_binding_check fail

Fix dt_binding_check fail:
Fix Documentation/devicetree/bindings/net/ti,k3-am654-cpts.yaml: $id: relative path/filename doesn't match actual path or filename
expected: http://devicetree.org/schemas/net/ti,k3-am654-cpts.yaml#
Unknown file referenced: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/dist-packages/dtschema/schemas/net/ti,am654-cpts.yaml'
 Documentation/devicetree/bindings/net/ti,k3-am654-cpts.yaml: $id: relative path/filename doesn't match actual path or filename
 expected: http://devicetree.org/schemas/net/ti,k3-am654-cpts.yaml#
Unknown file referenced: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/dist-packages/dtschema/schemas/net/ti,am654-cpts.yaml'

Cc: Rob Herring <robh@kernel.org>
Fixes: 6e87ac748e94 ("dt-binding: ti: am65x: document common platform time sync cpts module")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: remove duplicated include from ipa_mem.c
YueHaibing [Tue, 5 May 2020 10:03:07 +0000 (10:03 +0000)]
net: ipa: remove duplicated include from ipa_mem.c

Remove duplicated include.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosch_choke: Remove classid from choke_skb_cb.
David S. Miller [Tue, 5 May 2020 19:08:02 +0000 (12:08 -0700)]
sch_choke: Remove classid from choke_skb_cb.

Suggested by Cong Wang.

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: sierra_net: Remove unused inline function
YueHaibing [Tue, 5 May 2020 08:51:24 +0000 (16:51 +0800)]
net: sierra_net: Remove unused inline function

There's no callers in-tree

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnx2x: Remove unused inline function bnx2x_vf_vlan_credit
YueHaibing [Tue, 5 May 2020 08:50:09 +0000 (16:50 +0800)]
bnx2x: Remove unused inline function bnx2x_vf_vlan_credit

commit 05cc5a39ddb7 ("bnx2x: add vlan filtering offload")
left behind this, remove it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: sched: choke: Remove unused inline function choke_set_classid
YueHaibing [Tue, 5 May 2020 08:47:36 +0000 (16:47 +0800)]
net: sched: choke: Remove unused inline function choke_set_classid

There's no callers in-tree anymore since commit 5952fde10c35 ("net:
sched: choke: remove dead filter classify code")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: microchip: Remove unused inline function is_bits_set
YueHaibing [Tue, 5 May 2020 08:44:21 +0000 (16:44 +0800)]
net: microchip: Remove unused inline function is_bits_set

There's no callers in-tree.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomyri10ge: Remove unused inline function myri10ge_vlan_ip_csum
YueHaibing [Tue, 5 May 2020 08:43:39 +0000 (16:43 +0800)]
myri10ge: Remove unused inline function myri10ge_vlan_ip_csum

commit 4ca3221fe4b6 ("myri10ge: Convert from LRO to GRO")
left behind this, remove it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: stmmac: Remove unused inline function stmmac_rx_threshold_count
YueHaibing [Tue, 5 May 2020 08:42:56 +0000 (16:42 +0800)]
net: stmmac: Remove unused inline function stmmac_rx_threshold_count

There's no caller in-tree since
commit 2af6106ae949 ("net: stmmac: Introducing support for Page Pool")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mv643xx_eth: Remove unused inline function sum16_as_be
YueHaibing [Tue, 5 May 2020 08:40:37 +0000 (16:40 +0800)]
net: mv643xx_eth: Remove unused inline function sum16_as_be

commit 84411f73b884 ("net: mv643xx_eth: Avoid setting the initial TCP checksum")
left behind this, remove it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: sun: cassini: Remove unused inline functions
YueHaibing [Tue, 5 May 2020 08:33:12 +0000 (16:33 +0800)]
net: sun: cassini: Remove unused inline functions

There's no callers in-tree anymore.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: tehuti: remove unused inline function bdx_tx_db_size
YueHaibing [Tue, 5 May 2020 08:31:56 +0000 (16:31 +0800)]
net: tehuti: remove unused inline function bdx_tx_db_size

There's no callers in-tree anymore.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ni: Fix use correct return type for ndo_start_xmit()
Yunjian Wang [Tue, 5 May 2020 07:59:26 +0000 (15:59 +0800)]
net: ni: Fix use correct return type for ndo_start_xmit()

The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix
the ndo function to use the correct type.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: ti: use true, false for bool variables in cpsw_new.c
Jason Yan [Tue, 5 May 2020 07:46:23 +0000 (15:46 +0800)]
net: ethernet: ti: use true, false for bool variables in cpsw_new.c

Fix the following coccicheck warning:

drivers/net/ethernet/ti/cpsw_new.c:1924:2-17: WARNING: Assignment of
0/1 to bool variable
drivers/net/ethernet/ti/cpsw_new.c:1231:1-16: WARNING: Assignment of
0/1 to bool variable

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: bnxt: Remove Comparison to bool in bnxt_ethtool.c
Jason Yan [Tue, 5 May 2020 07:46:08 +0000 (15:46 +0800)]
net: bnxt: Remove Comparison to bool in bnxt_ethtool.c

Fix the following coccicheck warning:

drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:1991:5-46: WARNING:
Comparison to bool
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:1993:10-54: WARNING:
Comparison to bool
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:2380:5-38: WARNING:
Comparison to bool

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: agere: use true,false for bool variable
Jason Yan [Tue, 5 May 2020 07:45:56 +0000 (15:45 +0800)]
net: agere: use true,false for bool variable

Fix the following coccicheck warning:

drivers/net/ethernet/agere/et131x.c:717:3-22: WARNING: Assignment of
0/1 to bool variable
drivers/net/ethernet/agere/et131x.c:721:1-20: WARNING: Assignment of
0/1 to bool variable

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Acked-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atheros: remove conversion to bool in atl1c_start_mac()
Jason Yan [Tue, 5 May 2020 07:45:46 +0000 (15:45 +0800)]
net: atheros: remove conversion to bool in atl1c_start_mac()

No need to convert '==' expression to bool. This fixes the following
coccicheck warning:

drivers/net/ethernet/atheros/atl1c/atl1c_main.c:1189:63-68: WARNING:
conversion to bool not needed here

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: qede: Use true for bool variable in qede_init_fp()
Jason Yan [Tue, 5 May 2020 07:45:39 +0000 (15:45 +0800)]
net: qede: Use true for bool variable in qede_init_fp()

Fix the following coccicheck warning:

drivers/net/ethernet/qlogic/qede/qede_main.c:1717:5-19: WARNING:
Assignment of 0/1 to bool variable

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnx2x: Remove Comparison to bool in bnx2x_dcb.c
Jason Yan [Tue, 5 May 2020 07:44:00 +0000 (15:44 +0800)]
bnx2x: Remove Comparison to bool in bnx2x_dcb.c

Fix the following coccicheck warning:

drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c:1548:17-31: WARNING:
Comparison to bool
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c:1148:16-24: WARNING:
Comparison to bool
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c:1158:30-38: WARNING:
Comparison to bool

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoqlcnic: use true,false for bool variable in qlcnic_sriov_common.c
Jason Yan [Tue, 5 May 2020 07:43:49 +0000 (15:43 +0800)]
qlcnic: use true,false for bool variable in qlcnic_sriov_common.c

Fix the following coccicheck warning:

drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c:1585:3-25:
WARNING: Assignment of 0/1 to bool variable
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c:1588:3-25:
WARNING: Assignment of 0/1 to bool variable

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: emac: Fix use correct return type for ndo_start_xmit()
Yunjian Wang [Tue, 5 May 2020 05:57:49 +0000 (13:57 +0800)]
net: emac: Fix use correct return type for ndo_start_xmit()

The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix
the ndo function to use the correct type.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: nxp: Fix use correct return type for ndo_start_xmit()
Yunjian Wang [Tue, 5 May 2020 03:22:20 +0000 (11:22 +0800)]
net: nxp: Fix use correct return type for ndo_start_xmit()

The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix
the ndo function to use the correct type.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: altera: Fix use correct return type for ndo_start_xmit()
Yunjian Wang [Tue, 5 May 2020 03:06:45 +0000 (11:06 +0800)]
net: altera: Fix use correct return type for ndo_start_xmit()

The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix
the ndo function to use the correct type.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: allwinner: Fix use correct return type for ndo_start_xmit()
Yunjian Wang [Tue, 5 May 2020 02:49:20 +0000 (10:49 +0800)]
net: allwinner: Fix use correct return type for ndo_start_xmit()

The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix
the ndo function to use the correct type. And emac_start_xmit() can
leak one skb if 'channel' == 3.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-reduce-dynamic-lockdep-keys'
David S. Miller [Mon, 4 May 2020 19:05:56 +0000 (12:05 -0700)]
Merge branch 'net-reduce-dynamic-lockdep-keys'

Cong Wang says:

====================
net: reduce dynamic lockdep keys

syzbot has been complaining about low MAX_LOCKDEP_KEYS for a
long time, it is mostly because we register 4 dynamic keys per
network device.

This patchset reduces the number of dynamic lockdep keys from
4 to 1 per netdev, by reverting to the previous static keys,
except for addr_list_lock which still has to be dynamic.
The second patch removes a bonding-specific key by the way.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobonding: remove useless stats_lock_key
Cong Wang [Sun, 3 May 2020 05:22:20 +0000 (22:22 -0700)]
bonding: remove useless stats_lock_key

After commit b3e80d44f5b1
("bonding: fix lockdep warning in bond_get_stats()") the dynamic
key is no longer necessary, as we compute nest level at run-time.
So, we can just remove it to save some lockdep key entries.

Test commands:
 ip link add bond0 type bond
 ip link add bond1 type bond
 ip link set bond0 master bond1
 ip link set bond0 nomaster
 ip link set bond1 master bond0

Reported-and-tested-by: syzbot+aaa6fa4949cc5d9b7b25@syzkaller.appspotmail.com
Cc: Dmitry Vyukov <dvyukov@google.com>
Acked-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: partially revert dynamic lockdep key changes
Cong Wang [Sun, 3 May 2020 05:22:19 +0000 (22:22 -0700)]
net: partially revert dynamic lockdep key changes

This patch reverts the folowing commits:

commit 064ff66e2bef84f1153087612032b5b9eab005bd
"bonding: add missing netdev_update_lockdep_key()"

commit 53d374979ef147ab51f5d632dfe20b14aebeccd0
"net: avoid updating qdisc_xmit_lock_key in netdev_update_lockdep_key()"

commit 1f26c0d3d24125992ab0026b0dab16c08df947c7
"net: fix kernel-doc warning in <linux/netdevice.h>"

commit ab92d68fc22f9afab480153bd82a20f6e2533769
"net: core: add generic lockdep keys"

but keeps the addr_list_lock_key because we still lock
addr_list_lock nestedly on stack devices, unlikely xmit_lock
this is safe because we don't take addr_list_lock on any fast
path.

Reported-and-tested-by: syzbot+aaa6fa4949cc5d9b7b25@syzkaller.appspotmail.com
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-ethernet-ti-k3-introduce-common-platform-time-sync-driver-cpts'
David S. Miller [Mon, 4 May 2020 19:02:03 +0000 (12:02 -0700)]
Merge branch 'net-ethernet-ti-k3-introduce-common-platform-time-sync-driver-cpts'

Grygorii Strashko says:

====================
net: ethernet: ti: k3: introduce common platform time sync driver - cpts

This series introduced support for significantly upgraded TI A65x/J721E Common
platform time sync (CPTS) modules which are part of AM65xx Time Synchronization
Architecture [1].
The TI A65x/J721E now contain more than one CPTS instance:
- MCU CPSW CPTS (IEEE 1588 compliant)
- Main NAVSS CPTS (central)
- PCIe CPTS(s) (PTM  compliant)
- J721E: Main CPSW9g CPTS (IEEE 1588 compliant)
which can work as separately as interact to each other through Time Sync Router
(TSR) and Compare Event Router (CER). In addition there are also ICSS-G IEP
blocks which can perform similar timsync functions, but require FW support.
More info also available in TRM [2][3]. Not all above modules are available
to the Linux by as of now as some of them are reserved for RTOS/FW purposes.

The scope of this submission is TI A65x/J721E CPSW CPTS and Main NAVSS CPTS,
and TSR was used for testing purposes.
                                                                       +---------------------------+
                                                                       | MCU CPSW                  |
+-------------------+           +------------------------+             |                TS         |
| Main Navss CPTS   |           | Time Sync Router (TSR) |             |          +-------------+  |
|                   |           |                        |             |          |             |  |
|            HW1_TS +<----------+                        |             | +--------v-----+    +--+--+
|                   |           |                        |             | |        CPTS  |    |Port |
|              ...  |           |                        |           X+-->HW1_TS        |    |     |
|            HW8_TS <------------<---------+             |           X|-->HW2_TS        |    +--^--+
|                   |           |          |             +--------------->HW3_TS        |       |  |
|                   |           |          |             +--------------->HW4_TS        |       |  |
|                   |           |          |             |             | |              |       |  |
|                   |           |          |             |             | |              |       |  |
|            Genf0  +----------->          (A)---------+ +<--------------+Genf0         |       |  |
|                   |           |          |             |             | |              |       |  |
|              ...  |           |          +-----------> <---------------+Genf1     ESTf+-------+  |
|                   |           |                        |             | |              |          |
|                   |           |                        |             | +--------------+          |
|            Genf8  +---------->+                        |             |                           |
|                   |           |    SYNC0 ...    SYNC3  |             |                           |
+-------------------+           +------+------------+----+             +---------------------------+
                                       +            +
                                       X            X
(A) shows possible routing path for MCU CPSW CPTS Genf0 signal as an example.

Main features of the new TI A65x/J721E CPTS modules are:
- 64-bit timestamp/counter mode support in ns by using add_val
- implemented in HW PPM and nudge adjustment.
- control of time sync events via interrupt or polling
- selection of multiple external reference clock sources
- hardware timestamp of ext. inputs events (HWx_TS_PUSH)
- periodic generator function outputs (TS_GENFx)
- (CPSW only) Ethernet Enhanced Scheduled Traffic Operations (CPTS_ESTFn),
  which drives TSN schedule
- timestamping of all RX packets bypassing CPTS FIFO

Patch 1 - DT bindings
Patch 2 - the AM65x/J721E driver
Patch 3 - enables packet timestamping support in TI AM65x/J721E MCU CPSW driver.
Patches 4-7 - DT updates.

=== PTP Testing:

phc2sys -s CLOCK_REALTIME -c eth0 -m -O 0 -u30
phc2sys[627.331]: eth0 rms 409912446712787392 max 1587584079521858304 freq  -6665 +/- 35040 delay   832 +/-  27
phc2sys[657.335]: eth0 rms   33 max   66 freq     -0 +/-  28 delay   820 +/-  30
phc2sys[687.339]: eth0 rms   37 max   70 freq     -1 +/-  32 delay   830 +/-  29
phc2sys[717.343]: eth0 rms   33 max   71 freq     -0 +/-  29 delay   828 +/-  23
phc2sys[747.346]: eth0 rms   35 max   75 freq     -0 +/-  31 delay   829 +/-  26
phc2sys[777.350]: eth0 rms   37 max   68 freq     -1 +/-  32 delay   825 +/-  25
phc2sys[807.354]: eth0 rms   28 max   57 freq     -1 +/-  25 delay   824 +/-  21
phc2sys[837.358]: eth0 rms   43 max   81 freq     -1 +/-  37 delay   836 +/-  23
phc2sys[867.361]: eth0 rms   33 max   74 freq     +0 +/-  29 delay   828 +/-  24
phc2sys[897.365]: eth0 rms   35 max   77 freq     -2 +/-  30 delay   824 +/-  25
phc2sys[927.369]: eth0 rms   28 max   50 freq     +0 +/-  25 delay   825 +/-  25

ptp4l -P -2 -H -i eth0 -l 6 -m -q -p /dev/ptp1 -f ptp.cfg -s
ptp4l[22095.754]: port 1: MASTER to UNCALIBRATED on RS_SLAVE
ptp4l[22097.754]: port 1: UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
ptp4l[22159.757]: rms  317 max 1418 freq    +79 +/- 186 delay   410 +/-   1
ptp4l[22223.760]: rms    9 max   24 freq    +42 +/-  12 delay   409 +/-   1
ptp4l[22287.763]: rms   10 max   28 freq    +41 +/-  11 delay   410 +/-   1
ptp4l[22351.767]: rms   10 max   26 freq    +34 +/-  12 delay   410 +/-   1
ptp4l[22415.770]: rms   10 max   26 freq    +49 +/-  14 delay   410 +/-   1

=== Ext. HW_TS and Genf testing:

For testing purposes Time Sync Router (TSR) can be modeled in DT as pin controller
+       timesync_router: timesync_router@A40000 {
+               compatible = "pinctrl-single";
+               reg = <0x0 0xA40000 0x0 0x800>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               #pinctrl-cells = <1>;
+               pinctrl-single,register-width = <32>;
+               pinctrl-single,function-mask = <0x800007ff>;
+       };

then signals routing can be done in board file, for example:
+#define TS_OFFSET(pa, val)     (0x4+(pa)*4) (0x80000000 | val)
+
+&timesync_router {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mcu_cpts>;
+
+       /* Example of the timesync routing */
+       mcu_cpts: mcu_cpts {
+               pinctrl-single,pins = <
+                       /* [cpts genf1] in13 -> out25 [cpts hw4_push] */
+                       TS_OFFSET(25, 13)
+                       /* [cpts genf1] in13 -> out0 [main cpts hw1_push] */
+                       TS_OFFSET(0, 13)
+                       /* [main cpts genf0] in4 -> out1 [main cpts hw2_push] */
+                       TS_OFFSET(1, 4)
+                       /* [main cpts genf0] in4 -> out24 [cpts hw3_push] */
+                       TS_OFFSET(24, 4)
+               >;
+       };
+};

will create link:
    cpsw cpts Genf1 -> main cpts hw1_push
                    -> cpsw cpts hw4_push

    main cpts Genf0 -> main cpts hw2_push
                    -> cpsw cpts hw3_push

 testptp -d /dev/ptp0 -i 0 -p 1000000000
 periodic output request okay
 testptp -d /dev/ptp0 -i 1 -e 5
 external time stamp request okay
 event index 1 at 22583.000000025
 event index 1 at 22584.000000025
 event index 1 at 22585.000000025
 event index 1 at 22586.000000025
 event index 1 at 22587.000000025
 testptp -d /dev/ptp1 -i 2 -e 5
 external time stamp request okay
 event index 2 at 1587606764.249304554
 event index 2 at 1587606765.249304467
 event index 2 at 1587606766.249304380
 event index 2 at 1587606767.249304293
 event index 2 at 1587606768.249304206

[1] https://www.ti.com/lit/pdf/spracp7
[2] https://www.ti.com/lit/pdf/sprz452
[3] https://www.ti.com/lit/pdf/spruil1
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoarm64: dts: ti: j721e-main: add main navss cpts node
Grygorii Strashko [Fri, 1 May 2020 20:50:11 +0000 (23:50 +0300)]
arm64: dts: ti: j721e-main: add main navss cpts node

Add DT node for Main NAVSS CPTS module.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoarm64: dts: ti: k3-j721e-mcu: add mcu cpsw cpts node
Grygorii Strashko [Fri, 1 May 2020 20:50:10 +0000 (23:50 +0300)]
arm64: dts: ti: k3-j721e-mcu: add mcu cpsw cpts node

Add DT node for The TI J721E MCU CPSW CPTS which is part of MCU CPSW NUSS.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoarm64: dts: ti: k3-am65-main: add main navss cpts node
Grygorii Strashko [Fri, 1 May 2020 20:50:09 +0000 (23:50 +0300)]
arm64: dts: ti: k3-am65-main: add main navss cpts node

Add DT node for Main NAVSS CPTS module.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoarm64: dts: ti: k3-am65-mcu: add cpsw cpts node
Grygorii Strashko [Fri, 1 May 2020 20:50:08 +0000 (23:50 +0300)]
arm64: dts: ti: k3-am65-mcu: add cpsw cpts node

Add DT node for the TI AM65x SoC Common Platform Time Sync (CPTS).

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: ti: am65-cpsw-nuss: enable packet timestamping support
Grygorii Strashko [Fri, 1 May 2020 20:50:07 +0000 (23:50 +0300)]
net: ethernet: ti: am65-cpsw-nuss: enable packet timestamping support

The MCU CPSW Common Platform Time Sync (CPTS) provides possibility to
timestamp TX PTP packets and all RX packets.

This enables corresponding support in TI AM65x/J721E MCU CPSW driver.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: ti: introduce am654 common platform time sync driver
Grygorii Strashko [Fri, 1 May 2020 20:50:06 +0000 (23:50 +0300)]
net: ethernet: ti: introduce am654 common platform time sync driver

The CPTS module is used to facilitate host control of time sync operations.
Main features of CPTS module are:
- selection of multiple external clock sources
- control of time sync events via interrupt or polling
- 64-bit timestamp mode in ns with HW PPM and nudge adjustment.
- hardware timestamp ext. inputs (HWx_TS_PUSH)
- timestamp Generator function outputs (TS_GENFx)
Depending on integration it enables compliance with the IEEE 1588-2008
standard for a precision clock synchronization protocol, Ethernet Enhanced
Scheduled Traffic Operations (CPTS_ESTFn) and PCIe Subsystem Precision Time
Measurement (PTM).

Introduced driver provides Linux PTP hardware clock for each CPTS device
and network packets timestamping where applicable. CPTS PTP hardware clock
supports following operations:
    - Set time
    - Get time
    - Shift the clock by a given offset atomically
    - Adjust clock frequency
    - Time stamp external events
    - Periodic output signals

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodt-binding: ti: am65x: document common platform time sync cpts module
Grygorii Strashko [Fri, 1 May 2020 20:50:05 +0000 (23:50 +0300)]
dt-binding: ti: am65x: document common platform time sync cpts module

Document device tree bindings for TI AM654/J721E SoC The Common Platform
Time Sync (CPTS) module. The CPTS module is used to facilitate host control
of time sync operations. Main features of CPTS module are:
  - selection of multiple external clock sources
  - 64-bit timestamp mode in ns with ppm and nudge adjustment.
  - control of time sync events via interrupt or polling
  - hardware timestamp of ext. events (HWx_TS_PUSH)
  - periodic generator function outputs (TS_GENFx)
  - PPS in combination with timesync router
  - Depending on integration it enables compliance with the IEEE 1588-2008
standard for a precision clock synchronization protocol, Ethernet Enhanced
Scheduled Traffic Operations (CPTS_ESTFn) and PCIe Subsystem Precision Time
Measurement (PTM).

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'devlink-kernel-region-snapshot-id-allocation'
David S. Miller [Mon, 4 May 2020 18:58:31 +0000 (11:58 -0700)]
Merge branch 'devlink-kernel-region-snapshot-id-allocation'

Jakub Kicinski says:

====================
devlink: kernel region snapshot id allocation

currently users have to find a free snapshot id to pass
to the kernel when they are requesting a snapshot to be
taken.

This set extends the kernel so it can allocate the id
on its own and send it back to user space in a response.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: devlink: clarify the scope of snapshot id
Jakub Kicinski [Fri, 1 May 2020 16:40:42 +0000 (09:40 -0700)]
docs: devlink: clarify the scope of snapshot id

In past discussions Jiri explained snapshot ids are cross-region.
Explain this in the docs.

v3: new patch

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: let kernel allocate region snapshot id
Jakub Kicinski [Fri, 1 May 2020 16:40:41 +0000 (09:40 -0700)]
devlink: let kernel allocate region snapshot id

Currently users have to choose a free snapshot id before
calling DEVLINK_CMD_REGION_NEW. This is potentially racy
and inconvenient.

Make the DEVLINK_ATTR_REGION_SNAPSHOT_ID optional and try
to allocate id automatically. Send a message back to the
caller with the snapshot info.

Example use:
$ devlink region new netdevsim/netdevsim1/dummy
netdevsim/netdevsim1/dummy: snapshot 1

$ id=$(devlink -j region new netdevsim/netdevsim1/dummy | \
       jq '.[][][][]')
$ devlink region dump netdevsim/netdevsim1/dummy snapshot $id
[...]
$ devlink region del netdevsim/netdevsim1/dummy snapshot $id

v4:
 - inline the notification code
v3:
 - send the notification only once snapshot creation completed.
v2:
 - don't wrap the line containing extack;
 - add a few sentences to the docs.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: factor out building a snapshot notification
Jakub Kicinski [Fri, 1 May 2020 16:40:40 +0000 (09:40 -0700)]
devlink: factor out building a snapshot notification

We'll need to send snapshot info back on the socket
which requested a snapshot to be created. Factor out
constructing a snapshot description from the broadcast
notification code.

v3: new patch

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet_sched: sch_fq: add horizon attribute
Eric Dumazet [Fri, 1 May 2020 14:07:41 +0000 (07:07 -0700)]
net_sched: sch_fq: add horizon attribute

QUIC servers would like to use SO_TXTIME, without having CAP_NET_ADMIN,
to efficiently pace UDP packets.

As far as sch_fq is concerned, we need to add safety checks, so
that a buggy application does not fill the qdisc with packets
having delivery time far in the future.

This patch adds a configurable horizon (default: 10 seconds),
and a configurable policy when a packet is beyond the horizon
at enqueue() time:
- either drop the packet (default policy)
- or cap its delivery time to the horizon.

$ tc -s -d qd sh dev eth0
qdisc fq 8022: root refcnt 257 limit 10000p flow_limit 100p buckets 1024
 orphan_mask 1023 quantum 10Kb initial_quantum 51160b low_rate_threshold 550Kbit
 refill_delay 40.0ms timer_slack 10.000us horizon 10.000s
 Sent 1234215879 bytes 837099 pkt (dropped 21, overlimits 0 requeues 6)
 backlog 0b 0p requeues 6
  flows 1191 (inactive 1177 throttled 0)
  gc 0 highprio 0 throttled 692 latency 11.480us
  pkts_too_long 0 alloc_errors 0 horizon_drops 21 horizon_caps 0

v2: fixed an overflow on 32bit kernels in fq_init(), reported
    by kbuild test robot <lkp@intel.com>

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: sched: fallback to qdisc noqueue if default qdisc setup fail
Jesper Dangaard Brouer [Thu, 30 Apr 2020 11:42:22 +0000 (13:42 +0200)]
net: sched: fallback to qdisc noqueue if default qdisc setup fail

Currently if the default qdisc setup/init fails, the device ends up with
qdisc "noop", which causes all TX packets to get dropped.

With the introduction of sysctl net/core/default_qdisc it is possible
to change the default qdisc to be more advanced, which opens for the
possibility that Qdisc_ops->init() can fail.

This patch detect these kind of failures, and choose to fallback to
qdisc "noqueue", which is so simple that its init call will not fail.
This allows the interface to continue functioning.

V2:
As this also captures memory failures, which are transient, the
device is not kept in IFF_NO_QUEUE state.  This allows the net_device
to retry to default qdisc assignment.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-ipa-I-O-map-SMEM-and-IMEM'
David S. Miller [Mon, 4 May 2020 18:26:55 +0000 (11:26 -0700)]
Merge branch 'net-ipa-I-O-map-SMEM-and-IMEM'

Alex Elder says:

====================
net: ipa: I/O map SMEM and IMEM

This series adds the definition of two memory regions that must be
mapped for IPA to access through an SMMU.  It requires the SMMU to
be defined in the IPA node in the SoC's Device Tree file.

There is no change since version 1 to the content of the code in
these patches, *however* this time the first patch is an update to
the binding definition rather than an update to a DTS file.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: define SMEM memory region for IPA
Alex Elder [Mon, 4 May 2020 17:58:59 +0000 (12:58 -0500)]
net: ipa: define SMEM memory region for IPA

Arrange to use an item from SMEM memory for IPA.  SMEM item number
497 is designated to be used by the IPA.  Specify the item ID and
size of the region in platform configuration data.  Allocate and get
a pointer to this region from ipa_mem_init().  The memory must be
mapped for access through an SMMU.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: define IMEM memory region for IPA
Alex Elder [Mon, 4 May 2020 17:58:58 +0000 (12:58 -0500)]
net: ipa: define IMEM memory region for IPA

Define a region of IMEM memory available for use by IPA in the
platform configuration data.  Initialize it from ipa_mem_init().
The memory must be mapped for access through an SMMU.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: redefine struct ipa_mem_data
Alex Elder [Mon, 4 May 2020 17:58:57 +0000 (12:58 -0500)]
net: ipa: redefine struct ipa_mem_data

The ipa_mem_data structure type was never actually used.  Instead,
the IPA memory regions were defined using the ipa_mem structure.

Redefine struct ipa_mem_data so it encapsulates the array of IPA-local
memory region descriptors along with the count of entries in that
array.  Pass just an ipa_mem structure pointer to ipa_mem_init().

Rename the ipa_mem_data[] array ipa_mem_local_data[] to emphasize
that the memory regions it defines are IPA-local memory.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodt-bindings: net: add IPA iommus property
Alex Elder [Mon, 4 May 2020 17:58:56 +0000 (12:58 -0500)]
dt-bindings: net: add IPA iommus property

The IPA accesses "IMEM" and main system memory through an SMMU, so
its DT node requires an iommus property to define range of stream IDs
it uses.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-add-helper-eth_hw_addr_crc'
David S. Miller [Mon, 4 May 2020 18:19:58 +0000 (11:19 -0700)]
Merge branch 'net-add-helper-eth_hw_addr_crc'

Heiner Kallweit says:

====================
net: add helper eth_hw_addr_crc

Several drivers use the same code as basis for filter hashes. Therefore
let's factor it out to a helper. This way drivers don't have to access
struct netdev_hw_addr internals.

First user is r8169.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: use new helper eth_hw_addr_crc
Heiner Kallweit [Mon, 4 May 2020 17:28:21 +0000 (19:28 +0200)]
r8169: use new helper eth_hw_addr_crc

Use new helper eth_hw_addr_crc to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: add helper eth_hw_addr_crc
Heiner Kallweit [Mon, 4 May 2020 17:27:00 +0000 (19:27 +0200)]
net: add helper eth_hw_addr_crc

Several drivers use the same code as basis for filter hashes. Therefore
let's factor it out to a helper. This way drivers don't have to access
struct netdev_hw_addr internals.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: felix: allow the device to be disabled
Michael Walle [Mon, 4 May 2020 16:52:28 +0000 (18:52 +0200)]
net: dsa: felix: allow the device to be disabled

If there is no specific configuration of the felix switch in the device
tree, but only the default configuration (ie. given by the SoCs dtsi
file), the probe fails because no CPU port has been set. On the other
hand you cannot set a default CPU port because that depends on the
actual board using the switch.

[    2.701300] DSA: tree 0 has no CPU port
[    2.705167] mscc_felix 0000:00:00.5: Failed to register DSA switch: -22
[    2.711844] mscc_felix: probe of 0000:00:00.5 failed with error -22

Thus let the device tree disable this device entirely, like it is also
done with the enetc driver of the same SoC.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-smc-add-failover-processing'
David S. Miller [Mon, 4 May 2020 17:54:40 +0000 (10:54 -0700)]
Merge branch 'net-smc-add-failover-processing'

Karsten Graul says:

====================
net/smc: add failover processing

This patch series adds the actual SMC-R link failover processing and
improved link group termination. There will be one more (very small)
series after this which will complete the SMC-R link failover support.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>