platform/kernel/linux-rpi.git
2 years agonet: enetc: Make use of the helper function dev_err_probe()
Cai Huoqing [Wed, 15 Sep 2021 14:58:19 +0000 (22:58 +0800)]
net: enetc: Make use of the helper function dev_err_probe()

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
And using dev_err_probe() can reduce code size, and simplify the code.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: chelsio: cxgb4vf: Make use of the helper function dev_err_probe()
Cai Huoqing [Wed, 15 Sep 2021 14:58:11 +0000 (22:58 +0800)]
net: chelsio: cxgb4vf: Make use of the helper function dev_err_probe()

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
And using dev_err_probe() can reduce code size, and simplify the code.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: atl1e: Make use of the helper function dev_err_probe()
Cai Huoqing [Wed, 15 Sep 2021 14:57:56 +0000 (22:57 +0800)]
net: atl1e: Make use of the helper function dev_err_probe()

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
And using dev_err_probe() can reduce code size, and simplify the code.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: atl1c: Make use of the helper function dev_err_probe()
Cai Huoqing [Wed, 15 Sep 2021 14:57:48 +0000 (22:57 +0800)]
net: atl1c: Make use of the helper function dev_err_probe()

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
And using dev_err_probe() can reduce code size, and simplify the code.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: arc_emac: Make use of the helper function dev_err_probe()
Cai Huoqing [Wed, 15 Sep 2021 14:57:41 +0000 (22:57 +0800)]
net: arc_emac: Make use of the helper function dev_err_probe()

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
And using dev_err_probe() can reduce code size, and simplify the code.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch 'mlxsw-Add-support-for-transceiver-modules-reset'
David S. Miller [Wed, 15 Sep 2021 15:17:16 +0000 (16:17 +0100)]
Merge branch 'mlxsw-Add-support-for-transceiver-modules-reset'

Ido Schimmel says:

====================
mlxsw: Add support for transceiver modules reset

This patchset prepares mlxsw for future transceiver modules related [1]
changes and adds reset support via the existing 'ETHTOOL_RESET'
interface.

Patches #1-#6 are relatively straightforward preparations.

Patch #7 tracks the number of logical ports that are mapped to the
transceiver module and the number of logical ports using it that are
administratively up. Needed for both reset support and power mode policy
support.

Patches #8-#9 add required fields in device registers.

Patch #10 implements support for ethtool_ops::reset in order to reset
transceiver modules.

[1] https://lore.kernel.org/netdev/20210824130344.1828076-1-idosch@idosch.org/
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: Add support for transceiver modules reset
Ido Schimmel [Wed, 15 Sep 2021 10:13:14 +0000 (13:13 +0300)]
mlxsw: Add support for transceiver modules reset

Implement support for ethtool_ops::reset in order to reset transceiver
modules. The module backing the netdev is reset when the 'ETH_RESET_PHY'
flag is set. After a successful reset, the flag is cleared by the driver
and other flags are ignored. This is in accordance with the interface
documentation:

"The reset() operation must clear the flags for the components which
were actually reset. On successful return, the flags indicate the
components which were not reset, either because they do not exist in the
hardware or because they cannot be reset independently. The driver must
never reset any components that were not requested."

Reset is useful in order to allow a module to transition out of a fault
state. From section 6.3.2.12 in CMIS 5.0: "Except for a power cycle, the
only exit path from the ModuleFault state is to perform a module reset
by taking an action that causes the ResetS transition signal to become
TRUE (see Table 6-11)".

An error is returned when the netdev is administratively up:

 # ip link set dev swp11 up

 # ethtool --reset swp11 phy
 ETHTOOL_RESET 0x40
 Cannot issue ETHTOOL_RESET: Invalid argument

 # ip link set dev swp11 down

 # ethtool --reset swp11 phy
 ETHTOOL_RESET 0x40
 Components reset:     0x40

An error is returned when the module is shared by multiple ports (split
ports) and the "phy-shared" flag is not set:

 # devlink port split swp11 count 4

 # ethtool --reset swp11s0 phy
 ETHTOOL_RESET 0x40
 Cannot issue ETHTOOL_RESET: Invalid argument

 # ethtool --reset swp11s0 phy-shared
 ETHTOOL_RESET 0x400000
 Components reset:     0x400000

 # devlink port unsplit swp11s0

 # ethtool --reset swp11 phy
 ETHTOOL_RESET 0x40
 Components reset:     0x40

An error is also returned when one of the ports using the module is
administratively up:

 # devlink port split swp11 count 4

 # ip link set dev swp11s1 up

 # ethtool --reset swp11s0 phy-shared
 ETHTOOL_RESET 0x400000
 Cannot issue ETHTOOL_RESET: Invalid argument

 # ip link set dev swp11s1 down

 # ethtool --reset swp11s0 phy-shared
 ETHTOOL_RESET 0x400000
 Components reset:     0x400000

Reset is performed by writing to the "rst" bit of the PMAOS register,
which instructs the firmware to assert the reset signal connected to the
module for a fixed amount of time.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: Make PMAOS pack function more generic
Ido Schimmel [Wed, 15 Sep 2021 10:13:13 +0000 (13:13 +0300)]
mlxsw: Make PMAOS pack function more generic

The PMAOS register has enable bits (e.g., PMAOS.ee) that allow changing
only a subset of the fields, which is exactly what subsequent patches
will need to do. Instead of passing multiple arguments to its pack
function, only pass the module index and let the rest be set by the
different callers.

No functional changes intended.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: reg: Add fields to PMAOS register
Ido Schimmel [Wed, 15 Sep 2021 10:13:12 +0000 (13:13 +0300)]
mlxsw: reg: Add fields to PMAOS register

The Ports Module Administrative and Operational Status (PMAOS) register
configures and retrieves the per-module status. Extend it with fields
required to support various module settings such as reset and power
mode.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: Track per-module port status
Ido Schimmel [Wed, 15 Sep 2021 10:13:11 +0000 (13:13 +0300)]
mlxsw: Track per-module port status

In the common port module core, track the number of logical ports that
are mapped to the port module and the number of logical ports using it
that are administratively up.

This will be used by later patches to potentially veto and control
certain operations on the module, such as reset and setting its power
mode.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: spectrum: Do not return an error in mlxsw_sp_port_module_unmap()
Ido Schimmel [Wed, 15 Sep 2021 10:13:10 +0000 (13:13 +0300)]
mlxsw: spectrum: Do not return an error in mlxsw_sp_port_module_unmap()

