Commit graph

1,482,811 commits

Author SHA1 Message Date
Alexandra Winter
aa5ec571b9 net/iucv: Add lock nesting annotation in iucv_sock_close()
iucv_sock_close() acquires lock_sock(sk) and then, when the socket is in
IUCV_LISTEN state, calls iucv_sock_cleanup_listen() which acquires
lock_sock(child_sk) for each pending child socket. Moreover
iucv_sock_close(child_sk) is called on the pending child sockets.

Avoid lockdep warning by using lock_sock_nested() in iucv_sock_close().
Split off __iucv_sock_close(), so iucv_sock_cleanup_listen() can call it
without nesting.

This is a missing lockdep annotation - not a real deadlock.

Example warning:
[ 6690.906930] ============================================
[ 6690.906935] WARNING: possible recursive locking detected
[ 6690.906942] 7.3.0-rc1net_KCSAN_KASAN-00240-g641d03105cc0 #23 Not tainted
[ 6690.906948] --------------------------------------------
[ 6690.906953] afiucv_test_loc/5183 is trying to acquire lock:
[ 6690.906959] 000601ad13f20a78 (sk_lock-IUCV){+.+.}-{0:0}, at: iucv_accept_dequeue+0xdc/0x340 [af_iucv]
[ 6690.906984]
               but task is already holding lock:
[ 6690.906989] 000601ad1c115278 (sk_lock-IUCV){+.+.}-{0:0}, at: iucv_sock_close+0x82/0x7d0 [af_iucv]
[ 6690.907006]
               other info that might help us debug this:
[ 6690.907010]  Possible unsafe locking scenario:

[ 6690.907014]        CPU0
[ 6690.907018]        ----
[ 6690.907021]   lock(sk_lock-IUCV);
[ 6690.907028]   lock(sk_lock-IUCV);
[ 6690.907034]
                *** DEADLOCK ***

[ 6690.907038]  May be due to missing lock nesting notation

[ 6690.907043] locks held by afiucv_test_loc/5183: 2, last CPU#0:
[ 6690.907085]  #0: 000601ad137a5550 (&sb->s_type->i_mutex_key#12){+.+.}-{3:3}, at: __sock_release+0x7e/0x230
[ 6690.907109]  #1: 000601ad1c115278 (sk_lock-IUCV){+.+.}-{0:0}, at: iucv_sock_close+0x82/0x7d0 [af_iucv]
[ 6690.907127]
               stack backtrace:
[ 6690.907135] CPU: 0 UID: 0 PID: 5183 Comm: afiucv_test_loc Kdump: loaded Not tainted 7.3.0-rc1net_KCSAN_KASAN-00240-g641d03105cc0 #23 PREEMPT
[ 6690.907140] Hardware name: IBM 8561 T01 703 (z/VM 7.4.0)
[ 6690.907142] Call Trace:
[ 6690.907144]  [<00061ab555fd6208>] dump_stack_lvl+0xe8/0x140
[ 6690.907151]  [<00061ab55623a110>] print_deadlock_bug+0x340/0x350
[ 6690.907156]  [<00061ab55623f768>] __lock_acquire+0x11b8/0x15d0
[ 6690.907159]  [<00061ab55623fc9c>] lock_acquire.part.0+0x11c/0x290
[ 6690.907162]  [<00061ab55623fec4>] lock_acquire+0xb4/0x1e0
[ 6690.907164]  [<00061ab5580d6b96>] lock_sock_nested+0x46/0xf0
[ 6690.907167]  [<00061ab4d66e38dc>] iucv_accept_dequeue+0xdc/0x340 [af_iucv]
[ 6690.907171]  [<00061ab4d66e541c>] iucv_sock_close+0xdc/0x7d0 [af_iucv]
[ 6690.907174]  [<00061ab4d66e5b62>] iucv_sock_release+0x52/0x130 [af_iucv]
[ 6690.907177]  [<00061ab5580c5b24>] __sock_release+0xa4/0x230
[ 6690.907180]  [<00061ab5580c5cdc>] sock_close+0x2c/0x40
[ 6690.907183]  [<00061ab556ac7a00>] __fput+0x2f0/0x880
[ 6690.907187]  [<00061ab556ac8cc0>] fput_close_sync+0xd0/0x1c0
[ 6690.907189]  [<00061ab556abbc70>] __s390x_sys_close+0x90/0xf0
[ 6690.907192]  [<00061ab55894df0e>] __do_syscall+0x1be/0x5a0
[ 6690.907196]  [<00061ab558976a7a>] system_call+0x72/0x90
[ 6690.907200] INFO: lockdep is turned off.

Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260910162919.2100124-1-wintera@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 18:52:33 -07:00
Hariprasad Kelam
afabe5e67b octeontx2-pf: report port connector type in ethtool link ksettings
otx2_get_link_ksettings() already reports speed, duplex, autoneg, link
modes and FEC from CGX firmware shared data, but never fills
cmd->base.port.  As a result, ethtool does not show the physical
connector type even though firmware provides it in fwdata.port.

Read the connector type from shared firmware data and expose it via
ethtool.  Extract only the low 8 bits of the firmware field and
validate the value against the standard ethtool PORT_* definitions
before publishing it to userspace.

Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260909040621.397255-1-rkannoth@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 18:45:32 -07:00
Jakub Kicinski
a0bd756087 Merge branch 'net-phy-add-x-powers-ac200-ac300-ephy-support'
James Hilliard says:

====================
net: phy: add X-Powers AC200/AC300 EPHY support

This submission contains only the networking binding and PHY driver and
is intended for net-next. The AC200 I2C register provider was submitted
separately for the MFD tree:

  https://patch.msgid.link/20260907-submit-ac200-mfd-v11-0-58dd9dc7f69a@gmail.com

The two series can build and be merged independently. AC300 needs only the
networking series. The AC200 runtime path additionally needs the separately
submitted MFD provider and binding. Their shared design point is the DT
representation: the MDIO PHY-package node references the AC200 I2C node for
access to package-control registers.

The AC200 and AC300 contain compatible Fast Ethernet link PHYs which
report the same Clause 22 identifier and use the same link-side register
layout. The link endpoint is inaccessible until package-specific control
registers have powered and configured it.

