sfrench/cifs-2.6.git
3 months agoMerge branch 'bnxt_en-ntuple-filter-improvements'
Paolo Abeni [Thu, 22 Feb 2024 14:31:25 +0000 (15:31 +0100)]
Merge branch 'bnxt_en-ntuple-filter-improvements'

Michael Chan says:

====================
bnxt_en: Ntuple filter improvements

The current Ntuple filter implementation has a limitation on 5750X (P5)
and newer chips.  The destination ring of the ntuple filter must be
a valid ring in the RSS indirection table.  Ntuple filters may not work
if the RSS indirection table is modified by the user to only contain a
subset of the rings.  If an ntuple filter is set to a ring destination
that is not in the RSS indirection table, the packet matching that
filter will be placed in a random ring instead of the specified
destination ring.

This series of patches will fix the problem by using a separate VNIC
for ntuple filters.  The default VNIC will be dedicated for RSS and
so the indirection table can be setup in any way and will not affect
ntuple filters using the separate VNIC.

Quite a bit of refactoring is needed to do the the VNIC and RSS
context accounting in the first few patches.  This is technically a
bug fix, but I think the changes are too big for -net.
====================

Link: https://lore.kernel.org/r/20240220230317.96341-1-michael.chan@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agobnxt_en: Use the new VNIC to create ntuple filters
Pavan Chebbi [Tue, 20 Feb 2024 23:03:17 +0000 (15:03 -0800)]
bnxt_en: Use the new VNIC to create ntuple filters

The newly created vnic (BNXT_VNIC_NTUPLE) is ready to be used to create
ntuple filters when supported by firmware.  All RX rings can be used
regardless of the RSS indirection setting on the default VNIC.

Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agobnxt_en: Create and setup the additional VNIC for adding ntuple filters
Pavan Chebbi [Tue, 20 Feb 2024 23:03:16 +0000 (15:03 -0800)]
bnxt_en: Create and setup the additional VNIC for adding ntuple filters

Allocate and setup the additional VNIC for ntuple filters if this
new method is supported by the firmware.  Even though this VNIC is
only used for ntuple filters with direct ring destinations, we still
setup the RSS hash to be identical to the default VNIC so that each
RX packet will have the correct hash in the RX completion.  This
VNIC is always at VNIC index BNXT_VNIC_NTUPLE.

Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agobnxt_en: Provision for an additional VNIC for ntuple filters
Pavan Chebbi [Tue, 20 Feb 2024 23:03:15 +0000 (15:03 -0800)]
bnxt_en: Provision for an additional VNIC for ntuple filters

On newer chips that support the ring table index method for
ntuple filters, the current scheme of using the same VNIC for
both RSS and ntuple filters will not work in all cases.  An
ntuple filter can only be directed to a destination ring if
that destination ring is also in the RSS indirection table.

To support ntuple filters with any arbitratry RSS indirection
table that may only include a subset of the rings, we need to
use a separate VNIC for ntuple filters.

This patch provisions the additional VNIC.  The next patch will
allocate additional VNIC from firmware and set it up.

Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agobnxt_en: Define BNXT_VNIC_DEFAULT for the default vnic index
Pavan Chebbi [Tue, 20 Feb 2024 23:03:14 +0000 (15:03 -0800)]
bnxt_en: Define BNXT_VNIC_DEFAULT for the default vnic index

Replace hard coded 0 index with more meaningful BNXT_VNIC_DEFAULT.

Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agobnxt_en: Refactor bnxt_set_features()
Pavan Chebbi [Tue, 20 Feb 2024 23:03:13 +0000 (15:03 -0800)]
bnxt_en: Refactor bnxt_set_features()

Refactor bnxt_set_features() function to have a common
function to re-init.  We'll need this to reinitialize when
ntuple configuration changes.

Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agobnxt_en: Add bnxt_get_total_vnics() to calculate number of VNICs
Venkat Duvvuru [Tue, 20 Feb 2024 23:03:12 +0000 (15:03 -0800)]
bnxt_en: Add bnxt_get_total_vnics() to calculate number of VNICs

Refactor the code by adding a new function to calculate the number of
required VNICs.  This is used in multiple places when reserving or
checking resources.

Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agobnxt_en: Check additional resources in bnxt_check_rings()
Michael Chan [Tue, 20 Feb 2024 23:03:11 +0000 (15:03 -0800)]
bnxt_en: Check additional resources in bnxt_check_rings()

bnxt_check_rings() is called to check if we have enough resource
assets to satisfy the new number of ethtool channels.  If the asset
test fails, the ethtool operation will fail gracefully.  Otherwise
we will proceed and commit to use the new number of channels.  If it
fails to allocate any resources, the chip will fail to come up.

For completeness, check all possible resources before committing to
the new settings.  Add the missing ring group and RSS context asset
tests in bnxt_check_rings().

Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agobnxt_en: Improve RSS context reservation infrastructure
Pavan Chebbi [Tue, 20 Feb 2024 23:03:10 +0000 (15:03 -0800)]
bnxt_en: Improve RSS context reservation infrastructure

Add RSS context fields to struct bnxt_hw_rings and struct bnxt_hw_resc.
With these, we can now specific the exact number of RSS contexts to
reserve and store the reserved value.  The original code relies on
other resources to infer the number of RSS contexts to reserve and the
reserved value is not stored.  This improved infrastructure will make
the RSS context accounting more complete and is needed by later
patches.

Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agobnxt_en: Explicitly specify P5 completion rings to reserve
Michael Chan [Tue, 20 Feb 2024 23:03:09 +0000 (15:03 -0800)]
bnxt_en: Explicitly specify P5 completion rings to reserve

The current code assumes that every RX ring group and every TX ring
requires a completion ring on P5_PLUS chips.  Now that we have the
bnxt_hw_rings structure, add the cp_p5 field so that it can
be explicitly specified.  This makes the logic more clear.

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agobnxt_en: Refactor ring reservation functions
Michael Chan [Tue, 20 Feb 2024 23:03:08 +0000 (15:03 -0800)]
bnxt_en: Refactor ring reservation functions

The current functions to reserve hardware rings pass in 6 different ring
or resource types as parameters.  Add a structure bnxt_hw_rings to
consolidate all these parameters and pass the structure pointer instead
to these functions.  Add 2 related helper functions also.  This makes
the code cleaner and makes it easier to add new resources to be
reserved.

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agoMerge branch 'mctp-core-protocol-updates-minor-fixes-tests'
Paolo Abeni [Thu, 22 Feb 2024 12:32:57 +0000 (13:32 +0100)]
Merge branch 'mctp-core-protocol-updates-minor-fixes-tests'

Jeremy Kerr says:

====================
MCTP core protocol updates, minor fixes & tests

This series implements some procotol improvements for AF_MCTP,
particularly for systems with multiple MCTP networks defined. For those,
we need to add the network ID to the tag lookups, which then suggests an
updated version of the tag allocate / drop ioctl to allow the net ID to
be specified there too.

The ioctl change affects uabi, so might warrant some extra attention.

There are also a couple of new kunit tests for multiple-net
configurations.

We have a fix for populating the flow data when fragmenting, and a
testcase for that too.

Of course, any queries/comments/etc., please let me know!
====================

Link: https://lore.kernel.org/r/cover.1708335994.git.jk@codeconstruct.com.au
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: mctp: tests: Add a test for proper tag creation on local output
Jeremy Kerr [Mon, 19 Feb 2024 09:51:56 +0000 (17:51 +0800)]
net: mctp: tests: Add a test for proper tag creation on local output

Ensure we have the correct key parameters on sending a message.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: mctp: tests: Test that outgoing skbs have flow data populated
Jeremy Kerr [Mon, 19 Feb 2024 09:51:55 +0000 (17:51 +0800)]
net: mctp: tests: Test that outgoing skbs have flow data populated

When CONFIG_MCTP_FLOWS is enabled, outgoing skbs should have their
SKB_EXT_MCTP extension set for drivers to consume.

Add two tests for local-to-output routing that check for the flow
extensions: one for the simple single-packet case, and one for
fragmentation.

We now make MCTP_TEST select MCTP_FLOWS, so we always get coverage of
these flow tests. The tests are skippable if MCTP_FLOWS is (otherwise)
disabled, but that would need manual config tweaking.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: mctp: copy skb ext data when fragmenting
Jeremy Kerr [Mon, 19 Feb 2024 09:51:54 +0000 (17:51 +0800)]
net: mctp: copy skb ext data when fragmenting

If we're fragmenting on local output, the original packet may contain
ext data for the MCTP flows. We'll want this in the resulting fragment
skbs too.

So, do a skb_ext_copy() in the fragmentation path, and implement the
MCTP-specific parts of an ext copy operation.

Fixes: 67737c457281 ("mctp: Pass flow data & flow release events to drivers")
Reported-by: Jian Zhang <zhangjian.3032@bytedance.com>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: mctp: tests: Add MCTP net isolation tests
Jeremy Kerr [Mon, 19 Feb 2024 09:51:53 +0000 (17:51 +0800)]
net: mctp: tests: Add MCTP net isolation tests

Add a couple of tests that excersise the new net-specific sk_key and
bind lookups

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: mctp: tests: Add netid argument to __mctp_route_test_init
Jeremy Kerr [Mon, 19 Feb 2024 09:51:52 +0000 (17:51 +0800)]
net: mctp: tests: Add netid argument to __mctp_route_test_init

We'll want to create net-specific test setups in an upcoming change, so
allow the caller to provide a non-default netid.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: mctp: provide a more specific tag allocation ioctl
Jeremy Kerr [Mon, 19 Feb 2024 09:51:51 +0000 (17:51 +0800)]
net: mctp: provide a more specific tag allocation ioctl