The return value is never checked. Allows us to simplify a later patch.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: spectrum: Do not return an error in ndo_stop()
Ido Schimmel [Wed, 15 Sep 2021 10:13:09 +0000 (13:13 +0300)]
mlxsw: spectrum: Do not return an error in ndo_stop()

The return value is not checked by the networking stack. Allows us to
simplify a later patch.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: core_env: Convert 'module_info_lock' to a mutex
Ido Schimmel [Wed, 15 Sep 2021 10:13:08 +0000 (13:13 +0300)]
mlxsw: core_env: Convert 'module_info_lock' to a mutex

After the previous patch, the lock is always taken in process context so
it can be converted to a mutex. It is needed for future changes where we
will need to be able to sleep when holding the lock.

Convert the lock to a mutex.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: core_env: Defer handling of module temperature warning events
Ido Schimmel [Wed, 15 Sep 2021 10:13:07 +0000 (13:13 +0300)]
mlxsw: core_env: Defer handling of module temperature warning events

Module temperature events are currently handled in softIRQ context,
requiring the 'module_info_lock' to be a spin lock. In future patchsets
we will need to be able to hold the lock while sleeping.

Therefore, defer handling of these events using a work queue so that the
next patch will be able to convert the lock to a mutex.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: core: Remove mlxsw_core_is_initialized()
Ido Schimmel [Wed, 15 Sep 2021 10:13:06 +0000 (13:13 +0300)]
mlxsw: core: Remove mlxsw_core_is_initialized()

After the previous patch, the switch driver is always initialized last,
making this function redundant.

Remove it.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: core: Initialize switch driver last
Ido Schimmel [Wed, 15 Sep 2021 10:13:05 +0000 (13:13 +0300)]
mlxsw: core: Initialize switch driver last

Commit 961cf99a074f ("mlxsw: core: Re-order initialization sequence")
changed the initialization sequence so that the switch driver (e.g.,
mlxsw_spectrum) is initialized before registration with the hwmon and
thermal subsystems.

This was done in order to avoid situations where hwmon/thermal code uses
features not supported by current firmware version, which is only
validated as part of switch driver initialization.

Later, commit b79cb787ac70 ("mlxsw: Move fw flashing code into core.c")
moved firmware validation and flashing code from the switch driver to
mlxsw_core so that it is performed before driver initialization.

Therefore, change the initialization sequence back to its original form.

In addition to being more straightforward, it will allow us to simplify
parts of the code in subsequent patches and future patchsets.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch 'devlink-delete-publidh-api'
David S. Miller [Wed, 15 Sep 2021 15:12:55 +0000 (16:12 +0100)]
Merge branch 'devlink-delete-publidh-api'

Leon Romanovsky says:

====================
devlink: Delete publish of single parameter API

This short series removes the single parameter publish/unpublish API
that does nothing expect mimics already existing
devlink_paramss_*publish calls.

In near future, we will be able to delete devlink_paramss_*publish too.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agodevlink: Delete not-used single parameter notification APIs
Leon Romanovsky [Tue, 14 Sep 2021 12:58:29 +0000 (15:58 +0300)]
devlink: Delete not-used single parameter notification APIs

There is no need in specific devlink_param_*publish(), because same
output can be achieved by using devlink_params_*publish() in correct
places.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet/mlx5: Publish and unpublish all devlink parameters at once
Leon Romanovsky [Tue, 14 Sep 2021 12:58:28 +0000 (15:58 +0300)]
net/mlx5: Publish and unpublish all devlink parameters at once

The devlink parameters were published in two steps despite being static
and known in advance.

First step was to use devlink_params_publish() which iterated over all
known up to that point parameters and sent notification messages.
In second step, the call was devlink_param_publish() that looped over
same parameters list and sent notification for new parameters.

In order to simplify the API, move devlink_params_publish() to be called
when all parameters were already added and save the need to iterate over
parameters list again.

As a side effect, this change fixes the error unwind flow in which
parameters were not marked as unpublished.

Fixes: 82e6c96f04e1 ("net/mlx5: Register to devlink ingress VLAN filter trap")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch 'qdisc-visibility'
David S. Miller [Wed, 15 Sep 2021 14:46:02 +0000 (15:46 +0100)]
Merge branch 'qdisc-visibility'

Jakub Kicinski says:

====================
net: sched: update default qdisc visibility after Tx queue cnt changes

Matthew noticed that number of children reported by mq does not match
number of queues on reconfigured interfaces. For example if mq is
instantiated when there is 8 queues it will always show 8 children,
regardless of config being changed:

 # ethtool -L eth0 combined 8
 # tc qdisc replace dev eth0 root handle 100: mq
 # tc qdisc show dev eth0
 qdisc mq 100: root
 qdisc pfifo_fast 0: parent 100:8 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:7 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:6 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:5 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:4 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:3 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:2 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:1 bands 3 priomap 1 2 ...
 # ethtool -L eth0 combined 1
 # tc qdisc show dev eth0
 qdisc mq 100: root
 qdisc pfifo_fast 0: parent 100:8 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:7 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:6 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:5 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:4 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:3 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:2 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:1 bands 3 priomap 1 2 ...
 # ethtool -L eth0 combined 32
 # tc qdisc show dev eth0
 qdisc mq 100: root
 qdisc pfifo_fast 0: parent 100:8 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:7 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:6 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:5 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:4 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:3 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:2 bands 3 priomap 1 2 ...
 qdisc pfifo_fast 0: parent 100:1 bands 3 priomap 1 2 ...

This patchset fixes this by hashing and unhasing the default
child qdiscs as number of queues gets adjusted.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoselftests: net: test ethtool -L vs mq
Jakub Kicinski [Mon, 13 Sep 2021 22:53:32 +0000 (15:53 -0700)]
selftests: net: test ethtool -L vs mq

Add a selftest for checking mq children are visible after ethtool -L.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonetdevsim: add ability to change channel count
Jakub Kicinski [Mon, 13 Sep 2021 22:53:31 +0000 (15:53 -0700)]
netdevsim: add ability to change channel count

For testing visibility of mq/mqprio default children.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: sched: update default qdisc visibility after Tx queue cnt changes
Jakub Kicinski [Mon, 13 Sep 2021 22:53:30 +0000 (15:53 -0700)]
net: sched: update default qdisc visibility after Tx queue cnt changes

