<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/net/ethernet/microchip, branch master</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>net: lan969x: fix RX ring stall on frames from inactive ports</title>
<updated>2026-11-18T02:52:05+00:00</updated>
<author>
<name>Daniel Machon</name>
<email>daniel.machon@microchip.com</email>
</author>
<published>2026-11-16T09:56:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1a47bc214d00fbfaeb9a963a8aac2e4e58d36e71'/>
<id>1a47bc214d00fbfaeb9a963a8aac2e4e58d36e71</id>
<content type='text'>
If the source port of a received frame does not map to an active port,
or build_skb() fails, lan969x_fdma_rx_get_frame() returns the page to
the page_pool and returns NULL, and the NAPI poll loop breaks without
advancing past the DB. The DB keeps its DONE bit, so every following
poll returns the same page to the page_pool again, and RX stops on all
ports.

Drop the frame and advance past the DB like for any other frame, and
replace the WARN_ON() with a ratelimited error, as the source port comes
from the hardware.

Confirmed on lan969x (EV23X71A) with a kernel modified to give received
frames an out-of-range source port, which stopped RX on all ports. The
fix was tested the same way: only the bad frames are dropped.

Fixes: d84ad2c0d80c ("net: lan969x: add FDMA implementation")
Reported-by: Zhang Hewei &lt;memoriaru@foxmail.com&gt;
Closes: https://lore.kernel.org/netdev/tencent_ACC296C1F221C304053BD0F1F4B0D2C2BA06@qq.com/
Signed-off-by: Daniel Machon &lt;daniel.machon@microchip.com&gt;
Link: https://patch.msgid.link/20261116-sparx5-rx-inactive-port-v1-2-343d8bab58bb@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the source port of a received frame does not map to an active port,
or build_skb() fails, lan969x_fdma_rx_get_frame() returns the page to
the page_pool and returns NULL, and the NAPI poll loop breaks without
advancing past the DB. The DB keeps its DONE bit, so every following
poll returns the same page to the page_pool again, and RX stops on all
ports.

Drop the frame and advance past the DB like for any other frame, and
replace the WARN_ON() with a ratelimited error, as the source port comes
from the hardware.

Confirmed on lan969x (EV23X71A) with a kernel modified to give received
frames an out-of-range source port, which stopped RX on all ports. The
fix was tested the same way: only the bad frames are dropped.

Fixes: d84ad2c0d80c ("net: lan969x: add FDMA implementation")
Reported-by: Zhang Hewei &lt;memoriaru@foxmail.com&gt;
Closes: https://lore.kernel.org/netdev/tencent_ACC296C1F221C304053BD0F1F4B0D2C2BA06@qq.com/
Signed-off-by: Daniel Machon &lt;daniel.machon@microchip.com&gt;
Link: https://patch.msgid.link/20261116-sparx5-rx-inactive-port-v1-2-343d8bab58bb@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: sparx5: fix RX ring stall on frames from inactive ports</title>
<updated>2026-11-18T02:52:05+00:00</updated>
<author>
<name>Daniel Machon</name>
<email>daniel.machon@microchip.com</email>
</author>
<published>2026-11-16T09:56:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=81d2cf1c6d567260e3195d2ef049f44446a462a7'/>
<id>81d2cf1c6d567260e3195d2ef049f44446a462a7</id>
<content type='text'>
If the source port of a received frame does not map to a port with a
netdev, sparx5_fdma_rx_get_frame() returns false without consuming the
DB. The DB keeps its DONE bit, so every following poll picks the same
DB and grows its skb with skb_put() again. This ends in
skb_over_panic(), or in an RX stall if no more frames arrive.

Drop the frame and return true, so that the DB is consumed like any
other. Remove the extraction queue flush, as the FDMA has already
extracted the frame, and ratelimit the error, as the source port comes
from the hardware.

Confirmed on Sparx5 (PCB135) with a kernel modified to give received
frames an out-of-range source port, which made the board reset. The fix
was tested the same way: only the bad frames are dropped.

