linux-2.6-microblaze.git
2 years agodt-bindings: net: dsa: qca8k: improve port definition documentation
Ansuel Smith [Tue, 30 Nov 2021 21:16:25 +0000 (22:16 +0100)]
dt-bindings: net: dsa: qca8k: improve port definition documentation

Clean and improve port definition for qca8k documentation by referencing
the dsa generic port definition and adding the additional specific port
definition.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agodt-bindings: net: dsa: split generic port definition from dsa.yaml
Ansuel Smith [Tue, 30 Nov 2021 21:16:24 +0000 (22:16 +0100)]
dt-bindings: net: dsa: split generic port definition from dsa.yaml

Some switch may require to add additional binding to the node port.
Move DSA generic port definition to a dedicated yaml to permit this.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch 'hns3-cleanups'
David S. Miller [Thu, 2 Dec 2021 11:53:43 +0000 (11:53 +0000)]
Merge branch 'hns3-cleanups'

Guangbin Huang says:

====================
net: hns3: some cleanups for -next

To improve code readability and simplicity, this series add 9 cleanup
patches for the HNS3 ethernet driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: refactor function hns3_get_vector_ring_chain()
Jie Wang [Thu, 2 Dec 2021 08:36:03 +0000 (16:36 +0800)]
net: hns3: refactor function hns3_get_vector_ring_chain()

Currently  hns3_get_vector_ring_chain() is a bit long. Refactor it by
extracting sub process to improve the readability.

Signed-off-by: Jie Wang <wangjie125@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: refactor function hclge_set_channels()
Jie Wang [Thu, 2 Dec 2021 08:36:02 +0000 (16:36 +0800)]
net: hns3: refactor function hclge_set_channels()

Currently  hclge_set_channels() is a bit long. Refactor it by extracting
sub process to improve the readability.

Signed-off-by: Jie Wang <wangjie125@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: refactor function hclge_configure()
Jie Wang [Thu, 2 Dec 2021 08:36:01 +0000 (16:36 +0800)]
net: hns3: refactor function hclge_configure()

Currently  hclge_configure() is a bit long. Refactor it by extracting sub
process to improve the readability.

Signed-off-by: Jie Wang <wangjie125@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: split function hclge_update_port_base_vlan_cfg()
Jian Shen [Thu, 2 Dec 2021 08:36:00 +0000 (16:36 +0800)]
net: hns3: split function hclge_update_port_base_vlan_cfg()

Currently the function hclge_update_port_base_vlan_cfg() is a
bit long. Split it to several small functions, to improve the
readability.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: split function hns3_nic_net_xmit()
Yufeng Mo [Thu, 2 Dec 2021 08:35:59 +0000 (16:35 +0800)]
net: hns3: split function hns3_nic_net_xmit()

Function hns3_nic_net_xmit() is a bit too long. So add a
new function hns3_handle_skb_desc() to simplify code and improve
code readability.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: split function hclge_get_fd_rule_info()
Jian Shen [Thu, 2 Dec 2021 08:35:58 +0000 (16:35 +0800)]
net: hns3: split function hclge_get_fd_rule_info()

Currently the function hclge_get_fd_rule_info() is a bit long.
Split it to several small functions, to improve readability.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: split function hclge_init_vlan_config()
Jian Shen [Thu, 2 Dec 2021 08:35:57 +0000 (16:35 +0800)]
net: hns3: split function hclge_init_vlan_config()

Currently the function hclge_init_vlan_config() is a bit long.
Split it to several small functions, to simplify code and
improve code readability.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: refactor function hns3_fill_skb_desc to simplify code
Peng Li [Thu, 2 Dec 2021 08:35:56 +0000 (16:35 +0800)]
net: hns3: refactor function hns3_fill_skb_desc to simplify code

The function hns3_fill_skb_desc is hard to read, this patch
extract 2 functions and add new a struct data to simplify the
code and Improve readability.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: extract macro to simplify ring stats update code
Peng Li [Thu, 2 Dec 2021 08:35:55 +0000 (16:35 +0800)]
net: hns3: extract macro to simplify ring stats update code

As the code to update ring stats is alike for different ring stats
type, this patch extract macro to simplify ring stats update code.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoRevert "net: snmp: add statistics for tcp small queue check"
Eric Dumazet [Wed, 1 Dec 2021 03:32:46 +0000 (19:32 -0800)]
Revert "net: snmp: add statistics for tcp small queue check"

This reverts commit aeeecb889165617a841e939117f9a8095d0e7d80.

The new SNMP variable (TCPSmallQueueFailure) can be incremented
for good reasons, even on a 100Gbit single TCP_STREAM flow.

If we really wanted to ease driver debugging [1], this would
require something more sophisticated.

[1] Usually, if a driver is delaying TX completions too much,
this can lead to stalls in TCP output. Various work arounds
have been used in the past, like skb_orphan() in ndo_start_xmit().

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Menglong Dong <imagedong@tencent.com>
Link: https://lore.kernel.org/r/20211201033246.2826224-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonet: mvneta: program 1ms autonegotiation clock divisor
Russell King [Tue, 30 Nov 2021 14:54:05 +0000 (14:54 +0000)]
net: mvneta: program 1ms autonegotiation clock divisor

Program the 1ms autonegotiation clock divisor according to the clocking
rate of neta - without this, the 1ms clock ticks at about 660us on
Armada 38x configured for 250MHz. Bring this into correct specification.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Marek Behún <kabel@kernel.org>
Link: https://lore.kernel.org/r/E1ms4WD-00EKLK-Ld@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonet: phylink: tidy up disable bit clearing
Russell King [Tue, 30 Nov 2021 14:49:41 +0000 (14:49 +0000)]
net: phylink: tidy up disable bit clearing

Tidy up the disable bit clearing where we clear a bit
and then run the link resolver.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/E1ms4Rx-00EKEc-En@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agoMerge branch 'net-dsa-convert-two-drivers-to-phylink_generic_validate'
Jakub Kicinski [Thu, 2 Dec 2021 02:58:03 +0000 (18:58 -0800)]
Merge branch 'net-dsa-convert-two-drivers-to-phylink_generic_validate'

