OSDN Git Service

tomoyo/tomoyo-test1.git
11 months agoocteontx2-af: Remove redundant functions mac2u64() and cfg2mac()
Li Zetao [Tue, 8 Aug 2023 11:45:02 +0000 (19:45 +0800)]
octeontx2-af: Remove redundant functions mac2u64() and cfg2mac()

The mac2u64() is used to convert an Ethernet MAC address into a u64 value,
as this is exactly what ether_addr_to_u64() does. Similarly, the cfg2mac()
is also the case. Use ether_addr_to_u64() and u64_to_ether_addr() instead
of these two.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
Acked-by: Geethasowjanya Akula <gakula@marvell.com>
Link: https://lore.kernel.org/r/20230808114504.4036008-2-lizetao1@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoMerge branch 'mlxsw-set-port-stp-state-on-bridge-enslavement'
Jakub Kicinski [Wed, 9 Aug 2023 22:27:52 +0000 (15:27 -0700)]
Merge branch 'mlxsw-set-port-stp-state-on-bridge-enslavement'

Petr Machata says:

====================
mlxsw: Set port STP state on bridge enslavement

When the first port joins a LAG that already has a bridge upper, an
instance of struct mlxsw_sp_bridge_port is created for the LAG to keep
track of it as a bridge port. The bridge_port's STP state is initialized to
BR_STATE_DISABLED. This made sense previously, because mlxsw would only
ever allow a port to join a LAG if the LAG had no uppers. Thus if a
bridge_port was instantiated, it must have been because the LAG as such is
joining a bridge, and the STP state is correspondingly disabled.