Now that we have net-specific tags, extend the tag allocation ioctls
(SIOCMCTPALLOCTAG / SIOCMCTPDROPTAG) to allow a network parameter to be
passed to the tag allocation.

We also add a local_addr member to the ioc struct, to allow for a future
finer-grained tag allocation using local EIDs too. We don't add any
specific support for that now though, so require MCTP_ADDR_ANY or
MCTP_ADDR_NULL for those at present.

The old ioctls will still work, but allocate for the default MCTP net.
These are now marked as deprecated in the header.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: mctp: separate key correlation across nets
Jeremy Kerr [Mon, 19 Feb 2024 09:51:50 +0000 (17:51 +0800)]
net: mctp: separate key correlation across nets

Currently, we lookup sk_keys from the entire struct net_namespace, which
may contain multiple MCTP net IDs. In those cases we want to distinguish
between endpoints with the same EID but different net ID.

Add the net ID data to the struct mctp_sk_key, populate on add and
filter on this during route lookup.

For the ioctl interface, we use a default net of
MCTP_INITIAL_DEFAULT_NET (ie., what will be in use for single-net
configurations), but we'll extend the ioctl interface to provide
net-specific tag allocation in an upcoming change.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: mctp: tests: create test skbs with the correct net and device
Jeremy Kerr [Mon, 19 Feb 2024 09:51:49 +0000 (17:51 +0800)]
net: mctp: tests: create test skbs with the correct net and device

In our test skb creation functions, we're not setting up the net and
device data. This doesn't matter at the moment, but we will want to add
support for distinct net IDs in future.

Set the ->net identifier on the test MCTP device, and ensure that test
skbs are set up with the correct device-related data on creation. Create
a helper for setting skb->dev and mctp_skb_cb->net.

We have a few cases where we're calling __mctp_cb() to initialise the cb
(which we need for the above) separately, so integrate this into the skb
creation helpers.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: mctp: make key lookups match the ANY address on either local or peer
Jeremy Kerr [Mon, 19 Feb 2024 09:51:48 +0000 (17:51 +0800)]
net: mctp: make key lookups match the ANY address on either local or peer

We may have an ANY address in either the local or peer address of a
sk_key, and may want to match on an incoming daddr or saddr being ANY.

Do this by altering the conflicting-tag lookup to also accept ANY as
the local/peer address.

We don't want mctp_address_matches to match on the requested EID being
ANY, as that is a specific lookup case on packet input.

Reported-by: Eric Chuang <echuang@google.com>
Reported-by: Anthony <anthonyhkf@google.com>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: mctp: Add some detail on the key allocation implementation
Jeremy Kerr [Mon, 19 Feb 2024 09:51:47 +0000 (17:51 +0800)]
net: mctp: Add some detail on the key allocation implementation

We could do with a little more comment on where MCTP_ADDR_ANY will match
in the key allocations.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: mctp: avoid confusion over local/peer dest/source addresses
Jeremy Kerr [Mon, 19 Feb 2024 09:51:46 +0000 (17:51 +0800)]
net: mctp: avoid confusion over local/peer dest/source addresses

We have a double-swap of local and peer addresses in
mctp_alloc_local_tag; the arguments in both call sites are swapped, but
there is also a swap in the implementation of alloc_local_tag. This is
opaque because we're using source/dest address references, which don't
match the local/peer semantics.

Avoid this confusion by naming the arguments as 'local' and 'peer', and
remove the double swap. The calling order now matches mctp_key_alloc.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agoPPPoL2TP: Add more code snippets
Samuel Thibault [Sat, 17 Feb 2024 21:14:25 +0000 (22:14 +0100)]
PPPoL2TP: Add more code snippets

The existing documentation was not telling that one has to create a PPP
channel and a PPP interface to get PPPoL2TP data offloading working.

Also, tunnel switching was not mentioned, so that people were thinking
it was not supported, while it actually is.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Acked-by: Tom Parkin <tparkin@katalix.com>
Link: https://lore.kernel.org/r/20240217211425.qj576u3jmaa6yidf@begin
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agoudp: add local "peek offset enabled" flag
Paolo Abeni [Tue, 20 Feb 2024 11:00:01 +0000 (12:00 +0100)]
udp: add local "peek offset enabled" flag

We want to re-organize the struct sock layout. The sk_peek_off
field location is problematic, as most protocols want it in the
RX read area, while UDP wants it on a cacheline different from
sk_receive_queue.

Create a local (inside udp_sock) copy of the 'peek offset is enabled'
flag and place it inside the same cacheline of reader_queue.

Check such flag before reading sk_peek_off. This will save potential
false sharing and cache misses in the fast-path.

Tested under UDP flood with small packets. The struct sock layout
update causes a 4% performance drop, and this patch restores completely
the original tput.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/67ab679c15fbf49fa05b3ffe05d91c47ab84f147.1708426665.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agoMerge branch 'net-phy-marvell-88q2xxx-add-driver-for-the-marvell-88q2220-phy'
Jakub Kicinski [Wed, 21 Feb 2024 22:57:03 +0000 (14:57 -0800)]
Merge branch 'net-phy-marvell-88q2xxx-add-driver-for-the-marvell-88q2220-phy'

Dimitri Fedrau says:

====================
net: phy: marvell-88q2xxx: add driver for the Marvell 88Q2220 PHY
====================

Link: https://lore.kernel.org/r/20240218075753.18067-1-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: marvell-88q2xxx: move interrupt configuration
Dimitri Fedrau [Sun, 18 Feb 2024 07:57:51 +0000 (08:57 +0100)]
net: phy: marvell-88q2xxx: move interrupt configuration

Move interrupt configuration from mv88q222x_revb0_config_init to
mv88q2xxx_config_init. Same register and bits are used for the 88q2xxx
devices.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Stefan Eichenberger <eichest@gmail.com>
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Link: https://lore.kernel.org/r/20240218075753.18067-15-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: marvell-88q2xxx: remove duplicated assignment of pma_extable
Dimitri Fedrau [Sun, 18 Feb 2024 07:57:50 +0000 (08:57 +0100)]
net: phy: marvell-88q2xxx: remove duplicated assignment of pma_extable

Remove assignment of phydev->pma_extable in mv88q222x_revb0_config_init.
It is already done in mv88q2xxx_config_init, just call
mv88q2xxx_config_init.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Link: https://lore.kernel.org/r/20240218075753.18067-14-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: marvell-88q2xxx: cleanup mv88q2xxx_config_init
Dimitri Fedrau [Sun, 18 Feb 2024 07:57:49 +0000 (08:57 +0100)]
net: phy: marvell-88q2xxx: cleanup mv88q2xxx_config_init

mv88q2xxx_config_init calls genphy_c45_read_pma which is done by
mv88q2xxx_read_status, it calls also mv88q2xxx_config_aneg which is
also called by the PHY state machine. Let the PHY state machine handle
the phydriver ops in their intendend way.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Stefan Eichenberger <eichest@gmail.com>
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Link: https://lore.kernel.org/r/20240218075753.18067-13-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: marvell-88q2xxx: switch to mv88q2xxx_config_aneg
Dimitri Fedrau [Sun, 18 Feb 2024 07:57:48 +0000 (08:57 +0100)]
net: phy: marvell-88q2xxx: switch to mv88q2xxx_config_aneg

Switch to mv88q2xxx_config_aneg for Marvell 88Q2220 devices and remove
the mv88q222x_config_aneg function which is basically a copy of the
mv88q2xxx_config_aneg function.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Link: https://lore.kernel.org/r/20240218075753.18067-12-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: marvell-88q2xxx: make mv88q2xxx_config_aneg generic
Dimitri Fedrau [Sun, 18 Feb 2024 07:57:47 +0000 (08:57 +0100)]
net: phy: marvell-88q2xxx: make mv88q2xxx_config_aneg generic

Marvell 88Q2xxx devices follow the same scheme, after configuration they
need a soft reset. Soft resets differ between devices, so we use the
.soft_reset callback instead of creating .config_aneg callbacks for each
device.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Link: https://lore.kernel.org/r/20240218075753.18067-11-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: marvell-88q2xxx: add cable test support
Dimitri Fedrau [Sun, 18 Feb 2024 07:57:46 +0000 (08:57 +0100)]
net: phy: marvell-88q2xxx: add cable test support

Add cable test support for Marvell 88Q222x devices. Reported distance
granularity is 1m.

1m cable, open:
  Cable test started for device eth0.
  Cable test completed for device eth0.
  Pair A code Open Circuit
  Pair A, fault length: 1.00m

1m cable, shorted:
  Cable test started for device eth0.
  Cable test completed for device eth0.
  Pair A code Short within Pair
  Pair A, fault length: 1.00m

6m cable, open:
  Cable test started for device eth0.
  Cable test completed for device eth0.
  Pair A code Open Circuit
  Pair A, fault length: 6.00m

6m cable, shorted:
  Cable test started for device eth0.
  Cable test completed for device eth0.
  Pair A code Short within Pair
  Pair A, fault length: 6.00m

Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20240218075753.18067-10-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: marvell-88q2xxx: add support for temperature sensor
Dimitri Fedrau [Sun, 18 Feb 2024 07:57:45 +0000 (08:57 +0100)]
net: phy: marvell-88q2xxx: add support for temperature sensor

Marvell 88q2xxx devices have an inbuilt temperature sensor. Add hwmon
support for this sensor.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Link: https://lore.kernel.org/r/20240218075753.18067-9-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: marvell-88q2xxx: add suspend / resume ops
Dimitri Fedrau [Sun, 18 Feb 2024 07:57:44 +0000 (08:57 +0100)]
net: phy: marvell-88q2xxx: add suspend / resume ops

