platform/kernel/linux-starfive.git
4 years agonet: phy: mscc: remove useless page configuration in the config init
Antoine Tenart [Thu, 25 Jun 2020 15:42:10 +0000 (17:42 +0200)]
net: phy: mscc: remove useless page configuration in the config init

In the middle of vsc8584_config_init and vsc8514_config_init, the page
is set to 'standard'. This is the default value, and the page isn't set
to another value before. Those pages configuration can be safely
removed.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: mscc: restore the base page in vsc8514/8584_config_init
Antoine Tenart [Thu, 25 Jun 2020 15:42:09 +0000 (17:42 +0200)]
net: phy: mscc: restore the base page in vsc8514/8584_config_init

In the vsc8584_config_init and vsc8514_config_init, the base page is set
to 'GPIO', configuration is done, and the page is never explicitly
restored to the standard page. No bug was triggered as it turns out
helpers called in those config_init functions do modify the base page,
and set it back to standard. But that is dangerous and any modification
to those functions would introduce bugs. This patch fixes this, to
improve maintenance, by restoring the base page to 'standard' once
'GPIO' accesses are completed.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: mscc: do not access the MDIO bus lock directly
Antoine Tenart [Thu, 25 Jun 2020 15:42:08 +0000 (17:42 +0200)]
net: phy: mscc: do not access the MDIO bus lock directly

This patch improves the MSCC driver by using the provided
phy_lock_mdio_bus and phy_unlock_mdio_bus helpers instead of locking and
unlocking the MDIO bus lock directly. The patch is only cosmetic but
should improve maintenance and consistency.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: mscc: ptp: fix a typo in a comment
Antoine Tenart [Thu, 25 Jun 2020 15:42:07 +0000 (17:42 +0200)]
net: phy: mscc: ptp: fix a typo in a comment

This patch fixes a typo in a comment, s/Ths/This/. The patch is cosmetic
only.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: mscc: ptp: fix a smatch error
Antoine Tenart [Thu, 25 Jun 2020 15:42:06 +0000 (17:42 +0200)]
net: phy: mscc: ptp: fix a smatch error

The following error was reported by smatch:
vsc85xx_ts_read_csr() error: uninitialized symbol 'blk_hw'.

In practice this is very unlikely, as all the block identifiers given to
this functions are handled and described in an enum. The smatch error is
fixed by doing what is already done in vsc85xx_ts_write_csr: using the
"PROCESSOR" block by default.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: mscc: fix a possible double unlock
Antoine Tenart [Thu, 25 Jun 2020 15:42:05 +0000 (17:42 +0200)]
net: phy: mscc: fix a possible double unlock

On vsc8584_ptp_init failure we jump to the 'err' label, which unlocks
the MDIO bus lock. But vsc8584_ptp_init isn't called with the MDIO bus
lock taken, which could result in a double unlock. Fix this.

Fixes: ab2bf9339357 ("net: phy: mscc: 1588 block initialization")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: mscc: macsec: fix sparse warnings
Antoine Tenart [Thu, 25 Jun 2020 15:42:04 +0000 (17:42 +0200)]
net: phy: mscc: macsec: fix sparse warnings

This patch fixes the following sparse warnings when building MACsec
support in the MSCC PHY driver.

  mscc_macsec.c:393:42: warning: cast from restricted sci_t
  mscc_macsec.c:395:42: warning: restricted sci_t degrades to integer
  mscc_macsec.c:402:42: warning: restricted __be16 degrades to integer
  mscc_macsec.c:608:34: warning: cast from restricted sci_t
  mscc_macsec.c:610:34: warning: restricted sci_t degrades to integer

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'RGMII-Internal-delay-common-property'
David S. Miller [Thu, 25 Jun 2020 23:05:21 +0000 (16:05 -0700)]
Merge branch 'RGMII-Internal-delay-common-property'

Dan Murphy says:

====================
RGMII Internal delay common property

The RGMII internal delay is a common setting found in most RGMII capable PHY
devices.  It was found that many vendor specific device tree properties exist
to do the same function. This creates a common property to be used for PHY's
that have internal delays for the Rx and Tx paths.

If the internal delay is tunable then the caller needs to pass the internal
delay array and the return will be the index in the array that was found in
the firmware node.

If the internal delay is fixed then the caller only needs to indicate which
delay to return.  There is no need for a fixed delay to add device properties
since the value is not configurable. Per the ethernet-controller.yaml the
interface type indicates that the PHY should provide the delay.

This series contains examples of both a configurable delay and a fixed delay.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: DP83822: Add setting the fixed internal delay
Dan Murphy [Wed, 24 Jun 2020 12:16:05 +0000 (07:16 -0500)]
net: phy: DP83822: Add setting the fixed internal delay

The DP83822 can be configured to use the RGMII interface. There are
independent fixed 3.5ns clock shift (aka internal delay) for the TX and RX
paths. This allow either one to be set if the MII interface is RGMII and
the value is set in the firmware node.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dp83869: Add RGMII internal delay configuration
Dan Murphy [Wed, 24 Jun 2020 12:16:04 +0000 (07:16 -0500)]
net: dp83869: Add RGMII internal delay configuration

Add RGMII internal delay configuration for Rx and Tx.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodt-bindings: net: Add RGMII internal delay for DP83869
Dan Murphy [Wed, 24 Jun 2020 12:16:03 +0000 (07:16 -0500)]
dt-bindings: net: Add RGMII internal delay for DP83869

Add the internal delay values into the header and update the binding
with the internal delay properties.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: Add a helper to return the index for of the internal delay
Dan Murphy [Wed, 24 Jun 2020 12:16:02 +0000 (07:16 -0500)]
net: phy: Add a helper to return the index for of the internal delay

Add a helper function that will return the index in the array for the
passed in internal delay value.  The helper requires the array, size and
delay value.

The helper will then return the index for the exact match or return the
index for the index to the closest smaller value.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodt-bindings: net: Add tx and rx internal delays
Dan Murphy [Wed, 24 Jun 2020 12:16:01 +0000 (07:16 -0500)]
dt-bindings: net: Add tx and rx internal delays

tx-internal-delays and rx-internal-delays are a common setting for RGMII
capable devices.

These properties are used when the phy-mode or phy-controller is set to
rgmii-id, rgmii-rxid or rgmii-txid.  These modes indicate to the
controller that the PHY will add the internal delay for the connection.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'dpaa2-eth-small-updates'
David S. Miller [Thu, 25 Jun 2020 23:03:39 +0000 (16:03 -0700)]
Merge branch 'dpaa2-eth-small-updates'

Ioana Ciornei says:

====================
dpaa2-eth: small updates

This patch set adds some updates to the dpaa2-eth driver: trimming of
the frame queue debugfs counters, cleanup of the remaining sparse
warnings and some other small fixes such as a recursive header include.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa2-eth: fix misspelled function parameters in dpni_[set/get]_taildrop
Ioana Ciornei [Wed, 24 Jun 2020 11:34:21 +0000 (14:34 +0300)]
dpaa2-eth: fix misspelled function parameters in dpni_[set/get]_taildrop