Both variants are modeled as standard Ethernet PHY packages with one
forced-ID link-PHY child. The package reg value is the link address.
AC300's control range is a fixed package-relative offset of 16 and is
accessed with the PHY package helpers. AC200 reaches its control registers
through a phandle to the companion IC's I2C register interface.

For AC200, the driver resolves the referenced I2C device, establishes a
managed device link, and takes the supplier device lock before checking
that the provider is fully bound and retrieving the regmap attached to
that device. It waits for transient lock holders instead of treating lock
contention as a missing dependency. The link then keeps the provider bound
until the PHY consumer has unbound. This uses the generic device and
regmap interfaces and supports multiple AC200 instances without syscon or
a private cross-subsystem API.

Fixed hardware uses an AC200- or AC300-specific package compatible.
Systems which can contain either package use the ACx00 package compatible
and one packed SID configuration field. Bits 3 through 0 carry the analog
calibration, bit 8 selects AC300, and bit 9 selects its low-calibration
tuning. The driver chooses the backend before acquiring any
backend-specific resource.

One xpowers-acx00 module binds the link child, joins the parent package and
runs the selected backend. It manages the package supply, MII or RMII mode,
vendor analog initialization and package state across suspend and resume.
The common link implementation preserves automatic MDI/MDI-X and standard
MAC-managed EEE advertisement while disabling only the vendor
PHY-autonomous Intelligent EEE mode. A private mutex serializes
package state across phylib callback contexts, while suspend recovery
also holds the phylib lock.

The two patches add the AC200/AC300 PHY-package binding and combined PHY
driver. Board Device Trees and optional PHY features remain outside this
initial series.

The AC200 portions build on earlier work by Jernej Skrabec and Andre
Przywara:

  https://github.com/jernejsk/linux-1/commits/ac200-v4

Public AC200 and AC300 documentation is linked from:

  https://linux-sunxi.org/AC200
====================

Link: https://patch.msgid.link/20260909-submit-acx00-of-dynamic-v1-v11-0-eb45e89ef918@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 18:44:01 -07:00
James Hilliard
6cc2fbceb4 net: phy: add X-Powers AC200/AC300 EPHY driver
The AC200 and AC300 contain compatible Fast Ethernet link PHYs, but the
link endpoint is inaccessible until package-specific control registers
have powered and configured it.

Add one PHY driver which binds the link child and joins its parent
Ethernet PHY package. Fixed package compatibles select the corresponding
backend. The generic ACx00 compatible reads one packed configuration field
and selects the backend before touching backend-specific resources. The
AC300 path therefore does not resolve or access the candidate AC200 I2C
device.

Require two returned NVMEM bytes for AC300 and selectable ACx00
packages before selecting the backend. Keep the existing little-endian
decoding and one-byte calibration support for fixed AC200 packages.

AC200 locates the I2C device referenced by the package and establishes a
managed device link. It verifies that the provider is fully bound under
the supplier device lock before retrieving the regmap attached to the I2C
device. The companion MFD provider enables and exclusively pins the input
clock rate while it is bound. The link keeps the supplier bound until the
PHY consumer has unbound. Firmware must make the selected AC200 provider
path available before the PHY probes.

AC300 uses the PHY package helpers to access the control range at base
address plus 16. Keeping both backends in the same module lets the common
link implementation own the complete PHY without registering artificial
control devices.

Obtain and manage the selected package supply and calibration, manage the
AC300 input clock, validate or program the link address, and apply the
required reset, clock, I/O and shutdown sequences. Start in the
hardware-default MII mode so the forced PHY device can probe before a MAC
attaches, then apply the MAC-provided MII or RMII mode before the normal
PHY soft reset. AC200 specifies no additional delay between its EPHY
controls; the provider's input-clock startup delay is already complete
before its regmap becomes available.

Apply the common vendor analog initialization, optional AC300
low-calibration tuning and board-selected receive-clock inversion. Keep
MDI/MDI-X in automatic mode. Preserve standard MAC-managed EEE support
while disabling the vendor PHY-autonomous Intelligent EEE mode. Restart
autonegotiation when restoring the standard EEE advertisement changes it.

Serialize package state and the multi-register power sequences across the
different phylib callback lock contexts. Power down the package control
block and its supply during PHY suspend, then restore them and the vendor
configuration during resume. If shutdown fails after resetting the PHY,
restore the vendor settings and standard advertisement or forced
speed/duplex under the phylib lock before returning the original error.
A failed suspend is not followed by a normal resume to restore these
settings. Power down again if recovery fails, and unwind package power if
reset, resume or configuration fails after power-on.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Link: https://patch.msgid.link/20260909-submit-acx00-of-dynamic-v1-v11-2-eb45e89ef918@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 18:44:00 -07:00
James Hilliard
783f6f1fdc dt-bindings: net: x-powers: add AC200/AC300 EPHY packages
The AC200 and AC300 contain compatible Fast Ethernet link PHYs which
report the same Clause 22 identifier and use the same link-side register
layout. Their package control paths differ: AC200 control registers are
accessed through the I2C register interface of the companion IC, while
the AC300 control range is at a second Clause 22 address fixed at 16 plus
the link address.

Describe both variants as Ethernet PHY packages. The package reg value is
the link PHY base address and the child supplies the documented PHY ID,
because the identification registers cannot be read until package setup
has completed. The AC300 driver reaches its control range with the PHY
package offset helpers. The AC200 package instead references the companion
IC described by the separately submitted x-powers,ac200 MFD binding. Its
I2C interface provides access to the package controls.

Give fixed hardware variant-specific compatibles. Also provide an ACx00
compatible for systems which can contain either package, with one packed
NVMEM field containing calibration in bits 3 through 0, the AC300 selector
in bit 8 and its low-calibration selector in bit 9. Such a description
contains the potential resources for both backends; the driver consumes
only those selected by the configuration field.

Document the little-endian encoding and two-byte full configuration,
while allowing a one-byte calibration value for fixed AC200 packages.

Describe the package clock, supply and optional xMII receive-clock
inversion needed by some integrations. A fixed AC200 package may omit the
NVMEM field and use its internal calibration copy. Limit both the package
and child link-PHY addresses in AC300-capable descriptions to 0 through 7
so the control address remains in the documented range 16 through 23.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260909-submit-acx00-of-dynamic-v1-v11-1-eb45e89ef918@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 18:44:00 -07:00
Lorenzo Bianconi
a952507ca0 net: airoha: add LRO offload support
Introduce LRO offload support to the airoha_eth driver, leveraging
the EN7581/AN7583 SoC's 8 dedicated LRO hardware queues mapped to RX
queues 24-31. LRO offloading does not support Scatter-Gather (SG) so
it is required to increase the page_pool allocation order to 2 for RX
queues 24-31 (LRO queues).