Fixes: 10615907e9b5 ("net: sparx5: switchdev: adding frame DMA functionality")
Reported-by: Zhang Hewei &lt;memoriaru@foxmail.com&gt;
Closes: https://lore.kernel.org/netdev/tencent_ACC296C1F221C304053BD0F1F4B0D2C2BA06@qq.com/
Signed-off-by: Daniel Machon &lt;daniel.machon@microchip.com&gt;
Link: https://patch.msgid.link/20261116-sparx5-rx-inactive-port-v1-1-343d8bab58bb@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the source port of a received frame does not map to a port with a
netdev, sparx5_fdma_rx_get_frame() returns false without consuming the
DB. The DB keeps its DONE bit, so every following poll picks the same
DB and grows its skb with skb_put() again. This ends in
skb_over_panic(), or in an RX stall if no more frames arrive.

Drop the frame and return true, so that the DB is consumed like any
other. Remove the extraction queue flush, as the FDMA has already
extracted the frame, and ratelimit the error, as the source port comes
from the hardware.

Confirmed on Sparx5 (PCB135) with a kernel modified to give received
frames an out-of-range source port, which made the board reset. The fix
was tested the same way: only the bad frames are dropped.

Fixes: 10615907e9b5 ("net: sparx5: switchdev: adding frame DMA functionality")
Reported-by: Zhang Hewei &lt;memoriaru@foxmail.com&gt;
Closes: https://lore.kernel.org/netdev/tencent_ACC296C1F221C304053BD0F1F4B0D2C2BA06@qq.com/
Signed-off-by: Daniel Machon &lt;daniel.machon@microchip.com&gt;
Link: https://patch.msgid.link/20261116-sparx5-rx-inactive-port-v1-1-343d8bab58bb@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: microchip: encx24j600: Avoid unsequenced accesses to jiffies in encx24j600_tx()</title>
<updated>2026-11-18T02:45:04+00:00</updated>
<author>
<name>Nathan Chancellor</name>
<email>nathan@kernel.org</email>
</author>
<published>2026-11-15T04:38:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5ec918f8d66a0311c52cc767ade67e7019beb176'/>
<id>5ec918f8d66a0311c52cc767ade67e7019beb176</id>
<content type='text'>
After a recent improvement in clang to warn on unsequenced accesses to
volatile variables [1], an instance appears in encx24j600_tx(), which
can break the build with CONFIG_WERROR=y / W=e:

  drivers/net/ethernet/microchip/encx24j600.c:898:14: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced]
    898 |                   jiffies, jiffies - dev_trans_start(dev));
        |                   ~~~~~~~  ^

Per C11 5.1.2.3.2, accessing a volatile object is a side effect. Per C11
6.5.2, unsequenced side effects on the same scalar object are undefined
behavior. Per C11 6.5.2.2.10/12, the evaluation of arguments in a
function call is indeterminately sequenced, meaning any side effects in
the arguments are unsequenced.

Add a local variable to hold the value of jiffies before the function
call so that there are no unsequenced side effects, clearing up the
warning.

Cc: stable@vger.kernel.org
Fixes: 04fbfce7a222 ("net: Microchip encx24j600 driver")
Closes: https://github.com/ClangBuiltLinux/linux/issues/2196
Link: https://github.com/llvm/llvm-project/commit/955715460eaf9188c241c74750637fc82dfcc423 [1]
Signed-off-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Reviewed-by: Andrew Lunn &lt;andrew@lunn.ch&gt;
Link: https://patch.msgid.link/20261114-encx24j600-wunsequenced-v1-1-c978fc36cacd@kernel.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
After a recent improvement in clang to warn on unsequenced accesses to
volatile variables [1], an instance appears in encx24j600_tx(), which
can break the build with CONFIG_WERROR=y / W=e:

  drivers/net/ethernet/microchip/encx24j600.c:898:14: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced]
    898 |                   jiffies, jiffies - dev_trans_start(dev));
        |                   ~~~~~~~  ^

Per C11 5.1.2.3.2, accessing a volatile object is a side effect. Per C11
6.5.2, unsequenced side effects on the same scalar object are undefined
behavior. Per C11 6.5.2.2.10/12, the evaluation of arguments in a
function call is indeterminately sequenced, meaning any side effects in
the arguments are unsequenced.

Add a local variable to hold the value of jiffies before the function
call so that there are no unsequenced side effects, clearing up the
warning.