Two of the function parameters (qtype and index) were misspelled in the
associated descriptions of dpni_[set/get]_taildrop which led to sparse
warnings. Fix this by using the exact same names as present in the
function definition.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa2-eth: fix recursive header include
Ioana Ciornei [Wed, 24 Jun 2020 11:34:20 +0000 (14:34 +0300)]
dpaa2-eth: fix recursive header include

The dpaa2-eth.h header file includes dpaa2-eth-trace.h which includes
back dpaa2-eth leading to a recursion in the include path. Fix this by
removing the include of dpaa2-eth.h in the trace header.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa2-eth: fix condition for number of buffer acquire retries
Ioana Ciornei [Wed, 24 Jun 2020 11:34:19 +0000 (14:34 +0300)]
dpaa2-eth: fix condition for number of buffer acquire retries

We should keep retrying to acquire buffers through the software portals
as long as the function returns -EBUSY and the number of retries is
__below__ DPAA2_ETH_SWP_BUSY_RETRIES.

Fixes: ef17bd7cc0c8 ("dpaa2-eth: Avoid unbounded while loops")
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa2-eth: check the result of skb_to_sgvec()
Ioana Ciornei [Wed, 24 Jun 2020 11:34:18 +0000 (14:34 +0300)]
dpaa2-eth: check the result of skb_to_sgvec()

Before passing the result of skb_to_sgvec() to dma_map_sg() check if any
error was returned.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodpaa2-eth: trim debugfs FQ stats
Ioana Radulescu [Wed, 24 Jun 2020 11:34:17 +0000 (14:34 +0300)]
dpaa2-eth: trim debugfs FQ stats

With the addition of multiple traffic classes support, the number
of available frame queues grew significantly, overly inflating the
debugfs FQ statistics entry. Update it to only show the queues
which are actually in use (i.e. have a non-zero frame counter).

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phylink: only restart AN if the link mode is using in-band AN
Russell King [Wed, 24 Jun 2020 11:30:04 +0000 (12:30 +0100)]
net: phylink: only restart AN if the link mode is using in-band AN

If we are not using in-band autonegotiation, there is no point passing
the request to restart autonegotiation on to the driver.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa/ar9331: convert to mac_link_up()
Russell King [Wed, 24 Jun 2020 10:21:32 +0000 (11:21 +0100)]
net: dsa/ar9331: convert to mac_link_up()

Convert the ar9331 DSA driver to use the finalised link parameters in
mac_link_up() rather than the parameters in mac_config().

Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge tag 'mlx5-updates-2020-06-23' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Thu, 25 Jun 2020 21:04:51 +0000 (14:04 -0700)]
Merge tag 'mlx5-updates-2020-06-23' of git://git./linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5 updates 2020-06-23

This series adds misc cleanup and updates to mlx5 driver.

1) Misc updates and cleanup
2) Use RCU instead of spinlock for vxlan table

v1->v2:
 - Removed unnecessary Fixes Tags

v2->v3:
 - Drop "macro undefine" patch, it has no value

v3->v4:
 - Drop the Relaxed ordering patch.
====================

Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phylink: add phylink_speed_(up|down) interface
Russell King [Wed, 24 Jun 2020 10:06:54 +0000 (11:06 +0100)]
net: phylink: add phylink_speed_(up|down) interface

Add an interface for the phy_speed_(up|down) functions when a driver
makes use of phylink. These pass the call through to phylib when we
have a normal PHY attached (i.o.w., not a PHY on a SFP module.)

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/mlx5e: vxlan: Return bool instead of opaque ptr in port_lookup()
Saeed Mahameed [Sat, 16 May 2020 00:11:29 +0000 (17:11 -0700)]
net/mlx5e: vxlan: Return bool instead of opaque ptr in port_lookup()

struct mlx5_vxlan_port is not exposed to the outside callers, it is
redundant to return a pointer to it from mlx5_vxlan_port_lookup(), to be
only used as a boolean, so just return a boolean.

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5e: vxlan: Use RCU for vxlan table lookup
Saeed Mahameed [Sat, 16 May 2020 00:09:05 +0000 (17:09 -0700)]
net/mlx5e: vxlan: Use RCU for vxlan table lookup

Remove the spinlock protecting the vxlan table and use RCU instead.
This will improve performance as it will eliminate contention on data
path cores.

Fixes: b3f63c3d5e2c ("net/mlx5e: Add netdev support for VXLAN tunneling")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@mellanox.com>
4 years agonet/mlx5e: Move TC-specific function definitions into MLX5_CLS_ACT
Vlad Buslov [Wed, 10 Jun 2020 15:09:13 +0000 (18:09 +0300)]
net/mlx5e: Move TC-specific function definitions into MLX5_CLS_ACT

en_tc.h header file declares several TC-specific functions in
CONFIG_MLX5_ESWITCH block even though those functions are only compiled
when CONFIG_MLX5_CLS_ACT is set, which is a recent change. Move them to
proper block.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Maor Dickman <maord@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5e: Move including net/arp.h from en_rep.c to rep/neigh.c
Alaa Hleihel [Tue, 2 Jun 2020 09:09:21 +0000 (12:09 +0300)]
net/mlx5e: Move including net/arp.h from en_rep.c to rep/neigh.c

After the cited commit, the header net/arp.h is no longer used in en_rep.c.
So, move it to the new file rep/neigh.c that uses it now.

Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
Reviewed-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5e: Remove unused mlx5e_xsk_first_unused_channel
Maxim Mikityanskiy [Thu, 11 Jun 2020 12:48:45 +0000 (15:48 +0300)]
net/mlx5e: Remove unused mlx5e_xsk_first_unused_channel

mlx5e_xsk_first_unused_channel is a leftover from old versions of the
first XSK commit, and it was never used. Remove it.

Fixes: db05815b36cb ("net/mlx5e: Add XSK zero-copy support")
Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Use kfree(ft->g) in arfs_create_groups()
Denis Efremov [Fri, 5 Jun 2020 19:22:35 +0000 (22:22 +0300)]
net/mlx5: Use kfree(ft->g) in arfs_create_groups()

Use kfree() instead of kvfree() on ft->g in arfs_create_groups() because
the memory is allocated with kcalloc().

Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: FWTrace: Add missing space
Hu Haowen [Fri, 3 Apr 2020 04:26:59 +0000 (12:26 +0800)]
net/mlx5: FWTrace: Add missing space

Missing space at the end of a comment line, add it.

Signed-off-by: Hu Haowen <xianfengting221@163.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Avoid eswitch header inclusion in fs core layer
Parav Pandit [Thu, 28 May 2020 09:48:27 +0000 (04:48 -0500)]
net/mlx5: Avoid eswitch header inclusion in fs core layer

Flow steering core layer is independent of the eswitch layer.
Hence avoid fs_core dependency on eswitch.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agoptp_pch: use generic power management
Vaibhav Gupta [Thu, 25 Jun 2020 12:10:43 +0000 (17:40 +0530)]
ptp_pch: use generic power management

With legacy PM, drivers themselves were responsible for managing the
device's power states and takes care of register states.

After upgrading to the generic structure, PCI core will take care of
required tasks and drivers should do only device-specific operations.