However as of commit 2c5ffe8d7226 ("mlxsw: spectrum: Permit enslavement to
netdevices with uppers"), mlxsw allows a port to join a LAG that is already
a member of a bridge. The STP state may be different than disabled in that
case. Initialize it properly by querying the actual state.

This bug may cause an issue as traffic on ports attached to a bridged LAG
gets dropped on ingress with discard_ingress_general counter bumped.

The above fix in patch #1. Patch #2 contains a selftest that would
sporadically reproduce the issue.
====================

Link: https://lore.kernel.org/r/cover.1691498735.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoselftests: mlxsw: router_bridge_lag: Add a new selftest
Petr Machata [Tue, 8 Aug 2023 13:18:16 +0000 (15:18 +0200)]
selftests: mlxsw: router_bridge_lag: Add a new selftest

Add a selftest to verify enslavement to a LAG with upper after fresh
devlink reload.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/373a7754daa4dac32759a45095f47b08a2a869c8.1691498735.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agomlxsw: Set port STP state on bridge enslavement
Petr Machata [Tue, 8 Aug 2023 13:18:15 +0000 (15:18 +0200)]
mlxsw: Set port STP state on bridge enslavement

When the first port joins a LAG that already has a bridge upper, an
instance of struct mlxsw_sp_bridge_port is created for the LAG to keep
track of it as a bridge port. The bridge_port's STP state is initialized to
BR_STATE_DISABLED. This made sense previously, because mlxsw would only
ever allow a port to join a LAG if the LAG had no uppers. Thus if a
bridge_port was instantiated, it must have been because the LAG as such is
joining a bridge, and the STP state is correspondingly disabled.

However as of commit 2c5ffe8d7226 ("mlxsw: spectrum: Permit enslavement to
netdevices with uppers"), mlxsw allows a port to join a LAG that is already
a member of a bridge. The STP state may be different than disabled in that
case. Initialize it properly by querying the actual state.

This bug may cause an issue as traffic on ports attached to a bridged LAG
gets dropped on ingress with discard_ingress_general counter bumped.

Fixes: c6514f3627a0 ("Merge branch 'mlxsw-enslavement'")
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/39f4a5781050866b4132f350d7d8cf7ab23ea070.1691498735.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoethernet: s2io: Use ether_addr_to_u64() to convert ethernet address
Li Zetao [Tue, 8 Aug 2023 11:38:49 +0000 (19:38 +0800)]
ethernet: s2io: Use ether_addr_to_u64() to convert ethernet address

Use ether_addr_to_u64() to convert an Ethernet address into a u64 value,
instead of directly calculating, as this is exactly what
this function does.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230808113849.4033657-1-lizetao1@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoMerge tag 'nf-next-2023-08-08' of https://git.kernel.org/pub/scm/linux/kernel/git...
Jakub Kicinski [Wed, 9 Aug 2023 20:52:36 +0000 (13:52 -0700)]
Merge tag 'nf-next-2023-08-08' of https://git./linux/kernel/git/netfilter/nf-next

Florian Westphal says:

====================
netfilter updates for net-next

First 4 Patches, from Yue Haibing, remove unused prototypes in
various netfilter headers.

Last patch makes nfnetlink_log to always include a packet timestamp,
up to now it was only included if the skb had assigned previously.
From Maciej Żenczykowski.

* tag 'nf-next-2023-08-08' of https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next:
  netfilter: nfnetlink_log: always add a timestamp
  netfilter: h323: Remove unused function declarations
  netfilter: conntrack: Remove unused function declarations
  netfilter: helper: Remove unused function declarations
  netfilter: gre: Remove unused function declaration nf_ct_gre_keymap_flush()
====================

Link: https://lore.kernel.org/r/20230808124159.19046-1-fw@strlen.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agomlxsw: spectrum_switchdev: Use is_zero_ether_addr() instead of ether_addr_equal()
Ruan Jinjie [Tue, 8 Aug 2023 13:35:28 +0000 (21:35 +0800)]
mlxsw: spectrum_switchdev: Use is_zero_ether_addr() instead of ether_addr_equal()

Use is_zero_ether_addr() instead of ether_addr_equal()
to check if the ethernet address is all zeros.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/20230808133528.4083501-1-ruanjinjie@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agotools: ynl-gen: add missing empty line between policies
Jakub Kicinski [Tue, 8 Aug 2023 20:09:07 +0000 (13:09 -0700)]
tools: ynl-gen: add missing empty line between policies

We're missing empty line between policies.
DPLL will need this.

Tested-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://lore.kernel.org/r/20230808200907.1290647-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: switchdev: Remove unused declaration switchdev_port_fwd_mark_set()
Yue Haibing [Tue, 8 Aug 2023 14:59:55 +0000 (22:59 +0800)]
net: switchdev: Remove unused declaration switchdev_port_fwd_mark_set()

Commit 6bc506b4fb06 ("bridge: switchdev: Add forward mark support for stacked devices")
removed the implementation but leave declaration.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Link: https://lore.kernel.org/r/20230808145955.2176-1-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agomlxbf_gige: Remove two unused function declarations
Yue Haibing [Tue, 8 Aug 2023 14:52:49 +0000 (22:52 +0800)]
mlxbf_gige: Remove two unused function declarations

Commit f92e1869d74e ("Add Mellanox BlueField Gigabit Ethernet driver")
declared but never implemented these.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Asmaa Mnebhi <asmaa@nvidia.com>
Link: https://lore.kernel.org/r/20230808145249.41596-1-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: phy: Remove two unused function declarations
Yue Haibing [Tue, 8 Aug 2023 14:46:10 +0000 (22:46 +0800)]
net: phy: Remove two unused function declarations

Commit 1e2dc14509fd ("net: ethtool: Add helpers for reporting test results")
declared but never implemented these function.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20230808144610.19096-1-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: dsa: mark parsed interface mode for legacy switch drivers
Russell King (Oracle) [Tue, 8 Aug 2023 11:12:16 +0000 (12:12 +0100)]
net: dsa: mark parsed interface mode for legacy switch drivers

If we successfully parsed an interface mode with a legacy switch
driver, populate that mode into phylink's supported interfaces rather
than defaulting to the internal and gmii interfaces.

This hasn't caused an issue so far, because when the interface doesn't
match a supported one, phylink_validate() doesn't clear the supported
mask, but instead returns -EINVAL. phylink_parse_fixedlink() doesn't
check this return value, and merely relies on the supported ethtool
link modes mask being cleared. Therefore, the fixed link settings end
up being allowed despite validation failing.

Before this causes a problem, arrange for DSA to more accurately
populate phylink's supported interfaces mask so validation can
correctly succeed.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Link: https://lore.kernel.org/r/E1qTKdM-003Cpx-Eh@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agodevlink: clear flag on port register error path
Jiri Pirko [Tue, 8 Aug 2023 08:20:20 +0000 (10:20 +0200)]
devlink: clear flag on port register error path

When xarray insertion fails, clear the flag.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230808082020.1363497-1-jiri@resnulli.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agotools: ynl-gen: avoid rendering empty validate field
Jiri Pirko [Tue, 8 Aug 2023 09:03:44 +0000 (11:03 +0200)]
tools: ynl-gen: avoid rendering empty validate field

When dont-validate flags are filtered out for do/dump op, the list may
be empty. In that case, avoid rendering the validate field.

Fixes: fa8ba3502ade ("ynl-gen-c.py: render netlink policies static for split ops")
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20230808090344.1368874-1-jiri@resnulli.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: txgbe: Use pci_dev_id() to simplify the code
Xiongfeng Wang [Tue, 8 Aug 2023 02:49:31 +0000 (10:49 +0800)]
net: txgbe: Use pci_dev_id() to simplify the code

PCI core API pci_dev_id() can be used to get the BDF number for a pci
device. We don't need to compose it manually. Use pci_dev_id() to
simplify the code a little bit.

Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230808024931.147048-1-wangxiongfeng2@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agobcm63xx_enet: Remove redundant initialization owner
Li Zetao [Tue, 8 Aug 2023 01:47:02 +0000 (09:47 +0800)]
bcm63xx_enet: Remove redundant initialization owner

The platform_register_drivers() will set "THIS_MODULE" to driver.owner when
register a platform_driver driver, so it is redundant initialization to set
driver.owner in the statement. Remove it for clean code.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Link: https://lore.kernel.org/r/20230808014702.2712699-1-lizetao1@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agotipc: Remove unused declaration tipc_link_build_bc_sync_msg()
Yue Haibing [Mon, 7 Aug 2023 14:29:26 +0000 (22:29 +0800)]
tipc: Remove unused declaration tipc_link_build_bc_sync_msg()

Commit 526669866140 ("tipc: let broadcast packet reception use new link receive function")
declared but never implemented this.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230807142926.45752-1-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: dsa: mt7530: improve and relax PHY driver dependency
Daniel Golle [Sat, 5 Aug 2023 14:45:36 +0000 (15:45 +0100)]
net: dsa: mt7530: improve and relax PHY driver dependency

Different MT7530 variants require different PHY drivers.
Use 'imply' instead of 'select' to relax the dependency on the PHY
driver, and choose the appropriate driver.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 months agoMerge branch 'sfc-conntrack-offload'
David S. Miller [Wed, 9 Aug 2023 10:14:38 +0000 (11:14 +0100)]
Merge branch 'sfc-conntrack-offload'

Edward Cree says:

====================
sfc: basic conntrack offload

Support offloading tracked connections and matching against them in
 TC chains on the PF and on representors.
Later patch serieses will add NAT and conntrack-on-tunnel-netdevs;
 keep it simple for now.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
11 months agosfc: offload left-hand side rules for conntrack
Edward Cree [Mon, 7 Aug 2023 13:48:11 +0000 (14:48 +0100)]
sfc: offload left-hand side rules for conntrack

Handle the (comparatively) simple case of a -trk rule on an efx netdev
 (i.e. not a tunnel decap rule) with ct and goto chain actions.

Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 months agosfc: conntrack state matches in TC rules
Edward Cree [Mon, 7 Aug 2023 13:48:10 +0000 (14:48 +0100)]
sfc: conntrack state matches in TC rules

Parse ct_state trk/est, mark and zone out of flower keys, and plumb
 them through to the hardware, performing some minor translations.
Nothing can actually hit them yet as we're not offloading any DO_CT
 actions.

Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 months agosfc: handle non-zero chain_index on TC rules
Edward Cree [Mon, 7 Aug 2023 13:48:09 +0000 (14:48 +0100)]
sfc: handle non-zero chain_index on TC rules

Map it to an 8-bit recirc_id for use by the hardware.
Currently nothing in the driver is offloading 'goto chain' actions,
 so these rules cannot yet be hit.

Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 months agosfc: offload conntrack flow entries (match only) from CT zones
Edward Cree [Mon, 7 Aug 2023 13:48:08 +0000 (14:48 +0100)]
sfc: offload conntrack flow entries (match only) from CT zones

No handling yet for FLOW_ACTION_MANGLE (NAT or NAPT) actions.

Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 months agosfc: functions to insert/remove conntrack entries to MAE hardware
Edward Cree [Mon, 7 Aug 2023 13:48:07 +0000 (14:48 +0100)]
sfc: functions to insert/remove conntrack entries to MAE hardware

Translate from software struct efx_tc_ct_entry objects to the key
 and response bitstrings, and implement insertion and removal of
 these entries from the hardware table.
Callers of these functions will be added in subsequent patches.

Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 months agosfc: functions to register for conntrack zone offload
Edward Cree [Mon, 7 Aug 2023 13:48:06 +0000 (14:48 +0100)]
sfc: functions to register for conntrack zone offload

Bind a stub callback to the netfilter flow table.

Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 months agosfc: add MAE table machinery for conntrack table
Edward Cree [Mon, 7 Aug 2023 13:48:05 +0000 (14:48 +0100)]
sfc: add MAE table machinery for conntrack table

Access to the connection tracking table in EF100 hardware is through
 a "generic" table mechanism, whereby a firmware call at probe time
 gives the driver a description of the field widths and offsets, so
 that the driver can then construct key and response bitstrings at
 runtime.
Probe the NIC for this information and populate the needed metadata
 into a new meta_ct field of struct efx_tc_state.

Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 months agoMerge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next...
Jakub Kicinski [Tue, 8 Aug 2023 23:41:30 +0000 (16:41 -0700)]
Merge branch '100GbE' of git://git./linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2023-08-07 (ice)

This series contains updates to ice driver only.

Wojciech allows for LAG interfaces to be used for bridge offloads.

Marcin tracks additional metadata for filtering rules to aid in proper
differentiation of similar rules. He also renames some flags that
do not entirely describe their representation.

Karol and Jan add additional waiting for firmware load on devices that
require it.

Przemek refactors RSS implementation to clarify/simplify configurations.

* '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
  ice: clean up __ice_aq_get_set_rss_lut()
  ice: add FW load wait
  ice: Add get C827 PHY index function
  ice: Rename enum ice_pkt_flags values
  ice: Add direction metadata
  ice: Accept LAG netdevs in bridge offloads
====================

Link: https://lore.kernel.org/r/20230807204835.3129164-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoMerge tag 'mlx5-updates-2023-08-07' of git://git.kernel.org/pub/scm/linux/kernel...
Jakub Kicinski [Tue, 8 Aug 2023 23:28:28 +0000 (16:28 -0700)]
Merge tag 'mlx5-updates-2023-08-07' of git://git./linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5-updates-2023-08-07

1) Few cleanups

2) Dynamic completion EQs

The driver creates completion EQs for all vectors directly on driver
load, even if those EQs will not be utilized later on.

To allow more flexibility in managing completion EQs and to reduce the
memory overhead of driver load, this series will adjust completion EQs
creation to be dynamic. Meaning, completion EQs will be created only
when needed.

Patch #1 introduces a counter for tracking the current number of
completion EQs.
Patches #2-6 refactor the existing infrastructure of managing completion
EQs and completion IRQs to be compatible with per-vector
allocation/release requests.
Patches #7-8 modify the CPU-to-IRQ affinity calculation to be resilient
in case the affinity is requested but completion IRQ is not allocated yet.
Patch #9 function rename.
Patch #10 handles the corner case of SF performing an IRQ request when no
SF IRQ pool is found, and no PF IRQ exists for the same vector.
Patch #11 modify driver to use dynamically allocate completion EQs.