Cc: stable@vger.kernel.org
Fixes: 04fbfce7a222 ("net: Microchip encx24j600 driver")
Closes: https://github.com/ClangBuiltLinux/linux/issues/2196
Link: https://github.com/llvm/llvm-project/commit/955715460eaf9188c241c74750637fc82dfcc423 [1]
Signed-off-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Reviewed-by: Andrew Lunn &lt;andrew@lunn.ch&gt;
Link: https://patch.msgid.link/20261114-encx24j600-wunsequenced-v1-1-c978fc36cacd@kernel.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'devm_kmalloc_obj-v7.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux</title>
<updated>2026-11-08T22:55:54+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-11-08T22:55:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e0d8e8de8bcb1ef7b749033b5af5518ba8df7bec'/>
<id>e0d8e8de8bcb1ef7b749033b5af5518ba8df7bec</id>
<content type='text'>
Pull devm_kmalloc_obj conversion from Kees Cook:

 - treewide refresh of kmalloc_obj() conversions

 - devm_kmalloc_obj conversion rules added to Coccinelle scripting

 - treewide conversion of devm_kmalloc() family to devm_kmalloc_obj()

* tag 'devm_kmalloc_obj-v7.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() family
  coccinelle: kmalloc_obj: Include devm_kmalloc_obj conversion rules
  treewide: refresh kmalloc_obj() conversions
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull devm_kmalloc_obj conversion from Kees Cook:

 - treewide refresh of kmalloc_obj() conversions

 - devm_kmalloc_obj conversion rules added to Coccinelle scripting

 - treewide conversion of devm_kmalloc() family to devm_kmalloc_obj()

* tag 'devm_kmalloc_obj-v7.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() family
  coccinelle: kmalloc_obj: Include devm_kmalloc_obj conversion rules
  treewide: refresh kmalloc_obj() conversions
</pre>
</div>
</content>
</entry>
<entry>
<title>treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() family</title>
<updated>2026-11-06T05:55:50+00:00</updated>
<author>
<name>Kees Cook</name>
<email>kees+treewide@kernel.org</email>
</author>
<published>2026-10-29T06:16:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4dd10fbbeb9c33709edc89916e19c03c780a0751'/>
<id>4dd10fbbeb9c33709edc89916e19c03c780a0751</id>
<content type='text'>
Mirroring the earlier kmalloc_obj() conversion, convert the
device-managed allocators over to the type-based API using the now
updated scripts/coccinelle/api/kmalloc_objs.cocci. The size is derived
from the type rather than written out as a sizeof(), and the result is
a pointer to that type rather than void *, so a mismatch between the
size requested and the variable assigned becomes a build error instead
of being silently accepted.

The conversions break down as:

	6713	devm_kzalloc_obj()
	1749	devm_kzalloc_objs()
	 307	devm_kzalloc_flex()
	  91	devm_kmalloc_objs()
	  82	devm_kmalloc_obj()
	   2	devm_kmalloc_flex()

The rules deliberately leave alone allocations sized by a string or a
byte-sized type, or assigned to a pointer to a byte-sized type, since
those are byte buffers rather than objects. Allocations sized by a
multi-byte integer type are only converted when they are assigned to a
pointer to that same type, and allocations of pointers to integers or of
void pointers are left alone too. After this change, 528 files still
call devm_kmalloc(), devm_kzalloc(), devm_kcalloc(), or
devm_kmalloc_array().

Build tested with allmodconfig on x86_64, arm64, i386, arm, riscv, s390,
m68k, mips, parisc, sparc, loongarch, arc, xtensa, and openrisc with GCC
16.2.0 with no new warnings.

Signed-off-by: Kees Cook &lt;kees+treewide@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Mirroring the earlier kmalloc_obj() conversion, convert the
device-managed allocators over to the type-based API using the now
updated scripts/coccinelle/api/kmalloc_objs.cocci. The size is derived
from the type rather than written out as a sizeof(), and the result is
a pointer to that type rather than void *, so a mismatch between the
size requested and the variable assigned becomes a build error instead
of being silently accepted.

The conversions break down as:

	6713	devm_kzalloc_obj()
	1749	devm_kzalloc_objs()
	 307	devm_kzalloc_flex()
	  91	devm_kmalloc_objs()
	  82	devm_kmalloc_obj()
	   2	devm_kmalloc_flex()

The rules deliberately leave alone allocations sized by a string or a
byte-sized type, or assigned to a pointer to a byte-sized type, since
those are byte buffers rather than objects. Allocations sized by a
multi-byte integer type are only converted when they are assigned to a
pointer to that same type, and allocations of pointers to integers or of
void pointers are left alone too. After this change, 528 files still
call devm_kmalloc(), devm_kzalloc(), devm_kcalloc(), or
devm_kmalloc_array().