Add suspend/resume ops for Marvell 88Q2xxx devices.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Link: https://lore.kernel.org/r/20240218075753.18067-8-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: marvell-88q2xxx: add interrupt support for link detection
Dimitri Fedrau [Sun, 18 Feb 2024 07:57:43 +0000 (08:57 +0100)]
net: phy: marvell-88q2xxx: add interrupt support for link detection

Added .config_intr and .handle_interrupt callbacks. Whenever the link
goes up or down an interrupt will be triggered. Interrupts are configured
separately for 100/1000BASET1.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Link: https://lore.kernel.org/r/20240218075753.18067-7-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: marvell-88q2xxx: add driver for the Marvell 88Q2220 PHY
Dimitri Fedrau [Sun, 18 Feb 2024 07:57:42 +0000 (08:57 +0100)]
net: phy: marvell-88q2xxx: add driver for the Marvell 88Q2220 PHY

Add a driver for the Marvell 88Q2220. This driver allows to detect the
link, switch between 100BASE-T1 and 1000BASE-T1 and switch between
master and slave mode. Autonegotiation is supported.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Gregor Herburger <gregor.herburger@ew.tq-group.com>
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Link: https://lore.kernel.org/r/20240218075753.18067-6-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: marvell-88q2xxx: fix typos
Dimitri Fedrau [Sun, 18 Feb 2024 07:57:41 +0000 (08:57 +0100)]
net: phy: marvell-88q2xxx: fix typos

Rename mv88q2xxxx_get_sqi to mv88q2xxx_get_sqi and
mv88q2xxxx_get_sqi_max to mv88q2xxx_get_sqi_max.
Fix linebreaks and use everywhere hexadecimal numbers written with
lowercase letters instead of mixing it up.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Link: https://lore.kernel.org/r/20240218075753.18067-5-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: c45: detect 100/1000BASE-T1 linkmode advertisements
Dimitri Fedrau [Sun, 18 Feb 2024 07:57:40 +0000 (08:57 +0100)]
net: phy: c45: detect 100/1000BASE-T1 linkmode advertisements

Set 100BT1 and 1000BT1 linkmode advertisement bits to adv_l_mask to
enable detection.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Link: https://lore.kernel.org/r/20240218075753.18067-4-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: Support 100/1000BT1 linkmode advertisements
Dimitri Fedrau [Sun, 18 Feb 2024 07:57:39 +0000 (08:57 +0100)]
net: phy: Support 100/1000BT1 linkmode advertisements

Extend helper functions mii_t1_adv_m_mod_linkmode_t and
linkmode_adv_to_mii_t1_adv_m_t to support 100BT1 and 1000BT1 linkmode
advertisements.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Link: https://lore.kernel.org/r/20240218075753.18067-3-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: Add BaseT1 auto-negotiation constants
Dimitri Fedrau [Sun, 18 Feb 2024 07:57:38 +0000 (08:57 +0100)]
net: phy: Add BaseT1 auto-negotiation constants

Added constants for advertising 100BT1 and 1000BT1 in register BASE-T1
auto-negotiation advertisement register [31:16] (Register 7.515)

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Link: https://lore.kernel.org/r/20240218075753.18067-2-dima.fedrau@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: phy: mxl-gpy: fill in possible_interfaces for GPY21x chipset
Raju Lakkaraju [Fri, 16 Feb 2024 05:44:35 +0000 (11:14 +0530)]
net: phy: mxl-gpy: fill in possible_interfaces for GPY21x chipset

Fill in the possible_interfaces member.
GPY21x phys support the SGMII and 2500base-X interfaces

Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
Link: https://lore.kernel.org/r/20240216054435.22380-1-Raju.Lakkaraju@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agoMerge branch 'rework-genet-mdioclocking'
David S. Miller [Wed, 21 Feb 2024 12:46:17 +0000 (12:46 +0000)]
Merge branch 'rework-genet-mdioclocking'

Florian Fainelli says:

====================
Rework GENET MDIO controller clocking

This patch series reworks the way that we manage the GENET MDIO
controller clocks around I/O accesses. During testing with a fully
modular build where bcmgenet, mdio-bcm-unimac, and the Broadcom PHY
driver (broadcom) are all loaded as modules, with no particular care
being taken to order them to mimize deferred probing the following bus
error was obtained:

[    4.344831] printk: console [ttyS0] enabled
[    4.351102] 840d000.serial: ttyS1 at MMIO 0x840d000 (irq = 29, base_baud = 5062500) is a Broadcom BCM7271 UART
[    4.363110] 840e000.serial: ttyS2 at MMIO 0x840e000 (irq = 30, base_baud = 5062500) is a Broadcom BCM7271 UART
[    4.387392] iproc-rng200 8402000.rng: hwrng registered
[    4.398012] Consider using thermal netlink events interface
[    4.403717] brcmstb_thermal a581500.thermal: registered AVS TMON of-sensor driver
[    4.440085] bcmgenet 8f00000.ethernet: GENET 5.0 EPHY: 0x0000
[    4.482526] unimac-mdio unimac-mdio.0: Broadcom UniMAC MDIO bus
[    4.514019] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    4.551304] SError Interrupt on CPU2, code 0x00000000bf000002 -- SError
[    4.551324] CPU: 2 PID: 8 Comm: kworker/u8:0 Not tainted 6.1.53-0.1pre-g5a26d98e908c #2
[    4.551330] Hardware name: BCM972180HB_V20 (DT)
[    4.551336] Workqueue: events_unbound deferred_probe_work_func
[    4.551363] pstate: 00000005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    4.551368] pc : el1_abort+0x2c/0x58
[    4.551376] lr : el1_abort+0x20/0x58
[    4.551379] sp : ffffffc00a383960
[    4.551380] x29: ffffffc00a383960 x28: ffffff80029fd780 x27: 0000000000000000
[    4.551385] x26: 0000000000000000 x25: ffffff8002839005 x24: ffffffc00a1f9bd0
[    4.551390] x23: 0000000040000005 x22: ffffffc000a48084 x21: ffffffc00a3dde14
[    4.551394] x20: 0000000096000210 x19: ffffffc00a3839a0 x18: 0000000000000579
[    4.551399] x17: 0000000000000000 x16: 0000000100000000 x15: ffffffc00a3838c0
[    4.551403] x14: 000000000000000a x13: 6e69622f7273752f x12: 3a6e6962732f7273
[    4.551408] x11: 752f3a6e69622f3a x10: 6e6962732f3d4854 x9 : ffffffc0086466a8
[    4.551412] x8 : ffffff80049ee100 x7 : ffffff8003231938 x6 : 0000000000000000
[    4.551416] x5 : 0000002200000000 x4 : ffffffc00a3839a0 x3 : 0000002000000000
[    4.551420] x2 : 0000000000000025 x1 : 0000000096000210 x0 : 0000000000000000
[    4.551429] Kernel panic - not syncing: Asynchronous SError Interrupt
[    4.551432] CPU: 2 PID: 8 Comm: kworker/u8:0 Not tainted 6.1.53-0.1pre-g5a26d98e908c #2
[    4.551435] Hardware name: BCM972180HB_V20 (DT)
[    4.551437] Workqueue: events_unbound deferred_probe_work_func
[    4.551443] Call trace:
[    4.551445]  dump_backtrace+0xe4/0x124
[    4.551452]  show_stack+0x1c/0x28
[    4.551455]  dump_stack_lvl+0x60/0x78
[    4.551462]  dump_stack+0x14/0x2c
[    4.551467]  panic+0x134/0x304
[    4.551472]  nmi_panic+0x50/0x70
[    4.551480]  arm64_serror_panic+0x70/0x7c
[    4.551484]  do_serror+0x2c/0x5c
[    4.551487]  el1h_64_error_handler+0x2c/0x40
[    4.551491]  el1h_64_error+0x64/0x68
[    4.551496]  el1_abort+0x2c/0x58
[    4.551499]  el1h_64_sync_handler+0x8c/0xb4
[    4.551502]  el1h_64_sync+0x64/0x68
[    4.551505]  unimac_mdio_readl.isra.0+0x4/0xc [mdio_bcm_unimac]
[    4.551519]  __mdiobus_read+0x2c/0x88
[    4.551526]  mdiobus_read+0x40/0x60
[    4.551530]  phy_read+0x18/0x20
[    4.551534]  bcm_phy_config_intr+0x20/0x84
[    4.551537]  phy_disable_interrupts+0x2c/0x3c
[    4.551543]  phy_probe+0x80/0x1b0
[    4.551545]  really_probe+0x1b8/0x390
[    4.551550]  __driver_probe_device+0x134/0x14c
[    4.551554]  driver_probe_device+0x40/0xf8
[    4.551559]  __device_attach_driver+0x108/0x11c
[    4.551563]  bus_for_each_drv+0xa4/0xcc
[    4.551567]  __device_attach+0xdc/0x190
[    4.551571]  device_initial_probe+0x18/0x20
[    4.551575]  bus_probe_device+0x34/0x94
[    4.551579]  deferred_probe_work_func+0xd4/0xe8
[    4.551583]  process_one_work+0x1ac/0x25c
[    4.551590]  worker_thread+0x1f4/0x260
[    4.551595]  kthread+0xc0/0xd0
[    4.551600]  ret_from_fork+0x10/0x20
[    4.551608] SMP: stopping secondary CPUs
[    4.551617] Kernel Offset: disabled
[    4.551619] CPU features: 0x00000,00c00080,0000420b
[    4.551622] Memory Limit: none
[    4.833838] ---[ end Kernel panic - not syncing: Asynchronous SError Interrupt ]---