mq / mqprio make the default child qdiscs visible. They only do
so for the qdiscs which are within real_num_tx_queues when the
device is registered. Depending on order of calls in the driver,
or if user space changes config via ethtool -L the number of
qdiscs visible under tc qdisc show will differ from the number
of queues. This is confusing to users and potentially to system
configuration scripts which try to make sure qdiscs have the
right parameters.

Add a new Qdisc_ops callback and make relevant qdiscs TTRT.

Note that this uncovers the "shortcut" created by
commit 1f27cde313d7 ("net: sched: use pfifo_fast for non real queues")
The default child qdiscs beyond initial real_num_tx are always
pfifo_fast, no matter what the sysfs setting is. Fixing this
gets a little tricky because we'd need to keep a reference
on whatever the default qdisc was at the time of creation.
In practice this is likely an non-issue the qdiscs likely have
to be configured to non-default settings, so whatever user space
is doing such configuration can replace the pfifos... now that
it will see them.

Reported-by: Matthew Massey <matthewmassey@fb.com>
Reviewed-by: Dave Taht <dave.taht@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch 'ibmvnic-next'
David S. Miller [Wed, 15 Sep 2021 10:12:24 +0000 (11:12 +0100)]
Merge branch 'ibmvnic-next'

Sukadev Bhattiprolu says:

====================
ibmvnic: Reuse ltb, rx, tx pools

It can take a long time to free and reallocate rx and tx pools and long
term buffer (LTB) during each reset of the VNIC. This is specially true
when the partition (LPAR) is heavily loaded and going through a Logical
Partition Migration (LPM). The long drawn reset causes the LPAR to lose
connectivity for extended periods of time and results in "RMC connection"
errors and the LPM failing.

What is worse is that during the LPM we could get a failover because
of the lost connectivity. At that point, the vnic driver releases
even the resources it has already allocated and starts over.

As long as the resources we have already allocated are valid/applicable,
we might as well hold on to them while trying to allocate the remaining
resources. This patch set attempts to reuse the resources previously
allocated as long as they are valid. It seems to vastly improve the
time taken for the vnic reset and signficantly reduces the chances of
getting the RMC connection errors. We do get still them occasionally,
but appears to be for reasons other than memory allocation delays and
those are still being investigated.