In the case of ptp_pch, after removing PCI helper functions, .suspend()
and .resume() became empty-body functions. Hence, define them NULL and
use dev_pm_ops.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: enetc add tc flower offload flow metering policing action
Po Liu [Wed, 24 Jun 2020 09:36:31 +0000 (17:36 +0800)]
net: enetc add tc flower offload flow metering policing action

Flow metering entries in IEEE 802.1Qci is an optional function for a
flow filtering module. Flow metering is two rates two buckets and three
color marker to policing the frames. This patch only enable one rate one
bucket and in color blind mode. Flow metering instance are as
specified in the algorithm in MEF 10.3 and in Bandwidth Profile
Parameters. They are:

a) Flow meter instance identifier. An integer value identifying the flow
meter instance. The patch use the police 'index' as thin value.
b) Committed Information Rate (CIR), in bits per second. This patch use
the 'rate_bytes_ps' represent this value.
c) Committed Burst Size (CBS), in octets. This patch use the 'burst'
represent this value.
d) Excess Information Rate (EIR), in bits per second.
e) Excess Burst Size per Bandwidth Profile Flow (EBS), in octets.
And plus some other parameters. This patch set EIR/EBS default disable
and color blind mode.

v1->v2 changes:
- Use div_u64() as division replace the '/' report:

All errors (new ones prefixed by >>):

   ld: drivers/net/ethernet/freescale/enetc/enetc_qos.o: in function `enetc_flowmeter_hw_set':
>> enetc_qos.c:(.text+0x66): undefined reference to `__udivdi3'

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Po Liu <Po.Liu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: qos: police action add index for tc flower offloading
Po Liu [Wed, 24 Jun 2020 09:36:30 +0000 (17:36 +0800)]
net: qos: police action add index for tc flower offloading

Hardware device may include more than one police entry. Specifying the
action's index make it possible for several tc filters to share the same
police action when installing the filters.

Propagate this index to device drivers through the flow offload
intermediate representation, so that drivers could share a single
hardware policer between multiple filters.

v1->v2 changes:
- Update the commit message suggest by Ido Schimmel <idosch@idosch.org>

Signed-off-by: Po Liu <Po.Liu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: enetc: add support max frame size for tc flower offload
Po Liu [Wed, 24 Jun 2020 09:36:29 +0000 (17:36 +0800)]
net: enetc: add support max frame size for tc flower offload

Base on the tc flower offload police action add max frame size by the
parameter 'mtu'. Tc flower device driver working by the IEEE 802.1Qci
stream filter can implement the max frame size filtering. Add it to the
current hardware tc flower stearm filter driver.

Signed-off-by: Po Liu <Po.Liu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: qos: add tc police offloading action with max frame size limit
Po Liu [Wed, 24 Jun 2020 09:36:28 +0000 (17:36 +0800)]
net: qos: add tc police offloading action with max frame size limit

Current police offloading support the 'burst'' and 'rate_bytes_ps'. Some
hardware own the capability to limit the frame size. If the frame size
larger than the setting, the frame would be dropped. For the police
action itself already accept the 'mtu' parameter in tc command. But not
extend to tc flower offloading. So extend 'mtu' to tc flower offloading.

Signed-off-by: Po Liu <Po.Liu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agolan743x: Remove duplicated include from lan743x_main.c
YueHaibing [Wed, 24 Jun 2020 07:18:21 +0000 (07:18 +0000)]
lan743x: Remove duplicated include from lan743x_main.c

Remove duplicated include.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-bridge-fdb-activity-tracking'
David S. Miller [Wed, 24 Jun 2020 21:36:33 +0000 (14:36 -0700)]
Merge branch 'net-bridge-fdb-activity-tracking'

Nikolay Aleksandrov says:

====================
net: bridge: fdb activity tracking

This set adds extensions needed for EVPN multi-homing proper and
efficient mac sync. User-space (e.g. FRR) needs to be able to track
non-dynamic entry activity on per-fdb basis depending if a tracked fdb is
currently peer active or locally active and needs to be able to add new
peer active fdb (static + track + inactive) without refreshing it to get
real activity tracking. Patch 02 adds a new NDA attribute - NDA_FDB_EXT_ATTRS
to avoid future pollution of NDA attributes by bridge or vxlan. New
bridge/vxlan specific fdb attributes are embedded in NDA_FDB_EXT_ATTRS,
which is used in patch 03 to pass the new NFEA_ACTIVITY_NOTIFY attribute
which controls if an fdb should be tracked and also reflects its current
state when dumping. It is treated as a bitfield, current valid bits are:
 1 - mark an entry for activity tracking
 2 - mark an entry as inactive to avoid multiple notifications and
     reflect state properly

Patch 04 adds the ability to avoid refreshing an entry when changing it
via the NFEA_DONT_REFRESH flag. That allows user-space to mark a static
entry for tracking and keep its real activity unchanged.
The set has been extensively tested with FRR and those changes will
be upstreamed if/after it gets accepted.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: bridge: add a flag to avoid refreshing fdb when changing/adding
Nikolay Aleksandrov [Tue, 23 Jun 2020 20:47:18 +0000 (23:47 +0300)]
net: bridge: add a flag to avoid refreshing fdb when changing/adding

When we modify or create a new fdb entry sometimes we want to avoid
refreshing its activity in order to track it properly. One example is
when a mac is received from EVPN multi-homing peer by FRR, which doesn't
want to change local activity accounting. It makes it static and sets a
flag to track its activity.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: bridge: add option to allow activity notifications for any fdb entries
Nikolay Aleksandrov [Tue, 23 Jun 2020 20:47:17 +0000 (23:47 +0300)]
net: bridge: add option to allow activity notifications for any fdb entries

This patch adds the ability to notify about activity of any entries
(static, permanent or ext_learn). EVPN multihoming peers need it to
properly and efficiently handle mac sync (peer active/locally active).
We add a new NFEA_ACTIVITY_NOTIFY attribute which is used to dump the
current activity state and to control if static entries should be monitored
at all. We use 2 bits - one to activate fdb entry tracking (disabled by
default) and the second to denote that an entry is inactive. We need
the second bit in order to avoid multiple notifications of inactivity.
Obviously this makes no difference for dynamic entries since at the time
of inactivity they get deleted, while the tracked non-dynamic entries get
the inactive bit set and get a notification.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: neighbor: add fdb extended attribute
Nikolay Aleksandrov [Tue, 23 Jun 2020 20:47:16 +0000 (23:47 +0300)]
net: neighbor: add fdb extended attribute

Add an attribute to NDA which will contain all future fdb-specific
attributes in order to avoid polluting the NDA namespace with e.g.
bridge or vxlan specific attributes. The attribute is called
NDA_FDB_EXT_ATTRS and the structure would look like:
 [NDA_FDB_EXT_ATTRS] = {
    [NFEA_xxx]
 }

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: bridge: fdb_add_entry takes ndm as argument
Nikolay Aleksandrov [Tue, 23 Jun 2020 20:47:15 +0000 (23:47 +0300)]
net: bridge: fdb_add_entry takes ndm as argument