Since LRO is configured per-QDMA and shared across all devices using
it, LRO is mutually exclusive with multiple devices bound to the
same QDMA block. NETIF_F_LRO availability is re-evaluated whenever the
QDMA user count changes (device registration and runtime QDMA
migration): airoha_update_netdev_features() drops the feature when the
QDMA has more than one user, while airoha_dev_set_qdma() re-enables LRO
on the destination QDMA after a migration so that a running device
keeps it active on the new QDMA block.

Set the GSO metadata (gso_type/gso_size/gso_segs) on aggregated packets,
together with CHECKSUM_PARTIAL and the pseudo-header checksum, so that
L3-forwarded traffic is correctly re-segmented by the GSO/TSO path on
the egress device.

The HW does not report the per-segment MSS (msg3[31:16] only reports
the max aggregated size), so the gso_size of an aggregated packet is
approximated as DIV_ROUND_UP(data_len, agg_count), i.e. the mean
segment size. Since this can never exceed the largest merged segment,
re-segmentation only produces smaller packets, which is safe.
Aggregated skbs are marked SKB_GSO_DODGY so that the stack recomputes
gso_segs from gso_size and does not merge the aggregate into the GRO
engine.

Performance comparison between sw GRO and LRO has been carried out using
a 10Gbps NIC:
GRO:    ~2.7 Gbps
LRO:    ~8.2 Gbps

Tested-by: Madhur Agrawal <madhur.agrawal@airoha.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260909-airoha-eth-lro-v7-1-e6317be79067@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 18:40:40 -07:00
Jakub Kicinski
61ef87401d Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says:

====================
ice: expose TSPLL state on E825 through dpll subsystem

Grzegorz Nitka says:

On E825 devices that own the source timer, the TSPLL can lose lock when
the TCXO or TIME_REF signal is disrupted. This series adds monitoring
and recovery for that condition, then surfaces the lock status and clock
source selection through the dpll subsystem. It also fixes the clock_id
generation for E825 generic DPLL devices so userspace can unambiguously
map each DPLL device to its owning interface.

Patch 1 adds TSPLL lock monitoring to ice_ptp_periodic_work(). Placing it
there ensures recovery runs regardless of whether DPLL init succeeded or
CONFIG_DPLL is enabled. Lock state is cached in pf->ptp.tspll_locked via
WRITE_ONCE()/READ_ONCE() for consumption by the DPLL worker.

Patch 2 registers the TSPLL as a DPLL_TYPE_GENERIC device for E825 owner
PFs, with a fwnode-backed "time_ref" input pin. The pin state_on_dpll_set
callback switches the clock source between TIME_REF and TCXO. Lock status
is read from pf->ptp.tspll_locked; UNLOCKED is reported unconditionally
when the clock source is TCXO to reflect the free-running oscillator state.

Patch 3 changes the clock_id generation for E825 TX-CLK and TSPLL DPLLs.
Previously they used the board-level PCIe DSN, which is identical for
all interfaces sharing the same NAC/quad, so userspace could not tell
them apart. The new scheme derives the clock_id from the permanent port
MAC (with a dedicated tag bit distinguishing TSPLL from TX-CLK), while
other DPLL objects (EEC/PPS and non-E825 paths) keep the board-level
DSN-derived clock_id.

* '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
  ice: use per-interface clock_id for E825 generic DPLLs
  ice: add TSPLL DPLL device and TIME_REF pin for E825
  ice: monitor TSPLL lock from PTP periodic worker
====================