Russell King says:

====================
net: dsa: convert two drivers to phylink_generic_validate()

Patches 1 to 3 update core DSA code to allow drivers to be converted,
and patches 4 and 5 convert hellcreek and lantiq to use this (both of
which received reviewed-by from their maintainers.) As the rest have
yet to be reviewed by their maintainers, they are not included here.

Patch 1 had a request to change the formatting of it; I have not done
so as I believe a patch should do one change and one change only -
reformatting it is a separate change that should be in its own patch.
However, as patch 2 gets rid of the reason for reformatting it, it
would be pointless, and pure noise to include such an intermediary
patch.

Instead, I have swapped the order of patches 2 and 3 from the RFC
series.
====================

Link: https://lore.kernel.org/r/YaYiiU9nvmVugqnJ@shell.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonet: dsa: lantiq: convert to phylink_generic_validate()
Russell King (Oracle) [Tue, 30 Nov 2021 13:10:16 +0000 (13:10 +0000)]
net: dsa: lantiq: convert to phylink_generic_validate()

Populate the supported interfaces and MAC capabilities for the Lantiq
DSA switches and remove the old validate implementation to allow DSA to
use phylink_generic_validate() for this switch driver.

The exclusion of Gigabit linkmodes for MII, Reverse MII and Reduced MII
links is handled within phylink_generic_validate() in phylink, so there
is no need to make them conditional on the interface mode in the driver.

Reviewed-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonet: dsa: hellcreek: convert to phylink_generic_validate()
Russell King (Oracle) [Tue, 30 Nov 2021 13:10:11 +0000 (13:10 +0000)]
net: dsa: hellcreek: convert to phylink_generic_validate()

Populate the supported interfaces and MAC capabilities for the
hellcreek DSA switch and remove the old validate implementation to
allow DSA to use phylink_generic_validate() for this switch driver.

The switch actually only supports MII and RGMII, but as phylib defaults
to GMII, we need to include this interface mode to keep existing DT
working.

Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de>
Tested-by: Kurt Kanzenbach <kurt@linutronix.de>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonet: dsa: support use of phylink_generic_validate()
Russell King (Oracle) [Tue, 30 Nov 2021 13:10:06 +0000 (13:10 +0000)]
net: dsa: support use of phylink_generic_validate()

Support the use of phylink_generic_validate() when there is no
phylink_validate method given in the DSA switch operations and
mac_capabilities have been set in the phylink_config structure by the
DSA switch driver.

This gives DSA switch drivers the option to use this if they provide
the supported_interfaces and mac_capabilities, while still giving them
an option to override the default implementation if necessary.

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonet: dsa: replace phylink_get_interfaces() with phylink_get_caps()
Russell King (Oracle) [Tue, 30 Nov 2021 13:10:01 +0000 (13:10 +0000)]
net: dsa: replace phylink_get_interfaces() with phylink_get_caps()

Phylink needs slightly more information than phylink_get_interfaces()
allows us to get from the DSA drivers - we need the MAC capabilities.
Replace the phylink_get_interfaces() method with phylink_get_caps() to
allow DSA drivers to fill in the phylink_config MAC capabilities field
as well.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonet: dsa: consolidate phylink creation
Russell King (Oracle) [Tue, 30 Nov 2021 13:09:55 +0000 (13:09 +0000)]
net: dsa: consolidate phylink creation

The code in port.c and slave.c creating the phylink instance is very
similar - let's consolidate this into a single function.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonet: mdio: mscc-miim: Add depend of REGMAP_MMIO on MDIO_MSCC_MIIM
Tianchen Ding [Tue, 30 Nov 2021 11:02:09 +0000 (19:02 +0800)]
net: mdio: mscc-miim: Add depend of REGMAP_MMIO on MDIO_MSCC_MIIM

There's build error while CONFIG_REGMAP_MMIO is not set
and CONFIG_MDIO_MSCC_MIIM=m.

ERROR: modpost: "__devm_regmap_init_mmio_clk"
[drivers/net/mdio/mdio-mscc-miim.ko] undefined!

Add the depend of REGMAP_MMIO to fix it.

Fixes: a27a76282837 ("net: mdio: mscc-miim: convert to a regmap implementation")
Signed-off-by: Tianchen Ding <dtcccc@linux.alibaba.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20211130110209.804536-1-dtcccc@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonet: spider_net: Use non-atomic bitmap API when applicable
Christophe JAILLET [Sat, 27 Nov 2021 15:18:59 +0000 (16:18 +0100)]
net: spider_net: Use non-atomic bitmap API when applicable

No concurrent access is possible when a bitmap is local to a function.
So prefer the non-atomic functions to save a few cycles.
   - replace a 'for' loop by an equivalent non-atomic 'bitmap_fill()' call
   - use '__set_bit()'

While at it, clear the 'bitmask' bitmap only when needed.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/3de0792f5088f00d135c835df6c19e63ae95f5d2.1638026251.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agoMerge branch 'mlxsw-Spectrum-4-prep'
David S. Miller [Wed, 1 Dec 2021 14:52:34 +0000 (14:52 +0000)]
Merge branch 'mlxsw-Spectrum-4-prep'

From: Ido Schimmel <idosch@nvidia.com>

====================
mlxsw: Spectrum-4 preparations

The Spectrum-4 ASIC will support more than 256 ports, unlike existing
ASICs. As such, various device registers were extended with two
additional bits to encode a 10 bit local port. In some cases, new
(Version 2) registers were introduced.

This patchset prepares mlxsw for Spectrum-4 support by encoding local
port in a 'u16' instead of a 'u8' and by extending the definitions of
the various registers to support the extended local port form.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: Use Switch Multicast ID Register Version 2
Amit Cohen [Wed, 1 Dec 2021 08:12:40 +0000 (10:12 +0200)]
mlxsw: Use Switch Multicast ID Register Version 2

The SMID-V2 register maps Multicast ID (MID) into a list of local ports.
It is a new version of SMID in order to support 1024 bits of local_port.

Add SMID-V2 register and use it instead of SMID.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: Use Switch Flooding Table Register Version 2
Amit Cohen [Wed, 1 Dec 2021 08:12:39 +0000 (10:12 +0200)]
mlxsw: Use Switch Flooding Table Register Version 2