We can just pass ndm as an argument instead of its fields separately.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-phy-mscc-PHC-and-timestamping-support'
David S. Miller [Wed, 24 Jun 2020 21:33:17 +0000 (14:33 -0700)]
Merge branch 'net-phy-mscc-PHC-and-timestamping-support'

Antoine Tenart says:

====================
net: phy: mscc: PHC and timestamping support

This series aims at adding support for PHC and timestamping operations
in the MSCC PHY driver, for the VSC858x and VSC8575. Those PHYs are
capable of timestamping in 1-step and 2-step for both L2 and L4 traffic.

As of this series, only IPv4 support was implemented when using L4 mode.
This is because of an hardware limitation which prevents us for
supporting both IPv4 and IPv6 at the same time. Implementing support for
IPv6 should be quite easy (I do have the modifications needed for the
hardware configuration) but I did not see a way to retrieve this
information in hwtstamp(). What would you suggest?

Those PHYs are distributed in hardware packages containing multiple
times the PHY. The VSC8584 for example is composed of 4 PHYs. With
hardware packages, parts of the logic is usually common and one of the
PHY has to be used for some parts of the initialization. Following this
logic, the 1588 blocks of those PHYs are shared between two PHYs and
accessing the registers has to be done using the "base" PHY of the
group. This is handled thanks to helpers in the PTP code (and locks).
We also need the MDIO bus lock while performing a single read or write
to the 1588 registers as the read/write are composed of multiple MDIO
transactions (and we don't want other threads updating the page).

To get and set the PHC time, a GPIO has to be used and changes are only
retrieved or committed when on a rising edge. The same GPIO is shared by
all PHYs, so the granularity of the lock protecting it has to be
different from the ones protecting the 1588 registers (the VSC8584 PHY
has 2 1588 blocks, and a single load/save pin).

Patch 1 extends the recently added helpers to share information between
PHYs of the same hardware package; to allow having part of the probe to
be shared (in addition to the already supported init part). This will be
used when adding support for PHC/TS to initialize locks.

Patches 2 and 3 are mostly cosmetic.

Patch 4 takes into account the 1588 block in the MACsec initialization,
to allow having both the MACsec and 1588 blocks initialized on a running
system.

Patches 5 and 6 add support for PHC and timestamping operations in the
MSCC driver. An initialization of the 1588 block (plus all the registers
definition; and helpers) is added first; and then comes a patch to
implement the PHC and timestamping API.

Patches 7 and 8 add the required hardware description for device trees,
to be able to use the load/save GPIO pin on the PCB120 board.

To use this on a PCB120 board, two other series are needed and have
already been sent upstream (one is merged). There are no dependency
between all those series.

Since v3:
  - Fixed a SKB leak.
  - Removed ts_lock from the init, as TS and PHC operations aren't
    registered at this time.
  - Refectored the ts_base_addr/phy intialization.
  - Cleaned up the ingr/egr latencies definitons.
  - Fixed a comment about locking and the shared GPIO.
  - A few cosmetic fixes.

Since v2:
  - Removed explicit inlines from .c files.
  - Fixed three warnings.

Since v1:
  - Removed checks in rxtstamp/txtstamp as skb cannot be NULL here.
  - Reworked get_ptp_header_rx/get_ptp_header.
  - Reworked the locking logic between the PHC and timestamping
    operations.
  - Fixed a compilation issue on x86 reported by Jakub.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMIPS: dts: ocelot: describe the load/save GPIO
Quentin Schulz [Tue, 23 Jun 2020 14:30:14 +0000 (16:30 +0200)]
MIPS: dts: ocelot: describe the load/save GPIO

This patch adds a description of the load/save GPIN pin, used in the
VSC8584 PHY for timestamping operations. The related pinctrl description
is also added.

Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodt-bindings: net: phy: vsc8531: document the load/save GPIO
Antoine Tenart [Tue, 23 Jun 2020 14:30:13 +0000 (16:30 +0200)]
dt-bindings: net: phy: vsc8531: document the load/save GPIO

A new optional property can be used to reference the load/save GPIO,
used for PTP hardware clock (PHC) operations. This patch documents it in
the binding documentation.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: mscc: timestamping and PHC support
Antoine Tenart [Tue, 23 Jun 2020 14:30:12 +0000 (16:30 +0200)]
net: phy: mscc: timestamping and PHC support

This patch adds support for PHC and timestamping operations for the MSCC
PHY. PTP 1-step and 2-step modes are supported, over Ethernet and UDP.

To get and set the PHC time, a GPIO has to be used and changes are only
retrieved or committed when on a rising edge. The same GPIO is shared by
all PHYs, so the granularity of the lock protecting it has to be
different from the ones protecting the 1588 registers (the VSC8584 PHY
has 2 1588 blocks, and a single load/save pin).

Co-developed-by: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: mscc: 1588 block initialization
Quentin Schulz [Tue, 23 Jun 2020 14:30:11 +0000 (16:30 +0200)]
net: phy: mscc: 1588 block initialization

This patch adds the first parts of the 1588 support in the MSCC PHY,
with registers definition and the 1588 block initialization.

Those PHYs are distributed in hardware packages containing multiple
times the PHY. The VSC8584 for example is composed of 4 PHYs. With
hardware packages, parts of the logic is usually common and one of the
PHY has to be used for some parts of the initialization. Following this
logic, the 1588 blocks of those PHYs are shared between two PHYs and
accessing the registers has to be done using the "base" PHY of the
group. This is handled thanks to helpers in the PTP code (and locks).
We also need the MDIO bus lock while performing a single read or write
to the 1588 registers as the read/write are composed of multiple MDIO
transactions (and we don't want other threads updating the page).

Co-developed-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: mscc: take into account the 1588 block in MACsec init
Antoine Tenart [Tue, 23 Jun 2020 14:30:10 +0000 (16:30 +0200)]
net: phy: mscc: take into account the 1588 block in MACsec init

This patch takes in account the use of the 1588 block in the MACsec
initialization, as a conditional configuration has to be done (when the
1588 block is used).

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: mscc: remove the TR CLK disable magic value
Quentin Schulz [Tue, 23 Jun 2020 14:30:09 +0000 (16:30 +0200)]
net: phy: mscc: remove the TR CLK disable magic value

This patch adds a define for the 0x8000 magic value used to perform
enable/disable actions on the "token ring clock". The patch is only
cosmetic.

Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: mscc: fix copyright and author information in MACsec
Antoine Tenart [Tue, 23 Jun 2020 14:30:08 +0000 (16:30 +0200)]
net: phy: mscc: fix copyright and author information in MACsec

All headers in the MSCC PHY driver have been copied and pasted from the
original mscc.c file. However the information is not necessarily
correct, as in the MACsec support. Fix this.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: add support for a common probe between shared PHYs
Antoine Tenart [Tue, 23 Jun 2020 14:30:07 +0000 (16:30 +0200)]
net: phy: add support for a common probe between shared PHYs

Shared PHYs (PHYs in the same hardware package) may have shared
registers and their drivers would usually need to share information.
There is currently a way to have a shared (part of the) init, by using
phy_package_init_once(). This patch extends the logic to share parts of
the probe to allow sharing the initialization of locks or resources
retrieval.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'cxgb4-fix-more-warnings-reported-by-sparse'
David S. Miller [Wed, 24 Jun 2020 03:55:45 +0000 (20:55 -0700)]
Merge branch 'cxgb4-fix-more-warnings-reported-by-sparse'

Rahul Lakkireddy says:

====================
cxgb4: fix more warnings reported by sparse

Patch 1 ensures all callers take on-chip memory lock when flashing
PHY firmware to fix lock context imbalance warnings.

Patch 2 moves all static arrays in header file to respective C file
in device dump collection path.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agocxgb4: move device dump arrays in header to C file
Rahul Lakkireddy [Tue, 23 Jun 2020 20:33:23 +0000 (02:03 +0530)]
cxgb4: move device dump arrays in header to C file

Move all arrays related to device dump in header file to C file.
Also, move the function that shares the arrays to the same C file.

Fixes following warnings reported by make W=1 in several places:
cudbg_entity.h:513:18: warning: 't6_hma_ireg_array' defined but not
used [-Wunused-const-variable=]
  513 | static const u32 t6_hma_ireg_array[][IREG_NUM_ELEM] = {

Fixes: a7975a2f9a79 ("cxgb4: collect register dump")
Fixes: 17b332f48074 ("cxgb4: add support to read serial flash")
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agocxgb4: always sync access when flashing PHY firmware
Rahul Lakkireddy [Tue, 23 Jun 2020 20:33:22 +0000 (02:03 +0530)]
cxgb4: always sync access when flashing PHY firmware

Access to on-chip memory for flashing PHY firmware must always
be synchronized. So, ensure the callers take on-chip memory lock.

Also fixes following sparse warning:
sge.c:1641:26: warning: context imbalance in 't4_load_phy_fw' -
different lock contexts for basic block

Fixes: 01b6961410b7 ("cxgb4: Add PHY firmware support for T420-BT cards")
Fixes: 4ee339e1e92a ("cxgb4: add support to flash PHY image")
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests/net: plug rxtimestamp test into kselftest framework
tannerlove [Mon, 22 Jun 2020 17:43:24 +0000 (13:43 -0400)]
selftests/net: plug rxtimestamp test into kselftest framework

Run rxtimestamp as part of TEST_PROGS. Analogous to other tests, add
new rxtimestamp.sh wrapper script, so that the test runs isolated
from background traffic in a private network namespace.

Also ignore failures of test case #6 by default. This case verifies
that a receive timestamp is not reported if timestamp reporting is
enabled for a socket, but generation is disabled. Receive timestamp
generation has to be enabled globally, as no associated socket is
known yet. A background process that enables rx timestamp generation
therefore causes a false positive. Ntpd is one example that does.

Add a "--strict" option to cause failure in the event that any test
case fails, including test #6. This is useful for environments that
are known to not have such background processes.

Tested:
make -C tools/testing/selftests TARGETS="net" run_tests

Signed-off-by: Tanner Love <tannerlove@google.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: thunderbolt: Add comment clarifying prtcstns flags
Mika Westerberg [Mon, 22 Jun 2020 16:30:22 +0000 (19:30 +0300)]
net: thunderbolt: Add comment clarifying prtcstns flags

ThunderboltIP protocol currently has two flags from which we only
support and set match frags ID. The first flag is reserved for full E2E
flow control. Add a comment that clarifies them.

Suggested-by: Yehezkel Bernat <yehezkelshb@gmail.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Yehezkel Bernat <YehezkelShB@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'ACPI-support-for-xgmac_mdio-drivers'
David S. Miller [Wed, 24 Jun 2020 03:35:15 +0000 (20:35 -0700)]
Merge branch 'ACPI-support-for-xgmac_mdio-drivers'

Calvin Johnson says:

====================
ACPI support for xgmac_mdio drivers.

This patch series provides ACPI support for xgmac_mdio driver.

Changes in v3:
- handle case MDIOBUS_NO_CAP

Changes in v2:
- Reserve "0" to mean that no mdiobus capabilities have been declared.
- bus->id: change to appropriate printk format specifier
- clean up xgmac_acpi_match
- clariy platform_get_resource() usage with comments
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/fsl: enable extended scanning in xgmac_mdio
Jeremy Linton [Mon, 22 Jun 2020 15:05:34 +0000 (20:35 +0530)]
net/fsl: enable extended scanning in xgmac_mdio

Since we know the xgmac hardware always has a c45
compliant bus, let's try scanning for c22 capable
PHYs first. If we fail to find any, then it will
fall back to c45 automatically.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Signed-off-by: Calvin Johnson <calvin.johnson@oss.nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/fsl: acpize xgmac_mdio
Calvin Johnson [Mon, 22 Jun 2020 15:05:33 +0000 (20:35 +0530)]
net/fsl: acpize xgmac_mdio

Add ACPI support for xgmac MDIO bus registration while maintaining
the existing DT support.

The function mdiobus_register() inside of_mdiobus_register(), brings
up all the PHYs on the mdio bus and attach them to the bus.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Signed-off-by: Calvin Johnson <calvin.johnson@oss.nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: Allow mdio buses to auto-probe c45 devices
Jeremy Linton [Mon, 22 Jun 2020 15:05:32 +0000 (20:35 +0530)]
net: phy: Allow mdio buses to auto-probe c45 devices

The mdiobus_scan logic is currently hardcoded to only
work with c22 devices. This works fairly well in most
cases, but its possible that a c45 device doesn't respond
despite being a standard phy. If the parent hardware
is capable, it makes sense to scan for c22 devices before
falling back to c45.

As we want this to reflect the capabilities of the STA,
lets add a field to the mii_bus structure to represent
the capability. That way devices can opt into the extended
scanning. Existing users should continue to default to c22
only scanning as long as they are zero'ing the structure
before use.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Signed-off-by: Calvin Johnson <calvin.johnson@oss.nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'ethernet-dec-tulip-use-generic-power-management'
David S. Miller [Wed, 24 Jun 2020 03:33:15 +0000 (20:33 -0700)]
Merge branch 'ethernet-dec-tulip-use-generic-power-management'

Vaibhav Gupta says:

====================
ethernet: dec: tulip: use generic power management

Linux Kernel Mentee: Remove Legacy Power Management.

The purpose of this patch series is to remove legacy power management
callbacks and invocation of PCI helper functions, from tulip ethernet drivers.

With legacy PM, drivers themselves are responsible for handling the device's
power states. And they do this with the help of PCI helper functions like
pci_enable/disable_device(), pci_set/restore_state(), pci_set_powr_state(), etc.
which is not recommended.

In generic PM, all the required tasks are handled by PCI core and drivers need
to perform device-specific operations only.

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

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotulip: uli526x: use generic power management
Vaibhav Gupta [Mon, 22 Jun 2020 11:42:28 +0000 (17:12 +0530)]
tulip: uli526x: use generic power management

With the support of generic PM callbacks, drivers no longer need to use
legacy .suspend() and .resume() in which they had to maintain PCI states
changes and device's power state themselves.

Legacy PM involves usage of PCI helper functions like pci_enable_wake()
which is no longer recommended.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotulip: tulip_core: use generic power management
Vaibhav Gupta [Mon, 22 Jun 2020 11:42:27 +0000 (17:12 +0530)]
tulip: tulip_core: use generic power management

With the support of generic PM callbacks, drivers no longer need to use
legacy .suspend() and .resume() in which they had to maintain PCI
states changes and device's power state themselves.

Earlier, .suspend() and .resume() were invoking pci_disable_device()
and pci_enable_device() respectively to manage the device's power state.
driver also invoked pci_save/restore_state() and pci_set_power_sitate().
With generic PM, it is no longer needed. The driver is expected to just
implement driver-specific operations and leave power transitions to PCI
core.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotulip: de2104x: use generic power management
Vaibhav Gupta [Mon, 22 Jun 2020 11:42:26 +0000 (17:12 +0530)]
tulip: de2104x: use generic power management

With the support of generic PM callbacks, drivers no longer need to use
legacy .suspend() and .resume() in which they had to maintain PCI states
changes and device's power state themselves.

Earlier, .suspend() and .resume() were invoking pci_disable_device()
and pci_enable_device() respectively to manage the device's power state.
With generic PM, it is no longer needed. The driver is expected to just
implement driver-specific operations and leave power transitions to PCI
core.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotulip: windbond-840: use generic power management
Vaibhav Gupta [Mon, 22 Jun 2020 11:42:25 +0000 (17:12 +0530)]
tulip: windbond-840: use generic power management

With stable support of generic PM callbacks, drivers no longer need to use
legacy .suspend() and .resume() in which they had to maintain PCI states
changes and device's power state themselves.

Earlier, .resume() was invoking pci_enable_device(). Drivers should not
call PCI legacy helper functions, hence, it was removed. This should not
change the behavior of the device as this function is called by PCI core
if somehow pm_ops is not able to bind with the driver, else, required tasks
are managed by the core itself.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotulip: dmfe: use generic power management
Vaibhav Gupta [Mon, 22 Jun 2020 11:42:24 +0000 (17:12 +0530)]
tulip: dmfe: use generic power management

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

The legacy suspend() and resume() were making use of
pci_read/write_config_dword() to enable/disable wol. Driver editing
configuration registers of a device is not recommended. Thus replace them
all with device_wakeup_enable/disable().

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'ethernet-amd-Convert-to-generic-power-management'
David S. Miller [Wed, 24 Jun 2020 03:31:18 +0000 (20:31 -0700)]
Merge branch 'ethernet-amd-Convert-to-generic-power-management'

Vaibhav Gupta says:

====================
ethernet: amd: Convert to generic power management

Linux Kernel Mentee: Remove Legacy Power Management.

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

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

The conversion requires the removal of the those function calls and change the
callback definition accordingly and make use of dev_pm_ops structure.

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

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoamd-xgbe: Convert to generic power management
Vaibhav Gupta [Mon, 22 Jun 2020 11:14:00 +0000 (16:44 +0530)]
amd-xgbe: Convert to generic power management

Use dev_pm_ops structure to call generic suspend() and resume() callbacks.

Drivers should avoid saving device register and/or change power states
using PCI helper functions. With the generic approach, all these are handled
by PCI core.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoamd8111e: Convert to generic power management
Vaibhav Gupta [Mon, 22 Jun 2020 11:13:59 +0000 (16:43 +0530)]
amd8111e: Convert to generic power management

Drivers should not save device registers and/or change the power state of
the device. As per the generic PM approach, these are handled by PCI core.

The driver should support dev_pm_ops callbacks and bind them to pci_driver.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agopcnet32: Convert to generic power management
Vaibhav Gupta [Mon, 22 Jun 2020 11:13:58 +0000 (16:43 +0530)]
pcnet32: Convert to generic power management

Remove legacy PM callbacks and use generic operations. With legacy code,
drivers were responsible for handling PCI PM operations like
pci_save_state(). In generic code, all these are handled by PCI core.

The generic suspend() and resume() are called at the same point the legacy
ones were called. Thus, it does not affect the normal functioning of the
driver.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodn_route_rcv: remove redundant dev null check
Gaurav Singh [Tue, 23 Jun 2020 03:41:19 +0000 (23:41 -0400)]
dn_route_rcv: remove redundant dev null check

dev cannot be NULL here since its already being accessed
before. Remove the redundant null check.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodcb_doit: remove redundant skb check
Gaurav Singh [Tue, 23 Jun 2020 02:50:39 +0000 (22:50 -0400)]
dcb_doit: remove redundant skb check

skb cannot be NULL here since its already being accessed
before: sock_net(skb->sk). Remove the redundant null check.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipv6: Use struct_size() helper and kcalloc()
Gustavo A. R. Silva [Mon, 22 Jun 2020 23:07:41 +0000 (18:07 -0500)]
net: ipv6: Use struct_size() helper and kcalloc()

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes. Also, remove unnecessary
function ipv6_rpl_srh_alloc_size() and replace kzalloc() with kcalloc(),
which has a 2-factor argument form for multiplication.

This code was detected with the help of Coccinelle and, audited and
fixed manually.

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoxirc2ps_cs: remove dev null check from do_reset().
Gaurav Singh [Wed, 24 Jun 2020 00:55:45 +0000 (20:55 -0400)]
xirc2ps_cs: remove dev null check from do_reset().

dev cannot be NULL here since its already being accessed
before. Remove the redundant null check.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-address-some-sparse-warnings'
David S. Miller [Wed, 24 Jun 2020 03:10:15 +0000 (20:10 -0700)]
Merge branch 'net-address-some-sparse-warnings'

Eric Dumazet says:

====================
net: address some sparse warnings

This series adds missing declarations and move others to
address W=1 C=1 warnings in tcp and udp.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoudp: move gro declarations to net/udp.h
Eric Dumazet [Tue, 23 Jun 2020 22:31:15 +0000 (15:31 -0700)]
udp: move gro declarations to net/udp.h

This removes following warnings :
  CC      net/ipv4/udp_offload.o
net/ipv4/udp_offload.c:504:17: warning: no previous prototype for 'udp4_gro_receive' [-Wmissing-prototypes]
  504 | struct sk_buff *udp4_gro_receive(struct list_head *head, struct sk_buff *skb)
      |                 ^~~~~~~~~~~~~~~~
net/ipv4/udp_offload.c:584:29: warning: no previous prototype for 'udp4_gro_complete' [-Wmissing-prototypes]
  584 | INDIRECT_CALLABLE_SCOPE int udp4_gro_complete(struct sk_buff *skb, int nhoff)
      |                             ^~~~~~~~~~~~~~~~~

  CHECK   net/ipv6/udp_offload.c
net/ipv6/udp_offload.c:115:16: warning: symbol 'udp6_gro_receive' was not declared. Should it be static?
net/ipv6/udp_offload.c:148:29: warning: symbol 'udp6_gro_complete' was not declared. Should it be static?
  CC      net/ipv6/udp_offload.o
net/ipv6/udp_offload.c:115:17: warning: no previous prototype for 'udp6_gro_receive' [-Wmissing-prototypes]
  115 | struct sk_buff *udp6_gro_receive(struct list_head *head, struct sk_buff *skb)
      |                 ^~~~~~~~~~~~~~~~
net/ipv6/udp_offload.c:148:29: warning: no previous prototype for 'udp6_gro_complete' [-Wmissing-prototypes]
  148 | INDIRECT_CALLABLE_SCOPE int udp6_gro_complete(struct sk_buff *skb, int nhoff)
      |                             ^~~~~~~~~~~~~~~~~
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: move tcp gro declarations to net/tcp.h
Eric Dumazet [Tue, 23 Jun 2020 22:31:14 +0000 (15:31 -0700)]
net: move tcp gro declarations to net/tcp.h

This patch removes following (C=1 W=1) warnings for CONFIG_RETPOLINE=y :

net/ipv4/tcp_offload.c:306:16: warning: symbol 'tcp4_gro_receive' was not declared. Should it be static?
net/ipv4/tcp_offload.c:306:17: warning: no previous prototype for 'tcp4_gro_receive' [-Wmissing-prototypes]
net/ipv4/tcp_offload.c:319:29: warning: symbol 'tcp4_gro_complete' was not declared. Should it be static?
net/ipv4/tcp_offload.c:319:29: warning: no previous prototype for 'tcp4_gro_complete' [-Wmissing-prototypes]
  CHECK   net/ipv6/tcpv6_offload.c
net/ipv6/tcpv6_offload.c:16:16: warning: symbol 'tcp6_gro_receive' was not declared. Should it be static?
net/ipv6/tcpv6_offload.c:29:29: warning: symbol 'tcp6_gro_complete' was not declared. Should it be static?
  CC      net/ipv6/tcpv6_offload.o
net/ipv6/tcpv6_offload.c:16:17: warning: no previous prototype for 'tcp6_gro_receive' [-Wmissing-prototypes]
   16 | struct sk_buff *tcp6_gro_receive(struct list_head *head, struct sk_buff *skb)
      |                 ^~~~~~~~~~~~~~~~
net/ipv6/tcpv6_offload.c:29:29: warning: no previous prototype for 'tcp6_gro_complete' [-Wmissing-prototypes]
   29 | INDIRECT_CALLABLE_SCOPE int tcp6_gro_complete(struct sk_buff *skb, int thoff)
      |                             ^~~~~~~~~~~~~~~~~

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: move ipv4_specific to tcp include file
Eric Dumazet [Tue, 23 Jun 2020 22:31:13 +0000 (15:31 -0700)]
tcp: move ipv4_specific to tcp include file

Declare ipv4_specific once, in tcp.h were it belongs.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: move ipv6_specific declaration to remove a warning
Eric Dumazet [Tue, 23 Jun 2020 22:31:12 +0000 (15:31 -0700)]
tcp: move ipv6_specific declaration to remove a warning

ipv6_specific should be declared in tcp include files,
not mptcp.

This removes the following warning :
  CHECK   net/ipv6/tcp_ipv6.c
net/ipv6/tcp_ipv6.c:78:42: warning: symbol 'ipv6_specific' was not declared. Should it be static?

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: add declarations to avoid warnings
Eric Dumazet [Tue, 23 Jun 2020 22:31:11 +0000 (15:31 -0700)]
tcp: add declarations to avoid warnings

Remove these errors:

net/ipv6/tcp_ipv6.c:1550:29: warning: symbol 'tcp_v6_rcv' was not declared. Should it be static?
net/ipv6/tcp_ipv6.c:1770:30: warning: symbol 'tcp_v6_early_demux' was not declared. Should it be static?

net/ipv6/tcp_ipv6.c:1550:29: warning: no previous prototype for 'tcp_v6_rcv' [-Wmissing-prototypes]
 1550 | INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)
      |                             ^~~~~~~~~~
net/ipv6/tcp_ipv6.c:1770:30: warning: no previous prototype for 'tcp_v6_early_demux' [-Wmissing-prototypes]
 1770 | INDIRECT_CALLABLE_SCOPE void tcp_v6_early_demux(struct sk_buff *skb)
      |                              ^~~~~~~~~~~~~~~~~~

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: rename RTL8125 to RTL8125A
Heiner Kallweit [Tue, 23 Jun 2020 21:04:42 +0000 (23:04 +0200)]
r8169: rename RTL8125 to RTL8125A

Realtek added new members to the RTL8125 chip family, therefore rename
RTL8125 to RTL8125a. Then we use the same chip naming as in the r8125
vendor driver.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobonding/xfrm: use real_dev instead of slave_dev
Jarod Wilson [Tue, 23 Jun 2020 20:40:01 +0000 (16:40 -0400)]
bonding/xfrm: use real_dev instead of slave_dev

Rather than requiring every hw crypto capable NIC driver to do a check for
slave_dev being set, set real_dev in the xfrm layer and xso init time, and
then override it in the bonding driver as needed. Then NIC drivers can
always use real_dev, and at the same time, we eliminate the use of a
variable name that probably shouldn't have been used in the first place,
particularly given recent current events.

CC: Boris Pismenny <borisp@mellanox.com>
CC: Saeed Mahameed <saeedm@mellanox.com>
CC: Leon Romanovsky <leon@kernel.org>
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: "David S. Miller" <davem@davemloft.net>
CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
CC: Jakub Kicinski <kuba@kernel.org>
CC: Steffen Klassert <steffen.klassert@secunet.com>
CC: Herbert Xu <herbert@gondor.apana.org.au>
CC: netdev@vger.kernel.org
Suggested-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'mlxsw-Bump-firmware-version-to-XX-2007-1168'
David S. Miller [Tue, 23 Jun 2020 22:14:13 +0000 (15:14 -0700)]
Merge branch 'mlxsw-Bump-firmware-version-to-XX-2007-1168'

Ido Schimmel says:

====================
mlxsw: Bump firmware version to XX.2007.1168

Petr says:

In patch #1, bump the firmware version required by the driver to
XX.2007.1168. This version fixes several issues observed in the
offloaded datapath.

In patch #2, add support for requiring FW version on Spectrum-3 (so far
only Spectrum-1 and Spectrum-2 have had this requirement). Demand the
same version as mentioned above.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: Enforce firmware version for Spectrum-3
Petr Machata [Tue, 23 Jun 2020 19:13:46 +0000 (22:13 +0300)]
mlxsw: Enforce firmware version for Spectrum-3

In a fashion similar to the other Spectrum systems, enforce a specific
firmware version for Spectrum-3 so that the driver and firmware are
always in sync with regards to new features.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: Bump firmware version to XX.2007.1168
Petr Machata [Tue, 23 Jun 2020 19:13:45 +0000 (22:13 +0300)]
mlxsw: Bump firmware version to XX.2007.1168

This version comes with fixes to the following problems, among others:

- Wrong shaper configuration on Spectrum-1
- Bogus temperature reading on Spectrum-2
- Problems in setting egress buffer size after MTU change on Spectrum-2

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv6: fib6: avoid indirect calls from fib6_rule_lookup
Brian Vazquez [Tue, 23 Jun 2020 16:42:32 +0000 (09:42 -0700)]
ipv6: fib6: avoid indirect calls from fib6_rule_lookup

It was reported that a considerable amount of cycles were spent on the
expensive indirect calls on fib6_rule_lookup. This patch introduces an
inline helper called pol_route_func that uses the indirect_call_wrappers
to avoid the indirect calls.

This patch saves around 50ns per call.

Performance was measured on the receiver by checking the amount of
syncookies that server was able to generate under a synflood load.

Traffic was generated using trafgen[1] which was pushing around 1Mpps on
a single queue. Receiver was using only one rx queue which help to
create a bottle neck and make the experiment rx-bounded.

These are the syncookies generated over 10s from the different runs:

Whithout the patch:
TcpExtSyncookiesSent            3553749            0.0
TcpExtSyncookiesSent            3550895            0.0
TcpExtSyncookiesSent            3553845            0.0
TcpExtSyncookiesSent            3541050            0.0
TcpExtSyncookiesSent            3539921            0.0
TcpExtSyncookiesSent            3557659            0.0
TcpExtSyncookiesSent            3526812            0.0
TcpExtSyncookiesSent            3536121            0.0
TcpExtSyncookiesSent            3529963            0.0
TcpExtSyncookiesSent            3536319            0.0

With the patch:
TcpExtSyncookiesSent            3611786            0.0
TcpExtSyncookiesSent            3596682            0.0
TcpExtSyncookiesSent            3606878            0.0
TcpExtSyncookiesSent            3599564            0.0
TcpExtSyncookiesSent            3601304            0.0
TcpExtSyncookiesSent            3609249            0.0
TcpExtSyncookiesSent            3617437            0.0
TcpExtSyncookiesSent            3608765            0.0
TcpExtSyncookiesSent            3620205            0.0
TcpExtSyncookiesSent            3601895            0.0

Without the patch the average is 354263 pkt/s or 2822 ns/pkt and with
the patch the average is 360738 pkt/s or 2772 ns/pkt which gives an
estimate of 50 ns per packet.

[1] http://netsniff-ng.org/

Changelog since v1:
 - Change ordering in the ICW (Paolo Abeni)

Cc: Luigi Rizzo <lrizzo@google.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Brian Vazquez <brianvv@google.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoindirect_call_wrapper: extend indirect wrapper to support up to 4 calls
Brian Vazquez [Tue, 23 Jun 2020 16:42:31 +0000 (09:42 -0700)]
indirect_call_wrapper: extend indirect wrapper to support up to 4 calls

There are many places where 2 annotations are not enough. This patch
adds INDIRECT_CALL_3 and INDIRECT_CALL_4 to cover such cases.

Signed-off-by: Brian Vazquez <brianvv@google.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_dcb: Fix a spelling typo in spectrum_dcb.c
Masanari Iida [Tue, 23 Jun 2020 14:13:01 +0000 (23:13 +0900)]
mlxsw: spectrum_dcb: Fix a spelling typo in spectrum_dcb.c

This patch fixes a spelling typo in spectrum_dcb.c

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agortnetlink: add keepalived rtm_protocol
Alexandre Cassen [Tue, 23 Jun 2020 08:33:45 +0000 (10:33 +0200)]
rtnetlink: add keepalived rtm_protocol

Keepalived can set global static ip routes or virtual ip routes dynamically
following VRRP protocol states. Using a dedicated rtm_protocol will help
keeping track of it.

Changes in v2:
 - fix tab/space indenting

Signed-off-by: Alexandre Cassen <acassen@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-atlantic-additional-A2-features'
David S. Miller [Tue, 23 Jun 2020 04:10:22 +0000 (21:10 -0700)]
Merge branch 'net-atlantic-additional-A2-features'

Igor Russkikh says:

====================
net: atlantic: additional A2 features

This patchset adds more features to A2:
 * half duplex rates;
 * EEE;
 * flow control;
 * link partner capabilities reporting;
 * phy loopback.

Feature-wise A2 is almost on-par with A1 save for WoL and filtering, which
will be submitted as separate follow-up patchset(s).
====================

Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atlantic: A2: phy loopback support
Dmitry Bogdanov [Mon, 22 Jun 2020 14:53:09 +0000 (17:53 +0300)]
net: atlantic: A2: phy loopback support

This patch adds the phy loopback support on A2.

Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atlantic: A2: report link partner capabilities
Dmitry Bogdanov [Mon, 22 Jun 2020 14:53:08 +0000 (17:53 +0300)]
net: atlantic: A2: report link partner capabilities

This patch adds link partner capabilities reporting support on A2.
In particular, the following capabilities are available for reporting:
* link rate;
* EEE;
* flow control.

Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atlantic: A2: flow control support
Igor Russkikh [Mon, 22 Jun 2020 14:53:07 +0000 (17:53 +0300)]
net: atlantic: A2: flow control support

This patch adds flow control support on A2.

Co-developed-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atlantic: A2: EEE support
Nikita Danilov [Mon, 22 Jun 2020 14:53:06 +0000 (17:53 +0300)]
net: atlantic: A2: EEE support

This patch adds EEE support on A2.

Signed-off-by: Nikita Danilov <ndanilov@marvell.com>
Co-developed-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atlantic: remove baseX usage
Nikita Danilov [Mon, 22 Jun 2020 14:53:05 +0000 (17:53 +0300)]
net: atlantic: remove baseX usage

This patch removes 2.5G baseX wrong usage/reporting, since it shouldn't have
been mixed with baseT.

Signed-off-by: Nikita Danilov <ndanilov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atlantic: A2: half duplex support
Igor Russkikh [Mon, 22 Jun 2020 14:53:04 +0000 (17:53 +0300)]
net: atlantic: A2: half duplex support

This patch adds support for 10M/100M/1G half duplex rates, which are
supported by A2 in additional to full duplex rates supported by A1.

Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/core/devlink.c: remove new uninitialized_var() usage
Stephen Rothwell [Tue, 23 Jun 2020 03:43:06 +0000 (13:43 +1000)]
net/core/devlink.c: remove new uninitialized_var() usage

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcindex_change: Remove redundant null check
Gaurav Singh [Mon, 22 Jun 2020 02:24:30 +0000 (22:24 -0400)]
tcindex_change: Remove redundant null check

arg cannot be NULL since its already being dereferenced
before. Remove the redundant NULL check.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mtk_eth_soc: use resolved link config in mac_link_up()
Russell King [Sun, 21 Jun 2020 14:36:39 +0000 (15:36 +0100)]
net: mtk_eth_soc: use resolved link config in mac_link_up()

Convert the mtk_eth_soc driver to use the finalised link parameters in
mac_link_up() rather than the parameters in mac_config().

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'Multicast-improvement-in-Ocelot-and-Felix-drivers'
David S. Miller [Tue, 23 Jun 2020 03:41:05 +0000 (20:41 -0700)]
Merge branch 'Multicast-improvement-in-Ocelot-and-Felix-drivers'

Vladimir Oltean says:

====================
Multicast improvement in Ocelot and Felix drivers

This series makes some basic multicast forwarding functionality work for
Felix DSA and for Ocelot switchdev. IGMP/MLD snooping in Felix is still
missing, and there are other improvements to be made in the general area
of multicast address filtering towards the CPU, but let's get these
hardware-specific fixes out of the way first.
====================

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