platform/kernel/linux-rpi.git
4 years agomlxsw: spectrum_qdisc: Support offloading of FIFO Qdisc
Petr Machata [Thu, 5 Mar 2020 07:16:43 +0000 (09:16 +0200)]
mlxsw: spectrum_qdisc: Support offloading of FIFO Qdisc

There are two peculiarities about offloading FIFO:

- sometimes the qdisc has an unspecified handle (it is "invisible")
- it may be created before the qdisc that it will be a child of

These features make the offload a bit more tricky. The approach chosen in
this patch is to make note of all the FIFOs that needed to be rejected
because their parents were not known. Later when the parent is created,
they are offloaded

FIFO is only offloaded for its counters, queue length is ignored.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_qdisc: Add handle parameter to ..._ops.replace
Petr Machata [Thu, 5 Mar 2020 07:16:42 +0000 (09:16 +0200)]
mlxsw: spectrum_qdisc: Add handle parameter to ..._ops.replace

PRIO and ETS will need to check the value of qdisc handle in their
handlers. Add it to the callback and propagate through.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_qdisc: Introduce struct mlxsw_sp_qdisc_state
Petr Machata [Thu, 5 Mar 2020 07:16:41 +0000 (09:16 +0200)]
mlxsw: spectrum_qdisc: Introduce struct mlxsw_sp_qdisc_state

In order to have a tidy structure where to put information related to Qdisc
offloads, introduce a new structure. Move there the two existing pieces of
data: root_qdisc and tclass_qdiscs. Embed them directly, because there's no
reason to go through pointer anymore. Convert users, update init/fini
functions.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: sched: Make FIFO Qdisc offloadable
Petr Machata [Thu, 5 Mar 2020 07:16:40 +0000 (09:16 +0200)]
net: sched: Make FIFO Qdisc offloadable

Invoke ndo_setup_tc() as appropriate to signal init / replacement,
destroying and dumping of pFIFO / bFIFO Qdisc.

A lot of the FIFO logic is used for pFIFO_head_drop as well, but that's a
semantically very different Qdisc that isn't really in the same boat as
pFIFO / bFIFO. Split some of the functions to keep the Qdisc intact.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'ethtool-consolidate-parameter-checking-for-irq-coalescing'
David S. Miller [Thu, 5 Mar 2020 20:12:35 +0000 (12:12 -0800)]
Merge branch 'ethtool-consolidate-parameter-checking-for-irq-coalescing'

Jakub Kicinski says:

====================
ethtool: consolidate parameter checking for irq coalescing

This set aims to simplify and unify the unsupported irq
coalescing parameter handling.

First patch adds a bitmask which drivers should fill in
in their ethtool_ops structs to declare which parameters
they support. Core will then ensure that driver callback
won't see any parameter outside of that set.

This allows us to save some LoC and make sure all drivers
respond the same to unsupported parameters.

If any parameter driver does not support is set to a value
other than 0 core will return -EINVAL. In the future we can
reject any present but unsupported netlink attribute, without
assuming 0 means unset. We can also add some prints or extack,
perhaps a'la Intel's current code.

I started converting the drivers alphabetically but then
realized that for the first set it's probably best to
address a representative mix of actively developed drivers.

According to my unreliable math there are roughly 69 drivers
in the tree which support some form of interrupt coalescing
settings via ethtool. Of these roughly 17 reject parameters
they don't support.

I hope drivers which ignore the parameters don't care, and
won't care about the slight change in behavior. Once all
drivers are converted we can make the checking mandatory.

I've only tested the e1000e and virtio patches, the rest builds.

v2: fix up ice and virtio conversions
v3: (patch 1)
    - move the (temporary) check if driver defines types
      earlier (Michal)
    - rename used_types -> nonzero_params, and
      coalesce_types -> supported_coalesce_params (Alex)
    - use EOPNOTSUPP instead of EINVAL (Andrew, Michal)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agovirtio_net: reject unsupported coalescing params
Jakub Kicinski [Thu, 5 Mar 2020 05:15:42 +0000 (21:15 -0800)]
virtio_net: reject unsupported coalescing params

Set ethtool_ops->supported_coalesce_params to let
the core reject unsupported coalescing parameters.

This driver correctly rejects all unsupported parameters.
As a side effect of these changes the error code for
unsupported params changes from EINVAL to EOPNOTSUPP.

v2: correctly handle rx-frames (and adjust the commit msg)
v3: adjust commit message for new error code and member name

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoe1000e: reject unsupported coalescing params
Jakub Kicinski [Thu, 5 Mar 2020 05:15:41 +0000 (21:15 -0800)]
e1000e: reject unsupported coalescing params

Set ethtool_ops->supported_coalesce_params to let
the core reject unsupported coalescing parameters.

This driver did not previously reject unsupported parameters.

v3: adjust commit message for new member name

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlx5: reject unsupported coalescing params
Jakub Kicinski [Thu, 5 Mar 2020 05:15:40 +0000 (21:15 -0800)]
mlx5: reject unsupported coalescing params

Set ethtool_ops->supported_coalesce_params to let
the core reject unsupported coalescing parameters.

This driver did not previously reject unsupported parameters.

v3: adjust commit message for new member name

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt: reject unsupported coalescing params
Jakub Kicinski [Thu, 5 Mar 2020 05:15:39 +0000 (21:15 -0800)]
bnxt: reject unsupported coalescing params

Set ethtool_ops->supported_coalesce_params to let
the core reject unsupported coalescing parameters.

This driver did not previously reject unsupported parameters.

v3: adjust commit message for new member name

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoice: let core reject the unsupported coalescing parameters
Jakub Kicinski [Thu, 5 Mar 2020 05:15:38 +0000 (21:15 -0800)]
ice: let core reject the unsupported coalescing parameters

Set ethtool_ops->supported_coalesce_params to let
the core reject unsupported coalescing parameters.

This driver correctly rejects all unsupported parameters.
As a side effect of these changes the info message about
the bad parameter will no longer be printed. We also
always reject the tx_coalesce_usecs_high param, even
if the target queue pair does not have a TX queue.
Error code changes from EINVAL to EOPNOTSUPP.

v2: allow adaptive TX
v3: adjust commit message for new error code and member name

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agohisilicon: let core reject the unsupported coalescing parameters
Jakub Kicinski [Thu, 5 Mar 2020 05:15:37 +0000 (21:15 -0800)]
hisilicon: let core reject the unsupported coalescing parameters

Set ethtool_ops->supported_coalesce_params to let
the core reject unsupported coalescing parameters.

This driver correctly rejects all unsupported parameters.
No functional changes.

v3: adjust commit message for new error code and member name

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoionic: let core reject the unsupported coalescing parameters
Jakub Kicinski [Thu, 5 Mar 2020 05:15:36 +0000 (21:15 -0800)]
ionic: let core reject the unsupported coalescing parameters

