Skip to content

Commit 4bf54de

Browse files
committed
Documentation: describe the STM32 Ethernet lower half drivers.
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>
1 parent 6a72887 commit 4bf54de

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

‎Documentation/guides/chip-specific/port_drivers_to_stm32f7.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,13 @@ are nearly identical. Only changes that are a direct consequence of the
196196
STM32 F7 D-Cache were required to make the driver work on the STM32 F7.
197197
Those changes are summarized below.
198198

199+
.. note::
200+
201+
Both drivers now send and receive the IOBs of the network in place (see
202+
:doc:`stm32_ports`): the RX and TX packet buffers described below are
203+
gone. The F7 driver keeps the padded descriptors, cleans the TX IOBs
204+
and invalidates the RX IOBs.
205+
199206
Reorganize DMA Data Structure
200207
-----------------------------
201208

‎Documentation/guides/chip-specific/stm32_ports.rst‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,40 @@ that the chip Kconfig ``select``-s next to its timer IP-core selector. The
230230
16-bit cases - TIM2 on STM32F10xx/STM32L15xx/STM32L0 and TIM5 on
231231
STM32F10xx/STM32F30xx - simply leave them unset.
232232

233+
Ethernet drivers
234+
================
235+
236+
The Ethernet MAC drivers of F1, F2, F4 (``common/stm32/stm32_eth_m3m4_v1.c``),
237+
F7 (``stm32f7/stm32_ethernet.c``) and H5, H7, N6
238+
(``common/stm32/stm32_eth_v2.c``) are lower half drivers of the network upper
239+
half (``include/nuttx/net/netdev_lowerhalf.h``, see
240+
:ref:`Network Drivers <netdriver>`). New STM32 network drivers must use this
241+
interface too.
242+
243+
The drivers send and receive the IOBs of the network in place. Each DMA
244+
descriptor holds one IOB and a frame spans ``NSEGS`` descriptors, where
245+
``NSEGS`` is ``CONFIG_NET_ETH_PKTSIZE + 4`` divided by ``CONFIG_IOB_BUFSIZE``,
246+
rounded up. The frames are received in the interrupt work
247+
(``NETDEV_RX_DIRECT``). When no IOB is free, the received frame waits in
248+
the ring until an IOB is freed (``CONFIG_IOB_NOTIFIER``) and the MAC drops
249+
the next frames. ``CONFIG_STM32_ETH_NRXDESC`` and
250+
``CONFIG_STM32_ETH_NTXDESC`` are the number of RX and TX frames. The build
251+
fails if the IOB pool is too small for the rings. All STM32 Ethernet
252+
configurations use:
253+
254+
- ``CONFIG_IOB_NBUFFERS=100``: the rings hold ``(NRXDESC + 1) * NSEGS +
255+
NTXDESC`` IOBs, 76 with the default 8 RX and 4 TX frames of up to 1514
256+
bytes, and the network keeps the others,
257+
- ``CONFIG_IOB_THROTTLE=8``: the IOBs that the driver needs to refill the
258+
RX ring for one frame. Without this reserve the TCP receive window takes
259+
all free IOBs and received frames are dropped.
260+
261+
With the D-Cache (``CONFIG_ARMV7M_DCACHE`` or ``CONFIG_ARMV8M_DCACHE``),
262+
also in the write-through mode, ``CONFIG_IOB_ALIGNMENT`` and
263+
``CONFIG_IOB_BUFSIZE`` must be multiples of the D-Cache line size, for
264+
example ``CONFIG_IOB_ALIGNMENT=32`` and ``CONFIG_IOB_BUFSIZE=224``: the RX
265+
DMA corrupts other data in the D-Cache lines of its buffers.
266+
233267
Family peripheral inventory
234268
===========================
235269

‎Documentation/os/drivers/special/net/ethernet.rst‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ Ethernet Device Drivers
1212
Each Ethernet driver registers itself by calling
1313
``netdev_register()``.
1414

15+
- ``include/nuttx/net/netdev_lowerhalf.h``. (Recommended for new
16+
drivers, see :ref:`Network Drivers <netdriver>`)
17+
A lower half driver registers itself by calling
18+
``netdev_lower_register()``.
19+
1520
- **Examples**: ``drivers/net/dm90x0.c``,
1621
``arch/drivers/arm/src/c5471/c5471_ethernet.c``,
1722
``arch/z80/src/ez80/ez80_emac.c``, etc.

0 commit comments

Comments
 (0)