The SFTR-V2 register is used for flooding packet replication.
It is a new version of SFTR in order to support 1024 bits of local_port.

Add SFTR-V2 register and use it instead of SFTR.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: Add support for more than 256 ports in SBSR register
Amit Cohen [Wed, 1 Dec 2021 08:12:38 +0000 (10:12 +0200)]
mlxsw: Add support for more than 256 ports in SBSR register

Add 'port_page' field in SBSR to be able to query occupancy of more than
256 ports. The field determines the range of the ports specified in the
'ingress_port_mask' and 'egress_port_mask' bit masks:
>From '256 * port_page' to '256 * port_page + 255'.

For each local port, the appropriate port page is used. A query is never
performed for a port range that spans multiple port pages.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: Use u16 for local_port field instead of u8
Amit Cohen [Wed, 1 Dec 2021 08:12:37 +0000 (10:12 +0200)]
mlxsw: Use u16 for local_port field instead of u8

Currently, local_port field is saved as u8, which means that maximum 256
ports can be used.

As preparation for Spectrum-4, which will support more than 256 ports,
local_port field should be extended.

Save local_port as u16 to allow use of additional ports.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: reg: Adjust PPCNT register to support local port 255
Amit Cohen [Wed, 1 Dec 2021 08:12:36 +0000 (10:12 +0200)]
mlxsw: reg: Adjust PPCNT register to support local port 255

Local port 255 has a special meaning in PPCNT register, it is used to
refer to all local ports. This wild card ability is not currently used
by the driver.

Special casing local port 255 in Spectrum-4 systems where it is a valid
port is going to be a problem.

Work around this issue by adding and always setting the 'lp_gl' bit
which instructs the device's firmware to treat this local port like an
ordinary port.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: reg: Increase 'port_num' field in PMTDB register
Amit Cohen [Wed, 1 Dec 2021 08:12:35 +0000 (10:12 +0200)]
mlxsw: reg: Increase 'port_num' field in PMTDB register

'port_num' field is used to indicate the local port value which can be
assigned to a module.

Increase the field from 8 bits to 10 bits in order to support more than
255 ports.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: reg: Align existing registers to use extended local_port field
Amit Cohen [Wed, 1 Dec 2021 08:12:34 +0000 (10:12 +0200)]
mlxsw: reg: Align existing registers to use extended local_port field

Add support for 10-bit local ports in device registers by making use of the
MLXSW_ITEM32_LP() macro that was added in the previous patch.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: item: Add support for local_port field in a split form
Amit Cohen [Wed, 1 Dec 2021 08:12:33 +0000 (10:12 +0200)]
mlxsw: item: Add support for local_port field in a split form

Currently, local_port field uses 8 bits, which means that maximum 256
ports can be used.

As preparation for the next ASIC, which will support more than 256
ports, local_port field should be extended to 10 bits.

It is not possible to use 10 consecutive bits in all registers, and
therefore, the field is split into 2 fields:
1. local_port - the existing 8 bits, represent LSB of the extended
   field.
2. lp_msb - extra 2 bits, represent MSB of the extended field.

To avoid complex programming when reading/writing local_port, add a
dedicated macro which creates get and set functions which handle both parts
of local_port.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomlxsw: reg: Remove unused functions
Amit Cohen [Wed, 1 Dec 2021 08:12:32 +0000 (10:12 +0200)]
mlxsw: reg: Remove unused functions

The functions mlxsw_reg_sfd_uc_unpack() and
mlxsw_reg_sfd_uc_lag_unpack() are not used. Remove them.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@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.2010.1006
Amit Cohen [Wed, 1 Dec 2021 08:12:31 +0000 (10:12 +0200)]
mlxsw: spectrum: Bump minimum FW version to xx.2010.1006

Add latest verified version of Nvidia Spectrum-family switch firmware,
for Spectrum (13.2010.1006), Spectrum-2 (29.2010.1006) and
Spectrum-3 (30.2010.1006).

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next...
David S. Miller [Wed, 1 Dec 2021 14:46:03 +0000 (14:46 +0000)]
Merge branch '40GbE' of git://git./linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
40GbE Intel Wired LAN Driver Updates 2021-11-30

This series contains updates to iavf driver only.

Patryk adds a debug message when MTU is changed.

Grzegorz adds messaging when transitioning in and out of multicast
promiscuous mode.

Jake returns correct error codes for iavf_parse_cls_flower().

Jedrzej adds messaging for when the driver is removed and refactors
struct usage to take less memory. He also adjusts ethtool statistics to
only display information on active queues.

Tony allows for user to specify the RSS hash.

Karen resolves some static analysis warnings, corrects format specifiers,
and rewords a message to come across as informational.

v2:
- Dropped patch 1 (for net) and 5
- Change MTU message from info to debug
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next...
David S. Miller [Wed, 1 Dec 2021 14:42:23 +0000 (14:42 +0000)]
Merge branch '100GbE' of git://git./linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
100GbE Intel Wired LAN Driver Updates 2021-11-30

This series contains updates to ice driver only.

Shiraz corrects assignment of boolean variable and removes an unused
enum.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
David S. Miller [Wed, 1 Dec 2021 14:41:02 +0000 (14:41 +0000)]
Merge branch '1GbE' of git://git./linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
1GbE Intel Wired LAN Driver Updates 2021-11-30

Jesper Dangaard Brouer says:

Changes to fix and enable XDP metadata to a specific Intel driver igc.
Tested with hardware i225 that uses driver igc, while testing AF_XDP
access to metadata area.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: natsemi: fix hw address initialization for jazz and xtensa
Max Filippov [Tue, 30 Nov 2021 14:36:00 +0000 (06:36 -0800)]
net: natsemi: fix hw address initialization for jazz and xtensa

Use eth_hw_addr_set function instead of writing the address directly to
net_device::dev_addr.