The issue here is that we managed to probe the GENET controller, the
mdio-bcm-unimac MDIO controller, but the PHY was still being held in a
probe deferral state because it depended upon a GPIO controller provider
not loaded yet. As soon as that provider is loaded however, the PHY
continues to probe, tries to disable the interrupts, and this causes a
MDIO transaction. That MDIO transaction requires I/O register accesses
within the GENET's larger block, and since its clocks are turned off,
the CPU gets a bus error signaled as a System Error.

The patch series takes the simplest approach of keeping the clocks
enabled just for the duration of the I/O accesses. This is also
beneficial to other drivers like bcmasp2 which make use of the same MDIO
controller driver.

Changes in v2:

- added missing ret assignment in the if (IS_ERR(priv->clk)) branch

- added Jacob's R-by tags

- corrected the commit ID being reverted in patch #3
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agoRevert "net: bcmgenet: Ensure MDIO unregistration has clocks enabled"
Florian Fainelli [Mon, 19 Feb 2024 20:40:53 +0000 (12:40 -0800)]
Revert "net: bcmgenet: Ensure MDIO unregistration has clocks enabled"

This reverts commit 1b5ea7ffb7a3bdfffb4b7f40ce0d20a3372ee405 ("net:
bcmgenet: Ensure MDIO unregistration has clocks enabled"). This is no
longer necessary now that the MDIO bus controller has a clock that it
can manage around the I/O accesses.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: bcmgenet: Pass "main" clock down to the MDIO driver
Florian Fainelli [Mon, 19 Feb 2024 20:40:52 +0000 (12:40 -0800)]
net: bcmgenet: Pass "main" clock down to the MDIO driver

GENET has historically had to create a MDIO platform device for its
controller and pass some auxiliary data to it, like a MDIO completion
callback. Now we also pass the "main" clock to allow for the MDIO bus
controller to manage that clock adequately around I/O accesses.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: mdio: mdio-bcm-unimac: Manage clock around I/O accesses
Florian Fainelli [Mon, 19 Feb 2024 20:40:51 +0000 (12:40 -0800)]
net: mdio: mdio-bcm-unimac: Manage clock around I/O accesses

Up until now we have managed not to have the mdio-bcm-unimac manage its
clock except during probe and suspend/resume. This works most of the
time, except where it does not.

With a fully modular build, we can get into a situation whereby the
GENET driver is fully registered, and so is the mdio-bcm-unimac driver,
however the Ethernet PHY driver is not yet, because it depends on a
resource that is not yet available (e.g.: GPIO provider). In that state,
the network device is not usable yet, and so to conserve power, the
GENET driver will have turned off its "main" clock which feeds its MDIO
controller.

When the PHY driver finally probes however, we make an access to the PHY
registers to e.g.: disable interrupts, and this causes a bus error
within the MDIO controller space because the MDIO controller clock(s)
are turned off.

To remedy that, we manage the clock around all of the I/O accesses to
the hardware which are done exclusively during read, write and clock
divider configuration.

This ensures that the register space is accessible, and this also
ensures that there are not unnecessarily elevated reference counts
keeping the clocks active when the network device is administratively
turned off. It would be the case with the previous way of managing the
clock.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: wan: framer: remove children from struct framer_ops kdoc
Simon Horman [Mon, 19 Feb 2024 17:45:48 +0000 (17:45 +0000)]
net: wan: framer: remove children from struct framer_ops kdoc

Remove documentation of non-existent children field
from the Kernel doc for struct framer_ops.

Introduced by 82c944d05b1a ("net: wan: Add framer framework support")

Signed-off-by: Simon Horman <horms@kernel.org>
Acked-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agoMerge tag 'wireless-next-2024-02-20' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Wed, 21 Feb 2024 11:48:20 +0000 (11:48 +0000)]
Merge tag 'wireless-next-2024-02-20' of git://git./linux/kernel/git/wireless/wireless-next

Kalle Valo says:

====================
wireless-next patches for v6.9

The second "new features" pull request for v6.9.  Lots of iwlwifi and
stack changes this time. And naturally smaller changes to other drivers.

We also twice merged wireless into wireless-next to avoid conflicts
between the trees.

Major changes:

stack

* mac80211: negotiated TTLM request support

* SPP A-MSDU support

* mac80211: wider bandwidth OFDMA config support

iwlwifi

* kunit tests

* bump FW API to 89 for AX/BZ/SC devices

* enable SPP A-MSDUs

* support for new devices

ath12k

* refactoring in preparation for Multi-Link Operation (MLO) support

* 1024 Block Ack window size support

* provide firmware wmi logs via a trace event

ath11k

* 36 bit DMA mask support

* support 6 GHz station power modes: Low Power Indoor (LPI), Standard
  Power) SP and Very Low Power (VLP)

rtl8xxxu

* TP-Link TL-WN823N V2 support
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agoMerge branch 'net-kmem-cache-create'
David S. Miller [Wed, 21 Feb 2024 11:28:58 +0000 (11:28 +0000)]
Merge branch 'net-kmem-cache-create'

Kunwu Chan says:

====================
net: Use KMEM_CACHE instead of kmem_cache_create

As Jiri Pirko suggests,
I'm using a patchset to cleanup the same issues in the 'net' module.
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.

Some cache names are changed to be the same as struct names.
This change is recorded in the changelog for easy reference.
It's harmless cause it's used in /proc/slabinfo to identify this cache.
---
Changes in v2:
- Delete a patch as Eric said in https://lore.kernel.org/all/CANn89iLkWvum6wSqSya_K+1eqnFvp=L2WLW=kAYrZTF8Ei4b7g@mail.gmail.com/
- No code changes,only add Reviewed-by tag
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agoipv6: Simplify the allocation of slab caches
Kunwu Chan [Tue, 20 Feb 2024 07:36:46 +0000 (15:36 +0800)]
ipv6: Simplify the allocation of slab caches

Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agoipv4: Simplify the allocation of slab caches in ip_rt_init
Kunwu Chan [Tue, 20 Feb 2024 07:36:45 +0000 (15:36 +0800)]
ipv4: Simplify the allocation of slab caches in ip_rt_init

Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.
And change cache name from 'ip_dst_cache' to 'rtable'.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agoipmr: Simplify the allocation of slab caches
Kunwu Chan [Tue, 20 Feb 2024 07:36:44 +0000 (15:36 +0800)]
ipmr: Simplify the allocation of slab caches

Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.
And change cache name from 'ip_mrt_cache' to 'mfc_cache'.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agoip6mr: Simplify the allocation of slab caches in ip6_mr_init
Kunwu Chan [Tue, 20 Feb 2024 07:36:43 +0000 (15:36 +0800)]
ip6mr: Simplify the allocation of slab caches in ip6_mr_init

Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.
And change cache name from 'ip6_mrt_cache' to 'mfc6_cache'.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: kcm: Simplify the allocation of slab caches
Kunwu Chan [Tue, 20 Feb 2024 07:36:42 +0000 (15:36 +0800)]
net: kcm: Simplify the allocation of slab caches

Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.
And change cache name from 'kcm_mux_cache' to 'kcm_mux',
'kcm_psock_cache' to 'kcm_psock'.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet/dummy: Move stats allocation to core
Breno Leitao [Mon, 19 Feb 2024 13:43:28 +0000 (05:43 -0800)]
net/dummy: Move stats allocation to core