Build tested with allmodconfig on x86_64, arm64, i386, arm, riscv, s390,
m68k, mips, parisc, sparc, loongarch, arc, xtensa, and openrisc with GCC
16.2.0 with no new warnings.

Signed-off-by: Kees Cook &lt;kees+treewide@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: sparx5/lan969x: release the in-flight slot of a stale TX skb</title>
<updated>2026-11-02T14:31:20+00:00</updated>
<author>
<name>Daniel Machon</name>
<email>daniel.machon@microchip.com</email>
</author>
<published>2026-10-29T11:48:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=873363ac591a1774aa3ced84f7ea3d93a3eb9b07'/>
<id>873363ac591a1774aa3ced84f7ea3d93a3eb9b07</id>
<content type='text'>
sparx5_ptp_txtstamp_request() counts every two step TX skb waiting for
its timestamp in sparx5-&gt;ptp_skbs, and refuses new ones once
SPARX5_MAX_PTP_ID are in flight. sparx5_ptp_txtstamp_old_release()
frees the skbs that have waited longer than SPARX5_PTP_TIMEOUT.

Before this patch, old_release() does not decrement ptp_skbs, so every
skb whose timestamp never arrives, for example because the switch
discarded the frame, keeps its slot forever. Once SPARX5_MAX_PTP_ID
slots are lost, two step frames fail to transmit on every port of the
switch.

Return the number of released skbs from old_release() and subtract it
from ptp_skbs in txtstamp_request(), under the ptp_ts_id_lock it already
takes.

This fixes the accounting only. A port's stale skbs are still aged out
only when that port sends a two step frame, so a port that stops sending
them keeps its stale skbs, and their slots, until it sends one again.
That behaviour is unchanged by this patch.

Found by an AI code review agent. Reproduced on a lan9696 board with a
modified kernel that drops the TX timestamps of two step frames, after
which two step timestamping stopped working on the port. With the fix,
timestamping keeps working on that board and on a sparx5 PCB135 board.

Fixes: 70dfe25cd866 ("net: sparx5: Update extraction/injection for timestamping")
Signed-off-by: Daniel Machon &lt;daniel.machon@microchip.com&gt;
Reviewed-by: Simon Horman &lt;horms@kernel.org&gt;
Link: https://patch.msgid.link/20261029-sparx5-ptp-stale-tx-slot-v1-1-ec15f391bbb7@microchip.com
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
sparx5_ptp_txtstamp_request() counts every two step TX skb waiting for
its timestamp in sparx5-&gt;ptp_skbs, and refuses new ones once
SPARX5_MAX_PTP_ID are in flight. sparx5_ptp_txtstamp_old_release()
frees the skbs that have waited longer than SPARX5_PTP_TIMEOUT.

Before this patch, old_release() does not decrement ptp_skbs, so every
skb whose timestamp never arrives, for example because the switch
discarded the frame, keeps its slot forever. Once SPARX5_MAX_PTP_ID
slots are lost, two step frames fail to transmit on every port of the
switch.

Return the number of released skbs from old_release() and subtract it
from ptp_skbs in txtstamp_request(), under the ptp_ts_id_lock it already
takes.

This fixes the accounting only. A port's stale skbs are still aged out
only when that port sends a two step frame, so a port that stops sending
them keeps its stale skbs, and their slots, until it sends one again.
That behaviour is unchanged by this patch.

Found by an AI code review agent. Reproduced on a lan9696 board with a
modified kernel that drops the TX timestamps of two step frames, after
which two step timestamping stopped working on the port. With the fix,
timestamping keeps working on that board and on a sparx5 PCB135 board.

Fixes: 70dfe25cd866 ("net: sparx5: Update extraction/injection for timestamping")
Signed-off-by: Daniel Machon &lt;daniel.machon@microchip.com&gt;
Reviewed-by: Simon Horman &lt;horms@kernel.org&gt;
Link: https://patch.msgid.link/20261029-sparx5-ptp-stale-tx-slot-v1-1-ec15f391bbb7@microchip.com
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: lan966x: don't free XDP buffers in fdma tx clear with budget 0</title>
<updated>2026-11-02T11:59:38+00:00</updated>
<author>
<name>Daniel Machon</name>
<email>daniel.machon@microchip.com</email>
</author>
<published>2026-10-29T11:47:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=263a5514cb9535380734b5e300b298f82570eb57'/>
<id>263a5514cb9535380734b5e300b298f82570eb57</id>
<content type='text'>
lan966x_fdma_tx_clear_buf() runs from the NAPI poll and frees the
buffers of completed tx DCBs with napi_consume_skb(),
page_pool_recycle_direct() and xdp_return_frame_bulk().