Fixes: adeef3e32146 ("net: constify netdev->dev_addr")
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Link: https://lore.kernel.org/r/20211130143600.31970-1-jcmvbkbc@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agomctp: remove unnecessary check before calling kfree_skb()
Yang Yingliang [Tue, 30 Nov 2021 03:12:43 +0000 (11:12 +0800)]
mctp: remove unnecessary check before calling kfree_skb()

The skb will be checked inside kfree_skb(), so remove the
outside check.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20211130031243.768823-1-yangyingliang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agoiavf: Fix displaying queue statistics shown by ethtool
Jedrzej Jagielski [Fri, 17 Sep 2021 08:52:52 +0000 (08:52 +0000)]
iavf: Fix displaying queue statistics shown by ethtool

Driver provided too many lines as an output to ethtool -S command.
Return actual length of string set of ethtool stats. Instead of predefined
maximal value use the actual value on netdev, iterate over active queues.
Without this patch, ethtool -S report would produce additional
erroneous lines of queues that are not configured.

Signed-off-by: Witold Fijalkowski <witoldx.fijalkowski@intel.com>
Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agoiavf: Refactor string format to avoid static analysis warnings
Karen Sornek [Tue, 31 Aug 2021 11:39:01 +0000 (13:39 +0200)]
iavf: Refactor string format to avoid static analysis warnings

Change format to match variable type that is used in string.

Use %u format for unsigned variable and %d format for signed variable
to remove static analysis warnings.

Signed-off-by: Michal Swiatkowski <michal.swiatkowski@intel.com>
Signed-off-by: Karen Sornek <karen.sornek@intel.com>
Tested-by: George Kuruvinakunnel <george.kuruvinakunnel@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agoiavf: Refactor text of informational message
Karen Sornek [Tue, 31 Aug 2021 10:12:02 +0000 (12:12 +0200)]
iavf: Refactor text of informational message

This message is intended to be informational to indicate a reset is about
to happen, but the use of "warning" in the message text can cause concern
with users.  Reword the message to make it less alarming.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Karen Sornek <karen.sornek@intel.com>
Tested-by: George Kuruvinakunnel <george.kuruvinakunnel@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agoiavf: Fix static code analysis warning
Karen Sornek [Mon, 30 Aug 2021 08:38:01 +0000 (10:38 +0200)]
iavf: Fix static code analysis warning

Change min() to min_t() to fix static code analysis warning of possible
overflow.

Signed-off-by: Paul Greenwalt <paul.greenwalt@intel.com>
Signed-off-by: Karen Sornek <karen.sornek@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agoiavf: Refactor iavf_mac_filter struct memory usage
Jedrzej Jagielski [Mon, 30 Aug 2021 08:25:36 +0000 (08:25 +0000)]
iavf: Refactor iavf_mac_filter struct memory usage

iavf_mac_filter struct contained couple boolean
flags using up more memory than is necessary.
Change the flags to be bitfields in an anonymous struct
so all the flags now fit in one byte.

Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agoiavf: Enable setting RSS hash key
Tony Nguyen [Fri, 16 Jul 2021 22:16:37 +0000 (15:16 -0700)]
iavf: Enable setting RSS hash key

Driver support for changing the RSS hash key exists, however, checks
have caused it to be reported as unsupported. Remove the check and
allow the hash key to be specified.

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: Tony Brelinski <tony.brelinski@intel.com>
2 years agoiavf: Add trace while removing device
Jedrzej Jagielski [Tue, 22 Jun 2021 13:43:48 +0000 (15:43 +0200)]
iavf: Add trace while removing device

Add kernel trace that device was removed.
Currently there is no such information.
I.e. Host admin removes a PCI device from a VM,
than on VM shall be info about the event.

This patch adds info log to iavf_remove function.

Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agoiavf: return errno code instead of status code
Jacob Keller [Fri, 4 Jun 2021 16:53:34 +0000 (09:53 -0700)]
iavf: return errno code instead of status code

The iavf_parse_cls_flower function returns an integer error code, and
not an iavf_status enumeration.

Fix the function to use the standard errno value EINVAL as its return
instead of using IAVF_ERR_CONFIG.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agoiavf: Log info when VF is entering and leaving Allmulti mode
Grzegorz Szczurek [Fri, 4 Jun 2021 16:53:32 +0000 (09:53 -0700)]
iavf: Log info when VF is entering and leaving Allmulti mode

Add log when VF is entering and leaving Allmulti mode.
The change of VF state is visible in dmesg now.
Without this commit, entering and leaving Allmulti mode
is not logged in dmesg.

Signed-off-by: Grzegorz Szczurek <grzegorzx.szczurek@intel.com>
Tested-by: George Kuruvinakunnel <george.kuruvinakunnel@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agoiavf: Add change MTU message
Patryk Małek [Fri, 4 Jun 2021 16:53:30 +0000 (09:53 -0700)]
iavf: Add change MTU message

Add a netdev_dbg log entry in case of a change of MTU so that user is
notified about this change in the same manner as in case of pf driver.

Signed-off-by: Patryk Małek <patryk.malek@intel.com>
Tested-by: George Kuruvinakunnel <george.kuruvinakunnel@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agoigc: enable XDP metadata in driver
Jesper Dangaard Brouer [Mon, 15 Nov 2021 20:36:30 +0000 (21:36 +0100)]
igc: enable XDP metadata in driver

Enabling the XDP bpf_prog access to data_meta area is a very small
change. Hint passing 'true' to xdp_prepare_buff().

The SKB layers can also access data_meta area, which required more
driver changes to support. Reviewers, notice the igc driver have two
different functions that can create SKBs, depending on driver config.

Hint for testers, ethtool priv-flags legacy-rx enables
the function igc_construct_skb()

 ethtool --set-priv-flags DEV legacy-rx on

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Tested-by: Nechama Kraus <nechamax.kraus@linux.intel.com>
Reviewed-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agoigc: AF_XDP zero-copy metadata adjust breaks SKBs on XDP_PASS
Jesper Dangaard Brouer [Mon, 15 Nov 2021 20:36:25 +0000 (21:36 +0100)]
igc: AF_XDP zero-copy metadata adjust breaks SKBs on XDP_PASS

Driver already implicitly supports XDP metadata access in AF_XDP
zero-copy mode, as xsk_buff_pool's xp_alloc() naturally set xdp_buff
data_meta equal data.