Set ethtool_ops->supported_coalesce_params to let
the core reject unsupported coalescing parameters.

This driver correctly rejects all unsupported parameters.
As a side effect of these changes the error code for
unsupported params changes from EINVAL to EOPNOTSUPP.

v3: adjust commit message for new error code and member name

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonfp: let core reject the unsupported coalescing parameters
Jakub Kicinski [Thu, 5 Mar 2020 05:15:35 +0000 (21:15 -0800)]
nfp: let core reject the unsupported coalescing parameters

Set ethtool_ops->supported_coalesce_params to let
the core reject unsupported coalescing parameters.

This driver correctly rejects all unsupported parameters.
No functional changes.

v3: adjust commit message for new error code and member name

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agostmmac: let core reject the unsupported coalescing parameters
Jakub Kicinski [Thu, 5 Mar 2020 05:15:34 +0000 (21:15 -0800)]
stmmac: let core reject the unsupported coalescing parameters

Set ethtool_ops->supported_coalesce_params to let
the core reject unsupported coalescing parameters.

This driver correctly rejects all unsupported parameters.
No functional changes.

v3: adjust commit message for new error code and member name

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoenic: let core reject the unsupported coalescing parameters
Jakub Kicinski [Thu, 5 Mar 2020 05:15:33 +0000 (21:15 -0800)]
enic: let core reject the unsupported coalescing parameters

Set ethtool_ops->supported_coalesce_params to let
the core reject unsupported coalescing parameters.

This driver correctly rejects all unsupported parameters.
The error code changes from EINVAL to EOPNOTSUPP.

v3: adjust commit message for new error code and member name

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoxgbe: let core reject the unsupported coalescing parameters
Jakub Kicinski [Thu, 5 Mar 2020 05:15:32 +0000 (21:15 -0800)]
xgbe: let core reject the unsupported coalescing parameters

Set ethtool_ops->supported_coalesce_params to let
the core reject unsupported coalescing parameters.

This driver correctly rejects all unsupported parameters.
We are only losing the error print.

v3: adjust commit message for new error code and member name

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoethtool: add infrastructure for centralized checking of coalescing parameters
Jakub Kicinski [Thu, 5 Mar 2020 05:15:31 +0000 (21:15 -0800)]
ethtool: add infrastructure for centralized checking of coalescing parameters

Linux supports 22 different interrupt coalescing parameters.
No driver implements them all. Some drivers just ignore the
ones they don't support, while others have to carry a long
list of checks to reject unsupported settings.

To simplify the drivers add the ability to specify inside
ethtool_ops which parameters are supported and let the core
reject attempts to set any other one.

This commit makes the mechanism an opt-in, only drivers which
set ethtool_opts->coalesce_types to a non-zero value will have
the checks enforced.

The same mask is used for global and per queue settings.

v3: - move the (temporary) check if driver defines types
      earlier (Michal)
    - rename used_types -> nonzero_params, and
      coalesce_types -> supported_coalesce_params (Alex)
    - use EOPNOTSUPP instead of EINVAL (Andrew, Michal)

Leaving the long series of ifs for now, it seems nice to
be able to grep for the field and flag names. This will
probably have to be revisited once netlink support lands.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agohsr: fix refcnt leak of hsr slave interface
Taehee Yoo [Thu, 5 Mar 2020 00:02:54 +0000 (00:02 +0000)]
hsr: fix refcnt leak of hsr slave interface

In the commit e0a4b99773d3 ("hsr: use upper/lower device infrastructure"),
dev_get() was removed but dev_put() in the error path wasn't removed.
So, if creating hsr interface command is failed, the reference counter leak
of lower interface would occur.

Test commands:
    ip link add dummy0 type dummy
    ip link add ipvlan0 link dummy0 type ipvlan mode l2
    ip link add ipvlan1 link dummy0 type ipvlan mode l2
    ip link add hsr0 type hsr slave1 ipvlan0 slave2 ipvlan1
    ip link del ipvlan0

Result:
[  633.271992][ T1280] unregister_netdevice: waiting for ipvlan0 to become free. Usage count = -1

Fixes: e0a4b99773d3 ("hsr: use upper/lower device infrastructure")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'rmnet-cleanups'
David S. Miller [Thu, 5 Mar 2020 19:47:10 +0000 (11:47 -0800)]
Merge branch 'rmnet-cleanups'

Taehee Yoo says:

====================
net: rmnet: several code cleanup for rmnet module

This patchset is to cleanup rmnet module code.

1. The first patch is to add module alias
rmnet module can not be loaded automatically because there is no
alias name.

2. The second patch is to add extack error message code.
When rmnet netlink command fails, it doesn't print any error message.
So, users couldn't know the exact reason.
In order to tell the exact reason to the user, the extack error message
is used in this patch.

3. The third patch is to use GFP_KERNEL instead of GFP_ATOMIC.
In the sleepable context, GFP_KERNEL can be used.
So, in this patch, GFP_KERNEL is used instead of GFP_ATOMIC.

Change log:
 - v1->v2: change error message in the second patch.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: rmnet: use GFP_KERNEL instead of GFP_ATOMIC
Taehee Yoo [Wed, 4 Mar 2020 23:25:43 +0000 (23:25 +0000)]
net: rmnet: use GFP_KERNEL instead of GFP_ATOMIC

In the current code, rmnet_register_real_device() and rmnet_newlink()
are using GFP_ATOMIC.
But, these functions are allowed to sleep.
So, GFP_KERNEL can be used.

Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: rmnet: print error message when command fails
Taehee Yoo [Wed, 4 Mar 2020 23:25:22 +0000 (23:25 +0000)]
net: rmnet: print error message when command fails

When rmnet netlink command fails, it doesn't print any error message.
So, users couldn't know the exact reason.
In order to tell the exact reason to the user, the extack error message
is used in this patch.

Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: rmnet: add missing module alias
Taehee Yoo [Wed, 4 Mar 2020 23:24:42 +0000 (23:24 +0000)]
net: rmnet: add missing module alias

In the current rmnet code, there is no module alias.
So, RTNL couldn't load rmnet module automatically.

Test commands:
    ip link add dummy0 type dummy
    modprobe -rv rmnet
    ip link add rmnet0 link dummy0 type rmnet  mux_id 1

Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'marvell10g-tunable-and-power-saving-support'
David S. Miller [Wed, 4 Mar 2020 22:41:52 +0000 (14:41 -0800)]
Merge branch 'marvell10g-tunable-and-power-saving-support'

Russell King says:

====================
marvell10g tunable and power saving support

This patch series adds support for:
- mdix configuration (auto, mdi, mdix)
- energy detect power down (edpd)
- placing in edpd mode at probe

for both the 88x3310 and 88x2110 PHYs.

Antione, could you test this for the 88x2110 PHY please?