netpoll calls the NAPI poll with a budget of 0 and hardirqs disabled.
With a budget of 0, a driver cannot call any XDP or page pool API.

Before this patch, the XDP_TX pages and ndo_xdp_xmit frames are freed
regardless of the budget. With netconsole on the port that owns the
FDMA NAPI, such a buffer is freed with hardirqs disabled, and
__page_pool_put_page() warns via lockdep_assert_no_hardirq().

Leave the XDP buffers of completed DCBs in place when the budget is 0,
and free them in the next NAPI poll. napi_consume_skb() already handles
a budget of 0, so skbs are still freed.

Found by an AI code review agent. Reproduced on a lan9668 board with a
modified kernel that runs the NAPI poll with a budget of 0 and hardirqs
disabled. With the fix the warning is gone.

Fixes: 19c6f534f636 ("net: lan966x: Add support for XDP_TX")
Signed-off-by: Daniel Machon &lt;daniel.machon@microchip.com&gt;
Reviewed-by: Simon Horman &lt;horms@kernel.org&gt;
Link: https://patch.msgid.link/20261029-lan966x-fdma-tx-clear-budget-v1-1-38c52d7aab8c@microchip.com
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
lan966x_fdma_tx_clear_buf() runs from the NAPI poll and frees the
buffers of completed tx DCBs with napi_consume_skb(),
page_pool_recycle_direct() and xdp_return_frame_bulk().

netpoll calls the NAPI poll with a budget of 0 and hardirqs disabled.
With a budget of 0, a driver cannot call any XDP or page pool API.

Before this patch, the XDP_TX pages and ndo_xdp_xmit frames are freed
regardless of the budget. With netconsole on the port that owns the
FDMA NAPI, such a buffer is freed with hardirqs disabled, and
__page_pool_put_page() warns via lockdep_assert_no_hardirq().

Leave the XDP buffers of completed DCBs in place when the budget is 0,
and free them in the next NAPI poll. napi_consume_skb() already handles
a budget of 0, so skbs are still freed.

Found by an AI code review agent. Reproduced on a lan9668 board with a
modified kernel that runs the NAPI poll with a budget of 0 and hardirqs
disabled. With the fix the warning is gone.

Fixes: 19c6f534f636 ("net: lan966x: Add support for XDP_TX")
Signed-off-by: Daniel Machon &lt;daniel.machon@microchip.com&gt;
Reviewed-by: Simon Horman &lt;horms@kernel.org&gt;
Link: https://patch.msgid.link/20261029-lan966x-fdma-tx-clear-budget-v1-1-38c52d7aab8c@microchip.com
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: lan966x: don't disable hardirqs in fdma tx clear path</title>
<updated>2026-10-27T23:01:49+00:00</updated>
<author>
<name>Daniel Machon</name>
<email>daniel.machon@microchip.com</email>
</author>
<published>2026-10-26T13:45:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b2e17432e7ee75997657f99862eb83be0c78a6c1'/>
<id>b2e17432e7ee75997657f99862eb83be0c78a6c1</id>
<content type='text'>
lan966x_fdma_tx_clear_buf() runs from the NAPI poll and frees the
buffers of completed tx DCBs with napi_consume_skb(),
page_pool_recycle_direct() and xdp_return_frame_bulk(), under
lan966x-&gt;tx_lock.

Before this patch, the lock is taken with spin_lock_irqsave(), so the
buffers are freed with hardirqs disabled. RX skbs are marked for
page_pool recycling, so when such an skb is forwarded back out and its
tx completion frees it here, the free path reaches __page_pool_put_page(),
which warns via lockdep_assert_no_hardirq().

Take tx_lock with a plain spin_lock(), as the other tx_lock users,
lan966x_port_xmit() and lan966x_fdma_xmit_xdpf(), already do.
tx_clear_buf() runs from the NAPI poll, so disabling hardirqs there is
not needed.

Found with lockdep enabled (CONFIG_PROVE_LOCKING), which the assert
depends on. Reproduced on a lan9668 board by redirecting received frames
out of another port with tc mirred.