With commit 34d21de99cea9 ("net: Move {l,t,d}stats allocation to core and
convert veth & vrf"), stats allocation could be done on net core instead
of this driver.

With this new approach, the driver doesn't have to bother with error
handling (allocation failure checking, making sure free happens in the
right spot, etc). This is core responsibility now.

Move dummy driver to leverage the core allocation.

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agotg3: simplify tg3_phy_autoneg_cfg
Heiner Kallweit [Sun, 18 Feb 2024 18:04:42 +0000 (19:04 +0100)]
tg3: simplify tg3_phy_autoneg_cfg

Make use of ethtool_adv_to_mmd_eee_adv_t() to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agotg3: copy only needed fields from userspace-provided EEE data
Heiner Kallweit [Sun, 18 Feb 2024 14:49:55 +0000 (15:49 +0100)]
tg3: copy only needed fields from userspace-provided EEE data

The current code overwrites fields in tp->eee with unchecked data from
edata, e.g. the bitmap with supported modes. ethtool properly returns
the received data from get_eee() call, but we have no guarantee that
other users of the ioctl set_eee() interface behave properly too.
Therefore copy only fields which are actually needed.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agoMerge branch 'net-constify-device_type'
David S. Miller [Wed, 21 Feb 2024 09:45:24 +0000 (09:45 +0000)]
Merge branch 'net-constify-device_type'

Ricardo B. Marliere says:

====================
net: constify struct device_type usage

This is a simple and straight forward cleanup series that makes all device
types in the net subsystem constants. This has been possible since 2011 [1]
but not all occurrences were cleaned. I have been sweeping the tree to fix
them all.

I was not sure if I should send these squashed, but there are quite a few
changes so I decided to send them separately. Please let me know if that is
not desirable.

[1] https://lore.kernel.org/all/1305850262-9575-5-git-send-email-gregkh@suse.de/

====================

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
3 months agonet: hso: constify the struct device_type usage
Ricardo B. Marliere [Sat, 17 Feb 2024 20:13:34 +0000 (17:13 -0300)]
net: hso: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the hso_type
variable to be a constant structure as well, placing it into read-only
memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: wwan: core: constify the struct device_type usage
Ricardo B. Marliere [Sat, 17 Feb 2024 20:13:33 +0000 (17:13 -0300)]
net: wwan: core: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the wwan_type
variable to be a constant structure as well, placing it into read-only
memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: netdevsim: constify the struct device_type usage
Ricardo B. Marliere [Sat, 17 Feb 2024 20:13:32 +0000 (17:13 -0300)]
net: netdevsim: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the
nsim_bus_dev_type variable to be a constant structure as well, placing it
into read-only memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: vlan: constify the struct device_type usage
Ricardo B. Marliere [Sat, 17 Feb 2024 20:13:31 +0000 (17:13 -0300)]
net: vlan: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the vlan_type
variable to be a constant structure as well, placing it into read-only
memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: l2tp: constify the struct device_type usage
Ricardo B. Marliere [Sat, 17 Feb 2024 20:13:30 +0000 (17:13 -0300)]
net: l2tp: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the l2tpeth_type
variable to be a constant structure as well, placing it into read-only
memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: hsr: constify the struct device_type usage
Ricardo B. Marliere [Sat, 17 Feb 2024 20:13:29 +0000 (17:13 -0300)]
net: hsr: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the hsr_type
variable to be a constant structure as well, placing it into read-only
memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: geneve: constify the struct device_type usage
Ricardo B. Marliere [Sat, 17 Feb 2024 20:13:28 +0000 (17:13 -0300)]
net: geneve: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the geneve_type
variable to be a constant structure as well, placing it into read-only
memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: ppp: constify the struct device_type usage
Ricardo B. Marliere [Sat, 17 Feb 2024 20:13:27 +0000 (17:13 -0300)]
net: ppp: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the ppp_type
variable to be a constant structure as well, placing it into read-only
memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: vxlan: constify the struct device_type usage
Ricardo B. Marliere [Sat, 17 Feb 2024 20:13:26 +0000 (17:13 -0300)]
net: vxlan: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the vxlan_type
variable to be a constant structure as well, placing it into read-only
memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: bridge: constify the struct device_type usage
Ricardo B. Marliere [Sat, 17 Feb 2024 20:13:25 +0000 (17:13 -0300)]
net: bridge: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the br_type
variable to be a constant structure as well, placing it into read-only
memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: dsa: constify the struct device_type usage
Ricardo B. Marliere [Sat, 17 Feb 2024 20:13:24 +0000 (17:13 -0300)]
net: dsa: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the dsa_type
variable to be a constant structure as well, placing it into read-only
memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: usbnet: constify the struct device_type usage
Ricardo B. Marliere [Sat, 17 Feb 2024 20:13:23 +0000 (17:13 -0300)]
net: usbnet: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the wlan_type
and wwan_type variables to be constant structures as well, placing it into
read-only memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agonet: wan: framer: constify of_phandle_args in xlate
Krzysztof Kozlowski [Sat, 17 Feb 2024 10:03:06 +0000 (11:03 +0100)]
net: wan: framer: constify of_phandle_args in xlate

The xlate callbacks are supposed to translate of_phandle_args to proper
provider without modifying the of_phandle_args.  Make the argument
pointer to const for code safety and readability.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240217100306.86740-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agor8169: add MODULE_FIRMWARE entry for RTL8126A
Heiner Kallweit [Sat, 17 Feb 2024 14:48:23 +0000 (15:48 +0100)]
r8169: add MODULE_FIRMWARE entry for RTL8126A

Add the missing MODULE_FIRMWARE entry for RTL8126A.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/47ef79d2-59c4-4d44-9595-366c70c4ad87@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: fix pointer check in skb_pp_cow_data routine
Lorenzo Bianconi [Sat, 17 Feb 2024 11:12:14 +0000 (12:12 +0100)]
net: fix pointer check in skb_pp_cow_data routine

Properly check page pointer returned by page_pool_dev_alloc routine in
skb_pp_cow_data() for non-linear part of the original skb.

Reported-by: Julian Wiedmann <jwiedmann.dev@gmail.com>
Closes: https://lore.kernel.org/netdev/cover.1707729884.git.lorenzo@kernel.org/T/#m7d189b0015a7281ed9221903902490c03ed19a7a
Fixes: e6d5dbdd20aa ("xdp: add multi-buff support for xdp running in generic mode")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Link: https://lore.kernel.org/r/25512af3e09befa9dcb2cf3632bdc45b807cf330.1708167716.git.lorenzo@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agoMerge tag 'linux-can-next-for-6.9-20240220' of git://git.kernel.org/pub/scm/linux...
Paolo Abeni [Tue, 20 Feb 2024 14:32:44 +0000 (15:32 +0100)]
Merge tag 'linux-can-next-for-6.9-20240220' of git://git./linux/kernel/git/mkl/linux-can-next

Marc Kleine-Budde says:

====================
pull-request: can-next 2024-02-20

this is a pull request of 9 patches for net-next/master.

The first patch is by Francesco Dolcini and removes a redundant check
for pm_clock_support from the m_can driver.

Martin Hundebøll contributes 3 patches to the m_can/tcan4x5x driver to
allow resume upon RX of a CAN frame.

3 patches by Srinivas Goud add support for ECC statistics to the
xilinx_can driver.

The last 2 patches are by Oliver Hartkopp and me, target the CAN RAW
protocol and fix an error in the getsockopt() for CAN-XL introduced in
the previous pull request to net-next (linux-can-next-for-6.9-20240213).

linux-can-next-for-6.9-20240220

* tag 'linux-can-next-for-6.9-20240220' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next:
  can: raw: raw_getsockopt(): reduce scope of err
  can: raw: fix getsockopt() for new CAN_RAW_XL_VCID_OPTS
  can: xilinx_can: Add ethtool stats interface for ECC errors
  can: xilinx_can: Add ECC support
  dt-bindings: can: xilinx_can: Add 'xlnx,has-ecc' optional property
  can: tcan4x5x: support resuming from rx interrupt signal
  can: m_can: allow keeping the transceiver running in suspend
  dt-bindings: can: tcan4x5x: Document the wakeup-source flag
  can: m_can: remove redundant check for pm_clock_support
====================

Link: https://lore.kernel.org/r/20240220085130.2936533-1-mkl@pengutronix.de
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: skbuff: add overflow debug check to pull/push helpers
Florian Westphal [Fri, 16 Feb 2024 11:36:57 +0000 (12:36 +0100)]
net: skbuff: add overflow debug check to pull/push helpers

syzbot managed to trigger following splat:
BUG: KASAN: use-after-free in __skb_flow_dissect+0x4a3b/0x5e50
Read of size 1 at addr ffff888208a4000e by task a.out/2313
[..]
  __skb_flow_dissect+0x4a3b/0x5e50
  __skb_get_hash+0xb4/0x400
  ip_tunnel_xmit+0x77e/0x26f0
  ipip_tunnel_xmit+0x298/0x410
  ..

Analysis shows that the skb has a valid ->head, but bogus ->data
pointer.

skb->data gets its bogus value via the neigh layer, which does:

1556    __skb_pull(skb, skb_network_offset(skb));

... and the skb was already dodgy at this point:

skb_network_offset(skb) returns a negative value due to an
earlier overflow of skb->network_header (u16).  __skb_pull thus
"adjusts" skb->data by a huge offset, pointing outside skb->head
area.

Allow debug builds to splat when we try to pull/push more than
INT_MAX bytes.

After this, the syzkaller reproducer yields a more precise splat
before the flow dissector attempts to read off skb->data memory:

WARNING: CPU: 5 PID: 2313 at include/linux/skbuff.h:2653 neigh_connected_output+0x28e/0x400
  ip_finish_output2+0xb25/0xed0
  iptunnel_xmit+0x4ff/0x870
  ipgre_xmit+0x78e/0xbb0

Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240216113700.23013-1-fw@strlen.de
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: reorganize "struct sock" fields
Eric Dumazet [Fri, 16 Feb 2024 16:20:06 +0000 (16:20 +0000)]
net: reorganize "struct sock" fields

Last major reorg happened in commit 9115e8cd2a0c ("net: reorganize
struct sock for better data locality")

Since then, many changes have been done.

Before SO_PEEK_OFF support is added to TCP, we need
to move sk_peek_off to a better location.

It is time to make another pass, and add six groups,
without explicit alignment.

- sock_write_rx (following sk_refcnt) read-write fields in rx path.
- sock_read_rx read-mostly fields in rx path.
- sock_read_rxtx read-mostly fields in both rx and tx paths.
- sock_write_rxtx read-write fields in both rx and tx paths.
- sock_write_tx read-write fields in tx paths.
- sock_read_tx read-mostly fields in tx paths.

Results on TCP_RR benchmarks seem to show a gain (4 to 5 %).

It is possible UDP needs a change, because sk_peek_off
shares a cache line with sk_receive_queue.
If this the case, we can exchange roles of sk->sk_receive
and up->reader_queue queues.

After this change, we have the following layout:

struct sock {
struct sock_common         __sk_common;          /*     0  0x88 */
/* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
__u8                       __cacheline_group_begin__sock_write_rx[0]; /*  0x88     0 */
atomic_t                   sk_drops;             /*  0x88   0x4 */
__s32                      sk_peek_off;          /*  0x8c   0x4 */
struct sk_buff_head        sk_error_queue;       /*  0x90  0x18 */
struct sk_buff_head        sk_receive_queue;     /*  0xa8  0x18 */
/* --- cacheline 3 boundary (192 bytes) --- */
struct {
atomic_t           rmem_alloc;           /*  0xc0   0x4 */
int                len;                  /*  0xc4   0x4 */
struct sk_buff *   head;                 /*  0xc8   0x8 */
struct sk_buff *   tail;                 /*  0xd0   0x8 */
} sk_backlog;                                    /*  0xc0  0x18 */
struct {
atomic_t                   rmem_alloc;           /*     0   0x4 */
int                        len;                  /*   0x4   0x4 */
struct sk_buff *           head;                 /*   0x8   0x8 */
struct sk_buff *           tail;                 /*  0x10   0x8 */

/* size: 24, cachelines: 1, members: 4 */
/* last cacheline: 24 bytes */
};

__u8                       __cacheline_group_end__sock_write_rx[0]; /*  0xd8     0 */
__u8                       __cacheline_group_begin__sock_read_rx[0]; /*  0xd8     0 */
rcu *                      sk_rx_dst;            /*  0xd8   0x8 */
int                        sk_rx_dst_ifindex;    /*  0xe0   0x4 */
u32                        sk_rx_dst_cookie;     /*  0xe4   0x4 */
unsigned int               sk_ll_usec;           /*  0xe8   0x4 */
unsigned int               sk_napi_id;           /*  0xec   0x4 */
u16                        sk_busy_poll_budget;  /*  0xf0   0x2 */
u8                         sk_prefer_busy_poll;  /*  0xf2   0x1 */
u8                         sk_userlocks;         /*  0xf3   0x1 */
int                        sk_rcvbuf;            /*  0xf4   0x4 */
rcu *                      sk_filter;            /*  0xf8   0x8 */
/* --- cacheline 4 boundary (256 bytes) --- */
union {
rcu *              sk_wq;                /* 0x100   0x8 */
struct socket_wq * sk_wq_raw;            /* 0x100   0x8 */
};                                               /* 0x100   0x8 */
union {
rcu *                      sk_wq;                /*     0   0x8 */
struct socket_wq *         sk_wq_raw;            /*     0   0x8 */
};

void                       (*sk_data_ready)(struct sock *); /* 0x108   0x8 */
long                       sk_rcvtimeo;          /* 0x110   0x8 */
int                        sk_rcvlowat;          /* 0x118   0x4 */
__u8                       __cacheline_group_end__sock_read_rx[0]; /* 0x11c     0 */
__u8                       __cacheline_group_begin__sock_read_rxtx[0]; /* 0x11c     0 */
int                        sk_err;               /* 0x11c   0x4 */
struct socket *            sk_socket;            /* 0x120   0x8 */
struct mem_cgroup *        sk_memcg;             /* 0x128   0x8 */
rcu *                      sk_policy[2];         /* 0x130  0x10 */
/* --- cacheline 5 boundary (320 bytes) --- */
__u8                       __cacheline_group_end__sock_read_rxtx[0]; /* 0x140     0 */
__u8                       __cacheline_group_begin__sock_write_rxtx[0]; /* 0x140     0 */
socket_lock_t              sk_lock;              /* 0x140  0x20 */
u32                        sk_reserved_mem;      /* 0x160   0x4 */
int                        sk_forward_alloc;     /* 0x164   0x4 */
u32                        sk_tsflags;           /* 0x168   0x4 */
__u8                       __cacheline_group_end__sock_write_rxtx[0]; /* 0x16c     0 */
__u8                       __cacheline_group_begin__sock_write_tx[0]; /* 0x16c     0 */
int                        sk_write_pending;     /* 0x16c   0x4 */
atomic_t                   sk_omem_alloc;        /* 0x170   0x4 */
int                        sk_sndbuf;            /* 0x174   0x4 */
int                        sk_wmem_queued;       /* 0x178   0x4 */
refcount_t                 sk_wmem_alloc;        /* 0x17c   0x4 */
/* --- cacheline 6 boundary (384 bytes) --- */
unsigned long              sk_tsq_flags;         /* 0x180   0x8 */
union {
struct sk_buff *   sk_send_head;         /* 0x188   0x8 */
struct rb_root     tcp_rtx_queue;        /* 0x188   0x8 */
};                                               /* 0x188   0x8 */
union {
struct sk_buff *           sk_send_head;         /*     0   0x8 */
struct rb_root             tcp_rtx_queue;        /*     0   0x8 */
};

struct sk_buff_head        sk_write_queue;       /* 0x190  0x18 */
u32                        sk_dst_pending_confirm; /* 0x1a8   0x4 */
u32                        sk_pacing_status;     /* 0x1ac   0x4 */
struct page_frag           sk_frag;              /* 0x1b0  0x10 */
/* --- cacheline 7 boundary (448 bytes) --- */
struct timer_list          sk_timer;             /* 0x1c0  0x28 */

/* XXX last struct has 4 bytes of padding */

unsigned long              sk_pacing_rate;       /* 0x1e8   0x8 */
atomic_t                   sk_zckey;             /* 0x1f0   0x4 */
atomic_t                   sk_tskey;             /* 0x1f4   0x4 */
__u8                       __cacheline_group_end__sock_write_tx[0]; /* 0x1f8     0 */
__u8                       __cacheline_group_begin__sock_read_tx[0]; /* 0x1f8     0 */
unsigned long              sk_max_pacing_rate;   /* 0x1f8   0x8 */
/* --- cacheline 8 boundary (512 bytes) --- */
long                       sk_sndtimeo;          /* 0x200   0x8 */
u32                        sk_priority;          /* 0x208   0x4 */
u32                        sk_mark;              /* 0x20c   0x4 */
rcu *                      sk_dst_cache;         /* 0x210   0x8 */
netdev_features_t          sk_route_caps;        /* 0x218   0x8 */
u16                        sk_gso_type;          /* 0x220   0x2 */
u16                        sk_gso_max_segs;      /* 0x222   0x2 */
unsigned int               sk_gso_max_size;      /* 0x224   0x4 */
gfp_t                      sk_allocation;        /* 0x228   0x4 */
u32                        sk_txhash;            /* 0x22c   0x4 */
u8                         sk_pacing_shift;      /* 0x230   0x1 */
bool                       sk_use_task_frag;     /* 0x231   0x1 */
__u8                       __cacheline_group_end__sock_read_tx[0]; /* 0x232     0 */
u8                         sk_gso_disabled:1;    /* 0x232: 0 0x1 */
u8                         sk_kern_sock:1;       /* 0x232:0x1 0x1 */
u8                         sk_no_check_tx:1;     /* 0x232:0x2 0x1 */
u8                         sk_no_check_rx:1;     /* 0x232:0x3 0x1 */

/* XXX 4 bits hole, try to pack */

u8                         sk_shutdown;          /* 0x233   0x1 */
u16                        sk_type;              /* 0x234   0x2 */
u16                        sk_protocol;          /* 0x236   0x2 */
unsigned long              sk_lingertime;        /* 0x238   0x8 */
/* --- cacheline 9 boundary (576 bytes) --- */
struct proto *             sk_prot_creator;      /* 0x240   0x8 */
rwlock_t                   sk_callback_lock;     /* 0x248   0x8 */
int                        sk_err_soft;          /* 0x250   0x4 */
u32                        sk_ack_backlog;       /* 0x254   0x4 */
u32                        sk_max_ack_backlog;   /* 0x258   0x4 */
kuid_t                     sk_uid;               /* 0x25c   0x4 */
spinlock_t                 sk_peer_lock;         /* 0x260   0x4 */
int                        sk_bind_phc;          /* 0x264   0x4 */
struct pid *               sk_peer_pid;          /* 0x268   0x8 */
const struct cred  *       sk_peer_cred;         /* 0x270   0x8 */
ktime_t                    sk_stamp;             /* 0x278   0x8 */
/* --- cacheline 10 boundary (640 bytes) --- */
int                        sk_disconnects;       /* 0x280   0x4 */
u8                         sk_txrehash;          /* 0x284   0x1 */
u8                         sk_clockid;           /* 0x285   0x1 */
u8                         sk_txtime_deadline_mode:1; /* 0x286: 0 0x1 */
u8                         sk_txtime_report_errors:1; /* 0x286:0x1 0x1 */
u8                         sk_txtime_unused:6;   /* 0x286:0x2 0x1 */

/* XXX 1 byte hole, try to pack */

void *                     sk_user_data;         /* 0x288   0x8 */
void *                     sk_security;          /* 0x290   0x8 */
struct sock_cgroup_data    sk_cgrp_data;         /* 0x298   0x8 */
void                       (*sk_state_change)(struct sock *); /* 0x2a0   0x8 */
void                       (*sk_write_space)(struct sock *); /* 0x2a8   0x8 */
void                       (*sk_error_report)(struct sock *); /* 0x2b0   0x8 */
int                        (*sk_backlog_rcv)(struct sock *, struct sk_buff *); /* 0x2b8   0x8 */
/* --- cacheline 11 boundary (704 bytes) --- */
void                       (*sk_destruct)(struct sock *); /* 0x2c0   0x8 */
rcu *                      sk_reuseport_cb;      /* 0x2c8   0x8 */
rcu *                      sk_bpf_storage;       /* 0x2d0   0x8 */
struct callback_head       sk_rcu __attribute__((__aligned__(8))); /* 0x2d8  0x10 */
netns_tracker              ns_tracker;           /* 0x2e8   0x8 */

/* size: 752, cachelines: 12, members: 105 */
/* sum members: 749, holes: 1, sum holes: 1 */
/* sum bitfield members: 12 bits, bit holes: 1, sum bit holes: 4 bits */
/* paddings: 1, sum paddings: 4 */
/* forced alignments: 1 */
/* last cacheline: 48 bytes */
};

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Link: https://lore.kernel.org/r/20240216162006.2342759-1-edumazet@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: tcp: Remove redundant initialization of variable len
Colin Ian King [Fri, 16 Feb 2024 12:54:43 +0000 (12:54 +0000)]
net: tcp: Remove redundant initialization of variable len

The variable len being initialized with a value that is never read, an
if statement is initializing it in both paths of the if statement.
The initialization is redundant and can be removed.

Cleans up clang scan build warning:
net/ipv4/tcp_ao.c:512:11: warning: Value stored to 'len' during its
initialization is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>
Link: https://lore.kernel.org/r/20240216125443.2107244-1-colin.i.king@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agocan: raw: raw_getsockopt(): reduce scope of err
Marc Kleine-Budde [Tue, 20 Feb 2024 08:16:16 +0000 (09:16 +0100)]
can: raw: raw_getsockopt(): reduce scope of err

Reduce the scope of the variable "err" to the individual cases. This
is to avoid the mistake of setting "err" in the mistaken belief that
it will be evaluated later.

Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/all/20240220-raw-setsockopt-v1-1-7d34cb1377fc@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 months agoMerge branch 'abstract-page-from-net-stack'
Paolo Abeni [Tue, 20 Feb 2024 08:23:00 +0000 (09:23 +0100)]
Merge branch 'abstract-page-from-net-stack'

Mina Almasry says:

====================
Abstract page from net stack

This series is a prerequisite to the devmem TCP series. For a full
snapshot of the code which includes these changes, feel free to check:

https://github.com/mina/linux/commits/tcpdevmem-rfcv5/

Currently these components in the net stack use the struct page
directly:

1. Drivers.
2. Page pool.
3. skb_frag_t.

To add support for new (non struct page) memory types to the net stack, we
must first abstract the current memory type.

Originally the plan was to reuse struct page* for the new memory types,
and to set the LSB on the page* to indicate it's not really a page.
However, for safe compiler type checking we need to introduce a new type.

struct netmem is introduced to abstract the underlying memory type.
Currently it's a no-op abstraction that is always a struct page underneath.
In parallel there is an undergoing effort to add support for devmem to the
net stack:

https://lore.kernel.org/netdev/20231208005250.2910004-1-almasrymina@google.com/

Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Yunsheng Lin <linyunsheng@huawei.com>
Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
====================

Link: https://lore.kernel.org/r/20240214223405.1972973-1-almasrymina@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: add netmem to skb_frag_t
Mina Almasry [Wed, 14 Feb 2024 22:34:03 +0000 (14:34 -0800)]
net: add netmem to skb_frag_t

Use struct netmem* instead of page in skb_frag_t. Currently struct
netmem* is always a struct page underneath, but the abstraction
allows efforts to add support for skb frags not backed by pages.

There is unfortunately 1 instance where the skb_frag_t is assumed to be
a exactly a bio_vec in kcm. For this case, WARN_ON_ONCE and return error
before doing a cast.

Add skb[_frag]_fill_netmem_*() and skb_add_rx_frag_netmem() helpers so
that the API can be used to create netmem skbs.

Signed-off-by: Mina Almasry <almasrymina@google.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agonet: introduce abstraction for network memory
Mina Almasry [Wed, 14 Feb 2024 22:34:02 +0000 (14:34 -0800)]
net: introduce abstraction for network memory

Add the netmem_ref type, an abstraction for network memory.

To add support for new memory types to the net stack, we must first
abstract the current memory type. Currently parts of the net stack
use struct page directly:

- page_pool
- drivers
- skb_frag_t

Originally the plan was to reuse struct page* for the new memory types,
and to set the LSB on the page* to indicate it's not really a page.
However, for compiler type checking we need to introduce a new type.

netmem_ref is introduced to abstract the underlying memory type.
Currently it's a no-op abstraction that is always a struct page
underneath. In parallel there is an undergoing effort to add support
for devmem to the net stack:

https://lore.kernel.org/netdev/20231208005250.2910004-1-almasrymina@google.com/

netmem_ref can be pointers to different underlying memory types, and the
low bits are set to indicate the memory type. Helpers are provided
to convert netmem pointers to the underlying memory type (currently only
struct page). In the devmem series helpers are provided so that calling
code can use netmem without worrying about the underlying memory type
unless absolutely necessary.

Reviewed-by: Shakeel Butt <shakeelb@google.com>
Signed-off-by: Mina Almasry <almasrymina@google.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
3 months agocan: raw: fix getsockopt() for new CAN_RAW_XL_VCID_OPTS
Oliver Hartkopp [Mon, 19 Feb 2024 20:00:21 +0000 (21:00 +0100)]
can: raw: fix getsockopt() for new CAN_RAW_XL_VCID_OPTS

The code for the CAN_RAW_XL_VCID_OPTS getsockopt() was incompletely adopted
from the CAN_RAW_FILTER getsockopt().

Add the missing put_user() and return statements.

Flagged by Smatch.

Fixes: c83c22ec1493 ("can: canxl: add virtual CAN network identifier support")
Reported-by: Simon Horman <horms@kernel.org>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/all/20240219200021.12113-1-socketcan@hartkopp.net
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 months agonet: sysfs: Do not create sysfs for non BQL device
Breno Leitao [Fri, 16 Feb 2024 09:41:52 +0000 (01:41 -0800)]
net: sysfs: Do not create sysfs for non BQL device

Creation of sysfs entries is expensive, mainly for workloads that
constantly creates netdev and netns often.

Do not create BQL sysfs entries for devices that don't need,
basically those that do not have a real queue, i.e, devices that has
NETIF_F_LLTX and IFF_NO_QUEUE, such as `lo` interface.

This will remove the /sys/class/net/eth0/queues/tx-X/byte_queue_limits/
directory for these devices.

In the example below, eth0 has the `byte_queue_limits` directory but not
`lo`.

# ls /sys/class/net/lo/queues/tx-0/
traffic_class  tx_maxrate  tx_timeout  xps_cpus  xps_rxqs

# ls /sys/class/net/eth0/queues/tx-0/byte_queue_limits/
hold_time  inflight  limit  limit_max  limit_min

This also removes the #ifdefs, since we can also use netdev_uses_bql() to
check if the config is enabled. (as suggested by Jakub).

Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Breno Leitao <leitao@debian.org>
Link: https://lore.kernel.org/r/20240216094154.3263843-1-leitao@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agonet: page_pool: fix recycle stats for system page_pool allocator
Lorenzo Bianconi [Fri, 16 Feb 2024 09:25:43 +0000 (10:25 +0100)]
net: page_pool: fix recycle stats for system page_pool allocator

Use global percpu page_pool_recycle_stats counter for system page_pool
allocator instead of allocating a separate percpu variable for each
(also percpu) page pool instance.

Reviewed-by: Toke Hoiland-Jorgensen <toke@redhat.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Link: https://lore.kernel.org/r/87f572425e98faea3da45f76c3c68815c01a20ee.1708075412.git.lorenzo@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agopage_pool: disable direct recycling based on pool->cpuid on destroy
Alexander Lobakin [Thu, 15 Feb 2024 11:39:05 +0000 (12:39 +0100)]
page_pool: disable direct recycling based on pool->cpuid on destroy

Now that direct recycling is performed basing on pool->cpuid when set,
memory leaks are possible:

1. A pool is destroyed.
2. Alloc cache is emptied (it's done only once).
3. pool->cpuid is still set.
4. napi_pp_put_page() does direct recycling basing on pool->cpuid.
5. Now alloc cache is not empty, but it won't ever be freed.

In order to avoid that, rewrite pool->cpuid to -1 when unlinking NAPI to
make sure no direct recycling will be possible after emptying the cache.
This involves a bit of overhead as pool->cpuid now must be accessed
via READ_ONCE() to avoid partial reads.
Rename page_pool_unlink_napi() -> page_pool_disable_direct_recycling()
to reflect what it actually does and unexport it.

Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/r/20240215113905.96817-1-aleksander.lobakin@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agodt-bindings: net: fec: add iommus property
Frank Li [Thu, 1 Feb 2024 20:22:42 +0000 (15:22 -0500)]
dt-bindings: net: fec: add iommus property

iMX8QM have iommu. Add proerty 'iommus'.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240201-8qm_smmu-v2-2-3d12a80201a3@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agowifi: wilc1000: add missing read critical sections around vif list traversal
Ajay Singh [Thu, 15 Feb 2024 15:36:21 +0000 (16:36 +0100)]
wifi: wilc1000: add missing read critical sections around vif list traversal

Some code manipulating the vif list is still missing some srcu_read_lock /
srcu_read_unlock, and so can trigger RCU warnings:

=============================
WARNING: suspicious RCU usage
6.8.0-rc1+ #37 Not tainted
-----------------------------
drivers/net/wireless/microchip/wilc1000/hif.c:110 RCU-list traversed without holding the required lock!!
[...]
stack backtrace:
CPU: 0 PID: 6 Comm: kworker/0:0 Not tainted 6.8.0-rc1+ #37
Hardware name: Atmel SAMA5
Workqueue: events sdio_irq_work
 unwind_backtrace from show_stack+0x18/0x1c
 show_stack from dump_stack_lvl+0x34/0x58
 dump_stack_lvl from wilc_get_vif_from_idx+0x158/0x180
 wilc_get_vif_from_idx from wilc_network_info_received+0x80/0x48c
 wilc_network_info_received from wilc_handle_isr+0xa10/0xd30
 wilc_handle_isr from wilc_sdio_interrupt+0x44/0x58
 wilc_sdio_interrupt from process_sdio_pending_irqs+0x1c8/0x60c
 process_sdio_pending_irqs from sdio_irq_work+0x6c/0x14c
 sdio_irq_work from process_one_work+0x8d4/0x169c
 process_one_work from worker_thread+0x8cc/0x1340
 worker_thread from kthread+0x448/0x510
 kthread from ret_from_fork+0x14/0x28

Fix those warnings by adding the needed lock around the corresponding
critical sections

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Co-developed-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240215-wilc_fix_rcu_usage-v1-4-f610e46c6f82@bootlin.com
3 months agowifi: wilc1000: fix declarations ordering
Alexis Lothoré [Thu, 15 Feb 2024 15:36:20 +0000 (16:36 +0100)]
wifi: wilc1000: fix declarations ordering

Fix reverse-christmas tree order in some functions before adding more
variables

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240215-wilc_fix_rcu_usage-v1-3-f610e46c6f82@bootlin.com
3 months agowifi: wilc1000: use SRCU instead of RCU for vif list traversal
Alexis Lothoré [Thu, 15 Feb 2024 15:36:19 +0000 (16:36 +0100)]
wifi: wilc1000: use SRCU instead of RCU for vif list traversal

Enabling CONFIG_PROVE_RCU_LIST raises many warnings in wilc driver, even on
some places already protected by a read critical section. An example of
such case is in wilc_get_available_idx:

=============================
WARNING: suspicious RCU usage
6.8.0-rc1+ #32 Not tainted
-----------------------------
drivers/net/wireless/microchip/wilc1000/netdev.c:944 RCU-list traversed in non-reader section!!
[...]
stack backtrace:
CPU: 0 PID: 26 Comm: kworker/0:3 Not tainted 6.8.0-rc1+ #32
Hardware name: Atmel SAMA5
Workqueue: events_freezable mmc_rescan
 unwind_backtrace from show_stack+0x18/0x1c
 show_stack from dump_stack_lvl+0x34/0x58
 dump_stack_lvl from wilc_netdev_ifc_init+0x788/0x8ec
 wilc_netdev_ifc_init from wilc_cfg80211_init+0x690/0x910
 wilc_cfg80211_init from wilc_sdio_probe+0x168/0x490
 wilc_sdio_probe from sdio_bus_probe+0x230/0x3f4
 sdio_bus_probe from really_probe+0x270/0xdf4
 really_probe from __driver_probe_device+0x1dc/0x580
 __driver_probe_device from driver_probe_device+0x60/0x140
 driver_probe_device from __device_attach_driver+0x268/0x364
 __device_attach_driver from bus_for_each_drv+0x15c/0x1cc
 bus_for_each_drv from __device_attach+0x1ec/0x3e8
 __device_attach from bus_probe_device+0x190/0x1c0
 bus_probe_device from device_add+0x10dc/0x18e4
 device_add from sdio_add_func+0x1c0/0x2c0
 sdio_add_func from mmc_attach_sdio+0xa08/0xe1c
 mmc_attach_sdio from mmc_rescan+0xa00/0xfe0
 mmc_rescan from process_one_work+0x8d4/0x169c
 process_one_work from worker_thread+0x8cc/0x1340
 worker_thread from kthread+0x448/0x510
 kthread from ret_from_fork+0x14/0x28

This warning is due to the section being protected by a srcu critical read
section, but the list traversal being done with classic RCU API. Fix the
warning by using corresponding SRCU read lock/unlock APIs. While doing so,
since we always manipulate the same list (managed through a pointer
embedded in struct_wilc), add a macro to reduce the corresponding
boilerplate in each call site.

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240215-wilc_fix_rcu_usage-v1-2-f610e46c6f82@bootlin.com
3 months agowifi: wilc1000: split deeply nested RCU list traversal in dedicated helper
Alexis Lothoré [Thu, 15 Feb 2024 15:36:18 +0000 (16:36 +0100)]
wifi: wilc1000: split deeply nested RCU list traversal in dedicated helper

Move netif_wake_queue and its surrounding RCU operations in a dedicated
function to clarify wilc_txq_task and ease refactoring

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240215-wilc_fix_rcu_usage-v1-1-f610e46c6f82@bootlin.com
3 months agowifi: rtw89: 8922a: add helper of set_channel
Ping-Ke Shih [Thu, 15 Feb 2024 05:57:41 +0000 (13:57 +0800)]
wifi: rtw89: 8922a: add helper of set_channel

Reset hardware state to prevent hardware stays at abnormal state during
setting channel. Besides, add preparation for MLO/DBCC before setting
channel, and reconfigure registers after that.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240215055741.14148-5-pkshih@realtek.com
3 months agowifi: rtw89: 8922a: add set_channel RF part
Ping-Ke Shih [Thu, 15 Feb 2024 05:57:40 +0000 (13:57 +0800)]
wifi: rtw89: 8922a: add set_channel RF part

Configure RF registers according to band, channel, bandwidth. Since this
chip will support MLO, it needs check the operating mode to decide paths
we are going to configure.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240215055741.14148-4-pkshih@realtek.com
3 months agowifi: rtw89: 8922a: add set_channel BB part
Ping-Ke Shih [Thu, 15 Feb 2024 05:57:39 +0000 (13:57 +0800)]
wifi: rtw89: 8922a: add set_channel BB part

In additional to configure band, channel and bandwidth registers, it also
configure CCK support on 2GHZ band, spur elimination, and RX gain.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240215055741.14148-3-pkshih@realtek.com
3 months agowifi: rtw89: 8922a: add set_channel MAC part
Ping-Ke Shih [Thu, 15 Feb 2024 05:57:38 +0000 (13:57 +0800)]
wifi: rtw89: 8922a: add set_channel MAC part

To set channel, add a function to get TXSB (TX subband) that is hardware
index to indicate primary channel. Then, configure band, channel,
bandwidth and TXSB via registers.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240215055741.14148-2-pkshih@realtek.com
3 months agonet: sched: Annotate struct tc_pedit with __counted_by
Kees Cook [Fri, 16 Feb 2024 23:27:44 +0000 (15:27 -0800)]
net: sched: Annotate struct tc_pedit with __counted_by

Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct tc_pedit.
Additionally, since the element count member must be set before accessing
the annotated flexible array member, move its initialization earlier.

Link: https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agoMerge branch 'pds_core-AER-handling'
David S. Miller [Mon, 19 Feb 2024 10:29:08 +0000 (10:29 +0000)]
Merge branch 'pds_core-AER-handling'

Shannon Nelson says:

====================
pds_core: AER handling

Add simple handlers for the PCI AER callbacks, and improve
the reset handling.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agopds_core: use pci_reset_function for health reset
Shannon Nelson [Fri, 16 Feb 2024 22:29:52 +0000 (14:29 -0800)]
pds_core: use pci_reset_function for health reset

We get the benefit of all the PCI reset locking and recovery if
we use the existing pci_reset_function() that will call our
local reset handlers.

Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agopds_core: delete VF dev on reset
Shannon Nelson [Fri, 16 Feb 2024 22:29:51 +0000 (14:29 -0800)]
pds_core: delete VF dev on reset

When the VF is hit with a reset, remove the aux device in
the prepare for reset and try to restore it after the reset.
The userland mechanics will need to recover and rebuild whatever
uses the device afterwards.

Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agopds_core: add simple AER handler
Shannon Nelson [Fri, 16 Feb 2024 22:29:50 +0000 (14:29 -0800)]
pds_core: add simple AER handler

Set up the pci_error_handlers error_detected and resume to be
useful in handling AER events.

Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agoMerge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next
David S. Miller [Mon, 19 Feb 2024 10:20:39 +0000 (10:20 +0000)]
Merge branch '40GbE' of git://git./linux/kernel/git/tnguy/next
-queue

Tony Nguyen says:

====================
i40e: Simplify VSI and VEB handling

Ivan Vecera says:

The series simplifies handling of VSIs and VEBs by introducing for-each
iterating macros, 'find' helper functions. Also removes the VEB
recursion because the VEBs cannot have sub-VEBs according datasheet and
fixes the support for floating VEBs.

The series content:
Patch 1 - Uses existing helper function for find FDIR VSI instead of loop
Patch 2 - Adds and uses macros to iterate VSI and VEB arrays
Patch 3 - Adds 2 helper functions to find VSIs and VEBs by their SEID
Patch 4 - Fixes broken support for floating VEBs
Patch 5 - Removes VEB recursion and simplifies VEB handling
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 months agotools: ynl: don't access uninitialized attr_space variable
Jiri Pirko [Thu, 15 Feb 2024 12:27:26 +0000 (13:27 +0100)]
tools: ynl: don't access uninitialized attr_space variable

If message contains unknown attribute and user passes
"--process-unknown" command line option, _decode() gets called with space
arg set to None. In that case, attr_space variable is not initialized
used which leads to following trace:

Traceback (most recent call last):
  File "./tools/net/ynl/cli.py", line 77, in <module>
    main()
  File "./tools/net/ynl/cli.py", line 68, in main
    reply = ynl.dump(args.dump, attrs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "tools/net/ynl/lib/ynl.py", line 909, in dump
    return self._op(method, vals, [], dump=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "tools/net/ynl/lib/ynl.py", line 894, in _op
    rsp_msg = self._decode(decoded.raw_attrs, op.attr_set.name)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "tools/net/ynl/lib/ynl.py", line 639, in _decode
    self._rsp_add(rsp, attr_name, None, self._decode_unknown(attr))
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "tools/net/ynl/lib/ynl.py", line 569, in _decode_unknown
    return self._decode(NlAttrs(attr.raw), None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "tools/net/ynl/lib/ynl.py", line 630, in _decode
    search_attrs = SpaceAttrs(attr_space, rsp, outer_attrs)
                              ^^^^^^^^^^
UnboundLocalError: cannot access local variable 'attr_space' where it is not associated with a value

Fix this by moving search_attrs assignment under the if statement
above it to make sure attr_space is initialized.

Fixes: bf8b832374fb ("tools/net/ynl: Support sub-messages in nested attribute spaces")
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>