This works fine for XDP and AF_XDP, but if a BPF-prog adjust via
bpf_xdp_adjust_meta() and choose to call XDP_PASS, then igc function
igc_construct_skb_zc() will construct an invalid SKB packet. The
function correctly include the xdp->data_meta area in the memcpy, but
forgot to pull header to take metasize into account.

Fixes: fc9df2a0b520 ("igc: Enable RX via AF_XDP zero-copy")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Tested-by: Nechama Kraus <nechamax.kraus@linux.intel.com>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agonet/ice: Remove unused enum
Shiraz Saleem [Wed, 24 Nov 2021 12:41:36 +0000 (06:41 -0600)]
net/ice: Remove unused enum

Remove ice_devlink_param_id enum as its not used.

Suggested-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agonet/ice: Fix boolean assignment
Shiraz Saleem [Wed, 24 Nov 2021 12:41:35 +0000 (06:41 -0600)]
net/ice: Fix boolean assignment

vbool in ice_devlink_enable_roce_get can be assigned to a
non-0/1 constant.

Fix this assignment of vbool to be 0/1.

Fixes: e523af4ee560 ("net/ice: Add support for enable_iwarp and enable_roce devlink param")
Suggested-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agonet: ixp4xx_hss: drop kfree for memory allocated with devm_kzalloc
Wei Yongjun [Tue, 30 Nov 2021 10:48:40 +0000 (10:48 +0000)]
net: ixp4xx_hss: drop kfree for memory allocated with devm_kzalloc

It's not necessary to free memory allocated with devm_kzalloc
and using kfree leads to a double free.

Fixes: 35aefaad326b ("net: ixp4xx_hss: Convert to use DT probing")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: mscc: ocelot: fix mutex_lock not released
Lv Ruyi [Tue, 30 Nov 2021 11:24:43 +0000 (11:24 +0000)]
net: mscc: ocelot: fix mutex_lock not released

If err is true, the function will be returned, but mutex_lock isn't
released.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: make symbol 'hclge_mac_speed_map_to_fw' static
Wei Yongjun [Tue, 30 Nov 2021 11:34:37 +0000 (11:34 +0000)]
net: hns3: make symbol 'hclge_mac_speed_map_to_fw' static

The sparse tool complains as follows:

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c:2656:28: warning:
 symbol 'hclge_mac_speed_map_to_fw' was not declared. Should it be static?

This symbol is not used outside of hclge_main.c, so marks it static.

Fixes: e46da6a3d4d3 ("net: hns3: refine function hclge_cfg_mac_speed_dup_hw()")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch 'prestera-next'
David S. Miller [Tue, 30 Nov 2021 12:26:01 +0000 (12:26 +0000)]
Merge branch 'prestera-next'

Volodymyr Mytnyk says:

====================
net: prestera: acl: migrate to new vTcam/counter api

This patch series aims to use new vTcam and Counter API
provided by latest fw version. The advantage of using
this API is the following:

- provides a way to have a rule with desired Tcam size (improves
  Tcam memory utilization).
- batch support for acl counters gathering (improves performance)
- gives more control over HW ACL engine (actions/matches/bindings)
  to be able to support more features in the future driver
  versions

Note: the feature set left the same as was before this patch.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: prestera: acl: add rule stats support
Volodymyr Mytnyk [Tue, 30 Nov 2021 10:33:00 +0000 (12:33 +0200)]
net: prestera: acl: add rule stats support

Make flower to use counter API to get rule HW statistics.

Co-developed-by: Serhiy Boiko <serhiy.boiko@marvell.com>
Signed-off-by: Serhiy Boiko <serhiy.boiko@marvell.com>
Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: prestera: add counter HW API
Volodymyr Mytnyk [Tue, 30 Nov 2021 10:32:59 +0000 (12:32 +0200)]
net: prestera: add counter HW API

Add counter API for getting HW statistics.

- HW statistics gathered by this API are deleyed.
- Batch of conters is supported.
- acl stat is supported.

Co-developed-by: Serhiy Boiko <serhiy.boiko@marvell.com>
Signed-off-by: Serhiy Boiko <serhiy.boiko@marvell.com>
Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: prestera: acl: migrate to new vTCAM api
Volodymyr Mytnyk [Tue, 30 Nov 2021 10:32:58 +0000 (12:32 +0200)]
net: prestera: acl: migrate to new vTCAM api

- Add new vTCAM HW API to configure HW ACLs.
- Migrate acl to use new vTCAM HW API.
- No counter support in this patch-set.

Co-developed-by: Yevhen Orlov <yevhen.orlov@plvision.eu>
Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu>
Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agodevlink: Simplify devlink resources unregister call
Leon Romanovsky [Tue, 30 Nov 2021 10:16:20 +0000 (12:16 +0200)]
devlink: Simplify devlink resources unregister call

The devlink_resources_unregister() used second parameter as an
entry point for the recursive removal of devlink resources. None
of the callers outside of devlink core needed to use this field,
so let's remove it.

As part of this removal, the "struct devlink_resource" was moved
from .h to .c file as it is not possible to use in any place in
the code except devlink.c.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: mdio: mscc-miim: Set back the optional resource.
Horatiu Vultur [Tue, 30 Nov 2021 09:57:45 +0000 (10:57 +0100)]
net: mdio: mscc-miim: Set back the optional resource.

In the blamed commit, the second memory resource was not considered
anymore as optional. On some platforms like sparx5 the second resource
is optional. So add it back as optional and restore the comment that
says so.

Fixes: a27a762828375a ("net: mdio: mscc-miim: convert to a regmap implementation")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agobond: pass get_ts_info and SIOC[SG]HWTSTAMP ioctl to active device
Hangbin Liu [Tue, 30 Nov 2021 07:09:32 +0000 (15:09 +0800)]
bond: pass get_ts_info and SIOC[SG]HWTSTAMP ioctl to active device

We have VLAN PTP support(via get_ts_info) on kernel, and bond support(by
getting active interface via netlink message) on userspace tool linuxptp.
But there are always some users who want to use PTP with VLAN over bond,
which is not able to do with the current implementation.