Fixes: 11871aba1974 ("net: lan96x: Use page_pool API")
Signed-off-by: Daniel Machon &lt;daniel.machon@microchip.com&gt;
Link: https://patch.msgid.link/20261026-lan966x-fdma-tx-clear-hardirq-v1-1-5f70f026a2e4@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
lan966x_fdma_tx_clear_buf() runs from the NAPI poll and frees the
buffers of completed tx DCBs with napi_consume_skb(),
page_pool_recycle_direct() and xdp_return_frame_bulk(), under
lan966x-&gt;tx_lock.

Before this patch, the lock is taken with spin_lock_irqsave(), so the
buffers are freed with hardirqs disabled. RX skbs are marked for
page_pool recycling, so when such an skb is forwarded back out and its
tx completion frees it here, the free path reaches __page_pool_put_page(),
which warns via lockdep_assert_no_hardirq().

Take tx_lock with a plain spin_lock(), as the other tx_lock users,
lan966x_port_xmit() and lan966x_fdma_xmit_xdpf(), already do.
tx_clear_buf() runs from the NAPI poll, so disabling hardirqs there is
not needed.

Found with lockdep enabled (CONFIG_PROVE_LOCKING), which the assert
depends on. Reproduced on a lan9668 board by redirecting received frames
out of another port with tc mirred.

Fixes: 11871aba1974 ("net: lan96x: Use page_pool API")
Signed-off-by: Daniel Machon &lt;daniel.machon@microchip.com&gt;
Link: https://patch.msgid.link/20261026-lan966x-fdma-tx-clear-hardirq-v1-1-5f70f026a2e4@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: microchip: fdma: fix DCB corruption under sustained load</title>
<updated>2026-10-27T22:20:52+00:00</updated>
<author>
<name>Daniel Machon</name>
<email>daniel.machon@microchip.com</email>
</author>
<published>2026-10-26T13:47:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=573a6d4c7a21e34d7a2174b8d3c7ca67a5e850b6'/>
<id>573a6d4c7a21e34d7a2174b8d3c7ca67a5e850b6</id>
<content type='text'>
__fdma_dcb_add() prepares a DCB and links it into a channel's chain by
writing its address to the NEXT_PTR of the current last DCB. The FDMA
may be processing the chain while this happens.

Before this patch, the link is written before the new DCB's own nextptr
and info fields, so the FDMA can follow it to a DCB that hasn't been fully
prepared yet. Under sustained load this stalls the FDMA.

Prepare the new DCB fully before linking it, and update the previous
DCB's NEXT_PTR using the two-step sequence from the datasheet (poison
the LSB and flush, then clear it) so the FDMA never observes a
partially-updated pointer.

Reported by a customer running iperf3 --bidir against a lan969x board.

Reproduced on lan969x with iperf3, throughput collapsing to zero:

  [  5]   1.00-2.00   sec  73.9 MBytes   620 Mbits/sec    0    305 KBytes
  [  5]   2.00-3.00   sec  73.9 MBytes   620 Mbits/sec    0    305 KBytes
  [  5]   3.00-4.00   sec  13.9 MBytes   116 Mbits/sec    2   1.41 KBytes
  [  5]   4.00-5.00   sec  0.00 Bytes  0.00 bits/sec    1   1.41 KBytes
  [  5]   5.00-6.00   sec  0.00 Bytes  0.00 bits/sec    0   1.41 KBytes
  [  5]   6.00-7.00   sec  0.00 Bytes  0.00 bits/sec    1   1.41 KBytes

The race is timing-dependent: across three reproductions the stall
appeared anywhere from ~400s to ~3000s into the run.

Fixes: 30e48a75df9c ("net: microchip: add FDMA library")
Signed-off-by: Daniel Machon &lt;daniel.machon@microchip.com&gt;
Link: https://patch.msgid.link/20261026-microchip-fdma-dcb-corruption-v1-1-36dab6caca07@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
__fdma_dcb_add() prepares a DCB and links it into a channel's chain by
writing its address to the NEXT_PTR of the current last DCB. The FDMA
may be processing the chain while this happens.

Before this patch, the link is written before the new DCB's own nextptr
and info fields, so the FDMA can follow it to a DCB that hasn't been fully
prepared yet. Under sustained load this stalls the FDMA.

Prepare the new DCB fully before linking it, and update the previous
DCB's NEXT_PTR using the two-step sequence from the datasheet (poison
the LSB and flush, then clear it) so the FDMA never observes a
partially-updated pointer.