v3: fix return code in get_tunable/set_tunable
v2: fix comments from Antione.
====================

Tested-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: marvell10g: place in powersave mode at probe
Russell King [Tue, 3 Mar 2020 18:08:45 +0000 (18:08 +0000)]
net: phy: marvell10g: place in powersave mode at probe

Place the 88x3310 into powersaving mode when probing, which saves 600mW
per PHY. For both PHYs on the Macchiatobin double-shot, this saves
about 10% of the board idle power.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: marvell10g: add energy detect power down tunable
Russell King [Tue, 3 Mar 2020 18:08:40 +0000 (18:08 +0000)]
net: phy: marvell10g: add energy detect power down tunable

Add support for the energy detect power down tunable, which saves
around 600mW when the link is down. The 88x3310 supports off, rx-only
and NLP every second. Enable EDPD by default for 88x3310.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: marvell10g: add mdix control
Russell King [Tue, 3 Mar 2020 18:08:34 +0000 (18:08 +0000)]
net: phy: marvell10g: add mdix control

Add support for controlling the MDI-X state of the PHY.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'PCI-Add-and-use-constant-PCI_STATUS_ERROR_BITS-and-helper-pci_status_ge...
David S. Miller [Wed, 4 Mar 2020 22:21:00 +0000 (14:21 -0800)]
Merge branch 'PCI-Add-and-use-constant-PCI_STATUS_ERROR_BITS-and-helper-pci_status_get_and_clear_errors'

Heiner Kallweit says:

====================
PCI: Add and use constant PCI_STATUS_ERROR_BITS and helper pci_status_get_and_clear_errors

Several drivers have own definitions for this constant, so move it
to the PCI core. In addition in multiple places the following code
sequence is used:
1. Read PCI_STATUS
2. Mask out non-error bits
3. Action based on set error bits
4. Write back set error bits to clear them

As this is a repeated pattern, add a helper to the PCI core.

Most affected drivers are network drivers. But as it's about core
PCI functionality, I suppose the series should go through the PCI
tree.

v2:
- fix formal issue with cover letter
v3:
- fix dumb typo in patch 7
v4:
- add patches 1-3
- move new constant PCI_STATUS_ERROR_BITS to include/linux/pci.h
- small improvements in commit messages
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosound: bt87x: use pci_status_get_and_clear_errors
Heiner Kallweit [Sat, 29 Feb 2020 22:29:07 +0000 (23:29 +0100)]
sound: bt87x: use pci_status_get_and_clear_errors

Use new helper pci_status_get_and_clear_errors() to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoPCI: pci-bridge-emul: Use new constant PCI_STATUS_ERROR_BITS
Heiner Kallweit [Sat, 29 Feb 2020 22:28:18 +0000 (23:28 +0100)]
PCI: pci-bridge-emul: Use new constant PCI_STATUS_ERROR_BITS

Use new constant PCI_STATUS_ERROR_BITS to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: skfp: use new constant PCI_STATUS_ERROR_BITS
Heiner Kallweit [Sat, 29 Feb 2020 22:27:34 +0000 (23:27 +0100)]
net: skfp: use new constant PCI_STATUS_ERROR_BITS

Use new PCI core constant PCI_STATUS_ERROR_BITS to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: sun: use pci_status_get_and_clear_errors
Heiner Kallweit [Sat, 29 Feb 2020 22:26:49 +0000 (23:26 +0100)]
net: sun: use pci_status_get_and_clear_errors

Use new helper pci_status_get_and_clear_errors() to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: use pci_status_get_and_clear_errors
Heiner Kallweit [Sat, 29 Feb 2020 22:25:05 +0000 (23:25 +0100)]
r8169: use pci_status_get_and_clear_errors

Use new helper pci_status_get_and_clear_errors() to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoPCI: Add pci_status_get_and_clear_errors
Heiner Kallweit [Sat, 29 Feb 2020 22:24:23 +0000 (23:24 +0100)]
PCI: Add pci_status_get_and_clear_errors

Several drivers use the following code sequence:
1. Read PCI_STATUS
2. Mask out non-error bits
3. Action based on error bits set
4. Write back set error bits to clear them

As this is a repeated pattern, add a helper to the PCI core.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoPCI: Add constant PCI_STATUS_ERROR_BITS
Heiner Kallweit [Sat, 29 Feb 2020 22:23:44 +0000 (23:23 +0100)]
PCI: Add constant PCI_STATUS_ERROR_BITS

This collection of PCI error bits is used in more than one driver,
so move it to the PCI core.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: add PCI_STATUS_PARITY to PCI status error bits
Heiner Kallweit [Sat, 29 Feb 2020 22:22:55 +0000 (23:22 +0100)]
r8169: add PCI_STATUS_PARITY to PCI status error bits

In preparation of factoring out PCI_STATUS error bit handling let drivers
use the same collection of error bits. To facilitate bisecting we do this
in a separate patch per affected driver. For the r8169 driver we have to
add PCI_STATUS_PARITY to the error bits.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: skfp: add PCI_STATUS_REC_TARGET_ABORT to PCI status error bits
Heiner Kallweit [Sat, 29 Feb 2020 22:21:45 +0000 (23:21 +0100)]
net: skfp: add PCI_STATUS_REC_TARGET_ABORT to PCI status error bits

In preparation of factoring out PCI_STATUS error bit handling let drivers
use the same collection of error bits. To facilitate bisecting we do this
in a separate patch per affected driver. For the skfp driver we have to
add PCI_STATUS_REC_TARGET_ABORT to the error bits.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: marvell: add PCI_STATUS_SIG_TARGET_ABORT to PCI status error bits
Heiner Kallweit [Sat, 29 Feb 2020 22:20:32 +0000 (23:20 +0100)]
net: marvell: add PCI_STATUS_SIG_TARGET_ABORT to PCI status error bits

In preparation of factoring out PCI_STATUS error bit handling let drivers
use the same collection of error bits. To facilitate bisecting we do this
in a separate patch per affected driver. For the Marvell drivers we have
to add PCI_STATUS_SIG_TARGET_ABORT to the error bits.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'Allow-unknown-unicast-traffic-to-CPU-for-Felix-DSA'
David S. Miller [Wed, 4 Mar 2020 22:19:23 +0000 (14:19 -0800)]
Merge branch 'Allow-unknown-unicast-traffic-to-CPU-for-Felix-DSA'

Vladimir Oltean says:

====================
Allow unknown unicast traffic to CPU for Felix DSA

This is the continuation of the previous "[PATCH net-next] net: mscc:
ocelot: Workaround to allow traffic to CPU in standalone mode":

https://www.spinics.net/lists/netdev/msg631067.html