Link: https://patch.msgid.link/20260908222428.872254-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 18:37:58 -07:00
Linkui Xiao
0019aa65bb ipmr, ip6mr: annotate data-races in vif_seq_show()
ipmr_vif_seq_show() and ip6mr_vif_seq_show() read vif->bytes_in,
vif->pkt_in, vif->bytes_out and vif->pkt_out with only rcu_read_lock()
held: since commit b96ef16d2f ("ipmr: convert /proc handlers to
rcu_read_lock()") both seq_start helpers are annotated __acquires(RCU)
and no longer take mrt_lock.

Those counters are updated from softirq context and the writers already
use WRITE_ONCE(): ipmr_prepare_xmit() and ip_mr_forward() on the IPv4
side, ip6mr_prepare_xmit() and ip6_mr_forward() on the IPv6 side. The
other lockless readers use READ_ONCE() as well - ipmr_ioctl(),
ipmr_compat_ioctl(), ipmr_fill_vif(), ip6mr_ioctl() and
ip6mr_compat_ioctl().

The two vif_seq_show() helpers are the only remaining bare readers, so
KCSAN flags them and the compiler is free to tear or reload the values
while the /proc/net/ip_mr_vif and /proc/net/ip6_mr_vif lines are being
formatted. Annotate them like the other readers; these are plain
statistics, no locking is needed.

Signed-off-by: Linkui Xiao <xiaolinkui@kylinos.cn>
Link: https://patch.msgid.link/20260910093452.2070079-1-xiaolinkui@126.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 18:01:21 -07:00
Jakub Kicinski
ad6ff1a67b Merge branch 'hardware-pacing-offload'
Willem de Bruijn says:

====================
hardware pacing offload

Enable safe hardware pacing offload on a first device (idpf), plus support.

- Add rtnetlink support for admin control over the device feature
- Add device support to the idpf driver

Besides the main feature, also

- Small optimization to FQ offload: avoid unnecessary ktime_.._get().
- Expand so_txtime drv-net test with hw offload testcases.

Details and detailed changelog in the individual patches.
====================

Link: https://patch.msgid.link/20260910171131.2532487-1-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 17:42:36 -07:00
Willem de Bruijn
ac48ee5339 selftests: drv-net: extend so_txtime with hw offload
Add two pacing hardware offload variants

1. one that uses FQ to safely offload when within bounds.
2. one that uses pfifo_fast and thus forwards all packets.

Verify that the packets are paced in hardware with new flag '-H'.

Also increase rcvtimeout significantly to reduce flakiness. Especially
for the new beyond_hw_horizon test, which is close to the 100ms limit.
But update recv_verify_empty to take MSG_DONTWAIT. That last empty
check must not delay each testcase by the receive timeout.

Hardware pacing offload can complete packets out of order. So the
reverse_order test is expected to pass with pfifo_fast too.

Do not test ETF, which does not change its dequeue behavior based on
pacing_offload.

The pfifo_fast beyond_hw_horizon testcase expects a failure because
the packet exceeds the hardware horizon and is transmitted immediately,
violating receiver arrival bounds. On slow machines (KSFT_MACHINE_SLOW),
timing variance errors are suppressed by the receiver, so relax the
failure expectation only for this timing-sensitive case while preserving
deterministic checks for other tests (such as ETF invalid txtime).

Signed-off-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260910171131.2532487-8-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 17:42:34 -07:00
Willem de Bruijn
4e50c0265f selftests: drv-net: in so_txtime tell apart sw from hw pacing
Detect software pacing in so_txtime.c using SO_TIMESTAMPING.

If '-H' (hw) is passed

1. measure sw tx delay with SOF_TIMESTAMPING_TX_SOFTWARE, and
2. fail if delay exceeds a threshold, indicating pacing

This will be used in the next patch in the series.

Also extend while condition to account for possible variance.
This applies to all tests, not just the new '-H' variants.

Also reorder getopt parameters to make them alphabetical.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260910171131.2532487-7-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 17:42:33 -07:00
Willem de Bruijn
2d5c630e6c selftests: drv-net: refactor so_txtime errqueue handling
Prepare error queue handling for upcoming SO_EE_ORIGIN_TIMESTAMPING
messages in the next patch in this series.

Convert do_recv_errqueue_timeout into dispatcher do_recv_errqueue
and move SO_EE_ORIGIN_TXTIME specific code into a separate helper.

This will make the next patch a lot more readable.

No functional changes.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260910171131.2532487-6-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 17:42:33 -07:00
Willem de Bruijn
4aa8b5cade idpf: support pacing offload
If skb->tstamp is in the future, program this future delivery txtime
in the transmit descriptor.

TCP pacing offload is only offloaded if SK_PACING_FQ is negotiated and
the FQ offload_horizon is configured. But device support for pacing
offload must be more robust: it can also be reached through SO_TXTIME.

Bounds check txtime. Only packets with timestamp between now and the
horizon (max_pacing_offload_horizon) are offloaded when pacing offload
is enabled on the device via pacing_offload.

Negotiate the feature with the device using virtchnl. Support is
conditional on
- splitq mode, where tx and tx completion queues are separate, so
  completions can be returned out of order.
- flow scheduling mode, where completions can arrive out of order.
- PTP to ensure the NIC clock is synced to CLOCK_TAI.

These features are negotiated per adapter, but expect all vports to
uniformly request splitq (req_[rt]x_splitq) and flow scheduling
(flow_sch_en) when available.

Packets beyond the horizon are sent immediately with the overflow bit
set.

On device reset, EDT capabilities are re-negotiated with firmware.
If re-negotiation succeeds, dev->max_pacing_offload_horizon is refreshed.
If pacing offload is no longer supported, dev->max_pacing_offload_horizon is set to 0.

Must not be called from netpoll due to ktime_get. But netpoll does not
generate packets with EDT, so no explicit test is needed.

Do not fail device initialization on EDT init error. Log an error, but
continue without EDT, similar to PTP.

Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Cc: Joshua A Hay <joshua.a.hay@intel.com>
Cc: intel-wired-lan@lists.osuosl.org
Cc: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260910171131.2532487-5-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 17:42:33 -07:00
Willem de Bruijn
e628a85c69 net_sched: sch_fq: clear past skb->tstamp if offloading pacing
When hardware offload is enabled, FQ will forward packets to the
netdevice for pacing. The device has to test that skb->tstamp is
in the future.

Avoid this cost for packets whose txtime has already passed, by
clearing skb->tstamp.

Also clear slightly into the future, for EDT timestamps that are
so close to now that they fall within a reasonable normal Tx
latency. This slack is set to 400 nsec.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260910171131.2532487-4-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 17:42:33 -07:00
Willem de Bruijn
8036cbf026 net_sched: sch_fq: check device pacing offload
Network devices can modify pacing offload administratively or device
renegotiation.

In FQ, only offload if the feature is enabled and within the supported
device horizon.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260910171131.2532487-3-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 17:42:33 -07:00
Willem de Bruijn
f2109e90a5 net: rtnetlink: add pacing_offload attribute to net_device
Add a new flag to administratively control pacing offload.

The feature is disabled by default. That does not cause regressions, as no
driver advertises max_pacing_offload_horizon yet.

Also add NLA_REJECT for max_pacing_offload_horizon, in line with
other such read-only members of link-attrs.

Both fields can be read with

    ynl --family rt-link --do getlink \
        --json '{"ifname": "eth0"}' | grep pacing

And pacing offload enabled with

    ynl --family rt-link --do setlink \
        --json '{"ifname": "eth0", "pacing-offload": 1}'

Signed-off-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260910171131.2532487-2-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 17:42:33 -07:00
Donggeun Yoo
043777e948 net: phy: dp83867: restore LED configuration after a soft reset
The LED configuration lives in LEDCR1 (the per-LED function nibble) and
LEDCR2 (per-LED driver enable/value and polarity). The driver programs it
through the LED class callbacks -- dp83867_led_brightness_set(),
dp83867_led_hw_control_set() and dp83867_led_polarity_set() -- either once
from device tree at probe, or at runtime from sysfs and the netdev trigger.

dp83867_phy_reset(), the .soft_reset callback, issues a global software
reset (CTRL SW_RESET), which the datasheet defines as resetting all
registers, including the extended registers, to their defaults.
phy_init_hw() runs .soft_reset before .config_init on every attach and
resume -- phy_attach_direct(), mdio_bus_phy_resume() and MAC drivers -- so
the LED configuration is wiped from the first attach onward and never
restored. A device-tree polarity is lost, a manually driven LED goes dark,
and an LED offloaded to the netdev trigger whose link stays down after a
resume keeps the reset-default function until the next link event.

Shadow what the LED callbacks program, as a value and a written-bits mask
per register, and replay it from config_init(), which runs right after the
soft reset. Only bits the driver actually set are restored.

The callbacks run under phydev->lock, but config_init() must not take it:
the cable-test abort path in phy_state_machine() already holds phydev->lock
when it reaches phy_init_hw(), so config_init() taking it would deadlock.
Serialize the shadow and its replay with a dedicated lock instead.

Signed-off-by: Donggeun Yoo <donggeunyoo.kernel@gmail.com>
Link: https://patch.msgid.link/20260908235740.120112-1-donggeunyoo.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 17:27:33 -07:00
Jakub Kicinski
1f20151408 netfilter pull request 26-09-11
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEjF9xRqF1emXiQiqU1w0aZmrPKyEFAmqjvZ0ACgkQ1w0aZmrP
 KyG6Vw//XRHhoUFfdS6S6TqCB2d1e/r/1OxkITV7KtTOUv9hhP2MO+MQTK0vXmaw
 0vEy07qwIZo0uUK5EX5QkNqKu8CRG18qk5LfjmqXkadRqk3qxo8sVD52dCq75HLg
 E+6P3+jcOxeuGopo0kAEhh+ZTb7YlcBjMu6Curqz+BXRq8KRjebBEJ/eidKWx7wg
 t6G2NPY/vQ2Uet4uR9Mg4sWrHIsYB7Zu8KnUmir9mzfkHMWdDGpPRbqDu3Jssj64
 7pHx+Gz/M1iQTV5aZKV3tX5Xo7GbL5lr6MY2BORt3C8A45RcEFmPbAUWm0rDbUxO
 0YjA/ty3dHhgeJEp1d//yWQhrJp4VSzzf1Z7bpYE5W/GOWEGOliTXkqJgCy4z4EY
 PJ1m4kSN4QrIQ1DMv3/1wgRJm1lCeMLpkYA4rCyXReKHSFPtU8Aewzez5sSF2m5u
 Xdp7lro5JA8/3yMf+3mGYi7pG299xvfGoKuDQ2zOy30j4Y/zrmdljvx9qGaKnJ43
 xR4CbZTrkA1pbGE7j03IaHg1FNP8dmkRCFec3K/uJ9SZioOBhteWACWbf8QBmaM7
 L7Bw0kED4FR9/H/vBQtzkJqIr2U4gY2bEG9xGAefsA+6eG0YrWpLiGRTWsTwJHV1
 tbG/y3MdsOOalR5EuUgzl5LLJKye4XuDatkYD26I2t7YGFbLnqs=
 =wAaq
 -----END PGP SIGNATURE-----

Merge tag 'nf-next-26-09-11' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next

Pablo Neira Ayuso says:

====================
Netfilter updates for net-next

1) No need to hold spinlock when ct seqadj is NULL, from Fernando F. Mancera.