This patch passed get_ts_info and SIOC[SG]HWTSTAMP ioctl to active device
with bond mode active-backup/tlb/alb. With this users could get kernel native
bond or VLAN over bond PTP support.

Test with ptp4l and it works with VLAN over bond after this patch:
]# ptp4l -m -i bond0.23
ptp4l[53377.141]: selected /dev/ptp4 as PTP clock
ptp4l[53377.142]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[53377.143]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[53377.143]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[53384.127]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
ptp4l[53384.127]: selected local clock e41d2d.fffe.123db0 as best master
ptp4l[53384.127]: port 1: assuming the grand master role

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: cxgb: fix a typo in kernel doc
Jean Sacren [Tue, 30 Nov 2021 07:03:11 +0000 (00:03 -0700)]
net: cxgb: fix a typo in kernel doc

Fix a trivial typo of 'pakcet' in cxgb kernel doc.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: cxgb3: fix typos in kernel doc
Jean Sacren [Tue, 30 Nov 2021 07:03:10 +0000 (00:03 -0700)]
net: cxgb3: fix typos in kernel doc

Fix two trivial typos of 'pakcet' in cxgb3 kernel doc.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoBonding: add arp_missed_max option
Hangbin Liu [Tue, 30 Nov 2021 04:29:47 +0000 (12:29 +0800)]
Bonding: add arp_missed_max option

Currently, we use hard code number to verify if we are in the
arp_interval timeslice. But some user may want to reduce/extend
the verify timeslice. With the similar team option 'missed_max'
the uers could change that number based on their own environment.

Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: lantiq: fix missing free_netdev() on error in ltq_etop_probe()
Yang Yingliang [Tue, 30 Nov 2021 03:38:37 +0000 (11:38 +0800)]
net: lantiq: fix missing free_netdev() on error in ltq_etop_probe()

Add the missing free_netdev() before return from ltq_etop_probe()
in the error handling case.

Fixes: 14d4e308e0aa ("net: lantiq: configure the burst length in ethernet drivers")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: ipv6: use the new fib6_nh_release_dsts helper in fib6_nh_release
Nikolay Aleksandrov [Mon, 29 Nov 2021 15:44:11 +0000 (17:44 +0200)]
net: ipv6: use the new fib6_nh_release_dsts helper in fib6_nh_release

We can remove a bit of code duplication by reusing the new
fib6_nh_release_dsts helper in fib6_nh_release. Their only difference is
that fib6_nh_release's version doesn't use atomic operation to swap the
pointers because it assumes the fib6_nh is no longer visible, while
fib6_nh_release_dsts can be used anywhere.

Suggested-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: nexthop: reduce rcu synchronizations when replacing resilient groups
Nikolay Aleksandrov [Mon, 29 Nov 2021 12:09:24 +0000 (14:09 +0200)]
net: nexthop: reduce rcu synchronizations when replacing resilient groups

