Repository navigation
!arch/arm/stm32: use the netdev upper half in all Ethernet drivers. - #21937
Open
raiden00pl wants to merge 6 commits into
Open
raiden00pl wants to merge 6 commits into
raiden00pl wants to merge 6 commits into
Conversation
xiaoxiang781216
previously approved these changes
Nov 17, 2026
|
raiden00pl
force-pushed
the
stm32-eth-refactor-upper-half
branch
from
November 18, 2026 12:07
d07588c to
cf82053
Compare
xiaoxiang781216
previously approved these changes
Nov 19, 2026
jerpelea
previously approved these changes
Nov 19, 2026
Contributor
|
@raiden00pl is this pr ready for merging? |
Member
Author
|
not yet. I want all the fixes I’ve found for the network-related code to be merged, and then I’ll run tests on all the hardware affected by this PR to be sure that nothing is broken |
raiden00pl
dismissed stale reviews from jerpelea and xiaoxiang781216
via
November 20, 2026 08:34
4bf54de
raiden00pl
force-pushed
the
stm32-eth-refactor-upper-half
branch
2 times, most recently
from
November 23, 2026 11:44
4bf54de to
2070c3d
Compare
jerpelea
previously approved these changes
Nov 23, 2026
Add the RMII pins of the LAN8742A PHY and a netnsh configuration. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: raiden00pl <raiden00@railab.me>
raiden00pl
force-pushed
the
stm32-eth-refactor-upper-half
branch
from
November 24, 2026 11:49
750239c to
be39c05
Compare
raiden00pl
marked this pull request as ready for review
November 24, 2026 12:46
raiden00pl
requested review from
Donny9,
GUIDINGLI,
JorgeGzm,
Ouss4,
acassis,
btashton,
masayuki2009,
pussuw and
tmedicci
as code owners
November 24, 2026 12:46
raiden00pl
requested review from
antmerlino,
fjpanag,
gustavonihei,
hartmannathan and
pkarashchenko
as code owners
November 24, 2026 12:46
Member
Author
|
ready for review |
xiaoxiang781216
previously approved these changes
Nov 24, 2026
hartmannathan
previously approved these changes
Nov 24, 2026
…iver. Convert stm32_eth_m3m4_v1.c to the lower half API. Frames are sent and received in place: each DMA descriptor owns one IOB and a frame spans several descriptors, so the static frame buffers are gone. The frames are received in the interrupt work (NETDEV_RX_DIRECT). BREAKING CHANGE: the RX/TX rings now take their buffers from the IOB pool. Configurations with too few IOBs fail to build. Quick fix: set CONFIG_IOB_NBUFFERS=100 and CONFIG_IOB_THROTTLE=8. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: raiden00pl <raiden00@railab.me>
Convert stm32_ethernet.c to the lower half API. Frames are sent and received in place: each DMA descriptor owns one IOB and a frame spans several descriptors, so the static frame buffers are gone. The frames are received in the interrupt work (NETDEV_RX_DIRECT): with the upper half work queue the TCP receive rate was 12 % below the old driver. BREAKING CHANGE: the RX/TX rings now take their buffers from the IOB pool. Configurations with too few IOBs fail to build. Quick fix: set CONFIG_IOB_NBUFFERS=100 and CONFIG_IOB_THROTTLE=8. With the D-Cache, CONFIG_IOB_ALIGNMENT and CONFIG_IOB_BUFSIZE must be multiples of 32. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: raiden00pl <raiden00@railab.me>
Convert stm32_eth_v2.c (STM32H5, STM32H7, STM32N6) to the lower half API. Frames are sent and received in place: each DMA descriptor owns one IOB and a frame spans several descriptors, so the static frame buffers are gone. The frames are received in the interrupt work (NETDEV_RX_DIRECT). BREAKING CHANGE: the RX/TX rings now take their buffers from the IOB pool. Configurations with too few IOBs fail to build. Quick fix: set CONFIG_IOB_NBUFFERS=100 and CONFIG_IOB_THROTTLE=8. With the D-Cache, CONFIG_IOB_ALIGNMENT and CONFIG_IOB_BUFSIZE must be multiples of the D-Cache line size. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: raiden00pl <raiden00@railab.me>
Note in the STM32 porting guide that the Ethernet drivers use the netdev upper half and how to size the IOB pool for them. Point the Ethernet driver page to the lower half interface. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: raiden00pl <raiden00@railab.me>
The F7 Ethernet MAC is the same IP as the F2/F4 one. Build stm32_eth_m3m4_v1.c for the F7 and remove the F7 copy. The common driver gets the D-Cache maintenance of the F7 driver, the MDC clock range up to 216 MHz and, on the F7, the MAC address from the unique ID. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: raiden00pl <raiden00@railab.me>
raiden00pl
dismissed stale reviews from hartmannathan and xiaoxiang781216
via
November 24, 2026 20:04
a9f4f97
raiden00pl
force-pushed
the
stm32-eth-refactor-upper-half
branch
from
November 24, 2026 20:04
be39c05 to
a9f4f97
Compare
xiaoxiang781216
approved these changes
Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Convert the STM32 Ethernet drivers to the netdev lower half API, and use
the common v1 driver for the F7:
MAC IP; its copy in stm32f7/ is removed),
Both drivers use the same design:
IOB and a frame spans several descriptors, so the static frame buffers
and the copies are gone,
(v1) is counted as dropped, not as an error; v2 receives in store and
forward mode, so such a frame is dropped in the MTL RX queue,
invalidated; the IOBs must fill whole D-Cache lines, because the RX DMA
corrupts other data in the lines of its buffers, also in write-through
mode.
The v1 driver gets the D-Cache maintenance, the MDC clock range up to
216 MHz and, on the F7, the MAC address from the unique ID of the old F7
driver. STM32_ETHMAC selects ARCH_HAVE_NETDEV_STATISTICS.
The series also adds Ethernet support to nucleo-f207zg, and an Ethernet
section to the STM32 porting guide.
Impact
BREAKING CHANGE: the RX/TX rings take their buffers from the IOB pool, so
configurations with too few IOBs fail to build. Quick fix: set
CONFIG_IOB_NBUFFERS=100 and CONFIG_IOB_THROTTLE=8. With a D-Cache,
CONFIG_IOB_ALIGNMENT and CONFIG_IOB_BUFSIZE must be multiples of the
D-Cache line size. All in-tree STM32 Ethernet defconfigs are updated.
Testing
iperf between the board and a Linux host on the same LAN, optimized builds
(netnsh with NETUTILS_IPERF, NETINIT_DHCPC, NET_ETH_PKTSIZE=1514), Mbit/s,
median of 3 runs. The UDP test restarts the board iperf server and floods
it from the host at 50 Mbit/s for 5 s, 50 times; no board crashed.
nucleo-f767zi: TCP measured with these commits on master 482be65, UDP
with a -O0 build.
nucleo-n657x0-q was loaded into AXISRAM2: the Ethernet DMA does not
receive into the FLEXRAM at 0x34000400 where the board loads today.
stm32n6570-dk runs a 1 Gbit/s RGMII link (RTL8211F); the others are
100 Mbit/s RMII.