* tag 'mlx5-updates-2023-08-07' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux:
  net/mlx5: Bridge, Only handle registered netdev bridge events
  net/mlx5: E-Switch, Remove redundant arg ignore_flow_lvl
  net/mlx5: Fix typo reminder -> remainder
  net/mlx5: remove many unnecessary NULL values
  net/mlx5: Allocate completion EQs dynamically
  net/mlx5: Handle SF IRQ request in the absence of SF IRQ pool
  net/mlx5: Rename mlx5_comp_vectors_count() to mlx5_comp_vectors_max()
  net/mlx5: Add IRQ vector to CPU lookup function
  net/mlx5: Introduce mlx5_cpumask_default_spread
  net/mlx5: Implement single completion EQ create/destroy methods
  net/mlx5: Use xarray to store and manage completion EQs
  net/mlx5: Refactor completion IRQ request/release handlers in EQ layer
  net/mlx5: Use xarray to store and manage completion IRQs
  net/mlx5: Refactor completion IRQ request/release API
  net/mlx5: Track the current number of completion EQs
====================

Link: https://lore.kernel.org/r/20230807175642.20834-1-saeed@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agodocs: net: page_pool: de-duplicate the intro comment
Jakub Kicinski [Mon, 7 Aug 2023 21:00:51 +0000 (14:00 -0700)]
docs: net: page_pool: de-duplicate the intro comment