We can optimize resilient nexthop group replaces by reducing the number of
synchronize_net calls. After commit 1005f19b9357 ("net: nexthop: release
IPv6 per-cpu dsts when replacing a nexthop group") we always do a
synchronize_net because we must ensure no new dsts can be created for the
replaced group's removed nexthops, but we already did that when replacing
resilient groups, so if we always call synchronize_net after any group
type replacement we'll take care of both cases and reduce synchronize_net
calls for resilient groups.

Suggested-by: Ido Schimmel <idosch@idosch.org>
Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet/tls: simplify the tls_set_sw_offload function
Tianjia Zhang [Mon, 29 Nov 2021 11:10:14 +0000 (19:10 +0800)]
net/tls: simplify the tls_set_sw_offload function

Assigning crypto_info variables in advance can simplify the logic
of accessing value and move related local variables to a smaller
scope.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: stmmac: Add platform level debug register dump feature
Bhupesh Sharma [Sun, 28 Nov 2021 19:58:54 +0000 (01:28 +0530)]
net: stmmac: Add platform level debug register dump feature

dwmac-qcom-ethqos currently exposes a mechanism to dump rgmii registers
after the 'stmmac_dvr_probe()' returns. However with commit
5ec55823438e ("net: stmmac: add clocks management for gmac driver"),
we now let 'pm_runtime_put()' disable the clocks before returning from
'stmmac_dvr_probe()'.

This causes a crash when 'rgmii_dump()' register dumps are enabled,
as the clocks are already off.

Since other dwmac drivers (possible future users as well) might
require a similar register dump feature, introduce a platform level
callback to allow the same.

This fixes the crash noticed while enabling rgmii_dump() dumps in
dwmac-qcom-ethqos driver as well. It also allows future changes
to keep a invoking the register dump callback from the correct
place inside 'stmmac_dvr_probe()'.

Fixes: 5ec55823438e ("net: stmmac: add clocks management for gmac driver")
Cc: Joakim Zhang <qiangqing.zhang@nxp.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoethtool: netlink: Slightly simplify 'ethnl_features_to_bitmap()'
Christophe JAILLET [Sun, 28 Nov 2021 11:03:30 +0000 (12:03 +0100)]
ethtool: netlink: Slightly simplify 'ethnl_features_to_bitmap()'

The 'dest' bitmap is fully initialized by the 'for' loop, so there is no
need to explicitly reset it.

This also makes this function in line with 'ethnl_features_to_bitmap32()'
which does not clear the destination before writing it.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/17fca158231c6f03689bd891254f0dd1f4e84cb8.1638091829.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonet: ifb: support ethtools stats
Tonghao Zhang [Sun, 28 Nov 2021 01:46:31 +0000 (09:46 +0800)]
net: ifb: support ethtools stats

With this feature, we can use the ethtools to get tx/rx
queues stats. This patch, introduce the ifb_update_q_stats
helper to update the queues stats, and ifb_q_stats to simplify
the codes.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Link: https://lore.kernel.org/r/20211128014631.43627-1-xiangxia.m.yue@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agostmmac: remove ethtool driver version info
Heiner Kallweit [Sun, 28 Nov 2021 18:45:56 +0000 (19:45 +0100)]
stmmac: remove ethtool driver version info

I think there's no benefit in reporting a date from almost 6 yrs ago.
Let ethtool report the default (kernel version) instead.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: dsa: felix: fix flexible_array.cocci warnings
kernel test robot [Sat, 27 Nov 2021 18:03:20 +0000 (19:03 +0100)]
net: dsa: felix: fix flexible_array.cocci warnings

Zero-length and one-element arrays are deprecated, see
Documentation/process/deprecated.rst
Flexible-array members should be used instead.

Generated by: scripts/coccinelle/misc/flexible_array.cocci

Fixes: 23ae3a787771 ("net: dsa: felix: add stream gate settings for psfp")
CC: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch 'hns3-cleanups'
David S. Miller [Mon, 29 Nov 2021 14:26:18 +0000 (14:26 +0000)]
Merge branch 'hns3-cleanups'

Guangbin Huang says:

====================
hns3: some cleanups for -next

To improve code readability and simplicity, this series refactor some
functions in the HNS3 ethernet driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: split function hns3_set_l2l3l4()
Yufeng Mo [Mon, 29 Nov 2021 14:00:27 +0000 (22:00 +0800)]
net: hns3: split function hns3_set_l2l3l4()

Function hns3_set_l2l3l4() is a bit too long. So add two
new functions hns3_set_l3_type() and hns3_set_l4_csum_length()
to simplify code and improve code readability.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: split function hns3_handle_bdinfo()
Yufeng Mo [Mon, 29 Nov 2021 14:00:26 +0000 (22:00 +0800)]
net: hns3: split function hns3_handle_bdinfo()

Function hns3_handle_bdinfo() is a bit too long. So add two
new functions hns3_handle_rx_ts_info() and hns3_handle_rx_vlan_tag(
to simplify code and improve code readability.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: split function hns3_nic_get_stats64()
Yufeng Mo [Mon, 29 Nov 2021 14:00:25 +0000 (22:00 +0800)]
net: hns3: split function hns3_nic_get_stats64()

Function hns3_nic_get_stats64() is a bit too long. So add a
new function hns3_fetch_stats() to simplify code and improve
code readability.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: refine function hclge_tm_pri_q_qs_cfg()
Guangbin Huang [Mon, 29 Nov 2021 14:00:24 +0000 (22:00 +0800)]
net: hns3: refine function hclge_tm_pri_q_qs_cfg()

This patch encapsulates the process code for queue to qset config of two
mode(tc based and vnet based) into two function, for making code more
concise.

Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: add new function hclge_tm_schd_mode_tc_base_cfg()
Guangbin Huang [Mon, 29 Nov 2021 14:00:23 +0000 (22:00 +0800)]
net: hns3: add new function hclge_tm_schd_mode_tc_base_cfg()

This patch encapsulates the process code of tc based schedule mode of
function hclge_tm_lvl34_schd_mode_cfg() into a new function
hclge_tm_schd_mode_tc_base_cfg(). It make code more concise and the new
process code can be reused.

Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: refine function hclge_cfg_mac_speed_dup_hw()
Guangbin Huang [Mon, 29 Nov 2021 14:00:22 +0000 (22:00 +0800)]
net: hns3: refine function hclge_cfg_mac_speed_dup_hw()

To reuse the code of converting speed of driver to speed of firmware in
function hclge_cfg_mac_speed_dup_hw(), encapsulate them into a new
function hclge_convert_to_fw_speed().

Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: split function hns3_get_tx_timeo_queue_info()
Yufeng Mo [Mon, 29 Nov 2021 14:00:21 +0000 (22:00 +0800)]
net: hns3: split function hns3_get_tx_timeo_queue_info()

Function hns3_get_tx_timeo_queue_info() is a bit too long. So add two
new functions hns3_dump_queue_stats() and hns3_dump_queue_reg() to
simplify code and improve code readability.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: refactor two hns3 debugfs functions
Jie Wang [Mon, 29 Nov 2021 14:00:20 +0000 (22:00 +0800)]
net: hns3: refactor two hns3 debugfs functions

Use for statement to optimize some print work of function
hclge_dbg_dump_rst_info() and hclge_dbg_dump_mac_enable_status() to
improve code simplicity.

Signed-off-by: Jie Wang <wangjie125@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: refactor hns3_nic_reuse_page()
Hao Chen [Mon, 29 Nov 2021 14:00:19 +0000 (22:00 +0800)]
net: hns3: refactor hns3_nic_reuse_page()

Split rx copybreak handle into a separate function from function
hns3_nic_reuse_page() to improve code simplicity.

Signed-off-by: Hao Chen <chenhao288@hisilicon.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: hns3: refactor reset_prepare_general retry statement
Jiaran Zhang [Mon, 29 Nov 2021 14:00:18 +0000 (22:00 +0800)]
net: hns3: refactor reset_prepare_general retry statement

Currently, the hclge_reset_prepare_general function uses the goto
statement to jump upwards, which increases code complexity and makes
the program structure difficult to understand. In addition, if
reset_pending is set, retry_cnt cannot be increased. This may result
in a failure to exit the retry or increase the number of retries.

Use the while statement instead to make the program easier to understand
and solve the problem that the goto statement cannot be exited.

Signed-off-by: Jiaran Zhang <zhangjiaran@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: snmp: add statistics for tcp small queue check
Menglong Dong [Sun, 28 Nov 2021 06:01:02 +0000 (14:01 +0800)]
net: snmp: add statistics for tcp small queue check

Once tcp small queue check failed in tcp_small_queue_check(), the
throughput of tcp will be limited, and it's hard to distinguish
whether it is out of tcp congestion control.

Add statistics of LINUX_MIB_TCPSMALLQUEUEFAILURE for this scene.

Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agodevlink: Remove misleading internal_flags from health reporter dump
Leon Romanovsky [Sun, 28 Nov 2021 12:14:46 +0000 (14:14 +0200)]
devlink: Remove misleading internal_flags from health reporter dump

DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET command doesn't have .doit callback
and has no use in internal_flags at all. Remove this misleading assignment.

Fixes: e44ef4e4516c ("devlink: Hang reporter's dump method on a dumpit cb")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch 'seville-shared-mdio'
David S. Miller [Mon, 29 Nov 2021 13:02:01 +0000 (13:02 +0000)]
Merge branch 'seville-shared-mdio'

Colin Foster says:

====================
update seville to use shared MDIO driver

This patch set exposes and utilizes the shared MDIO bus in
drivers/net/mdio/msio-mscc-miim.c

v3:
    * Fix errors using uninitilized "dev" inside the probe function.
    * Remove phy_regmap from the setup function, since it currently
    isn't used
    * Remove GCB_PHY_PHY_CFG definition from ocelot.h - it isn't used
    yet...

v2:
    * Error handling (thanks Andrew Lunn)
    * Fix logic errors calling mscc_miim_setup during patch 1/3 (thanks
    Jakub Kicinski)
    * Remove unnecessary felix_mdio file (thanks Vladimir Oltean)
    * Pass NULL to mscc_miim_setup instead of GCB_PHY_PHY_CFG, since the
    phy reset isn't handled at that point of the Seville driver (patch
    3/3)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: dsa: ocelot: felix: utilize shared mscc-miim driver for indirect MDIO access
Colin Foster [Mon, 29 Nov 2021 01:57:37 +0000 (17:57 -0800)]
net: dsa: ocelot: felix: utilize shared mscc-miim driver for indirect MDIO access

Switch to a shared MDIO access implementation by way of the mdio-mscc-miim
driver.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: dsa: ocelot: seville: utilize of_mdiobus_register
Colin Foster [Mon, 29 Nov 2021 01:57:36 +0000 (17:57 -0800)]
net: dsa: ocelot: seville: utilize of_mdiobus_register

Switch seville to use of_mdiobus_register(bus, NULL) instead of just
mdiobus_register. This code is about to be pulled into a separate module
that can optionally define ports by the device_node.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: mdio: mscc-miim: convert to a regmap implementation
Colin Foster [Mon, 29 Nov 2021 01:57:35 +0000 (17:57 -0800)]
net: mdio: mscc-miim: convert to a regmap implementation

Utilize regmap instead of __iomem to perform indirect mdio access. This
will allow for custom regmaps to be used by way of the mscc_miim_setup
function.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge branch 'lan966x-driver'
David S. Miller [Mon, 29 Nov 2021 12:58:39 +0000 (12:58 +0000)]
Merge branch 'lan966x-driver'

Horatiu Vultur says:

====================
net: lan966x: Add lan966x switch driver

This patch series add support for Microchip lan966x driver

The lan966x switch is a multi-port Gigabit AVB/TSN Ethernet Switch with
two integrated 10/100/1000Base-T PHYs. In addition to the integrated PHYs,
it supports up to 2RGMII/RMII, up to 3BASE-X/SERDES/2.5GBASE-X and up to
2 Quad-SGMII/Quad-USGMII interfaces.

Initially it adds support only for the ports to behave as simple
NIC cards. In the future patches it would be extended with other
functionality like Switchdev, PTP, Frame DMA, VCAP, etc.

v4->v5:
- more fixes to the reset of the switch, require all resources before
  activating the hardware
- fix to lan966x-switch binding
- implement get/set_pauseparam in ethtool_ops
- stop calling lan966x_port_link_down when calling lan966x_port_pcs_set and
  call it in lan966x_phylink_mac_link_down

v3->v4:
- add timeouts when injecting/extracting frames, in case the HW breaks
- simplify the creation of the IFH
- fix the order of operations in lan966x_cleanup_ports
- fixes to phylink based on Russel review

v2->v3:
- fix compiling issues for x86
- fix resource management in first patch

v1->v2:
- add new patch for MAINTAINERS
- add functions lan966x_mac_cpu_learn/forget
- fix build issues with second patch
- fix the reset of the switch, return error if there is no reset controller
- start to use phylink_mii_c22_pcs_decode_state and
  phylink_mii_c22_pcs_encode_advertisement to remove duplicate code
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: lan966x: Update MAINTAINERS to include lan966x driver
Horatiu Vultur [Mon, 29 Nov 2021 12:43:59 +0000 (13:43 +0100)]
net: lan966x: Update MAINTAINERS to include lan966x driver

Update MAINTAINERS to include lan966x driver

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: lan966x: add ethtool configuration and statistics
Horatiu Vultur [Mon, 29 Nov 2021 12:43:58 +0000 (13:43 +0100)]
net: lan966x: add ethtool configuration and statistics

This patch adds support for statistics counters for the network
interfaces. Also adds support for configuring the network interface via
ethtool like: speed, duplex etc.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: lan966x: add mactable support
Horatiu Vultur [Mon, 29 Nov 2021 12:43:57 +0000 (13:43 +0100)]
net: lan966x: add mactable support

This patch adds support for MAC table operations like add and forget.
Also add the functionality to read the MAC address from DT, if there is
no MAC set in DT it would use a random one.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: lan966x: add port module support
Horatiu Vultur [Mon, 29 Nov 2021 12:43:56 +0000 (13:43 +0100)]
net: lan966x: add port module support

This patch adds support for netdev and phylink in the switch. The
injection + extraction is register based. This will be replaced with DMA
accees.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: lan966x: add the basic lan966x driver
Horatiu Vultur [Mon, 29 Nov 2021 12:43:55 +0000 (13:43 +0100)]
net: lan966x: add the basic lan966x driver

This patch adds basic SwitchDev driver framework for lan966x. It
includes only the IO range mapping and probing of the switch.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agodt-bindings: net: lan966x: Add lan966x-switch bindings
Horatiu Vultur [Mon, 29 Nov 2021 12:43:54 +0000 (13:43 +0100)]
dt-bindings: net: lan966x: Add lan966x-switch bindings

Document the lan966x switch device driver bindings

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: ixp4xx_hss: Convert to use DT probing
Linus Walleij [Mon, 22 Nov 2021 22:35:30 +0000 (23:35 +0100)]
net: ixp4xx_hss: Convert to use DT probing

IXP4xx is being migrated to device tree only. Convert this
driver to use device tree probing.

Pull in all the boardfile code from the one boardfile and
make it local, pull all the boardfile parameters from the
device tree instead of the board file.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>