If the backing devices for a vnic adapter are not "matched" (see "pool
parameters" in patches 8 and 9) it is possible that we will still free
all the resources and allocate them. If that becomes a common problem,
we have to address it separately.

Thanks to input and extensive testing from Brian King, Cris Forno,
Dany Madden, Rick Lindsley.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoibmvnic: Reuse tx pools when possible
Sukadev Bhattiprolu [Wed, 15 Sep 2021 03:52:59 +0000 (20:52 -0700)]
ibmvnic: Reuse tx pools when possible

Rather than releasing the tx pools on every close and reallocating
them on open, reuse the tx pools unless the pool parameters (number
of pools, size of each pool or size of each buffer in a pool) have
changed.

If the pool parameters changed, then release the old pools (if
any) and allocate new ones.

Specifically release tx pools, if:
- adapter is removed,
- pool parameters change during reset,
- we encounter an error when opening the adapter in response
  to a user request (in ibmvnic_open()).

and don't release them:
- in __ibmvnic_close() or
- on errors in __ibmvnic_open()

in the hope that we can reuse them during this or next reset.

With these changes reset_tx_pools() can be dropped because its
optimization is now included in init_tx_pools() itself.

cleanup_tx_pools() releases all the skbs associated with the pool and
is called from ibmvnic_cleanup(), which is called on every reset. Since
we want to reuse skbs across resets, move cleanup_tx_pools() out of
ibmvnic_cleanup() and call it only when user closes the adapter.

Add two new adapter fields, ->prev_mtu, ->prev_tx_pool_size to track the
previous values and use them to decide whether to reuse or realloc the
pools.

Reviewed-by: Rick Lindsley <ricklind@linux.vnet.ibm.com>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoibmvnic: Reuse rx pools when possible
Sukadev Bhattiprolu [Wed, 15 Sep 2021 03:52:58 +0000 (20:52 -0700)]
ibmvnic: Reuse rx pools when possible

Rather than releasing the rx pools on and reallocating them on every
reset, reuse the rx pools unless the pool parameters (number of pools,
size of each pool or size of each buffer in a pool) have changed.

If the pool parameters changed, then release the old pools (if any)
and allocate new ones.

Specifically release rx pools, if:
- adapter is removed,
- pool parameters change during reset,
- we encounter an error when opening the adapter in response
  to a user request (in ibmvnic_open()).

and don't release them:
- in __ibmvnic_close() or
- on errors in __ibmvnic_open()

in the hope that we can reuse them on the next reset.

With these, reset_rx_pools() can be dropped because its optimzation is
now included in init_rx_pools() itself.

cleanup_rx_pools() releases all the skbs associated with the pool and
is called from ibmvnic_cleanup(), which is called on every reset. Since
we want to reuse skbs across resets, move cleanup_rx_pools() out of
ibmvnic_cleanup() and call it only when user closes the adapter.

Add two new adapter fields, ->prev_rx_buf_sz, ->prev_rx_pool_size to
keep track of the previous values and use them to decide whether to
reuse or realloc the pools.

Reviewed-by: Rick Lindsley <ricklind@linux.vnet.ibm.com>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoibmvnic: Reuse LTB when possible
Sukadev Bhattiprolu [Wed, 15 Sep 2021 03:52:57 +0000 (20:52 -0700)]
ibmvnic: Reuse LTB when possible

Reuse the long term buffer during a reset as long as its size has
not changed. If the size has changed, free it and allocate a new
one of the appropriate size.

When we do this, alloc_long_term_buff() and reset_long_term_buff()
become identical. Drop reset_long_term_buff().

Reviewed-by: Rick Lindsley <ricklind@linux.vnet.ibm.com>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoibmvnic: Use bitmap for LTB map_ids
Sukadev Bhattiprolu [Wed, 15 Sep 2021 03:52:56 +0000 (20:52 -0700)]
ibmvnic: Use bitmap for LTB map_ids

In a follow-on patch, we will reuse long term buffers when possible.
When doing so we have to be careful to properly assign map ids. We
can no longer assign them sequentially because a lower map id may be
available and we could wrap at 255 and collide with an in-use map id.

Instead, use a bitmap to track active map ids and to find a free map id.
Don't need to take locks here since the map_id only changes during reset
and at that time only the reset worker thread should be using the adapter.

Noticed this when analyzing an error Dany Madden ran into with the
patch set.

Reported-by: Dany Madden <drt@linux.ibm.com>
Reviewed-by: Rick Lindsley <ricklind@linux.vnet.ibm.com>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoibmvnic: init_tx_pools move loop-invariant code
Sukadev Bhattiprolu [Wed, 15 Sep 2021 03:52:55 +0000 (20:52 -0700)]
ibmvnic: init_tx_pools move loop-invariant code

In init_tx_pools() move some loop-invariant code out of the loop.

Reviewed-by: Rick Lindsley <ricklind@linux.vnet.ibm.com>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoibmvnic: Use/rename local vars in init_tx_pools
Sukadev Bhattiprolu [Wed, 15 Sep 2021 03:52:54 +0000 (20:52 -0700)]
ibmvnic: Use/rename local vars in init_tx_pools

Use/rename local variables in init_tx_pools() for consistency with
init_rx_pools() and for readability. Also add some comments

Reviewed-by: Rick Lindsley <ricklind@linux.vnet.ibm.com>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoibmvnic: Use/rename local vars in init_rx_pools
Sukadev Bhattiprolu [Wed, 15 Sep 2021 03:52:53 +0000 (20:52 -0700)]
ibmvnic: Use/rename local vars in init_rx_pools

To make the code more readable, use/rename some local variables.
Basically we have a set of pools, num_pools. Each pool has a set of
buffers, pool_size and each buffer is of size buff_size.

pool_size is a bit ambiguous (whether size in bytes or buffers). Add
a comment in the header file to make it explicit.

Reviewed-by: Rick Lindsley <ricklind@linux.vnet.ibm.com>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoibmvnic: Fix up some comments and messages
Sukadev Bhattiprolu [Wed, 15 Sep 2021 03:52:52 +0000 (20:52 -0700)]
ibmvnic: Fix up some comments and messages

Add/update some comments/function headers and fix up some messages.

Reviewed-by: Rick Lindsley <ricklind@linux.vnet.ibm.com>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoibmvnic: Consolidate code in replenish_rx_pool()
Sukadev Bhattiprolu [Wed, 15 Sep 2021 03:52:51 +0000 (20:52 -0700)]
ibmvnic: Consolidate code in replenish_rx_pool()

For better readability, consolidate related code in replenish_rx_pool()
and add some comments.

Reviewed-by: Rick Lindsley <ricklind@linux.vnet.ibm.com>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch 'ptp-ocp-timecard-v13-fw'
David S. Miller [Wed, 15 Sep 2021 10:10:01 +0000 (11:10 +0100)]
Merge branch 'ptp-ocp-timecard-v13-fw'

Jonathan Lemon says:

====================
timecard updates for v13 firmware

This update mainly deals with features for the TimeCard v13 firmware.

The signals provided from the external SMA connectors can be steered
to different locations, and the generated SMA signals can be chosen.

Future timecard revisions will allow selectable I/O on any of the
SMA connectors, so name the attributes appropriately, and set up
the ABI in preparation for the new features.

The update also adds support for IRIG-B and DCF formats, as well
as NMEA output.

A ts_window_adjust tunable is also provided to fine-tune the
PHC:SYS time mapping.
--
v1: Earlier reviewed series was for v10 firmware, this is expanded to
    include the v13 features.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agodocs: ABI: Add sysfs documentation for timecard
Jonathan Lemon [Wed, 15 Sep 2021 02:16:36 +0000 (19:16 -0700)]
docs: ABI: Add sysfs documentation for timecard

This patch describes the sysfs interface implemented by the
ptp_ocp driver, under /sys/class/timecard.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add timestamp window adjustment
Jonathan Lemon [Wed, 15 Sep 2021 02:16:35 +0000 (19:16 -0700)]
ptp: ocp: Add timestamp window adjustment

The following process is used to read the PHC clock and correlate
the reading with the "correct" system time.

- get starting timestamp
- issue PCI write command
- issue PCI read command
- get ending timestamp
- read latched sec/nsec registers

The write command is posted to PCI bus and returns.  When the write
arrives at the FPGA, the PHC time is latched into the sec/nsec registers,
and a flag is set indicating the registers are valid.  The read command
returns this flag, and the time retrieval proceeds.

Below is a non-scaled picture of the timing diagram involved.  The
PHC time corresponds to some SYS time between [start, end].  Userspace
usually uses the midpoint between [start, end] to estimate the PCI
delay and match this with the PHC time.

 [start] |                |
   write |-------+        |
 |        \       |
    read |----+    +----->|
 |     \          * PHC time latched into register
 |      \         |
midpoint |       +------->|
 |                |
 |                |
 |           +----|
 |          /     |
 |<--------+      |
   [end] |                |

As the diagram indicates, the PHC time is latched before the midpoint,
so the system clock time is slightly off the real PHC time.  This shows
up as a phase error with an oscilliscope.

The workaround here is to provide a tunable which reduces (shrinks)
the end time in the above diagram.  This in turn moves the calculated
midpoint so the system time and PHC time are in agreemment.

Currently, the adjustment reduces the end time by 3/16th of the entire
window.  E.g.:  [start, end] ==> [start, (end - (3/16 * end)], which
produces reasonably good results.

Also reduce delays by just writing to the clock control register
instead of performing a read/modify/write sequence, as the contents
of the control register are known.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Have FPGA fold in ns adjustment for adjtime.
Jonathan Lemon [Wed, 15 Sep 2021 02:16:34 +0000 (19:16 -0700)]
ptp: ocp: Have FPGA fold in ns adjustment for adjtime.

The current implementation of adjtime uses gettime/settime to
perform nanosecond adjustments.  This introduces addtional phase
errors due to delays.

Instead, use the FPGA's ability to just apply the nanosecond
adjustment to the clock directly.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Enable 4th timestamper / PPS generator
Jonathan Lemon [Wed, 15 Sep 2021 02:16:33 +0000 (19:16 -0700)]
ptp: ocp: Enable 4th timestamper / PPS generator

A 4th timestamper is added which timestamps the output of the PHC.

The clock nanosecond offset is not always zero, so when compared
to other timestampers, this provides precise measurements.

Also, the timestamper interrupt from the PHC can be used to generate
a PPS signal for /dev/pps.

Also allow PTP_CLK_REQ_PEROUT requests for a 1PPS output, but do
not actually configure any output pins, this is done via sysfs.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add second GNSS device
Jonathan Lemon [Wed, 15 Sep 2021 02:16:32 +0000 (19:16 -0700)]
ptp: ocp: Add second GNSS device

Upcoming boards may have a second GNSS receiver, getting information
from a different constellation than the first receiver, which provides
some measure of anti-spoofing.

Expose the sysfs attribute for this device, if detected.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add NMEA output
Jonathan Lemon [Wed, 15 Sep 2021 02:16:31 +0000 (19:16 -0700)]
ptp: ocp: Add NMEA output

The timecard can provide a NMEA-1083 ZDA (time and date) output
string on a serial port, which can be used to drive other devices.

Add the NMEA resources, and the serial port as a sysfs attribute.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add debugfs entry for timecard
Jonathan Lemon [Wed, 15 Sep 2021 02:16:30 +0000 (19:16 -0700)]
ptp: ocp: Add debugfs entry for timecard

Provide a view into the timecard internals for debugging.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Separate the init and info logic
Jonathan Lemon [Wed, 15 Sep 2021 02:16:29 +0000 (19:16 -0700)]
ptp: ocp: Separate the init and info logic

On startup, parts of the FPGA need to be initialized - break these
out into their own functions, separate from the purely informational
blocks.

On startup, distrbute the UTC:TAI offset from the NMEA GNSS parser,
if it is available.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add sysfs attribute utc_tai_offset
Jonathan Lemon [Wed, 15 Sep 2021 02:16:28 +0000 (19:16 -0700)]
ptp: ocp: Add sysfs attribute utc_tai_offset

IRIG and DCF output time in UTC, but the timecard operates
on TAI internally.  Add an attribute node which allows adding
an offset to these modes before output.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add IRIG-B output mode control
Jonathan Lemon [Wed, 15 Sep 2021 02:16:27 +0000 (19:16 -0700)]
ptp: ocp: Add IRIG-B output mode control

IRIG-B has several different output formats, the timecard defaults
to using B007.  Add a control which selects different output modes.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add IRIG-B and DCF blocks
Jonathan Lemon [Wed, 15 Sep 2021 02:16:26 +0000 (19:16 -0700)]
ptp: ocp: Add IRIG-B and DCF blocks

IRIG (Inter-range Instrumentation Group) timecode format on
one of the SMA output channels is provided by the IRIG master
FPGA block.  Enable the master when the IRIG output format is
selected on either one of the output channels.

By default, the output is in B007 format.

DCF output format is provided by the DCF master block.

Also enable the IRIG and DCF slaves, which parse an incoming
signal from the external SMA connectors, and may be used to
adjust the PHC.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add SMA selector and controls
Jonathan Lemon [Wed, 15 Sep 2021 02:16:25 +0000 (19:16 -0700)]
ptp: ocp: Add SMA selector and controls

The latest firmware for the TimeCard adds selectable signals for
the SMA input/outputs.  Add support for SMA selectors, and the
GPIO controls needed for steering signals.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add third timestamper
Jonathan Lemon [Wed, 15 Sep 2021 02:16:24 +0000 (19:16 -0700)]
ptp: ocp: Add third timestamper

The firmware may provide a third signal timestamper, so make it
available for use.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Report error if resource registration fails.
Jonathan Lemon [Wed, 15 Sep 2021 02:16:23 +0000 (19:16 -0700)]
ptp: ocp: Report error if resource registration fails.

If a resource could not be registered, report the name of
the resource and the error code.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Skip resources with out of range irqs
Jonathan Lemon [Wed, 15 Sep 2021 02:16:22 +0000 (19:16 -0700)]
ptp: ocp: Skip resources with out of range irqs

The TimeCard exposes different resources, which may have their
own irqs.  Space for the irqs is allocated through a MSI or MSI-X
interrupt vector.  On some platforms, the interrupt allocation
fails.

Rather than making this fatal, just skip exposing those resources.

The main timecard functionality (that of a PTP clock) will work
without the additional resources.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Skip I2C flash read when there is no controller.
Jonathan Lemon [Wed, 15 Sep 2021 02:16:21 +0000 (19:16 -0700)]
ptp: ocp: Skip I2C flash read when there is no controller.

If an I2C controller isn't present, don't try and read the I2C flash.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Parameterize the TOD information display.
Jonathan Lemon [Wed, 15 Sep 2021 02:16:20 +0000 (19:16 -0700)]
ptp: ocp: Parameterize the TOD information display.

Only display the TOD information if there is a corresponding
TOD resource.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: parameterize the i2c driver used
Jonathan Lemon [Wed, 15 Sep 2021 02:16:19 +0000 (19:16 -0700)]
ptp: ocp: parameterize the i2c driver used

Move the xilinx i2c driver parameters to the resource block instead
of hardcoding things in the registration functions.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agodt-bindings: net: lantiq: Add the burst length properties
Aleksander Jan Bajkowski [Tue, 14 Sep 2021 21:21:05 +0000 (23:21 +0200)]
dt-bindings: net: lantiq: Add the burst length properties

The new added properties are used for configuring burst length.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agodt-bindings: net: lantiq,etop-xway: Document Lantiq Xway ETOP bindings
Aleksander Jan Bajkowski [Tue, 14 Sep 2021 21:21:04 +0000 (23:21 +0200)]
dt-bindings: net: lantiq,etop-xway: Document Lantiq Xway ETOP bindings

Document the Lantiq Xway SoC series External Bus Unit (ETOP) bindings.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agodt-bindings: net: lantiq-xrx200-net: convert to the json-schema
Aleksander Jan Bajkowski [Tue, 14 Sep 2021 21:21:03 +0000 (23:21 +0200)]
dt-bindings: net: lantiq-xrx200-net: convert to the json-schema

Convert the Lantiq PMAC Device Tree binding documentation to json-schema.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: lantiq: configure the burst length in ethernet drivers
Aleksander Jan Bajkowski [Tue, 14 Sep 2021 21:21:02 +0000 (23:21 +0200)]
net: lantiq: configure the burst length in ethernet drivers

Configure the burst length in Ethernet drivers. This improves
Ethernet performance by 58%. According to the vendor BSP,
8W burst length is supported by ar9 and newer SoCs.

The NAT benchmark results on xRX200 (Down/Up):
* 2W: 330 Mb/s
* 4W: 432 Mb/s    372 Mb/s
* 8W: 520 Mb/s    389 Mb/s

Tested on xRX200 and xRX330.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMIPS: lantiq: dma: make the burst length configurable by the drivers
Aleksander Jan Bajkowski [Tue, 14 Sep 2021 21:21:01 +0000 (23:21 +0200)]
MIPS: lantiq: dma: make the burst length configurable by the drivers

Make the burst length configurable by the drivers.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMIPS: lantiq: dma: fix burst length for DEU
Aleksander Jan Bajkowski [Tue, 14 Sep 2021 21:21:00 +0000 (23:21 +0200)]
MIPS: lantiq: dma: fix burst length for DEU

The current definition of 2W burst length is invalid.
This patch fixes it. Current downstream DEU driver doesn't
use DMA. An incorrect burst length value doesn't cause any
errors. This patch also adds other burst length values.

Fixes: dfec1a827d2b ("MIPS: Lantiq: Add DMA support")
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMIPS: lantiq: dma: reset correct number of channel
Aleksander Jan Bajkowski [Tue, 14 Sep 2021 21:20:59 +0000 (23:20 +0200)]
MIPS: lantiq: dma: reset correct number of channel

Different SoCs have a different number of channels, e.g .:
* amazon-se has 10 channels,
* danube+ar9 have 20 channels,
* vr9 has 28 channels,
* ar10 has 24 channels.

We can read the ID register and, depending on the reported
number of channels, reset the appropriate number of channels.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMIPS: lantiq: dma: add small delay after reset
Aleksander Jan Bajkowski [Tue, 14 Sep 2021 21:20:58 +0000 (23:20 +0200)]
MIPS: lantiq: dma: add small delay after reset

Reading the DMA registers immediately after the reset causes
Data Bus Error. Adding a small delay fixes this issue.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: dsa: tag_rtl4_a: Drop bit 9 from egress frames
Linus Walleij [Mon, 13 Sep 2021 14:31:56 +0000 (16:31 +0200)]
net: dsa: tag_rtl4_a: Drop bit 9 from egress frames

This drops the code setting bit 9 on egress frames on the
Realtek "type A" (RTL8366RB) frames.

This bit was set on ingress frames for unknown reason,
and was set on egress frames as the format of ingress
and egress frames was believed to be the same. As that
assumption turned out to be false, and since this bit
seems to have zero effect on the behaviour of the switch
let's drop this bit entirely.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20210913143156.1264570-1-linus.walleij@linaro.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agoMerge branch 'hns3-mac'
David S. Miller [Tue, 14 Sep 2021 13:32:29 +0000 (14:32 +0100)]
Merge branch 'hns3-mac'

Guangbin Huang says:

====================
PF support get MAC address space assigned by firmware

This series add support PF to get unicast/multicast MAC address space
assigned by firmware for the HNS3 ethernet driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: PF support get multicast MAC address space assigned by firmware
Guangbin Huang [Tue, 14 Sep 2021 12:11:17 +0000 (20:11 +0800)]
net: hns3: PF support get multicast MAC address space assigned by firmware

The new firmware supports to divides the whole multicast MAC address space
equally to functions of all PFs, and calculates the space size of each PF
according to its function number.

To support this feature, PF driver adds querying multicast MAC address
space size from firmware and limits used number according to space size.

Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: PF support get unicast MAC address space assigned by firmware
Guangbin Huang [Tue, 14 Sep 2021 12:11:16 +0000 (20:11 +0800)]
net: hns3: PF support get unicast MAC address space assigned by firmware

Currently, there are two ways for PF to set the unicast MAC address space
size: specified by config parameters in firmware or set to default value.

That's mean if the config parameters in firmware is zero, driver will
divide the whole unicast MAC address space equally to 8 PFs. However, in
this case, the unicast MAC address space will be wasted a lot when the
hardware actually has less then 8 PFs. And in the other hand, if one PF has
much more VFs than other PFs, then each function of this PF will has much
less address space than other PFs.

In order to ameliorate the above two situations, introduce the third way
of unicast MAC address space assignment: firmware divides the whole unicast
MAC address space equally to functions of all PFs, and calculates the space
size of each PF according to its function number. PF queries the space size
by the querying device specification command when in initialization
process.

The third way assignment is lower priority than specified by config
parameters, only if the config parameters is zero can be used, and if
firmware does not support the third way assignment, then driver still
divides the whole unicast MAC address space equally to 8 PFs.

Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: phy: at803x: add support for qca 8327 internal phy
Ansuel Smith [Tue, 14 Sep 2021 12:33:45 +0000 (14:33 +0200)]
net: phy: at803x: add support for qca 8327 internal phy

Add support for qca8327 internal phy needed for correct init of the
switch port. It does use the same qca8337 function and reg just with a
different id.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Tested-by: Rosen Penev <rosenp@gmail.com>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoskbuff: inline page_frag_alloc_align()
Yajun Deng [Tue, 14 Sep 2021 03:49:35 +0000 (11:49 +0800)]
skbuff: inline page_frag_alloc_align()

The __alloc_frag_align() is short, and only called by two functions,
so inline page_frag_alloc_align() for reduce the overhead of calls.

Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoethtool: prevent endless loop if eeprom size is smaller than announced
Heiner Kallweit [Mon, 13 Sep 2021 19:58:26 +0000 (21:58 +0200)]
ethtool: prevent endless loop if eeprom size is smaller than announced

It shouldn't happen, but can happen that readable eeprom size is smaller
than announced. Then we would be stuck in an endless loop here because
after reaching the actual end reads return eeprom.len = 0. I faced this
issue when making a mistake in driver development. Detect this scenario
and return an error.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: wwan: iosm: fix linux-next build error
M Chetan Kumar [Tue, 14 Sep 2021 05:48:01 +0000 (11:18 +0530)]
net: wwan: iosm: fix linux-next build error

Removed "stdbool.h" inclusion in iosm_ipc_imem.h

Fixes: 13bb8429ca98 ("net: wwan: iosm: firmware flashing and coredump collection")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: M Chetan Kumar <m.chetan.kumar@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ptp_clockmatrix: Add support for pll_mode=0 and manual ref switch of WF and WP
Min Li [Mon, 13 Sep 2021 20:12:34 +0000 (16:12 -0400)]
ptp: ptp_clockmatrix: Add support for pll_mode=0 and manual ref switch of WF and WP

Also correct how initialize_dco_operating_mode is called

Signed-off-by: Min Li <min.li.xe@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ptp_clockmatrix: Add support for FW 5.2 (8A34005)
Min Li [Mon, 13 Sep 2021 20:12:33 +0000 (16:12 -0400)]
ptp: ptp_clockmatrix: Add support for FW 5.2 (8A34005)

So far we don't need to support new 5.2 functions but different register
addresses

Signed-off-by: Min Li <min.li.xe@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ptp_clockmatrix: Remove idtcm_enable_tod_sync()
Min Li [Mon, 13 Sep 2021 20:12:32 +0000 (16:12 -0400)]
ptp: ptp_clockmatrix: Remove idtcm_enable_tod_sync()

Not need since TCS firmware file will configure it properlly.

Signed-off-by: Min Li <min.li.xe@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agor8169: remove support for chip version RTL_GIGA_MAC_VER_27
Heiner Kallweit [Mon, 13 Sep 2021 19:46:06 +0000 (21:46 +0200)]
r8169: remove support for chip version RTL_GIGA_MAC_VER_27

This patch is a follow-up to beb401ec5006 ("r8169: deprecate support for
RTL_GIGA_MAC_VER_27") that came with 5.12. Nobody complained, so let's
remove support for this chip version.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch 'smc-EDID-support'
David S. Miller [Tue, 14 Sep 2021 11:49:10 +0000 (12:49 +0100)]
Merge branch 'smc-EDID-support'

Guvenc Gulce says:

====================
net/smc: add EID support

please apply the following patch series for smc to netdev's net-next
tree. The series introduce the so called Enterprise ID support for smc
protocol. Including the generic netlink based interface.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet/smc: add generic netlink support for system EID
Karsten Graul [Tue, 14 Sep 2021 08:35:07 +0000 (10:35 +0200)]
net/smc: add generic netlink support for system EID

With SMC-Dv2 users can configure if the static system EID should be used
during CLC handshake, or if only user EIDs are allowed.
Add generic netlink support to enable and disable the system EID, and
to retrieve the system EID and its current enabled state.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Reviewed-by: Guvenc Gulce <guvenc@linux.ibm.com>
Signed-off-by: Guvenc Gulce <guvenc@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet/smc: keep static copy of system EID
Karsten Graul [Tue, 14 Sep 2021 08:35:06 +0000 (10:35 +0200)]
net/smc: keep static copy of system EID

The system EID is retrieved using an registered ISM device each time
when needed. This adds some unnecessary complexity at all places where
the system EID is needed, but no ISM device is at hand.
Simplify the code and save the system EID in a static variable in
smc_ism.c.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Reviewed-by: Guvenc Gulce <guvenc@linux.ibm.com>
Signed-off-by: Guvenc Gulce <guvenc@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet/smc: add support for user defined EIDs
Karsten Graul [Tue, 14 Sep 2021 08:35:05 +0000 (10:35 +0200)]
net/smc: add support for user defined EIDs

SMC-Dv2 allows users to define EIDs which allows to create separate
name spaces enabling users to cluster their SMC-Dv2 connections.
Add support for user defined EIDs and extent the generic netlink
interface so users can add, remove and dump EIDs.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Reviewed-by: Guvenc Gulce <guvenc@linux.ibm.com>
Signed-off-by: Guvenc Gulce <guvenc@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch 's390-next'
David S. Miller [Tue, 14 Sep 2021 11:46:30 +0000 (12:46 +0100)]
Merge branch 's390-next'

Karsten Graul says:

====================
s390/net: updates 2021-09-14

Please apply the following patches to netdev's net-next tree.

Stop using the wrappers in include/linux/pci-dma-compat.h,
and fix warnings about incorrect kernel-doc comments.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agos390/ism: switch from 'pci_' to 'dma_' API
Christophe JAILLET [Tue, 14 Sep 2021 08:33:20 +0000 (10:33 +0200)]
s390/ism: switch from 'pci_' to 'dma_' API

The wrappers in include/linux/pci-dma-compat.h should go away.

The patch has been generated with the coccinelle script below.

@@
expression e1, e2;
@@
-    pci_set_dma_mask(e1, e2)
+    dma_set_mask(&e1->dev, e2)

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agos390/netiucv: remove incorrect kernel doc indicators
Heiko Carstens [Tue, 14 Sep 2021 08:33:19 +0000 (10:33 +0200)]
s390/netiucv: remove incorrect kernel doc indicators

Many comments above functions start with a kernel doc indicator, but
the comments are not using kernel doc style. Get rid of the warnings
by simply removing the indicator.

E.g.:

drivers/s390/net/netiucv.c:1852: warning:
 This comment starts with '/**', but isn't a kernel-doc comment.

Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agos390/lcs: remove incorrect kernel doc indicators
Heiko Carstens [Tue, 14 Sep 2021 08:33:18 +0000 (10:33 +0200)]
s390/lcs: remove incorrect kernel doc indicators

Many comments above functions start with a kernel doc indicator, but
the comments are not using kernel doc style. Get rid of the warnings
by simply removing the indicator.

E.g.:

drivers/s390/net/lcs.c:2355: warning:
 This comment starts with '/**', but isn't a kernel-doc comment.

Acked-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agos390/ctcm: remove incorrect kernel doc indicators
Heiko Carstens [Tue, 14 Sep 2021 08:33:17 +0000 (10:33 +0200)]
s390/ctcm: remove incorrect kernel doc indicators

Many comments above functions start with a kernel doc indicator, but
the comments are not using kernel doc style. Get rid of the warnings
by simply removing the indicator.

E.g.:

drivers/s390/net/ctcm_main.c:979: warning:
 This comment starts with '/**', but isn't a kernel-doc comment.

Acked-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch 'mlxsw-next'
David S. Miller [Tue, 14 Sep 2021 11:44:17 +0000 (12:44 +0100)]
Merge branch 'mlxsw-next'

Ido Schimmel says:

====================
mlxsw: spectrum: Adjustments to port split and label port

Jiri says:

This patchset includes patches that prepare the driver to support modular
systems.

PLLP register is introduced to get front panel port label which is no
longer equivalent to "module + 1" for modular systems, where the
numbering is per line card.

So far for all systems all front panel ports had same format and could
be split to the same number of subports. This is no longer true for
modular systems, where every line card can have different types of front
panel ports.

The PMTDB register is introduced to easily query FW for split
capabilities of particular front panel port. It is generic for use in
modular and non-modular systems.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: reg: Remove PMTM register
Jiri Pirko [Tue, 14 Sep 2021 06:13:30 +0000 (09:13 +0300)]
mlxsw: reg: Remove PMTM register

It is not used anymore, remove it.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: spectrum: Use PMTDB register to obtain split info
Jiri Pirko [Tue, 14 Sep 2021 06:13:29 +0000 (09:13 +0300)]
mlxsw: spectrum: Use PMTDB register to obtain split info

Newly introduced PMTDB register is there to provide all needed info
about particular requested port split configuration. Use it instead of
figuring the info out manually in the driver.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: reg: Add Port Module To local DataBase Register
Jiri Pirko [Tue, 14 Sep 2021 06:13:28 +0000 (09:13 +0300)]
mlxsw: reg: Add Port Module To local DataBase Register

The PMTDB register allows to query the possible module<->local port
mapping than can be used in PMLP. It does not represent the actual/current
mapping of the local to module. Actual mapping is only defined by PMLP.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: spectrum: Use PLLP to get front panel number and split number
Jiri Pirko [Tue, 14 Sep 2021 06:13:27 +0000 (09:13 +0300)]
mlxsw: spectrum: Use PLLP to get front panel number and split number

Instead of relying on the values coming from the PMLP register, use PLLP
to get the information about port front panel number and split number.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: reg: Add Port Local port to Label Port mapping Register
Jiri Pirko [Tue, 14 Sep 2021 06:13:26 +0000 (09:13 +0300)]
mlxsw: reg: Add Port Local port to Label Port mapping Register

The PLLP register returns the mapping from Local Port into Label Port.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: spectrum: Move port SWID set before core port init
Jiri Pirko [Tue, 14 Sep 2021 06:13:25 +0000 (09:13 +0300)]
mlxsw: spectrum: Move port SWID set before core port init

During port creation, mlxsw_core_port_init() is called with the front
panel port number and the split port sub-number. Currently, this
information is determined by the driver without firmware assistance.

Subsequent patches are going to query this information from firmware,
but this requires the port to assigned to SWID.

Therefore, move port SWID assignment before mlxsw_core_port_init().

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: spectrum: Move port module mapping before core port init
Jiri Pirko [Tue, 14 Sep 2021 06:13:24 +0000 (09:13 +0300)]
mlxsw: spectrum: Move port module mapping before core port init

During port creation, mlxsw_core_port_init() is called with the front
panel port number and the split port sub-number. Currently, this
information is determined by the driver without firmware assistance.

Subsequent patches are going to query this information from firmware,
but this requires the port to be mapped to a module.

Therefore, move port mapping before mlxsw_core_port_init().

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: spectrum: Bump minimum FW version to xx.2008.3326
Jiri Pirko [Tue, 14 Sep 2021 06:13:23 +0000 (09:13 +0300)]
mlxsw: spectrum: Bump minimum FW version to xx.2008.3326

Add latest verified version of Nvidia Spectrum-family switch firmware,
for Spectrum (13.2008.3326), Spectrum-2 (29.2008.3326) and Spectrum-3
(30.2008.3326).

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: wwan: iosm: firmware flashing and coredump collection
M Chetan Kumar [Mon, 13 Sep 2021 13:04:12 +0000 (18:34 +0530)]
net: wwan: iosm: firmware flashing and coredump collection

This patch brings-in support for M.2 7560 Device firmware flashing &
coredump collection using devlink.
- Driver Registers with Devlink framework.
- Register devlink params callback for configuring device params
  required in flashing or coredump flow.
- Implements devlink ops flash_update callback that programs modem
  firmware.
- Creates region & snapshot required for device coredump log collection.

On early detection of device in boot rom stage. Driver registers with
Devlink framework and establish transport channel for PSI (Primary Signed
Image) injection. Once PSI is injected to device, the device execution
stage details are read to determine whether device is in flash or
exception mode. The collected information is reported to devlink user
space application & based on this informationi, application proceeds with
either modem firmware flashing or coredump collection.

Signed-off-by: M Chetan Kumar <m.chetan.kumar@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch 'nfc-printk-cleanup'
David S. Miller [Mon, 13 Sep 2021 13:38:47 +0000 (14:38 +0100)]
Merge branch 'nfc-printk-cleanup'

Krzysztof Kozlowski says:

====================
nfc: minor printk cleanup

Changes since v1:
1. Remove unused variable in pn533 (reported by kbuild).
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonfc: mrvl: drop unneeded memory allocation fail messages
Krzysztof Kozlowski [Mon, 13 Sep 2021 13:20:35 +0000 (15:20 +0200)]
nfc: mrvl: drop unneeded memory allocation fail messages

nci_skb_alloc() already prints an error message on memory allocation
failure.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonfc: microread: drop unneeded memory allocation fail messages
Krzysztof Kozlowski [Mon, 13 Sep 2021 13:20:34 +0000 (15:20 +0200)]
nfc: microread: drop unneeded memory allocation fail messages

nfc_mei_phy_alloc() already prints an error message on memory allocation
failure.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonfc: pn544: drop unneeded memory allocation fail messages
Krzysztof Kozlowski [Mon, 13 Sep 2021 13:20:28 +0000 (15:20 +0200)]
nfc: pn544: drop unneeded memory allocation fail messages

nfc_mei_phy_alloc() already prints an error message on memory allocation
failure.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonfc: pn544: drop unneeded debug prints
Krzysztof Kozlowski [Mon, 13 Sep 2021 13:20:27 +0000 (15:20 +0200)]
nfc: pn544: drop unneeded debug prints

ftrace is a preferred and standard way to debug entering and exiting
functions so drop useless debug prints.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonfc: pn533: use dev_err() instead of pr_err()
Krzysztof Kozlowski [Mon, 13 Sep 2021 13:20:26 +0000 (15:20 +0200)]
nfc: pn533: use dev_err() instead of pr_err()

Print error message with reference to a device.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonfc: pn533: drop unneeded debug prints
Krzysztof Kozlowski [Mon, 13 Sep 2021 13:20:25 +0000 (15:20 +0200)]
nfc: pn533: drop unneeded debug prints

ftrace is a preferred and standard way to debug entering and exiting
functions so drop useless debug prints.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonfc: fdp: drop unneeded debug prints
Krzysztof Kozlowski [Mon, 13 Sep 2021 13:20:24 +0000 (15:20 +0200)]
nfc: fdp: drop unneeded debug prints

ftrace is a preferred and standard way to debug entering and exiting
functions so drop useless debug prints.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonfc: do not break pr_debug() call into separate lines
Krzysztof Kozlowski [Mon, 13 Sep 2021 13:20:22 +0000 (15:20 +0200)]
nfc: do not break pr_debug() call into separate lines

Remove unneeded line break between pr_debug and arguments.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>