In commit 82e896d992fa ("docs: net: page_pool: use kdoc to avoid
duplicating the information") I shied away from using the DOC:
comments when moving to kdoc for documenting page_pool API,
because I wasn't sure how familiar people are with it.

Turns out there is already a DOC: comment for the intro, which
is the same in both places, modulo what looks like minor rewording.
Use the version from Documentation/ but keep the contents with
the code.

Acked-by: Jesper Dangaard Brouer <hawk@kernel.org>
Link: https://lore.kernel.org/r/20230807210051.1014580-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agodevlink: Remove unused devlink_dpipe_table_resource_set() declaration
Yue Haibing [Mon, 7 Aug 2023 14:32:14 +0000 (22:32 +0800)]
devlink: Remove unused devlink_dpipe_table_resource_set() declaration

Commit f655dacb59ac ("net: devlink: remove unused locked functions")
removed this but leave the declaration.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20230807143214.46648-1-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: fq: Remove unused typedef fq_flow_get_default_t
Yue Haibing [Mon, 7 Aug 2023 14:21:11 +0000 (22:21 +0800)]
net: fq: Remove unused typedef fq_flow_get_default_t

Commitbf9009bf21b5 ("net/fq_impl: drop get_default_func, move default flow to fq_tin")
remove its last user, so can remove it.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230807142111.33524-1-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet/tls: avoid TCP window full during ->read_sock()
Hannes Reinecke [Mon, 7 Aug 2023 07:10:22 +0000 (09:10 +0200)]
net/tls: avoid TCP window full during ->read_sock()

When flushing the backlog after decoding a record we don't really
know how much data the caller want us to evaluate, so use INT_MAX
and 0 as arguments to tls_read_flush_backlog() to ensure we flush
at 128k of data. Otherwise we might be reading too much data and
trigger a TCP window full.

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Link: https://lore.kernel.org/r/20230807071022.10091-1-hare@suse.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoipv6: exthdrs: Replace opencoded swap() implementation
Ziyang Xuan [Mon, 7 Aug 2023 02:09:47 +0000 (10:09 +0800)]
ipv6: exthdrs: Replace opencoded swap() implementation

Get a coccinelle warning as follows:
net/ipv6/exthdrs.c:800:29-30: WARNING opportunity for swap()

Use swap() to replace opencoded implementation.

Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20230807020947.1991716-1-william.xuanziyang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet/ipv4: return the real errno instead of -EINVAL
xu xin [Mon, 7 Aug 2023 01:54:08 +0000 (01:54 +0000)]
net/ipv4: return the real errno instead of -EINVAL

For now, No matter what error pointer ip_neigh_for_gw() returns,
ip_finish_output2() always return -EINVAL, which may mislead the upper
users.

For exemple, an application uses sendto to send an UDP packet, but when the
neighbor table overflows, sendto() will get a value of -EINVAL, and it will
cause users to waste a lot of time checking parameters for errors.

Return the real errno instead of -EINVAL.

Signed-off-by: xu xin <xu.xin16@zte.com.cn>
Reviewed-by: Yang Yang <yang.yang29@zte.com.cn>
Cc: Si Hao <si.hao@zte.com.cn>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://lore.kernel.org/r/20230807015408.248237-1-xu.xin16@zte.com.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoMerge branch 'net-renesas-rswitch-add-speed-change-support'
Jakub Kicinski [Tue, 8 Aug 2023 22:31:53 +0000 (15:31 -0700)]
Merge branch 'net-renesas-rswitch-add-speed-change-support'

Yoshihiro Shimoda says:

====================
net: renesas: rswitch: Add speed change support

Add speed change support at runtime for the latest SoC version.
Also, add ethtool .[gs]et_link_ksettings.

v1: https://lore.kernel.org/all/20230803120621.1471440-1-yoshihiro.shimoda.uh@renesas.com/
====================

Link: https://lore.kernel.org/r/20230807003231.1552062-1-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: renesas: rswitch: Add .[gs]et_link_ksettings support
Yoshihiro Shimoda [Mon, 7 Aug 2023 00:32:31 +0000 (09:32 +0900)]
net: renesas: rswitch: Add .[gs]et_link_ksettings support

Add .[gs]et_link_ksettings support by using
phy_ethtool_[gs]et_link_ksettings() functions.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230807003231.1552062-3-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: renesas: rswitch: Add runtime speed change support
Yoshihiro Shimoda [Mon, 7 Aug 2023 00:32:30 +0000 (09:32 +0900)]
net: renesas: rswitch: Add runtime speed change support

The latest SoC version can support runtime speed change. So,
add detect SoC version by using soc_device_match() and then
reconfigure the hardware of this and SerDes if needed.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230807003231.1552062-2-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agortnetlink: remove redundant checks for nlattr IFLA_BRIDGE_MODE
Lin Ma [Mon, 7 Aug 2023 09:13:47 +0000 (17:13 +0800)]
rtnetlink: remove redundant checks for nlattr IFLA_BRIDGE_MODE

The commit d73ef2d69c0d ("rtnetlink: let rtnl_bridge_setlink checks
IFLA_BRIDGE_MODE length") added the nla_len check in rtnl_bridge_setlink,
which is the only caller for ndo_bridge_setlink handlers defined in
low-level driver codes. Hence, this patch cleanups the redundant checks in
each ndo_bridge_setlink handler function.

Suggested-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Lin Ma <linma@zju.edu.cn>
Acked-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230807091347.3804523-1-linma@zju.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoMerge branch 'bnxt_en-fix-2-compile-warnings-in-bnxt_dcb-c'
Jakub Kicinski [Tue, 8 Aug 2023 22:07:20 +0000 (15:07 -0700)]
Merge branch 'bnxt_en-fix-2-compile-warnings-in-bnxt_dcb-c'

Michael Chan says:

====================
bnxt_en: Fix 2 compile warnings in bnxt_dcb.c

Fix 2 similar warnings in bnxt_dcb.c related to the cos2bw interface
definitions in bnxt_hsi.h.
====================

Link: https://lore.kernel.org/r/20230807145720.159645-1-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agobnxt_en: Fix W=stringop-overflow warning in bnxt_dcb.c
Michael Chan [Mon, 7 Aug 2023 14:57:20 +0000 (07:57 -0700)]
bnxt_en: Fix W=stringop-overflow warning in bnxt_dcb.c

Fix the following warning:

drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c: In function ‘bnxt_hwrm_queue_cos2bw_cfg’:
cc1: error: writing 12 bytes into a region of size 1 [-Werror=stringop-overflow ]
In file included from drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c:19:
drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h:6045:17: note: destination object ‘unused_0’ of size 1
 6045 |         u8      unused_0;

Fix it by modifying struct hwrm_queue_cos2bw_cfg_input to use an array
of sub struct similar to the previous patch.  This will eliminate the
pointer arithmetc to calculate the destination pointer passed to
memcpy().

Link: https://lore.kernel.org/netdev/CACKFLinikvXmKcxr4kjWO9TPYxTd2cb5agT1j=w9Qyj5-24s5A@mail.gmail.com/
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20230807145720.159645-3-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agobnxt_en: Fix W=1 warning in bnxt_dcb.c from fortify memcpy()
Michael Chan [Mon, 7 Aug 2023 14:57:19 +0000 (07:57 -0700)]
bnxt_en: Fix W=1 warning in bnxt_dcb.c from fortify memcpy()

Fix the following warning:

inlined from ‘bnxt_hwrm_queue_cos2bw_qcfg’ at drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c:165:3,
./include/linux/fortify-string.h:592:4: error: call to ‘__read_overflow2_field’ declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror]
    __read_overflow2_field(q_size_field, size);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Modify the FW interface defintion of struct hwrm_queue_cos2bw_qcfg_output
to use an array of sub struct for the queue1 to queue7 fields.  Note that
the layout of the queue0 fields are different and these are not part of
the array.  This makes the code much cleaner by removing the pointer
arithmetic for memcpy().

Link: https://lore.kernel.org/netdev/20230727190726.1859515-2-kuba@kernel.org/
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20230807145720.159645-2-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: bcmasp: Prevent array undereflow in bcmasp_netfilt_get_init()
Dan Carpenter [Mon, 7 Aug 2023 13:01:53 +0000 (16:01 +0300)]
net: bcmasp: Prevent array undereflow in bcmasp_netfilt_get_init()

The "loc" value comes from the user and it can be negative leading to an
an array underflow when we check "priv->net_filters[loc].claimed".  Fix
this by changing the type to u32.

Fixes: c5d511c49587 ("net: bcmasp: Add support for wake on net filters")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Justin Chen <justin.chen@broadcom.com>
Link: https://lore.kernel.org/r/b3b47b25-01fc-4d9f-a6c3-e037ad4d71d7@moroto.mountain
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoMerge branch 'team-do-some-cleanups-in-team-driver'
Jakub Kicinski [Tue, 8 Aug 2023 22:04:06 +0000 (15:04 -0700)]
Merge branch 'team-do-some-cleanups-in-team-driver'

Zhengchao Shao says:

====================
team: do some cleanups in team driver

Do some cleanups in team driver.
====================

Link: https://lore.kernel.org/r/20230807012556.3146071-1-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoteam: remove unused input parameters in lb_htpm_select_tx_port and lb_hash_select_tx_port
Zhengchao Shao [Mon, 7 Aug 2023 01:25:56 +0000 (09:25 +0800)]
team: remove unused input parameters in lb_htpm_select_tx_port and lb_hash_select_tx_port

The input parameters "lb_priv" and "skb" in lb_htpm_select_tx_port and
lb_hash_select_tx_port are unused, so remove them.

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20230807012556.3146071-6-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoteam: change the getter function in the team_option structure to void
Zhengchao Shao [Mon, 7 Aug 2023 01:25:55 +0000 (09:25 +0800)]
team: change the getter function in the team_option structure to void

Because the getter function in the team_option structure always returns 0,
so change the getter function to void and remove redundant code.

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20230807012556.3146071-5-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoteam: change the init function in the team_option structure to void
Zhengchao Shao [Mon, 7 Aug 2023 01:25:54 +0000 (09:25 +0800)]
team: change the init function in the team_option structure to void

Because the init function in the team_option structure always returns 0,
so change the init function to void and remove redundant code.

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20230807012556.3146071-4-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoteam: remove unreferenced header in broadcast and roundrobin files
Zhengchao Shao [Mon, 7 Aug 2023 01:25:53 +0000 (09:25 +0800)]
team: remove unreferenced header in broadcast and roundrobin files

Because linux/errno.h is unreferenced in broadcast and roundrobin
files, so remove it.

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20230807012556.3146071-3-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoteam: add __exit modifier to team_nl_fini()
Zhengchao Shao [Mon, 7 Aug 2023 01:25:52 +0000 (09:25 +0800)]
team: add __exit modifier to team_nl_fini()

team_nl_fini is only called when the module exits, so add the __exit
modifier to it.

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20230807012556.3146071-2-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoMerge branch 'net-fs_enet-driver-cleanup'
Jakub Kicinski [Tue, 8 Aug 2023 22:01:41 +0000 (15:01 -0700)]
Merge branch 'net-fs_enet-driver-cleanup'

Christophe Leroy says:

====================
net: fs_enet: Driver cleanup

Over the years, platform and driver initialisation have evolved into
more generic ways, and driver or platform specific stuff has gone
away, leaving stale objects behind.

This series aims at cleaning all that up for fs_enet ethernet driver.
====================

Link: https://lore.kernel.org/r/cover.1691155346.git.christophe.leroy@csgroup.eu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: fs_enet: Use cpm_muram_xxx() functions instead of cpm_dpxxx() macros
Christophe Leroy [Fri, 4 Aug 2023 13:30:20 +0000 (15:30 +0200)]
net: fs_enet: Use cpm_muram_xxx() functions instead of cpm_dpxxx() macros

cpm_dpxxx() macros are now always referring to cpm_muram_xxx() functions
directly since commit 3dd82a1ea724 ("[POWERPC] CPM: Always use new
binding.")

Use cpm_muram_xxx() functions directly so that the cpm_dpxxx() macros
can be removed in the near future.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/2400b3156891adb653dc387fff6393de10cf2b24.1691155347.git.christophe.leroy@csgroup.eu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: fs_enet: Remove linux/fs_enet_pd.h
Christophe Leroy [Fri, 4 Aug 2023 13:30:19 +0000 (15:30 +0200)]
net: fs_enet: Remove linux/fs_enet_pd.h

linux/fs_enet_pd.h is not used anymore.

Remove it.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/5be102791c987792ad127b15543ee6715394cf67.1691155347.git.christophe.leroy@csgroup.eu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: fs_enet: Don't include fs_enet_pd.h when not needed
Christophe Leroy [Fri, 4 Aug 2023 13:30:18 +0000 (15:30 +0200)]
net: fs_enet: Don't include fs_enet_pd.h when not needed

Three platforms in arch/powerpc/platforms/8xx/ include fs_enet_pd.h
but don't use anything from it.

Remove the includes.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/de62ad1261a801c4a8ae4238bd4842ff278d2ddf.1691155347.git.christophe.leroy@csgroup.eu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: fs_enet: Move struct fs_platform_info into fs_enet.h
Christophe Leroy [Fri, 4 Aug 2023 13:30:17 +0000 (15:30 +0200)]
net: fs_enet: Move struct fs_platform_info into fs_enet.h

struct fs_platform_info is only used in fs_enet ethernet driver since
commit 3dd82a1ea724 ("[POWERPC] CPM: Always use new binding.").

Stale prototypes using fs_platform_info were left over in
arch/powerpc/sysdev/fsl_soc.c but they are now removed by
previous patch.

Move struct fs_platform_info into fs_enet.h

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/f882d6b0b7075d0d8435310634ceaa2cc8e9938f.1691155347.git.christophe.leroy@csgroup.eu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: fs_enet: Remove stale prototypes from fsl_soc.c
Christophe Leroy [Fri, 4 Aug 2023 13:30:16 +0000 (15:30 +0200)]
net: fs_enet: Remove stale prototypes from fsl_soc.c

Commit 3dd82a1ea724 ("[POWERPC] CPM: Always use new binding.")
removed last use of init_fec_ioports() and init_fcc_ioports().

Remove stale prototypes then don't include anymore fs_enet_pd.h
which was only included to provide fs_platform_info structure
for the prototypes.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/f2f2db5dce3242eaa4a2aad6c226ba587fb0f513.1691155347.git.christophe.leroy@csgroup.eu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: fs_enet: Remove has_phy field in fs_platform_info struct
Christophe Leroy [Fri, 4 Aug 2023 13:30:15 +0000 (15:30 +0200)]
net: fs_enet: Remove has_phy field in fs_platform_info struct

Since commit 3dd82a1ea724 ("[POWERPC] CPM: Always use new binding.")
has_phy field is never set.

Remove dead code and remove the field.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/bb5264e09e18f0ce8a0dbee399926a59f33cb248.1691155346.git.christophe.leroy@csgroup.eu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: fs_enet: Remove unused fields in fs_platform_info struct
Christophe Leroy [Fri, 4 Aug 2023 13:30:14 +0000 (15:30 +0200)]
net: fs_enet: Remove unused fields in fs_platform_info struct

Since commit 3dd82a1ea724 ("[POWERPC] CPM: Always use new binding.")
many fields of fs_platform_info structure are not used anymore.

Remove them.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/2e584fcd75e21a0f7e7d5f942eebdc067b2f82f9.1691155346.git.christophe.leroy@csgroup.eu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: fs_enet: Remove fs_get_id()
Christophe Leroy [Fri, 4 Aug 2023 13:30:13 +0000 (15:30 +0200)]
net: fs_enet: Remove fs_get_id()

fs_get_id() hasn't been used since commit b219108cbace ("fs_enet:
Remove !CONFIG_PPC_CPM_NEW_BINDING code")

Remove it.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/7a53b88cc40302fcbea59554f5e7067e3594ad53.1691155346.git.christophe.leroy@csgroup.eu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: fs_enet: Fix address space and base types mismatches
Christophe Leroy [Fri, 4 Aug 2023 13:30:12 +0000 (15:30 +0200)]
net: fs_enet: Fix address space and base types mismatches

CHECK   drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
drivers/net/ethernet/freescale/fs_enet/mac-fcc.c:550:9: warning: cast removes address space '__iomem' of expression
drivers/net/ethernet/freescale/fs_enet/mac-fcc.c:550:9: error: subtraction of different types can't work (different address spaces)
  CC      drivers/net/ethernet/freescale/fs_enet/mii-bitbang.o
  CHECK   drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:95:31: warning: incorrect type in argument 1 (different base types)
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:95:31:    expected unsigned int [noderef] [usertype] __iomem *p
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:95:31:    got restricted __be32 [noderef] [usertype] __iomem *dat
...
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:63:31: warning: incorrect type in argument 1 (different base types)
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:63:31:    expected unsigned int [noderef] [usertype] __iomem *p
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:63:31:    got restricted __be32 [noderef] [usertype] __iomem *dir
...

Fix those address space and base type mismatches reported by sparse.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/25c7965e6aeeb6bbe1b6be5a3c2c7125182fcb02.1691155346.git.christophe.leroy@csgroup.eu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: fs_enet: Remove set but not used variable
Christophe Leroy [Fri, 4 Aug 2023 13:30:11 +0000 (15:30 +0200)]
net: fs_enet: Remove set but not used variable

CC      drivers/net/ethernet/freescale/fs_enet/fs_enet-main.o
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c: In function 'fs_enet_interrupt':
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c:321:40: warning: variable 'fpi' set but not used [-Wunused-but-set-variable]

Remove that variable.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/90b72c1708bb8ba2b7a1a688e8259e428968364d.1691155346.git.christophe.leroy@csgroup.eu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: hns: Remove unused function declaration mac_adjust_link()
Yue Haibing [Fri, 4 Aug 2023 13:00:48 +0000 (21:00 +0800)]
net: hns: Remove unused function declaration mac_adjust_link()

Commit 511e6bc071db ("net: add Hisilicon Network Subsystem DSAF support")
declared but never implemented this, remove it.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Hao Lan <lanhao@huawei.com>
Link: https://lore.kernel.org/r/20230804130048.39808-1-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoi40e: Remove unused function declarations
Yue Haibing [Fri, 4 Aug 2023 12:55:25 +0000 (20:55 +0800)]
i40e: Remove unused function declarations

Commit f62b5060d670 ("i40e: fix mac address checking") left behind
i40e_validate_mac_addr() declaration.
Also the other declarations are declared but never implemented in
commit 56a62fc86895 ("i40e: init code and hardware support").

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230804125525.20244-1-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoixgbe: Remove unused function declarations
Yue Haibing [Fri, 4 Aug 2023 12:52:03 +0000 (20:52 +0800)]
ixgbe: Remove unused function declarations

Commit dc166e22ede5 ("ixgbe: DCB remove ixgbe_fcoe_getapp routine")
leave ixgbe_fcoe_getapp() unused.
Commit ffed21bcee7a ("ixgbe: Don't bother clearing buffer memory for descriptor rings")
leave ixgbe_unmap_and_free_tx_resource() declaration unused.
And commit 3b3bf3b92b31 ("ixgbe: remove unused fcoe.tc field and fcoe_setapp()")
removed the ixgbe_fcoe_setapp() implementation.

Commit c44ade9ef8ff ("ixgbe: update to latest common code module")
declared but never implemented ixgbe_init_ops_generic().

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230804125203.30924-1-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonetfilter: nfnetlink_log: always add a timestamp
Maciej Żenczykowski [Tue, 25 Jul 2023 08:54:43 +0000 (01:54 -0700)]
netfilter: nfnetlink_log: always add a timestamp

Compared to all the other work we're already doing to deliver
an skb to userspace this is very cheap - at worse an extra
call to ktime_get_real() - and very useful.

(and indeed it may even be cheaper if we're running from other hooks)

(background: Android occasionally logs packets which
caused wake from sleep/suspend and we'd like to have
timestamps reliably associated with these events)

Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
11 months agonetfilter: h323: Remove unused function declarations
Yue Haibing [Mon, 7 Aug 2023 14:25:26 +0000 (22:25 +0800)]
netfilter: h323: Remove unused function declarations

Commit f587de0e2feb ("[NETFILTER]: nf_conntrack/nf_nat: add H.323 helper port")
declared but never implemented these.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
11 months agonetfilter: conntrack: Remove unused function declarations
Yue Haibing [Fri, 4 Aug 2023 13:41:49 +0000 (21:41 +0800)]
netfilter: conntrack: Remove unused function declarations

Commit 1015c3de23ee ("netfilter: conntrack: remove extension register api")
leave nf_conntrack_acct_fini() and nf_conntrack_labels_init() unused, remove it.
And commit a0ae2562c6c4 ("netfilter: conntrack: remove l3proto abstraction")
leave behind nf_ct_l3proto_try_module_get() and nf_ct_l3proto_module_put().

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
11 months agonetfilter: helper: Remove unused function declarations
Yue Haibing [Wed, 2 Aug 2023 13:15:49 +0000 (21:15 +0800)]
netfilter: helper: Remove unused function declarations

Commit b118509076b3 ("netfilter: remove nf_conntrack_helper sysctl and modparam toggles")
leave these unused declarations.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
11 months agonetfilter: gre: Remove unused function declaration nf_ct_gre_keymap_flush()
Yue Haibing [Wed, 2 Aug 2023 13:09:57 +0000 (21:09 +0800)]
netfilter: gre: Remove unused function declaration nf_ct_gre_keymap_flush()

Commit a23f89a99906 ("netfilter: conntrack: nf_ct_gre_keymap_flush() removal")
leave this unused, remove it.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
11 months agoMerge branch 'net-remove-redundant-initialization-owner'
Jakub Kicinski [Tue, 8 Aug 2023 02:18:29 +0000 (19:18 -0700)]
Merge branch 'net-remove-redundant-initialization-owner'

Li Zetao says:

====================
net: Remove redundant initialization owner

This patch set removes redundant initialization owner when register a
fsl_mc_driver driver
====================

Link: https://lore.kernel.org/r/20230804095946.99956-1-lizetao1@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: dpaa2-switch: Remove redundant initialization owner in dpaa2_switch_drv
Li Zetao [Fri, 4 Aug 2023 09:59:46 +0000 (17:59 +0800)]
net: dpaa2-switch: Remove redundant initialization owner in dpaa2_switch_drv

The fsl_mc_driver_register() will set "THIS_MODULE" to driver.owner when
register a fsl_mc_driver driver, so it is redundant initialization to set
driver.owner in dpaa2_switch_drv statement. Remove it for clean code.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230804095946.99956-3-lizetao1@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: dpaa2-eth: Remove redundant initialization owner in dpaa2_eth_driver
Li Zetao [Fri, 4 Aug 2023 09:59:45 +0000 (17:59 +0800)]
net: dpaa2-eth: Remove redundant initialization owner in dpaa2_eth_driver

The fsl_mc_driver_register() will set "THIS_MODULE" to driver.owner when
register a fsl_mc_driver driver, so it is redundant initialization to set
driver.owner in dpaa2_eth_driver statement. Remove it for clean code.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230804095946.99956-2-lizetao1@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoMerge branch 'octeontx2-af-tc-flower-offload-changes'
Jakub Kicinski [Tue, 8 Aug 2023 02:16:00 +0000 (19:16 -0700)]
Merge branch 'octeontx2-af-tc-flower-offload-changes'

Suman Ghosh says:

====================
octeontx2-af: TC flower offload changes

This patchset includes minor code restructuring related to TC
flower offload for outer vlan and adding support for TC inner
vlan offload.

Patch #1 Code restructure to handle TC flower outer vlan offload

Patch #2 Add TC flower offload support for inner vlan
====================

Link: https://lore.kernel.org/r/20230804045935.3010554-1-sumang@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoocteontx2-af: TC flower offload support for inner VLAN
Suman Ghosh [Fri, 4 Aug 2023 04:59:35 +0000 (10:29 +0530)]
octeontx2-af: TC flower offload support for inner VLAN

Extend the current TC flower offload support to enable filters matching
inner VLAN, and support offload of those filters to hardware.

Signed-off-by: Suman Ghosh <sumang@marvell.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230804045935.3010554-3-sumang@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoocteontx2-af: Code restructure to handle TC outer VLAN offload
Suman Ghosh [Fri, 4 Aug 2023 04:59:34 +0000 (10:29 +0530)]
octeontx2-af: Code restructure to handle TC outer VLAN offload

Moved the TC outer VLAN offload support to a separate function.
This change is done to handle all VLAN related changes cleanly from
a dedicated function.

Signed-off-by: Suman Ghosh <sumang@marvell.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230804045935.3010554-2-sumang@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoMerge branch 'page_pool-a-couple-of-assorted-optimizations'
Jakub Kicinski [Mon, 7 Aug 2023 19:28:54 +0000 (12:28 -0700)]
Merge branch 'page_pool-a-couple-of-assorted-optimizations'

Alexander Lobakin says:

====================
page_pool: a couple of assorted optimizations

That initially was a spin-off of the IAVF PP series[0], but has grown
(and shrunk) since then a bunch. In fact, it consists of three
semi-independent blocks:

* #1-2: Compile-time optimization. Split page_pool.h into 2 headers to
  not overbloat the consumers not needing complex inline helpers and
  then stop including it in skbuff.h at all. The first patch is also
  prereq for the whole series.
* #3: Improve cacheline locality for users of the Page Pool frag API.
* #4-6: Use direct cache recycling more aggressively, when it is safe
  obviously. In addition, make sure nobody wants to use Page Pool API
  with disabled interrupts.

Patches #1 and #5 are authored by Yunsheng and Jakub respectively, with
small modifications from my side as per ML discussions.
For the perf numbers for #3-6, please see individual commit messages.

Also available on my GH with many more Page Pool goodies[1].

[0] https://lore.kernel.org/netdev/20230530150035.1943669-1-aleksander.lobakin@intel.com
[1] https://github.com/alobakin/linux/commits/iavf-pp-frag
====================

Link: https://lore.kernel.org/r/20230804180529.2483231-1-aleksander.lobakin@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: skbuff: always try to recycle PP pages directly when in softirq
Alexander Lobakin [Fri, 4 Aug 2023 18:05:29 +0000 (20:05 +0200)]
net: skbuff: always try to recycle PP pages directly when in softirq

Commit 8c48eea3adf3 ("page_pool: allow caching from safely localized
NAPI") allowed direct recycling of skb pages to their PP for some cases,
but unfortunately missed a couple of other majors.
For example, %XDP_DROP in skb mode. The netstack just calls kfree_skb(),
which unconditionally passes `false` as @napi_safe. Thus, all pages go
through ptr_ring and locks, although most of time we're actually inside
the NAPI polling this PP is linked with, so that it would be perfectly
safe to recycle pages directly.
Let's address such. If @napi_safe is true, we're fine, don't change
anything for this path. But if it's false, check whether we are in the
softirq context. It will most likely be so and then if ->list_owner
is our current CPU, we're good to use direct recycling, even though
@napi_safe is false -- concurrent access is excluded. in_softirq()
protection is needed mostly due to we can hit this place in the
process context (not the hardirq though).
For the mentioned xdp-drop-skb-mode case, the improvement I got is
3-4% in Mpps. As for page_pool stats, recycle_ring is now 0 and
alloc_slow counter doesn't change most of time, which means the
MM layer is not even called to allocate any new pages.

Suggested-by: Jakub Kicinski <kuba@kernel.org> # in_softirq()
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://lore.kernel.org/r/20230804180529.2483231-7-aleksander.lobakin@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agopage_pool: add a lockdep check for recycling in hardirq
Jakub Kicinski [Fri, 4 Aug 2023 18:05:28 +0000 (20:05 +0200)]
page_pool: add a lockdep check for recycling in hardirq

Page pool use in hardirq is prohibited, add debug checks
to catch misuses. IIRC we previously discussed using
DEBUG_NET_WARN_ON_ONCE() for this, but there were concerns
that people will have DEBUG_NET enabled in perf testing.
I don't think anyone enables lockdep in perf testing,
so use lockdep to avoid pushback and arguing :)

Acked-by: Jesper Dangaard Brouer <hawk@kernel.org>
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://lore.kernel.org/r/20230804180529.2483231-6-aleksander.lobakin@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: skbuff: avoid accessing page_pool if !napi_safe when returning page
Alexander Lobakin [Fri, 4 Aug 2023 18:05:27 +0000 (20:05 +0200)]
net: skbuff: avoid accessing page_pool if !napi_safe when returning page

Currently, pp->p.napi is always read, but the actual variable it gets
assigned to is read-only when @napi_safe is true. For the !napi_safe
cases, which yet is still a pack, it's an unneeded operation.
Moreover, it can lead to premature or even redundant page_pool
cacheline access. For example, when page_pool_is_last_frag() returns
false (with the recent frag improvements).
Thus, read it only when @napi_safe is true. This also allows moving
@napi inside the condition block itself. Constify it while we are
here, because why not.

Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://lore.kernel.org/r/20230804180529.2483231-5-aleksander.lobakin@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agopage_pool: place frag_* fields in one cacheline
Alexander Lobakin [Fri, 4 Aug 2023 18:05:26 +0000 (20:05 +0200)]
page_pool: place frag_* fields in one cacheline

On x86_64, frag_* fields of struct page_pool are scattered across two
cachelines despite the summary size of 24 bytes. All three fields are
used in pretty much the same places, but the last field, ::frag_users,
is pushed out to the next CL, provoking unwanted false-sharing on
hotpath (frags allocation code).
There are some holes and cold members to move around. Move frag_* one
block up, placing them right after &page_pool_params perfectly at the
beginning of CL2. This doesn't do any meaningful to the second block, as
those are some destroy-path cold structures, and doesn't do anything to
::alloc_stats, which still starts at 200-byte offset, 8 bytes after CL3
(still fitting into 1 cacheline).
On my setup, this yields 1-2% of Mpps when using PP frags actively.
When it comes to 32-bit architectures with 32-byte CL: &page_pool_params
plus ::pad is 44 bytes, the block taken care of is 16 bytes within one
CL, so there should be at least no regressions from the actual change.
::pages_state_hold_cnt is not related directly to that triple, but is
paired currently with ::frags_offset and decoupling them would mean
either two 4-byte holes or more invasive layout changes.

Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://lore.kernel.org/r/20230804180529.2483231-4-aleksander.lobakin@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: skbuff: don't include <net/page_pool/types.h> to <linux/skbuff.h>
Alexander Lobakin [Fri, 4 Aug 2023 18:05:25 +0000 (20:05 +0200)]
net: skbuff: don't include <net/page_pool/types.h> to <linux/skbuff.h>

Currently, touching <net/page_pool/types.h> triggers a rebuild of more
than half of the kernel. That's because it's included in
<linux/skbuff.h>. And each new include to page_pool/types.h adds more
[useless] data for the toolchain to process per each source file from
that pile.

In commit 6a5bcd84e886 ("page_pool: Allow drivers to hint on SKB
recycling"), Matteo included it to be able to call a couple of functions
defined there. Then, in commit 57f05bc2ab24 ("page_pool: keep pp info as
long as page pool owns the page") one of the calls was removed, so only
one was left. It's the call to page_pool_return_skb_page() in
napi_frag_unref(). The function is external and doesn't have any
dependencies. Having very niche page_pool_types.h included only for that
looks like an overkill.

As %PP_SIGNATURE is not local to page_pool.c (was only in the
early submissions), nothing holds this function there. Teleport
page_pool_return_skb_page() to skbuff.c, just next to the main consumer,
skb_pp_recycle(), and rename it to napi_pp_put_page(), as it doesn't
work with skbs at all and the former name tells nothing. The #if guards
here are only to not compile and have it in the vmlinux when not needed
-- both call sites are already guarded.
Now, touching page_pool_types.h only triggers rebuilding of the drivers
using it and a couple of core networking files.

Suggested-by: Jakub Kicinski <kuba@kernel.org> # make skbuff.h less heavy
Suggested-by: Alexander Duyck <alexanderduyck@fb.com> # move to skbuff.c
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://lore.kernel.org/r/20230804180529.2483231-3-aleksander.lobakin@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agopage_pool: split types and declarations from page_pool.h
Yunsheng Lin [Fri, 4 Aug 2023 18:05:24 +0000 (20:05 +0200)]
page_pool: split types and declarations from page_pool.h

Split types and pure function declarations from page_pool.h
and add them in page_page/types.h, so that C sources can
include page_pool.h and headers should generally only include
page_pool/types.h as suggested by jakub.
Rename page_pool.h to page_pool/helpers.h to have both in
one place.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://lore.kernel.org/r/20230804180529.2483231-2-aleksander.lobakin@intel.com
[Jakub: change microsoft/mana, fix kdoc paths in Documentation]
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoice: clean up __ice_aq_get_set_rss_lut()
Przemek Kitszel [Wed, 7 Jun 2023 13:09:57 +0000 (09:09 -0400)]
ice: clean up __ice_aq_get_set_rss_lut()

Refactor __ice_aq_get_set_rss_lut() to improve reader experience and limit
misuse scenarios (undesired LUT size for given LUT type).

Allow only 3 RSS LUT type+size variants:
PF LUT sized 2048, GLOBAL LUT sized 512, and VSI LUT sized 64, which were
used on default flows prior to this commit.

Prior to the change, code was mixing the meaning of @params->lut_size and
@params->lut_type, flag assigning logic was cryptic, while long defines
made everything harder to follow.

Fix that by extracting some code out to separate helpers.
Drop some of "shift by 0" statements that originated from Intel's
internal HW documentation.

Drop some redundant VSI masks (since ice_is_vsi_valid() gives "valid" for
up to 0x300 VSIs).

After sweeping all the defines out of struct ice_aqc_get_set_rss_lut,
it fits into 7 lines.

Finally apply some cleanup to the callsite
(use of the new enums, tmp var for lengthy bit extraction).

Note that flags for 128 and 64 sized VSI LUT are the same,
and 64 is used everywhere in the code (updated to new enum here), it just
happened that there was 128 in flag name.

__ice_aq_get_set_rss_key() uses the same VSI valid bit, make constant
common for it and __ice_aq_get_set_rss_lut().

Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Tested-by: Arpana Arland <arpanax.arland@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
11 months agoice: add FW load wait
Jan Sokolowski [Thu, 13 Jul 2023 13:21:24 +0000 (15:21 +0200)]
ice: add FW load wait

As some cards load FW from external sources, we have to wait
to be sure that FW is ready before setting link up.

Add check and wait for FW readiness

Signed-off-by: Jan Sokolowski <jan.sokolowski@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
11 months agoice: Add get C827 PHY index function
Karol Kolacinski [Thu, 13 Jul 2023 13:21:23 +0000 (15:21 +0200)]
ice: Add get C827 PHY index function

Add a function to find the C827 PHY node handle and return C827 PHY
index for the E810 products.

In order to bring this function to full functionality, some
helpers for this were written by Michal Michalik.

Co-developed-by: Michal Michalik <michal.michalik@intel.com>
Signed-off-by: Michal Michalik <michal.michalik@intel.com>
Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
Signed-off-by: Jan Sokolowski <jan.sokolowski@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
11 months agoice: Rename enum ice_pkt_flags values
Marcin Szycik [Thu, 22 Jun 2023 13:35:13 +0000 (15:35 +0200)]
ice: Rename enum ice_pkt_flags values

enum ice_pkt_flags contains values such as ICE_PKT_FLAGS_VLAN and
ICE_PKT_FLAGS_TUNNEL, but actually the flags words which they refer to
contain a range of unrelated values - e.g. word 0 (ICE_PKT_FLAGS_VLAN)
contains fields such as from_network and ucast, which have nothing to do
with VLAN. Rename each enum value to ICE_PKT_FLAGS_MDID<number>, so it's
clear in which flags word does some value reside.

Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
11 months agoice: Add direction metadata
Marcin Szycik [Thu, 22 Jun 2023 13:35:12 +0000 (15:35 +0200)]
ice: Add direction metadata

Currently it is possible to create a filter which breaks TX traffic, e.g.:

tc filter add dev $PF1 ingress protocol ip prio 1 flower ip_proto udp
dst_port $PORT action mirred egress redirect dev $VF1_PR

This adds a rule which might match both TX and RX traffic, and in TX path
the PF will actually receive the traffic, which breaks communication.

To fix this, add a match on direction metadata flag when adding a tc rule.

Because of the way metadata is currently handled, a duplicate lookup word
would appear if VLAN metadata is also added. The lookup would still work
correctly, but one word would be wasted. To prevent it, lookup 0 now always
contains all metadata. When any metadata needs to be added, it is added to
lookup 0 and lookup count is not incremented. This way, two flags residing
in the same word will take up one word, instead of two.

Note: the drop action is also affected, i.e. it will now only work in one
direction.

Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
11 months agoice: Accept LAG netdevs in bridge offloads
Wojciech Drewek [Thu, 27 Jul 2023 08:35:39 +0000 (10:35 +0200)]
ice: Accept LAG netdevs in bridge offloads

Allow LAG interfaces to be used in bridge offload using
netif_is_lag_master. In this case, search for ice netdev in
the list of LAG's lower devices.

Reviewed-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
11 months agoMerge tag 'linux-can-next-for-6.6-20230807' of git://git.kernel.org/pub/scm/linux...
Jakub Kicinski [Mon, 7 Aug 2023 19:25:46 +0000 (12:25 -0700)]
Merge tag 'linux-can-next-for-6.6-20230807' of git://git./linux/kernel/git/mkl/linux-can-next

Marc Kleine-Budde says:

====================
pull-request: can-next 2023-08-07

The patch is from me and reverts the addition of the CAN controller
nodes in the allwinner d1 SoC.

* tag 'linux-can-next-for-6.6-20230807' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next:
  Revert "riscv: dts: allwinner: d1: Add CAN controller nodes"
====================

Link: https://lore.kernel.org/r/20230807074222.1576119-1-mkl@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agoMerge branch 'net-stmmac-correct-mac-propagation-delay'
Jakub Kicinski [Mon, 7 Aug 2023 19:17:14 +0000 (12:17 -0700)]
Merge branch 'net-stmmac-correct-mac-propagation-delay'

Johannes Zink says:

====================
net: stmmac: correct MAC propagation delay

Changes in v3:
- work in Richard's review feedback. Thank you for reviewing my patch:
  - as some of the hardware may have no or invalid correction value
    registers: introduce feature switch which can be enabled in the glue
    code drivers depending on the actual hardware support
  - only enable the feature on the i.MX8MP for the time being, as the patch
    improves timing accuracy and is tested for this hardware
- Link to v2: https://lore.kernel.org/r/20230719-stmmac_correct_mac_delay-v2-1-3366f38ee9a6@pengutronix.de

Changes in v2:
- fix builds for 32bit, this was found by the kernel build bot
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202307200225.B8rmKQPN-lkp@intel.com/
- while at it also fix an overflow by shifting a u32 constant from macro by 10bits
  by casting the constant to u64
- Link to v1: https://lore.kernel.org/r/20230719-stmmac_correct_mac_delay-v1-1-768aa4d09334@pengutronix.de

Tested-by: Kurt Kanzenbach <kurt@linutronix.de> # imx8mp
====================

Link: https://lore.kernel.org/r/20230719-stmmac_correct_mac_delay-v3-0-61e63427735e@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: stmmac: dwmac-imx: enable MAC propagation delay correction for i.MX8MP
Johannes Zink [Tue, 1 Aug 2023 15:44:30 +0000 (17:44 +0200)]
net: stmmac: dwmac-imx: enable MAC propagation delay correction for i.MX8MP

As the i.MX8MP supports reading MAC propagation delay and correcting the
Hardware timestamp counter for additional delays [1], enable the feature
for this SoC.

This reduces phase error of the PPS output from the PTP Hardware Clock
from approx 150ns to 100ns.

[1] i.MX8MP Reference Manual, rev.1 Section 11.7.2.5.3 "Timestamp
correction"

Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
Link: https://lore.kernel.org/r/20230719-stmmac_correct_mac_delay-v3-2-61e63427735e@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet: stmmac: correct MAC propagation delay
Johannes Zink [Tue, 1 Aug 2023 15:44:29 +0000 (17:44 +0200)]
net: stmmac: correct MAC propagation delay

The IEEE1588 Standard specifies that the timestamps of Packets must be
captured when the PTP message timestamp point (leading edge of first
octet after the start of frame delimiter) crosses the boundary between
the node and the network. As the MAC latches the timestamp at an
internal point, the captured timestamp must be corrected for the
additional data transmission latency, as described in the publicly
available datasheet [1].

This patch only corrects for the MAC-Internal delay, which can be read
out from the MAC_Ingress_Timestamp_Latency register on DWMAC version 5,
since the Phy framework currently does not support querying the Phy
ingress and egress latency. The Closs Domain Crossing Circuits errors as
indicated in [1] are already being accounted in the
stmmac_get_tx_hwtstamp() function and are not corrected here.

As the Latency varies for different link speeds and MII
modes of operation, the correction value needs to be updated on each
link state change.

As the delay also causes a phase shift in the timestamp counter compared
to the rest of the network, this correction will also reduce phase error
when generating PPS outputs from the timestamp counter.

Since the correction registers may be unavailable on some hardware and
no feature bits are documented for dynamically detection of the MAC
propagation delay readout, introduce a feature bit to explicitely enable
MAC delay Correction in the gluecode driver.

[1] i.MX8MP Reference Manual, rev.1 Section 11.7.2.5.3 "Timestamp
correction"

Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
Link: https://lore.kernel.org/r/20230719-stmmac_correct_mac_delay-v2-1-3366f38ee9a6@pengutronix.de
Link: https://lore.kernel.org/r/20230719-stmmac_correct_mac_delay-v3-1-61e63427735e@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 months agonet/mlx5: Bridge, Only handle registered netdev bridge events
Roi Dayan [Tue, 11 Jul 2023 10:23:27 +0000 (13:23 +0300)]
net/mlx5: Bridge, Only handle registered netdev bridge events

Don't handle bridge events for a netdev that doesn't belong to
an eswitch that registered for bridge events.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Vlad Buslov <vladbu@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
11 months agonet/mlx5: E-Switch, Remove redundant arg ignore_flow_lvl
Roi Dayan [Tue, 11 Jul 2023 06:42:01 +0000 (09:42 +0300)]
net/mlx5: E-Switch, Remove redundant arg ignore_flow_lvl

The arg is always passed as true and thus redundant.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
11 months agonet/mlx5: Fix typo reminder -> remainder
Gal Pressman [Sun, 6 Aug 2023 10:34:59 +0000 (13:34 +0300)]
net/mlx5: Fix typo reminder -> remainder

Fix a typo in esw_qos_devlink_rate_to_mbps(): reminder -> remainder.

Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
11 months agonet/mlx5: remove many unnecessary NULL values
Ruan Jinjie [Fri, 4 Aug 2023 01:43:44 +0000 (09:43 +0800)]
net/mlx5: remove many unnecessary NULL values

There are many pointers assigned first, which need not to be
initialized, so remove the NULL assignments.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
11 months agonet/mlx5: Allocate completion EQs dynamically
Maher Sanalla [Mon, 12 Jun 2023 07:13:50 +0000 (10:13 +0300)]
net/mlx5: Allocate completion EQs dynamically

This commit enables the dynamic allocation of EQs at runtime, allowing
for more flexibility in managing completion EQs and reducing the memory
overhead of driver load. Whenever a CQ is created for a given vector
index, the driver will lookup to see if there is an already mapped
completion EQ for that vector, if so, utilize it. Otherwise, allocate a
new EQ on demand and then utilize it for the CQ completion events.

Add a protection lock to the EQ table to protect from concurrent EQ
creation attempts.

While at it, replace mlx5_vector2irqn()/mlx5_vector2eqn() with
mlx5_comp_eqn_get() and mlx5_comp_irqn_get() which will allocate an
EQ on demand if no EQ is found for the given vector.

Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
11 months agonet/mlx5: Handle SF IRQ request in the absence of SF IRQ pool
Maher Sanalla [Thu, 22 Jun 2023 16:05:46 +0000 (19:05 +0300)]
net/mlx5: Handle SF IRQ request in the absence of SF IRQ pool

In case the SF IRQ pool is not available due to setup limitations,
SF currently relies on the already allocated PF IRQs to fulfill
its IRQ vector requests.

However, with the dynamic EQ allocation introduced in the next patch,
it is possible that not all IRQs of PF will be allocated after the driver
is loaded. In such case, if a SF requests a completion IRQ without having
its own independent IRQ pool, SF will lack a PF IRQ to utilize.

To address this scenario, allocate an IRQ for the SF from the PF's IRQ pool
on demand. The new IRQ will be shared between the SF and it's PF.

Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
11 months agonet/mlx5: Rename mlx5_comp_vectors_count() to mlx5_comp_vectors_max()
Maher Sanalla [Thu, 22 Jun 2023 15:52:44 +0000 (18:52 +0300)]
net/mlx5: Rename mlx5_comp_vectors_count() to mlx5_comp_vectors_max()

To accurately represent its purpose, rename the function that retrieves
the value of maximum vectors from mlx5_comp_vectors_count() to
mlx5_comp_vectors_max().

Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
11 months agonet/mlx5: Add IRQ vector to CPU lookup function
Maher Sanalla [Mon, 12 Jun 2023 08:58:14 +0000 (11:58 +0300)]
net/mlx5: Add IRQ vector to CPU lookup function

Currently, once driver load completes, IRQ requests were performed for all
vectors. However, as we move to support dynamic creation of EQs, this will
not be the case as some IRQs will not exist at this stage. Thus, in such
case, use the default CPU to IRQ mapping which is the serial mapping based
on IRQ vector index. Meaning, the n'th vector gets mapped to the n'th CPU.

Introduce an API function mlx5_comp_vector_cpu() that takes an IRQ index and
provides the corresponding CPU mapping. It utilizes the existing IRQ
affinity if defined, or resorts to the default serialized CPU mapping
otherwise.

Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
11 months agonet/mlx5: Introduce mlx5_cpumask_default_spread
Maher Sanalla [Mon, 12 Jun 2023 08:50:10 +0000 (11:50 +0300)]
net/mlx5: Introduce mlx5_cpumask_default_spread

For better code readability in the completion IRQ request code, define
the cpu lookup per completion vector logic in a separate function.

The new method mlx5_cpumask_default_spread() given a vector index 'n'
will return the 'nth' cpu. This new method will be used also in the next
patch.

Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
11 months agonet/mlx5: Implement single completion EQ create/destroy methods
Maher Sanalla [Sun, 11 Jun 2023 16:55:02 +0000 (19:55 +0300)]
net/mlx5: Implement single completion EQ create/destroy methods

Currently, create_comp_eqs() function handles the creation of all
completion EQs for all the vectors on driver load. While on driver
unload, destroy_comp_eqs() performs the equivalent job.

In preparation for dynamic EQ creation, replace create_comp_eqs() /
destroy_comp_eqs() with  create_comp_eq() / destroy_comp_eq() functions
which will receive a vector index and allocate/destroy an EQ for that
specific vector. Thus, allowing more flexibility in the management
of completion EQs.

Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>