2) A series of patches to use GFP_KERNEL_ACCOUNT in x_tables matches
   and targets, nfnetlink, nf_tables, synproxy, sysctl, nat and conncount
   for better integration with memcg. This will surely need more follow
   ups but this gfp flag has been used in this tree over the time anyway.

* tag 'nf-next-26-09-11' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next:
  netfilter: conncount: use GFP_KERNEL_ACCOUNT
  netfilter: nat: use GFP_KERNEL_ACCOUNT
  netfilter: sysctl: use GFP_KERNEL_ACCOUNT
  netfilter: synproxy: use GFP_KERNEL_ACCOUNT
  netfilter: nf_tables: use GFP_KERNEL_ACCOUNT
  netfilter: nfnetlink: use GFP_KERNEL_ACCOUNT
  netfilter: x_tables: use GFP_KERNEL_ACCOUNT in match/target
  netfilter: seqadj: do not take ct lock if seqadj is NULL
====================

Link: https://patch.msgid.link/20260911084437.1838161-1-pablo@netfilter.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 17:11:14 -07:00
Maxime Chevallier (Netdev Foundation)
c0bb05f2d1 tools: ynl: Fix out-of-tree build for ynltool
After the blamed commit, running a out-of-tree build for ynltool fails :

  # make -C tools/net/ynl/ynltool O=/tmp/o1
  make: Entering directory 'tools/net/ynl/ynltool'
  make: *** No rule to make target '/tmp/o1/json_writer.o', needed by '/tmp/o1/ynltool'.  Stop.

ynltool's Makefile correctly accounts for $(OUTPUT) to get the list of
object files to generate :

OBJS := $(patsubst %.c,$(OUTPUT)%.o,$(SRCS))

but it never actually set $(OUTPUT) before the blamed commit, meaning
that out-of-tree buils of ynltool were always actually in-tree.

Now, the O= parameter is correctly accounted for, and the %o: %c rule fails.

Let's update the %o: %c rule to also use $(OUTPUT), as well as the .d
file expansion so that any header change is taken into account.

Reported-by: Bobby Eshleman <bobbyeshleman@gmail.com>
Closes: https://lore.kernel.org/all/aqCyWQxqKDuQnZYR@devvm29614.prn0.facebook.com/
Fixes: 917f713b4e ("tools: ynl: Allow cross-compiling ynl and associated tools")
Signed-off-by: Maxime Chevallier (Netdev Foundation) <maxime.chevallier@bootlin.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Link: https://patch.msgid.link/20260911164135.1428140-1-maxime.chevallier@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 17:09:18 -07:00
Jakub Kicinski
7b37f11090 selftests: net: add ruff linter exclusions
Fedora is now shipping ruff 0.16 which added a ton of more
opinionated rules. Let's add some exclusions for checks
which are both noisy and IMO of questionable value.
We can still follow them for new code but it's a matter
of preference.

 C401: set(x for x in Y) -> {x for x in Y}

I find the set() a little more readable.

 I001: hard requirements to sort includes

A little too much

 RUF015: list(set_a - set_b)[0] -> next(iter(set_a - set_b))

list + index are more readable to a "C person" for sure.

Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Link: https://patch.msgid.link/20260912233926.304768-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 17:08:46 -07:00
Hangbin Liu
879e280b84 selftests: netdevsim: add TEST_INCLUDES to Makefile
Some netdevsim selftests source forwarding/lib.sh and other files, but
the Makefile doesn't have TEST_INCLUDES targets, which makes

  make INSTALL_PATH=/tmp/kself TARGETS=drivers/net/netdevsim \
     -C tools/testing/selftests install