Reported by a customer running iperf3 --bidir against a lan969x board.

Reproduced on lan969x with iperf3, throughput collapsing to zero:

  [  5]   1.00-2.00   sec  73.9 MBytes   620 Mbits/sec    0    305 KBytes
  [  5]   2.00-3.00   sec  73.9 MBytes   620 Mbits/sec    0    305 KBytes
  [  5]   3.00-4.00   sec  13.9 MBytes   116 Mbits/sec    2   1.41 KBytes
  [  5]   4.00-5.00   sec  0.00 Bytes  0.00 bits/sec    1   1.41 KBytes
  [  5]   5.00-6.00   sec  0.00 Bytes  0.00 bits/sec    0   1.41 KBytes
  [  5]   6.00-7.00   sec  0.00 Bytes  0.00 bits/sec    1   1.41 KBytes

The race is timing-dependent: across three reproductions the stall
appeared anywhere from ~400s to ~3000s into the run.

Fixes: 30e48a75df9c ("net: microchip: add FDMA library")
Signed-off-by: Daniel Machon &lt;daniel.machon@microchip.com&gt;
Link: https://patch.msgid.link/20261026-microchip-fdma-dcb-corruption-v1-1-36dab6caca07@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: lan966x: release the in-flight slot of a stale TX skb</title>
<updated>2026-10-27T22:19:06+00:00</updated>
<author>
<name>Daniel Machon</name>
<email>daniel.machon@microchip.com</email>
</author>
<published>2026-10-26T13:46:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=074caa30a62726c0ee959e8b8ccb64cda0b26ae5'/>
<id>074caa30a62726c0ee959e8b8ccb64cda0b26ae5</id>
<content type='text'>
lan966x_ptp_txtstamp_request() counts every two step TX skb waiting for
its timestamp in lan966x-&gt;ptp_skbs, and refuses new ones once
LAN966X_MAX_PTP_ID are in flight. lan966x_ptp_txtstamp_old_release()
frees the skbs that have waited longer than LAN966X_PTP_TIMEOUT.

Before this patch, old_release() does not decrement ptp_skbs, so every
skb whose timestamp never arrives, for example because the switch
discarded the frame, keeps its slot forever. Once LAN966X_MAX_PTP_ID
slots are lost, two step frames fail to transmit on every port of the
switch.

Return the number of released skbs from old_release() and subtract it
from ptp_skbs in txtstamp_request(), under the ptp_ts_id_lock it already
takes.

This fixes the accounting only. A port's stale skbs are still aged out
only when that port sends a two step frame, so a port that stops sending
them keeps its stale skbs, and their slots, until it sends one again.
That behaviour is unchanged by this patch.

Found by an AI code review agent. Reproduced on a lan9668 board.

Fixes: 77eecf25bd9d ("net: lan966x: Update extraction/injection for timestamping")
Signed-off-by: Daniel Machon &lt;daniel.machon@microchip.com&gt;
Link: https://patch.msgid.link/20261026-lan966x-ptp-stale-tx-slot-v1-1-9f7c895eb1ff@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
lan966x_ptp_txtstamp_request() counts every two step TX skb waiting for
its timestamp in lan966x-&gt;ptp_skbs, and refuses new ones once
LAN966X_MAX_PTP_ID are in flight. lan966x_ptp_txtstamp_old_release()
frees the skbs that have waited longer than LAN966X_PTP_TIMEOUT.

Before this patch, old_release() does not decrement ptp_skbs, so every
skb whose timestamp never arrives, for example because the switch
discarded the frame, keeps its slot forever. Once LAN966X_MAX_PTP_ID
slots are lost, two step frames fail to transmit on every port of the
switch.

Return the number of released skbs from old_release() and subtract it
from ptp_skbs in txtstamp_request(), under the ptp_ts_id_lock it already
takes.

This fixes the accounting only. A port's stale skbs are still aged out
only when that port sends a two step frame, so a port that stops sending
them keeps its stale skbs, and their slots, until it sends one again.
That behaviour is unchanged by this patch.

Found by an AI code review agent. Reproduced on a lan9668 board.

Fixes: 77eecf25bd9d ("net: lan966x: Update extraction/injection for timestamping")
Signed-off-by: Daniel Machon &lt;daniel.machon@microchip.com&gt;
Link: https://patch.msgid.link/20261026-lan966x-ptp-stale-tx-slot-v1-1-9f7c895eb1ff@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