Following the feedback received from Allan Nielsen, the Ocelot and Felix
drivers were made to use the CPU port module in the same way (patch 1),
and Felix was made to additionally allow unknown unicast frames towards
the CPU port module (patch 2).
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: felix: Allow unknown unicast traffic towards the CPU port module
Vladimir Oltean [Sat, 29 Feb 2020 14:50:03 +0000 (16:50 +0200)]
net: dsa: felix: Allow unknown unicast traffic towards the CPU port module

Compared to other DSA switches, in the Ocelot cores, the RX filtering is
a much more important concern.

Firstly, the primary use case for Ocelot is non-DSA, so there isn't any
secondary Ethernet MAC [the DSA master's one] to implicitly drop frames
having a DMAC we are not interested in.  So the switch driver itself
needs to install FDB entries towards the CPU port module (PGID_CPU) for
the MAC address of each switch port, in each VLAN installed on the port.
Every address that is not whitelisted is implicitly dropped. This is in
order to achieve a behavior similar to N standalone net devices.

Secondly, even in the secondary use case of DSA, such as illustrated by
Felix with the NPI port mode, that secondary Ethernet MAC is present,
but its RX filter is bypassed. This is because the DSA tags themselves
are placed before Ethernet, so the DMAC that the switch ports see is
not seen by the DSA master too (since it's shifter to the right).

So RX filtering is pretty important. A good RX filter won't bother the
CPU in case the switch port receives a frame that it's not interested
in, and there exists no other line of defense.

Ocelot is pretty strict when it comes to RX filtering: non-IP multicast
and broadcast traffic is allowed to go to the CPU port module, but
unknown unicast isn't. This means that traffic reception for any other
MAC addresses than the ones configured on each switch port net device
won't work. This includes use cases such as macvlan or bridging with a
non-Ocelot (so-called "foreign") interface. But this seems to be fine
for the scenarios that the Linux system embedded inside an Ocelot switch
is intended for - it is simply not interested in unknown unicast
traffic, as explained in Allan Nielsen's presentation [0].

On the other hand, the Felix DSA switch is integrated in more
general-purpose Linux systems, so it can't afford to drop that sort of
traffic in hardware, even if it will end up doing so later, in software.

Actually, unknown unicast means more for Felix than it does for Ocelot.
Felix doesn't attempt to perform the whitelisting of switch port MAC
addresses towards PGID_CPU at all, mainly because it is too complicated
to be feasible: while the MAC addresses are unique in Ocelot, by default
in DSA all ports are equal and inherited from the DSA master. This adds
into account the question of reference counting MAC addresses (delayed
ocelot_mact_forget), not to mention reference counting for the VLAN IDs
that those MAC addresses are installed in. This reference counting
should be done in the DSA core, and the fact that it wasn't needed so
far is due to the fact that the other DSA switches don't have the DSA
tag placed before Ethernet, so the DSA master is able to whitelist the
MAC addresses in hardware.

So this means that even regular traffic termination on a Felix switch
port happens through flooding (because neither Felix nor Ocelot learn
source MAC addresses from CPU-injected frames).

So far we've explained that whitelisting towards PGID_CPU:
- helps to reduce the likelihood of spamming the CPU with frames it
  won't process very far anyway
- is implemented in the ocelot driver
- is sufficient for the ocelot use cases
- is not feasible in DSA
- breaks use cases in DSA, in the current status (whitelisting enabled
  but no MAC address whitelisted)

So the proposed patch allows unknown unicast frames to be sent to the
CPU port module. This is done for the Felix DSA driver only, as Ocelot
seems to be happy without it.

[0]: https://www.youtube.com/watch?v=B1HhxEcU7Jg

Suggested-by: Allan W. Nielsen <allan.nielsen@microchip.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Allan W. Nielsen <allan.nielsen@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mscc: ocelot: eliminate confusion between CPU and NPI port
Vladimir Oltean [Sat, 29 Feb 2020 14:50:02 +0000 (16:50 +0200)]
net: mscc: ocelot: eliminate confusion between CPU and NPI port

Ocelot has the concept of a CPU port. The CPU port is represented in the
forwarding and the queueing system, but it is not a physical device. The
CPU port can either be accessed via register-based injection/extraction
(which is the case of Ocelot), via Frame-DMA (similar to the first one),
or "connected" to a physical Ethernet port (called NPI in the datasheet)
which is the case of the Felix DSA switch.

In Ocelot the CPU port is at index 11.
In Felix the CPU port is at index 6.

The CPU bit is treated special in the forwarding, as it is never cleared
from the forwarding port mask (once added to it). Other than that, it is
treated the same as a normal front port.

Both Felix and Ocelot should use the CPU port in the same way. This
means that Felix should not use the NPI port directly when forwarding to
the CPU, but instead use the CPU port.

This patch is fixing this such that Felix will use port 6 as its CPU
port, and just use the NPI port to carry the traffic.

Therefore, eliminate the "ocelot->cpu" variable which was holding the
index of the NPI port for Felix, and the index of the CPU port module
for Ocelot, so the variable was actually configuring different things
for different drivers and causing at least part of the confusion.

Also remove the "ocelot->num_cpu_ports" variable, which is the result of
another confusion. The 2 CPU ports mentioned in the datasheet are
because there are two frame extraction channels (register based or DMA
based). This is of no relevance to the driver at the moment, and
invisible to the analyzer module.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Suggested-by: Allan W. Nielsen <allan.nielsen@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'pie-minor-improvements'
David S. Miller [Wed, 4 Mar 2020 21:25:55 +0000 (13:25 -0800)]
Merge branch 'pie-minor-improvements'

Leslie Monis says:

====================
pie: minor improvements

This patch series includes the following minor changes with
respect to the PIE/FQ-PIE qdiscs:

 - Patch 1 removes some ambiguity by using the term "backlog"
           instead of "qlen" when referring to the queue length
           in bytes.
 - Patch 2 removes redundant type casting on two expressions.
 - Patch 3 removes the pie_vars->accu_prob_overflows variable
           without affecting the precision in calculations and
           makes the size of the pie_vars structure exactly 64
           bytes.
 - Patch 4 realigns a comment affected by a change in patch 3.

Changes from v1 to v2:
 - Kept 8 as the argument to prandom_bytes() instead of changing it
   to 7 as suggested by David Miller.
====================

Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agopie: realign comment
Leslie Monis [Wed, 4 Mar 2020 18:56:02 +0000 (00:26 +0530)]
pie: realign comment

Realign a comment after the change introduced by the
previous patch.

Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agopie: remove pie_vars->accu_prob_overflows
Leslie Monis [Wed, 4 Mar 2020 18:56:01 +0000 (00:26 +0530)]
pie: remove pie_vars->accu_prob_overflows

The variable pie_vars->accu_prob is used as an accumulator for
probability values. Since probabilty values are scaled using the
MAX_PROB macro denoting (2^64 - 1), pie_vars->accu_prob is
likely to overflow as it is of type u64.

The variable pie_vars->accu_prob_overflows counts the number of
times the variable pie_vars->accu_prob overflows.

The MAX_PROB macro needs to be equal to at least (2^39 - 1) in
order to do precise calculations without any underflow. Thus
MAX_PROB can be reduced to (2^56 - 1) without affecting the
precision in calculations drastically. Doing so will eliminate
the need for the variable pie_vars->accu_prob_overflows as the
variable pie_vars->accu_prob will never overflow.

Removing the variable pie_vars->accu_prob_overflows also reduces
the size of the structure pie_vars to exactly 64 bytes.

Signed-off-by: Mohit P. Tahiliani <tahiliani@nitk.edu.in>
Signed-off-by: Gautam Ramakrishnan <gautamramk@gmail.com>
Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agopie: remove unnecessary type casting
Leslie Monis [Wed, 4 Mar 2020 18:56:00 +0000 (00:26 +0530)]
pie: remove unnecessary type casting

In function pie_calculate_probability(), the variables alpha and
beta are of type u64. The variables qdelay, qdelay_old and
params->target are of type psched_time_t (which is also u64).
The explicit type casting done when calculating the value for
the variable delta is redundant and not required.

Signed-off-by: Mohit P. Tahiliani <tahiliani@nitk.edu.in>
Signed-off-by: Gautam Ramakrishnan <gautamramk@gmail.com>
Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agopie: use term backlog instead of qlen
Leslie Monis [Wed, 4 Mar 2020 18:55:59 +0000 (00:25 +0530)]
pie: use term backlog instead of qlen

Remove ambiguity by using the term backlog instead of qlen when
representing the queue length in bytes.

Signed-off-by: Mohit P. Tahiliani <tahiliani@nitk.edu.in>
Signed-off-by: Gautam Ramakrishnan <gautamramk@gmail.com>
Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'act_ct-software-offload-of-established-flows-fixes'
David S. Miller [Wed, 4 Mar 2020 19:05:04 +0000 (11:05 -0800)]
Merge branch 'act_ct-software-offload-of-established-flows-fixes'

Paul Blakey says:

====================
Fixes for tc act_ct software offload of established flows (diff v4->v6)

v4 of the original patchset was accidentally merged while we moved ahead
with v6 review. This two patches are the diff between v4 that was merged and
v6 that was the final revision, which was acked by the community.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/sched: act_ct: Use pskb_network_may_pull()
Paul Blakey [Wed, 4 Mar 2020 11:49:39 +0000 (13:49 +0200)]
net/sched: act_ct: Use pskb_network_may_pull()

To make the filler functions more generic, use network
relative skb pulling.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/sched: act_ct: Fix ipv6 lookup of offloaded connections
Paul Blakey [Wed, 4 Mar 2020 11:49:38 +0000 (13:49 +0200)]
net/sched: act_ct: Fix ipv6 lookup of offloaded connections

When checking the protocol number tcf_ct_flow_table_lookup() handles
the flow as if it's always ipv4, while it can be ipv6.

Instead, refactor the code to fetch the tcp header, if available,
in the relevant family (ipv4/ipv6) filler function, and do the
check on the returned tcp header.

Fixes: 46475bb20f4b ("net/sched: act_ct: Software offload of established flows")
Signed-off-by: Paul Blakey <paulb@mellanox.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agogianfar: remove unnecessary zeroing coalesce settings
Jakub Kicinski [Wed, 4 Mar 2020 02:26:12 +0000 (18:26 -0800)]
gianfar: remove unnecessary zeroing coalesce settings

Core already zeroes out the struct ethtool_coalesce structure,
drivers don't have to set every field to 0 individually.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'Wire-up-Ocelot-tc-flower-to-Felix-DSA'
David S. Miller [Wed, 4 Mar 2020 02:58:02 +0000 (18:58 -0800)]
Merge branch 'Wire-up-Ocelot-tc-flower-to-Felix-DSA'

Vladimir Oltean says:

====================
Wire up Ocelot tc-flower to Felix DSA

This series is a proposal on how to wire up the tc-flower callbacks into
DSA. The example taken is the Microchip Felix switch, whose core
implementation is actually located in drivers/net/ethernet/mscc/.

The proposal is largely a compromise solution. The DSA middle layer
handles just enough to get to the interesting stuff (FLOW_CLS_REPLACE,
FLOW_CLS_DESTROY, FLOW_CLS_STATS), but also thin enough to let drivers
decide what filter keys and actions they support without worrying that
the DSA middle layer will grow exponentially. I am far from being an
expert, so I am asking reviewers to please voice your opinion if you
think it can be done differently, with better results.

The bulk of the work was actually refactoring the ocelot driver enough
to allow the VCAP (Versatile Content-Aware Processor) code for vsc7514
and the vsc9959 switch cores to live together.

Flow block offloads have not been tested yet, only filters attached to a
single port. It might be as simple as replacing ocelot_ace_rule_create
with something smarter, it might be more complicated, I haven't tried
yet.

I should point out that the tc-matchall filter offload is not
implemented in the same manner in current mainline. Florian has already
went all the way down into exposing actual per-action callbacks,
starting with port mirroring. Because currently only mirred is supported
by this DSA mid layer, everything else will return -EOPNOTSUPP. So even
though ocelot supports matchall (aka port-based) policers, we don't have
a call path to call into them.  Personally I think that this is not
going to scale for tc-matchall (there may be policers, traps, drops,
VLAN retagging, etc etc), and that we should consider whether further
matchall filter/action combinations should be just passed on to drivers
with no interpretation instead.
As for the existing mirroring callbacks in DSA, they can either be kept
as-is, or replaced with simple accessors to TC_CLSMATCHALL_REPLACE and
TC_CLSMATCHALL_DESTROY, just like for flower, and drivers which
currently implement the port mirroring callbacks will need to have some
extra "if" conditions now, in order for them to call their port
mirroring implementations.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: felix: Wire up the ocelot cls_flower methods
Vladimir Oltean [Sat, 29 Feb 2020 14:31:14 +0000 (16:31 +0200)]
net: dsa: felix: Wire up the ocelot cls_flower methods

Export the cls_flower methods from the ocelot driver and hook them up to
the DSA passthrough layer.

Tables for the VCAP IS2 parameters, as well as half key packing (field
offsets and lengths) need to be defined for the VSC9959 core, as they
are different from Ocelot, mainly due to the different port count.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: Add bypass operations for the flower classifier-action filter
Vladimir Oltean [Sat, 29 Feb 2020 14:31:13 +0000 (16:31 +0200)]
net: dsa: Add bypass operations for the flower classifier-action filter

Due to the immense variety of classification keys and actions available
for tc-flower, as well as due to potentially very different DSA switch
capabilities, it doesn't make a lot of sense for the DSA mid layer to
even attempt to interpret these. So just pass them on to the underlying
switch driver.

DSA implements just the standard boilerplate for binding and unbinding
flow blocks to ports, since nobody wants to deal with that.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mscc: ocelot: parameterize the vcap_is2 properties
Vladimir Oltean [Sat, 29 Feb 2020 14:31:12 +0000 (16:31 +0200)]
net: mscc: ocelot: parameterize the vcap_is2 properties

Remove the definitions for the VCAP IS2 table from ocelot_ace.c, since
it is specific to VSC7514.

The VSC9959 VCAP IS2 table supports more rules (1024 instead of 64) and
has a different width for the action (89 bits instead of 99).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mscc: ocelot: remove port_pcs_init indirection for VSC7514
Vladimir Oltean [Sat, 29 Feb 2020 14:31:11 +0000 (16:31 +0200)]
net: mscc: ocelot: remove port_pcs_init indirection for VSC7514

The Felix driver is now using its own PHYLINK instance, not calling into
ocelot_adjust_link. So the port_pcs_init function pointer is an
unnecessary indirection. Remove it.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Allan W. Nielsen <allan.nielsen@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mscc: ocelot: don't rely on preprocessor for vcap key/action packing
Vladimir Oltean [Sat, 29 Feb 2020 14:31:10 +0000 (16:31 +0200)]
net: mscc: ocelot: don't rely on preprocessor for vcap key/action packing

The IGR_PORT_MASK key width is different between the 11-port VSC7514 and
the 6-port VSC9959 switches. And since IGR_PORT_MASK is one of the first
fields of a VCAP key entry, it means that all further field
offset/length pairs are shifted between the 2.

The ocelot driver performs packing of VCAP half keys with the help of
some preprocessor macros:

- A set of macros for defining the HKO (Half Key Offset) and HKL (Half
  Key Length) of each possible key field. The offset of each field is
  defined as the sum between the offset and the sum of the previous
  field.

- A set of accessors on top of vcap_key_set for shorter (aka less
  typing) access to the HKO and HKL of each key field.

Since the field offsets and lengths are different between switches,
defining them through the preprocessor isn't going to fly. So introduce
a structure holding (offset, length) pairs and instantiate it in
ocelot_board.c for VSC7514. In a future patch, a similar structure will
be instantiated in felix_vsc9959.c for NXP LS1028A.

The accessors also need to go. They are based on macro name
concatenation, which is horrible to understand and follow.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mscc: ocelot: spell out full "ocelot" name instead of "oc"
Vladimir Oltean [Sat, 29 Feb 2020 14:31:09 +0000 (16:31 +0200)]
net: mscc: ocelot: spell out full "ocelot" name instead of "oc"

This is a cosmetic patch that makes the name of the driver private
variable be used uniformly in ocelot_ace.c as in the rest of the driver.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mscc: ocelot: return directly in ocelot_cls_flower_{replace, destroy}
Vladimir Oltean [Sat, 29 Feb 2020 14:31:08 +0000 (16:31 +0200)]
net: mscc: ocelot: return directly in ocelot_cls_flower_{replace, destroy}

There is no need to check the "ret" variable, one can just return the
function result back to the caller.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Allan W. Nielsen <allan.nielsen@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mscc: ocelot: replace "rule" and "ocelot_rule" variable names with "ace"
Vladimir Oltean [Sat, 29 Feb 2020 14:31:07 +0000 (16:31 +0200)]
net: mscc: ocelot: replace "rule" and "ocelot_rule" variable names with "ace"

The "ocelot_rule" variable name is both annoyingly long trying to
distinguish itself from struct flow_rule *rule =
flow_cls_offload_flow_rule(f), as well as actually different from the
"ace" variable name which is used all over the place in ocelot_ace.c and
is referring to the same structure.

And the "rule" variable name is, confusingly, different from f->rule,
but sometimes one has to look up to the beginning of the function to get
an understanding of what structure type is actually being handled.

So let's use the "ace" name wherever possible ("Access Control Entry").

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Allan W. Nielsen <allan.nielsen@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mscc: ocelot: simplify tc-flower offload structures
Vladimir Oltean [Sat, 29 Feb 2020 14:31:06 +0000 (16:31 +0200)]
net: mscc: ocelot: simplify tc-flower offload structures

The ocelot tc-flower offload binds a second flow block callback (apart
from the one for matchall) just because it uses a different block
private structure (ocelot_port_private for matchall, ocelot_port_block
for flower).

But ocelot_port_block just appears to be boilerplate, and doesn't help
with anything in particular at all, it's just useless glue between the
(global!) struct ocelot_acl_block *block pointer, and a per-netdevice
struct ocelot_port_private *priv.

So let's just simplify that, and make struct ocelot_port_private be the
private structure for the block offload. This makes us able to use the
same flow callback as in the case of matchall.

This also reveals that the struct ocelot_acl_block *block is used rather
strangely, as mentioned above: it is defined globally, allocated at
probe time, and freed at unbind time. So just move the structure to the
main ocelot structure, which gives further opportunity for
simplification.

Also get rid of backpointers from struct ocelot_acl_block and struct
ocelot_ace_rule back to struct ocelot, by reworking the function
prototypes, where necessary, to use a more DSA-friendly "struct ocelot
*ocelot, int port" format.

And finally, remove the debugging prints that were added during
development, since they provide no useful information at this point.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Allan W. Nielsen <allan.nielsen@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mscc: ocelot: make ocelot_ace_rule support multiple ports
Yangbo Lu [Sat, 29 Feb 2020 14:31:05 +0000 (16:31 +0200)]
net: mscc: ocelot: make ocelot_ace_rule support multiple ports

The ocelot_ace_rule is port specific now. Make it flexible to
be able to support multiple ports too.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Allan W. Nielsen <allan.nielsen@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-module-and-fw-vers'
David S. Miller [Wed, 4 Mar 2020 01:54:55 +0000 (17:54 -0800)]
Merge branch 'net-module-and-fw-vers'

Leon Romanovsky says:

====================
Clean driver, module and FW versions

This is second batch of the series which removes various static versions
in favour of globaly defined Linux kernel version.

The first part with better cover letter can be found here
https://lore.kernel.org/lkml/20200224085311.460338-1-leon@kernel.org

The code is based on
68e2c37690b0 ("Merge branch 'hsr-several-code-cleanup-for-hsr-module'")

and WIP branch is
https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/log/?h=ethtool
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/freescale: Don't set zero if FW iand bus not-available in gianfar
Leon Romanovsky [Sun, 1 Mar 2020 14:44:56 +0000 (16:44 +0200)]
net/freescale: Don't set zero if FW iand bus not-available in gianfar

Rely on ethtool to properly present the fact that FW and bus
are not available for the gianfar driver.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/freescale: Don't set zero if FW not-available in ucc_geth
Leon Romanovsky [Sun, 1 Mar 2020 14:44:55 +0000 (16:44 +0200)]
net/freescale: Don't set zero if FW not-available in ucc_geth

Rely on ethtool to properly present the fact that FW is not
available for the ucc_geth driver.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/freescale: Don't set zero if FW not-available in dpaa
Leon Romanovsky [Sun, 1 Mar 2020 14:44:54 +0000 (16:44 +0200)]
net/freescale: Don't set zero if FW not-available in dpaa

Rely on ethtool to properly present the fact that FW is not
available for the dpaa driver.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/freescale: Clean drivers from static versions
Leon Romanovsky [Sun, 1 Mar 2020 14:44:53 +0000 (16:44 +0200)]
net/freescale: Clean drivers from static versions

There is no need to set static versions because linux kernel is
released all together with same version applicable to the whole
code base.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/fealnx: Delete driver version
Leon Romanovsky [Sun, 1 Mar 2020 14:44:52 +0000 (16:44 +0200)]
net/fealnx: Delete driver version

Use general linux kernel version instead of static driver version.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/faraday: Delete driver version from the drivers
Leon Romanovsky [Sun, 1 Mar 2020 14:44:51 +0000 (16:44 +0200)]
net/faraday: Delete driver version from the drivers

Use general linux kernel version instead of static driver version.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/emulex: Delete driver version
Leon Romanovsky [Sun, 1 Mar 2020 14:44:50 +0000 (16:44 +0200)]
net/emulex: Delete driver version

Remove driver version in favor of general linux kernel version.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/dnet: Delete static version from the driver
Leon Romanovsky [Sun, 1 Mar 2020 14:44:49 +0000 (16:44 +0200)]
net/dnet: Delete static version from the driver

Remove static driver version from the ethtool output.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/dlink: Remove driver version and release date
Leon Romanovsky [Sun, 1 Mar 2020 14:44:48 +0000 (16:44 +0200)]
net/dlink: Remove driver version and release date

Convert dlink drivers to use linux kernel version.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/dec: Delete driver versions
Leon Romanovsky [Sun, 1 Mar 2020 14:44:47 +0000 (16:44 +0200)]
net/dec: Delete driver versions

There is no need in assignments of driver version while linux kernel
is released as a monolith where the whole code base is aligned to one
general version.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/davicom: Delete ethtool version assignment
Leon Romanovsky [Sun, 1 Mar 2020 14:44:46 +0000 (16:44 +0200)]
net/davicom: Delete ethtool version assignment

Rely on global linux kernel version instead of static value.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/cortina: Delete driver version from ethtool output
Leon Romanovsky [Sun, 1 Mar 2020 14:44:45 +0000 (16:44 +0200)]
net/cortina: Delete driver version from ethtool output

Use default ethtool version instead of static variant.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/cisco: Delete driver and module versions
Leon Romanovsky [Sun, 1 Mar 2020 14:44:44 +0000 (16:44 +0200)]
net/cisco: Delete driver and module versions

There is no need to overwrite global linux kernel version.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/cirrus: Delete driver version
Leon Romanovsky [Sun, 1 Mar 2020 14:44:43 +0000 (16:44 +0200)]
net/cirrus: Delete driver version

There is no need in static driver version, use global
linux kernel version instead.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/chelsio: Don't set N/A for not available FW
Leon Romanovsky [Sun, 1 Mar 2020 14:44:42 +0000 (16:44 +0200)]
net/chelsio: Don't set N/A for not available FW

There is no need to set N/A if FW is not available.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/chelsio: Delete drive and module versions
Leon Romanovsky [Sun, 1 Mar 2020 14:44:41 +0000 (16:44 +0200)]
net/chelsio: Delete drive and module versions

Clean the code related to various versions: driver and module.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/cavium: Delete N/A assignments for ethtool
Leon Romanovsky [Sun, 1 Mar 2020 14:44:40 +0000 (16:44 +0200)]
net/cavium: Delete N/A assignments for ethtool

There is no need to set N/A for the ethtool fields.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/cavium: Clean driver versions
Leon Romanovsky [Sun, 1 Mar 2020 14:44:39 +0000 (16:44 +0200)]
net/cavium: Clean driver versions

Delete driver and module versions in favor of global
linux kernel variant.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/liquidio: Delete non-working LIQUIDIO_PACKAGE check
Leon Romanovsky [Sun, 1 Mar 2020 14:44:38 +0000 (16:44 +0200)]
net/liquidio: Delete non-working LIQUIDIO_PACKAGE check

Size of LIQUIDIO_PACKAGE is 0 and it means that checks of package
version never worked, delete dead code.

Fixes: 3258124534f6 ("liquidio: Consolidate common functionality")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/liquidio: Delete driver version assignment
Leon Romanovsky [Sun, 1 Mar 2020 14:44:37 +0000 (16:44 +0200)]
net/liquidio: Delete driver version assignment

Drop driver version in favor of global to linux kernel version.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/brocade: Delete driver version
Leon Romanovsky [Sun, 1 Mar 2020 14:44:36 +0000 (16:44 +0200)]
net/brocade: Delete driver version

Remove driver and module version in favor of default one.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/broadcom: Don't set N/A FW if it is not available
Leon Romanovsky [Sun, 1 Mar 2020 14:44:35 +0000 (16:44 +0200)]
net/broadcom: Don't set N/A FW if it is not available

There is no need to explicitly set N/A if FW not available.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/broadcom: Clean broadcom code from driver versions
Leon Romanovsky [Sun, 1 Mar 2020 14:44:34 +0000 (16:44 +0200)]
net/broadcom: Clean broadcom code from driver versions

Use linux kernel version for ethtool and module versions.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-qrtr-Nameserver-fixes'
David S. Miller [Wed, 4 Mar 2020 01:52:21 +0000 (17:52 -0800)]
Merge branch 'net-qrtr-Nameserver-fixes'

Bjorn Andersson says:

====================
net: qrtr: Nameserver fixes

The need to respond to the HELLO message from the firmware was lost in the
translation from the user space implementation of the nameserver. Fixing this
also means we can remove the FIXME related to launching the ns.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: qrtr: Fix FIXME related to qrtr_ns_init()
Bjorn Andersson [Mon, 2 Mar 2020 07:03:05 +0000 (23:03 -0800)]
net: qrtr: Fix FIXME related to qrtr_ns_init()

The 2 second delay before calling qrtr_ns_init() meant that the remote
processors would register as endpoints in qrtr and the say_hello() call
would therefor broadcast the outgoing HELLO to them. With the HELLO
handshake corrected this delay is no longer needed.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: qrtr: Respond to HELLO message
Bjorn Andersson [Mon, 2 Mar 2020 07:03:04 +0000 (23:03 -0800)]
net: qrtr: Respond to HELLO message

Lost in the translation from the user space implementation was the
detail that HELLO mesages must be exchanged between each node pair.  As
such the incoming HELLO must be replied to.

Similar to the previous implementation no effort is made to prevent two
Linux boxes from continuously sending HELLO messages back and forth,
this is left to a follow up patch.

say_hello() is moved, to facilitate the new call site.

Fixes: 0c2204a4ad71 ("net: qrtr: Migrate nameservice to kernel from userspace")
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mlxfw: Replace zero-length array with flexible-array member
Gustavo A. R. Silva [Mon, 2 Mar 2020 21:04:37 +0000 (15:04 -0600)]
net: mlxfw: Replace zero-length array with flexible-array member

The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoliquidio: Replace zero-length array with flexible-array member
Gustavo A. R. Silva [Mon, 2 Mar 2020 20:58:47 +0000 (14:58 -0600)]
liquidio: Replace zero-length array with flexible-array member

The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-selftests'
David S. Miller [Wed, 4 Mar 2020 01:03:52 +0000 (17:03 -0800)]
Merge branch 'net-selftests'

Petr Machata says:

====================
selftests: Use busywait() in a couple places

Two helper function for active waiting for an event were recently
introduced: busywait() as the active-waiting tool, and until_counter_is()
as a configurable predicate that can be plugged into busywait(). Use these
in tc_common and mlxsw's qos_defprio instead of hand-coding equivalents.

Patches #1 and #2 extend lib.sh facilities to make the transition possible.
Patch #3 converts tc_common, and patch #4 qos_defprio.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: mlxsw: qos_defprio: Use until_counter_is
Petr Machata [Mon, 2 Mar 2020 17:56:05 +0000 (19:56 +0200)]
selftests: mlxsw: qos_defprio: Use until_counter_is

Instead of hand-coding the busywait() predicate, use the until_counter_is()
introduced recently.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Amit Cohen <amitc@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: forwarding: tc_common: Convert to use busywait
Petr Machata [Mon, 2 Mar 2020 17:56:04 +0000 (19:56 +0200)]
selftests: forwarding: tc_common: Convert to use busywait

A function busywait() was recently added based on the logic in
__tc_check_packets(). Convert the code in tc_common to use the new
function.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Amit Cohen <amitc@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: forwarding: Convert until_counter_is() to take expression
Petr Machata [Mon, 2 Mar 2020 17:56:03 +0000 (19:56 +0200)]
selftests: forwarding: Convert until_counter_is() to take expression

until_counter_is() currently takes as an argument a number and the
condition holds when the current counter value is >= that number. Make the
function more generic by taking a partial expression instead of just the
number.

Convert the two existing users.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Amit Cohen <amitc@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: forwarding: lib: Add tc_rule_handle_stats_get()
Petr Machata [Mon, 2 Mar 2020 17:56:02 +0000 (19:56 +0200)]
selftests: forwarding: lib: Add tc_rule_handle_stats_get()

The function tc_rule_stats_get() fetches a given statistic of a TC rule
given the rule preference. Another common way to reference a rule is using
its handle. Introduce a dual to the aforementioned function that gets a
statistic given rule handle.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Amit Cohen <amitc@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'mptcp-Improve-DATA_FIN-transmission'
David S. Miller [Wed, 4 Mar 2020 01:01:43 +0000 (17:01 -0800)]
Merge branch 'mptcp-Improve-DATA_FIN-transmission'

Mat Martineau says:

====================
mptcp: Improve DATA_FIN transmission

MPTCP's DATA_FIN flag is sent in a DSS option when closing the
MPTCP-level connection. This patch series prepares for correct DATA_FIN
handling across multiple subflows (where individual subflows may
disconnect without closing the entire MPTCP connection) by changing the
way the MPTCP-level socket requests a DATA_FIN on a subflow and
propagates the necessary data for the TCP option.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: Only send DATA_FIN with final mapping
Mat Martineau [Fri, 28 Feb 2020 23:47:41 +0000 (15:47 -0800)]
mptcp: Only send DATA_FIN with final mapping

When a DATA_FIN is sent in a MPTCP DSS option that contains a data
mapping, the DATA_FIN consumes one byte of space in the mapping. In this
case, the DATA_FIN should only be included in the DSS option if its
sequence number aligns with the end of the mapped data. Otherwise the
subflow can send an incorrect implicit sequence number for the DATA_FIN,
and the DATA_ACK for that sequence number would not close the
MPTCP-level connection correctly.

Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: Use per-subflow storage for DATA_FIN sequence number
Mat Martineau [Fri, 28 Feb 2020 23:47:40 +0000 (15:47 -0800)]
mptcp: Use per-subflow storage for DATA_FIN sequence number

Instead of reading the MPTCP-level sequence number when sending DATA_FIN,
store the data in the subflow so it can be safely accessed when the
subflow TCP headers are written to the packet without the MPTCP-level
lock held. This also allows the MPTCP-level socket to close individual
subflows without closing the MPTCP connection.

Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: Check connection state before attempting send
Mat Martineau [Fri, 28 Feb 2020 23:47:39 +0000 (15:47 -0800)]
mptcp: Check connection state before attempting send

MPTCP should wait for an active connection or skip sending depending on
the connection state, as TCP does. This happens before the possible
passthrough to a regular TCP sendmsg because the subflow's socket type
(MPTCP or TCP fallback) is not known until the connection is
complete. This is also relevent at disconnect time, where data should
not be sent in certain MPTCP-level connection states.

Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'devlink-virtual-port'
David S. Miller [Tue, 3 Mar 2020 23:40:40 +0000 (15:40 -0800)]
Merge branch 'devlink-virtual-port'

Parav Pandit says:

====================
devlink: Introduce devlink port flavour virtual

Currently PCI PF and VF devlink devices register their ports as
physical port in non-representors mode.

Introduce a new port flavour as virtual so that virtual devices can
register 'virtual' flavour to make it more clear to users.

An example of one PCI PF and 2 PCI virtual functions, each having
one devlink port.

$ devlink port show
pci/0000:06:00.0/1: type eth netdev ens2f0 flavour physical port 0
pci/0000:06:00.2/1: type eth netdev ens2f2 flavour virtual port 0
pci/0000:06:00.3/1: type eth netdev ens2f3 flavour virtual port 0

Patch summary:
Patch-1 Introduces new devlink port flavour 'virtual'.
Patch-2 Uses new flavour to register PCI VF virtual ports.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/mlx5e: Use devlink virtual flavour for VF devlink port
Parav Pandit [Tue, 3 Mar 2020 14:12:43 +0000 (08:12 -0600)]
net/mlx5e: Use devlink virtual flavour for VF devlink port

Use newly introduce 'virtual' port flavour for devlink
port of PCI VF devlink device in non-representors mode.

While at it, remove recently introduced empty lines at end of the file.

Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>