failed to install related lib files. Add TEST_INCLUDES to the Makefile
to install the dependencies.

Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260910-nsim_lib-v1-1-0be0d49eaa42@kylinos.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 17:10:22 -07:00
Mohsin Bashir
c0aca269ec eth: fbnic: Make Rx completion coalescing configurable
The Rx completion queue writeback coalescing window controls how long
the queue manager may defer writing completions to host memory.

Expose this window through the standard rx-cqe-nsecs ethtool
parameter. Preserve the existing 2000 ns default and accept values
from 1000 ns through the device maximum (~109 us).

Hardware expresses COAL_WAIT in 600 MHz core clock cycles, or 1.667 ns
per cycle. Programming rounds the configured value to the nearest clock
cycle, resulting in an error of less than 1 ns. Retain the requested
value for get_coalesce() because this error is below the one-nanosecond
resolution of the ethtool interface.

Signed-off-by: Mohsin Bashir <hmohsin@meta.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260909211111.1795726-1-mohsin.bashr@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:55:47 -07:00
Ethan Nelson-Moore
57ca800cd3 drivers: net: smsc: Remove unused smc9194.h header
The smc9194 driver was removed in commit 9fdf9f61fa ("drivers: net:
smsc: smc9194: Remove this driver"), but smc9194.h was left behind.
Remove it.

Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Joe Damato <joe@dama.to>
Link: https://patch.msgid.link/20260910143516.87304-1-enelsonmoore@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:54:32 -07:00
Jakub Kicinski
cde77d69ea Merge branch 'netlink-specs-conntrack-minor-spec-fixes'
Jakub Kicinski says:

====================
netlink: specs: conntrack: minor spec fixes

Clashiko raised a bunch of pre-existing issues on a recent series
from Ilya. Let's fix those and whatever else pops out in AI review
and looks relatively legitimate.
====================

Link: https://patch.msgid.link/20260910003852.2184031-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:42:52 -07:00
Jakub Kicinski
55edd9e557 netlink: specs: conntrack: tweak definition of obsolete attrs
CTA_SECMARK, CTA_COUNTERS32_{PACKETS,BYTES} are all obsolete
be32 attrs. Since they are obsolete we don't bother with
the byte-order annotation, but let's be consistent about
marking them as u32 with doc: obsolete.

The attrs were obsoleted by:
commit 584015727a ("netfilter: accounting rework: ct_extend + 64bit counters (v4)")
commit 1cc63249ad ("conntrack: export lsm context rather than internal secid via netlink")

Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Link: https://patch.msgid.link/20260910003852.2184031-8-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:42:49 -07:00
Jakub Kicinski
f869aa4cea netlink: specs: conntrack: fix the per-CPU stats reply
ctnetlink_ct_stat_cpu_fill_info() emits CTA_STATS_INVALID but
does not emit CTA_STATS_SEARCHED. Update the attr list, and
remove the false annotation of invalid as obsolete.

Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Link: https://patch.msgid.link/20260910003852.2184031-7-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:42:49 -07:00
Jakub Kicinski
6c98fd455e netlink: specs: conntrack: describe CTA_HELP_INFO
nfnl_cthelper_to_nlattr() seems to output CTA_HELP_INFO but the spec
doesn't have a definition for it, add one.

Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Link: https://patch.msgid.link/20260910003852.2184031-6-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:42:48 -07:00
Jakub Kicinski
58c7df883a netlink: specs: conntrack: fix the nat-attrs attribute IDs
The enum for attr IDs says:

     CTA_NAT_V4_MINIP,
  #define CTA_NAT_MINIP CTA_NAT_V4_MINIP
     CTA_NAT_V4_MAXIP,
  #define CTA_NAT_MAXIP CTA_NAT_V4_MAXIP
     CTA_NAT_PROTO,
     CTA_NAT_V6_MINIP,
     CTA_NAT_V6_MAXIP,

Move nat-proto to the right place in the YAML spec to make sure
the attr IDs match.

Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Link: https://patch.msgid.link/20260910003852.2184031-5-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:42:48 -07:00
Jakub Kicinski
924c8a610d netlink: specs: conntrack: fix SCTP conntrack state names
Correct the names of constants:

Value 1 is SCTP_CONNTRACK_CLOSED, not "cloned".
Value 6 is SCTP_CONNTRACK_SHUTDOWN_RECD, not "shutdown-received".
Value 8 is SCTP_CONNTRACK_HEARTBEAT_SENT, there is no "shutdown-heartbeat"
state.

Note that there's also a value of 9 (HEARTBEAT_ACKED) but sctp_nla_policy
caps the attribute at HEARTBEAT_SENT and HEARTBEAT_ACKED is marked no
longer used in the header.

Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Link: https://patch.msgid.link/20260910003852.2184031-4-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:42:48 -07:00
Jakub Kicinski
19be13c9c1 netlink: specs: conntrack: fix the get reply attribute lists
CTA_NAT_SRC and CTA_NAT_DST are input-only.  The only references to either
are cda[] reads in ctnetlink_setup_nat() and the rejection in
ctnetlink_change_conntrack(); no path ever puts them into a message, so
neither belongs in a reply.  nat-dst was listed twice on top of that.

CTA_TIMESTAMP is the opposite case - both the do and the dump reach
ctnetlink_fill_info() with extinfo set, so ctnetlink_dump_extinfo() ->
ctnetlink_dump_timestamp() emits it, but the lists never named it.

Reported-by: Sashiko <netdev-bot+sashiko@kernel.org>
Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260826220444.4054714-1-i.maximets@ovn.org
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Link: https://patch.msgid.link/20260910003852.2184031-3-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:42:47 -07:00
Jakub Kicinski
68fd293d99 netlink: specs: conntrack: timestamp is a nest, not a be64
ctnetlink_dump_timestamp() wraps CTA_TIMESTAMP_START
and CTA_TIMESTAMP_STOP in a nest, but the spec declares CTA_TIMESTAMP
as a flat be64. ynl picks reply attributes out of the attribute set rather
than the operation's attribute list, so the mistyped attribute stops
the whole dump:

  Error decoding 'timestamp' from 'conntrack-attrs'
  Traceback (most recent call last):
    File "tools/net/ynl/pyynl/cli.py", line 314, in main
      reply = ynl.dump(args.dump, attrs)
    File "tools/net/ynl/pyynl/lib/ynl.py", line 1082, in _decode
      decoded = attr.as_scalar(attr_spec['type'], attr_spec.byte_order)
    File "tools/net/ynl/pyynl/lib/ynl.py", line 291, in as_scalar
      return format_.unpack(self.raw)[0]
  struct.error: unpack requires a buffer of 8 bytes

The tstamp extension is only attached when CONFIG_NF_CONNTRACK_TIMESTAMP
is enabled and nf_conntrack_timestamp is turned on, which is off by default
and is why every dump does not hit this.

stop is omitted for live entries, so it stays optional like every other
member here.  The pad member mirrors counter-attrs, which covers the same
nla_put_be64() padding.

Reported-by: Sashiko <netdev-bot+sashiko@kernel.org>
Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260826220444.4054714-1-i.maximets@ovn.org
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Link: https://patch.msgid.link/20260910003852.2184031-2-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:42:47 -07:00
Junjie Cao
219c6b768e net: dropreason: add SKB_DROP_REASON_IP_TTL_EXCEEDED
The forwarding paths report an expired TTL or hop limit as
SKB_DROP_REASON_IP_INHDR, the reason otherwise used for a header that is
malformed (ip_input.c, exthdrs.c, br_netfilter). Nothing else in the drop
path separates the two: IPSTATS_MIB_INHDRERRORS covers both, and the TTL
check runs before NF_INET_FORWARD, so netfilter tracing stops at
PREROUTING and never sees the drop.

The Fedora bug linked below shows how that reads in practice. The
reporter took kfree_skb(reason=IP_INHDR, loc=ip_forward) to mean the
software header checksum check had failed, and worked through RX checksum
offload, tc csum actions and both libvirt firewall backends before the
drops turned out to be replies arriving with TTL 1. ip_forward() never
verifies the header checksum; that runs earlier, in ip_rcv_core(), and
reports IP_CSUM.

TTL expiry is not a corner case -- every traceroute through a Linux
router goes through too_many_hops.

The three loopback hop limit checks in exthdrs.c drop with no reason at
all; give them the new one.

IPSTATS_MIB_INHDRERRORS stays as it is: RFC 1213 counts time-to-live
exceeded under ipInHdrErrors. The drop reason has no such constraint.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=2517131
Signed-off-by: Junjie Cao <junjie.cao@intel.com>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Link: https://patch.msgid.link/20260910094937.536150-1-junjie.cao@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:38:36 -07:00
Jakub Kicinski
b81c7a91ce Merge branch 'net-xilinx-axienet-fix-irq-error-handling'
bui duc phuc says:

====================
net: xilinx: axienet: Fix IRQ error handling

This series fixes IRQ error handling in the Xilinx AXI Ethernet driver

Handle errors from optional IRQ lookup and preserve the original error
codes instead of returning -ENOMEM.

The changes were found by manual code inspection and compile-tested
only.
====================

Link: https://patch.msgid.link/20260909045450.16176-1-phucduc.bui@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:36:39 -07:00
bui duc phuc
bb2b710249 net: xilinx: axienet: Fix IRQ error handling
irq_of_parse_and_map() returns 0 when parsing or mapping an IRQ fails,
while platform_get_irq() returns a negative error code on failure.

Handle both failure cases appropriately: return -EINVAL when
irq_of_parse_and_map() fails, and propagate the original error code
returned by platform_get_irq() instead of returning -ENOMEM.

Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Reviewed-by: Suraj Gupta <suraj.gupta2@amd.com>
Link: https://patch.msgid.link/20260909045450.16176-4-phucduc.bui@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:36:35 -07:00
bui duc phuc
2d2f18d492 net: xilinx: axienet: Handle optional IRQ return value correctly
lp->eth_irq is assigned from platform_get_irq_optional(), which returns
a non-zero interrupt number on success or a negative error number on
failure. Errors other than -ENXIO are handled before this check,
so -ENXIO is the only error value that can reach this point.

Check for a negative value instead of treating 0 as an undefined IRQ.

Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260909045450.16176-3-phucduc.bui@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:36:02 -07:00
bui duc phuc
90ab44517e net: xilinx: axienet: Propagate errors from optional IRQ lookup
platform_get_irq_optional() returns a positive IRQ number on success or
a negative error code on failure. For an optional IRQ, -ENXIO indicates
that no optional IRQ is available, while other errors should be propagated.

Propagate all error codes returned by platform_get_irq_optional() other
than -ENXIO.

Another call to platform_get_irq_optional() in the same function already
handles the return value this way. Apply the same error handling to this
call site for consistency.

Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260909045450.16176-2-phucduc.bui@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11 16:36:02 -07:00
Ratheesh Kannoth
17d3afadf5 octeontx2: collapse consecutive blank lines in source files
Remove extra blank lines across the octeontx2 driver source.

Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2026-09-11 09:32:26 +01:00
Pablo Neira Ayuso
0e28586ee4 netfilter: conncount: use GFP_KERNEL_ACCOUNT
GFP_KERNEL_ACCOUNT is preferred these days for memcg, replace
GFP_KERNEL by GFP_KERNEL_ACCOUNT.

Allocate the internal nf_conncount datastructure via
GFP_KERNEL_ACCOUNT.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2026-09-11 10:31:09 +02:00
Pablo Neira Ayuso
70deb8ec08 netfilter: nat: use GFP_KERNEL_ACCOUNT
GFP_KERNEL_ACCOUNT is preferred these days for memcg, replace
GFP_KERNEL by GFP_KERNEL_ACCOUNT.

Allocate the internal nat hook via GFP_KERNEL_ACCOUNT.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2026-09-11 10:31:08 +02:00
Pablo Neira Ayuso
324ca7a2b6 netfilter: sysctl: use GFP_KERNEL_ACCOUNT
GFP_KERNEL_ACCOUNT is preferred these days for memcg, replace
GFP_KERNEL by GFP_KERNEL_ACCOUNT.

Allocate per-netns sysctl via GFP_KERNEL_ACCOUNT.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2026-09-11 10:31:08 +02:00
Pablo Neira Ayuso
399a0b7f32 netfilter: synproxy: use GFP_KERNEL_ACCOUNT
GFP_KERNEL_ACCOUNT is preferred these days for memcg, replace
GFP_KERNEL by GFP_KERNEL_ACCOUNT.

Allocate template conntrack via GFP_KERNEL_ACCOUNT.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2026-09-11 10:31:08 +02:00
Pablo Neira Ayuso
e8609e8d56 netfilter: nf_tables: use GFP_KERNEL_ACCOUNT
GFP_KERNEL_ACCOUNT is preferred these days for memcg, replace
GFP_KERNEL by GFP_KERNEL_ACCOUNT.

Just a few leftover in nft_ct and the pipapo set backend,
including alloc_percpu() calls.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2026-09-11 10:31:08 +02:00
Pablo Neira Ayuso
ef2344e67c netfilter: nfnetlink: use GFP_KERNEL_ACCOUNT
GFP_KERNEL_ACCOUNT is preferred these days for memcg, replace
GFP_KERNEL by GFP_KERNEL_ACCOUNT.

Use GFP_KERNEL_ACCOUNT for objects that are created from nfnetlink
subsystems.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2026-09-11 10:31:08 +02:00
Pablo Neira Ayuso
ba100f6f2a netfilter: x_tables: use GFP_KERNEL_ACCOUNT in match/target
GFP_KERNEL_ACCOUNT is preferred these days for memcg, replace GFP_KERNEL
by GFP_KERNEL_ACCOUNT.

Use GFP_KERNEL_ACCOUNT for objects that are allocated in the xtables
.check path. This includes template ct object with extensions such as
helper and timeout.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2026-09-11 10:31:08 +02:00
Fernando Fernandez Mancera
1b9c4f3f9c netfilter: seqadj: do not take ct lock if seqadj is NULL
This is a small optimization, only take ct lock if seqadj is present. In
the unlikely case seqadj isn't present we can return immediately. This
is consistent with the behavior of other functions that checks seqadj.

Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2026-09-11 10:03:52 +02:00
Jakub Kicinski
348ea4642f selftests: net: add ctl_file_write() helper
Setting a sysctl or a sysfs attribute for the duration of a test and
putting the old value back has been open coded multiple times.

We generally avoid creating library helpers but this one is very
common, and the defer is a little tricky as using the same function
for defer as the initial write leads to an infinite loop (not that
I would ever make such mistake!)

Some of the conversions are not identical, but arguably ctl_file_write()
semantics are more correct.

Reviewed-by: Nimrod Oren <noren@nvidia.com>
Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com>
Link: https://patch.msgid.link/20260909180009.1894019-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-10 18:46:40 -07:00
Jakub Kicinski
c48f4d49b4 Merge branch 'sit-convert-configuration-to-rcu-and-lockless-fill_info'
Eric Dumazet says:

====================
sit: convert configuration to RCU and lockless fill_info

SIT (IPv6-in-IPv4) tunnel configuration and status reporting have
historically relied on the RTNL lock for synchronization. Consequently,
netlink dumps via ipip6_fill_info() had to run with RTNL held, adding
contention during network device dumps.

At the same time, the transmit path (dev->lltx == true), tunnel lookups,
and error handling run locklessly and can race with configuration
updates. This can result in torn reads of multi-word fields (such as the
128-bit 6RD IPv6 prefix) or transiently zeroed encapsulation parameters.
Furthermore, ipip6_tunnel_update() currently unhashes, re-hashes, and
calls synchronize_net() unconditionally, even when the tunnel endpoint
addresses (saddr and daddr) have not changed.

This patch series addresses PRL issues, modernizes SIT parameter
management to use RCU protection, optimizes tunnel updates, and removes
the RTNL requirement from ipip6_fill_info():

- Patch 1 fixes a pre-existing UAF in PRL (Potential Router List)
  deletion where call_rcu() was invoked before unlinking t->prl.
- Patch 2 adds GFP_KERNEL_ACCOUNT to struct ip_tunnel_prl_entry
  allocations in ipip6_tunnel_add_prl().
- Patch 3 removes the unsafe in-place memset() in ip_tunnel_encap_setup()
  and uses WRITE_ONCE() to prevent lockless readers from observing
  transiently zeroed or torn fields.
- Patch 4 annotates data races on tunnel->fwmark with READ_ONCE() and
  WRITE_ONCE().
- Patch 5 converts 6RD configuration (tunnel->ip6rd) to an RCU-protected
  pointer, preventing torn reads on the 128-bit IPv6 prefix.
- Patch 6 implements a dedicated ipip6_get_iflink() callback to decouple
  SIT parameter handling from generic ip_tunnel.
- Patch 7 dynamically allocates struct ip_tunnel_parm_kern (sit_parms)
  as a preparatory step.
- Patch 8 converts tunnel->sit_parms to full RCU protection. Updates
  publish new parameters via rcu_assign_pointer() and free the old ones
  via kfree_rcu(). When saddr and daddr do not change, unhashing,
  re-hashing, and synchronize_net() are completely bypassed.
- Patch 9 wraps attribute serialization in ipip6_fill_info() under
  rcu_read_lock(), eliminating the reliance on the RTNL lock.
====================

Link: https://patch.msgid.link/20260907075846.2913645-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-10 18:35:36 -07:00
Eric Dumazet
f712bf6f17 sit: no longer rely on RTNL in ipip6_fill_info()
Now that SIT parameters and 6RD parameters are RCU-protected,
and fwmark/encap are annotated with READ_ONCE()/WRITE_ONCE(),
ipip6_fill_info() no longer requires RTNL to be held.

Wrap the attribute serialization in rcu_read_lock() and rcu_read_unlock().

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20260907075846.2913645-10-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-10 18:35:34 -07:00
Eric Dumazet
0301127e4d sit: convert configuration to RCU protection
Now that SIT parameters are dynamically allocated, convert
tunnel->sit_parms to an RCU-protected pointer.

Updates in ipip6_tunnel_update() allocate a new parameter block,
publish it using rcu_assign_pointer(), and free the old one
via kfree_rcu().

We only need to unlink and re-link the tunnel in the hash table
if either saddr or daddr changed. When neither address changes,
the unhash/re-hash and synchronize_net() can be completely skipped.

Readers in ipip6_tunnel_lookup(), ipip6_tunnel_xmit(), ipip6_err(),
and ipip6_rcv() now safely dereference tunnel->sit_parms under RCU.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20260907075846.2913645-9-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-10 18:35:34 -07:00
Eric Dumazet
3cd52b7c0b sit: dynamically allocate struct ip_tunnel_parm_kern
In preparation for converting SIT configuration parameters to RCU,
dynamically allocate struct ip_tunnel_parm_kern as sit_parms in
struct ip_tunnel.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20260907075846.2913645-8-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-10 18:35:34 -07:00