Commit graph

1306 commits

Author SHA1 Message Date
Adib Taraben
27711e69d3 eth_nxp_enet_qos_mac: adapt MAC configuration to actual PHY link speed
This adjust the MAC CONFIGURATION register settings to 10MBit/s if needed.
The reduction is needed for 10MBit only PHYs.

Signed-off-by: Adib Taraben <theadib@gmail.com>
2025-09-12 18:30:30 +02:00
Yangbo Lu
5aaf69e145 net: ethernet: make inclusion relation clear for DSA and Ethernet headers
DSA is part of Ethernet and will utilize more Ethernet definitions for
more features support. So, it's proper to let DSA header include
Ethernet header with moving some DSA definiton from DSA header to
Ethernet header and adding DSA header including in c files using DSA
definition.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-12 13:19:41 +02:00
Yangbo Lu
0501be8090 net: ethernet: use void pointer for dsa switch context
In ethernet_context structure, it just needs a void pointer
for dsa switch context.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-12 13:19:41 +02:00
Tony Han
9b7d73cf67 drivers: ethernet: ksz8081: fix compiling error about missing variable
The missing variable "config" in phy_mc_ksz8081_cfg_link() maybe
used by the macro "USING_INTERRUPT_GPIO", add the variable to avoid
compiling errors.

fixes: #95492

Signed-off-by: Tony Han <tony.han@microchip.com>
2025-09-09 21:42:38 -07:00
Immo Birnbaum
4ef8e14297 drivers: ethernet: xlnx_gem: invert RX/TX checksum offload behaviour
Invert the RX/TX checksum offloading to hardware behaviour so that
hardware checksum generation / evaluation for TCP/UDP packets on
either IPv4 or IPv6 is enabled by default, but can be disabled
explicitly.

This behaviour, which should optimize network performance, has
become possible with the implementation of the device driver's
get_config function, indicating to the network stack that HW
checksum offloading is not supported for, e.g., ICMP packets.
Before this implementation, enabling the HW checksum offloading
resulted in invalid packets for any unsupported protocol and
could therefore not be enabled by default.

For QEMU, which does not support the emulation of the HW
checksum offloading, automatically disable the offloading.

Signed-off-by: Immo Birnbaum <mail@birnbaum.immo>
2025-09-08 15:51:57 -04:00
Yangbo Lu
45cde66a02 drivers: eth_nxp_imx_netc: initialize vlan control
Initialized vlan control for ENETC.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-09-05 13:46:45 +02:00
Jiafei Pan
c10f64c97f drivers: dsa: netc: add mmio memory mapping support
Added memory mapping for the driver to support A-Core.
Add update related device tree accordingly.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-09-05 07:43:28 +02:00
Jiafei Pan
1b6e15f4ee drivers: netc_blk: add imx943 support
Add NETCMIX block initialization for i.MX 943.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-09-05 07:43:28 +02:00
Tony Han
1fd4886ad9 drivers: ethernet: phy: ksz8081: add support for interrupt mode
Enable Link-Up and Link-Down interrupts. On the interrupt handling
the monitor work is scheduled to update the link status and calling
corresponding callback routine.

Signed-off-by: Tony Han <tony.han@microchip.com>
2025-09-04 11:26:38 +02:00
Tony Han
44845e16b6 drivers: ethernet: ksz8081: move init_int_gpios() to after reset
Call ksz8081_init_int_gpios() after phy_mc_ksz8081_reset() due to
keep the configurations for interrupt.

Signed-off-by: Tony Han <tony.han@microchip.com>
2025-09-04 11:26:38 +02:00
Tony Han
e2113ce2c5 drivers: ethernet: ksz8081: fix internal flags for auto-negotiation
Update the internal driver flags to avoid setting DO_AUTONEG_FLAG
unconsciously when setting LINK_STATE_VALID.

Signed-off-by: Tony Han <tony.han@microchip.com>
2025-09-04 11:26:38 +02:00
Benjamin Cabé
0132ea07fb doc: fix spelling errors tree-wide
fix some spelling errors in code comments and Kconfig helps

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-03 17:04:13 +02:00
Tony Han
06fc36e496 drivers: ethernet: sam_eth: get the register address from parent node
Get the register address from the common parent node as the device
tree updated in the last commit.

Signed-off-by: Tony Han <tony.han@microchip.com>
2025-09-03 08:56:44 +02:00
Adib Taraben
4ca352b052 phy_adin2111.c: correctly assign state parameter with state from device
This fixes an unintialized variable access problem in callback.

Signed-off-by: Adib Taraben <theadib@gmail.com>
2025-09-03 01:18:54 +02:00
Declan Snyder
02b99470a3 drivers: ethernet: ksz8081: Save link state for get
Instead of using mdio bus for getting link state, only get it in the
monitor and save it off for get rate api implementation to use

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-29 18:19:17 +02:00
Declan Snyder
043ec3d9ee drivers: phy_ksz8081: Fix boot and link up
Two issues are being simultaneously address in this commit:

Issue 1:

Current issue is that zephyr boot / init is slow because it is blocked
by the phy ksz8081 init doing autonegotiation which can take on the
order of a few seconds.

Fix by now doing autonegotiation in the monitor handler instead of in
the cfg link call. The cfg link call will now only set the ANAR register
and a software flag to let the monitor handler know whether or not to
redo the autonegotiation sequence.

Issue 2:

The ksz8081 phy currently does not link up ever on cold boots on the NXP
RT platforms due to regression on mainline. My understanding of why is
not clear, but I found that re-setting the RMII override bit by the time
the monitor work handler runs with the change to fix the first issue,
makes the link come up.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-29 18:19:17 +02:00
Declan Snyder
be8a0f3d1e drivers: phy_ksz8081: Improve logging
Improve logging in the driver, using appropriate log levels.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-29 18:19:17 +02:00
Declan Snyder
aad41f8d66 phy: ksz8081: Minor refactor of init gpio code
Minor refactor to remove the #ifdefs inline in init function.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-29 18:19:17 +02:00
Ta Minh Nhat
4228444dd1 driver: ethernet: Add ethernet driver support for ra6m4 and ra6m5
Add ethernet support for RA6M4, RA6M5.
Add soc script for generating Renesas Partition Data (RFP file).

Signed-off-by: Ta Minh Nhat <nhat-minh.ta.yn@bp.renesas.com>
Singed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2025-08-28 13:58:33 +02:00
Michal Simek
7944467170 drivers: ethernet: xilinx: remove unused data variable
Clean up unused variable 'data' in eth_xilinx_axienet.c.

Signed-off-by: Michal Simek <michal.simek@amd.com>
2025-08-26 22:08:23 +02:00
Fin Maaß
57c4a5572a drivers: ethernet: remove select MDIO
remove `select MDIO` from the
ethernet drivers, that don't directly use mdio
and only use the ethernet phy api, now that the
phys select MDIO

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-08-25 15:32:38 +02:00
Fin Maaß
e053f1aad5 drivers: ethernet: phy: select GPIO
devices on a bus are recomended to
select its needed drivers, apply this to the eth phys
that need gpios, so that they just work by
enableing the device in the dts.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-08-25 15:32:38 +02:00
Fin Maaß
f5bbdaf8e7 drivers: ethernet: phy: select MDIO
devices on a bus are recomended to
select its protocol, apply this to the eth phys
on the mdio bus, so that they just work by
enableing the device in the dts.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-08-25 15:32:38 +02:00
Sven Ginka
ddc4f5f0be drivers: ethernet: sy1xx: fix random mac
before that commit, random mac was used even when defining
zephyr,random-mac-address to false.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2025-08-25 13:32:03 +02:00
Sven Ginka
a79e986e03 drivers: ethernet: sy1xx: fix warning
casting the address to uint32_t removes the compiler warning.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2025-08-25 13:32:03 +02:00
Sven Ginka
63299bb68b drivers: ethernet: sy1xx: fix static prototype
removed invalid arguments.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2025-08-25 13:32:03 +02:00
Luis Ubieda
5945a3fcd1 ethernet: nxp: Scrub tx_header
As it's not being used anywhere in the driver. Moreover, the extra
unref would trigger a double-free assert (#94311); which is what
motivated this cleanup.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-08-23 05:11:35 +02:00
Sven Ginka
410ce46578 drivers: ethernet: vsc8541: fix init
added missing config.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2025-08-21 17:06:21 +02:00
Pieter De Gendt
f1b4c7c992 drivers: ethernet: nxp_imx_netc: Fix LAA bit location
The Locally Administered Address (LAA) bit should be set on the first
octet of the MAC address.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-08-20 09:29:14 +02:00
Pieter De Gendt
300016c801 drivers: ethernet: stm32: Set LAA bit on MAC address based on device ID
The MAC addressed derived from the device ID is not assigned by the
manufacturer and therefor the Locally Administered Address (LAA) bit should
be set.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-08-19 19:14:45 +02:00
Alain Volmat
5017279493 drivers: ethernet: dwmac_stm32h7x: add select PINCTRL
stm32 dwmac_stm32h7x driver is relying on the pinctrl framework
hence select CONFIG_PINCTRL to ensure proper build.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-08-18 17:49:28 +02:00
Yangbo Lu
7c9c8d8f44 drivers: dsa_nxp_imx_netc: add tag protocol support
Added tag protocol support.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-08-13 22:09:50 -04:00
Yangbo Lu
a5f612b86a drivers: eth_nxp_imx_netc: allow to transmit DSA tag frame
Allowed to transmit DSA tag frame.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-08-13 22:09:50 -04:00
Yangbo Lu
b3e4dc1c9d drivers: ethernet: move NXP NETC DSA driver to dsa directory
Moved NXP NETC DSA driver to dsa directory.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-08-13 22:09:50 -04:00
Yangbo Lu
560249bcbc net: dsa: move DSA core options to subsystem
Moved DSA core options to subsystem.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-08-13 22:09:50 -04:00
Yangbo Lu
dd19dcb53b drivers: eth_xmc4xxx: adjust ptp clock rate based on nominal frequency
Adjusted ptp clock rate based on nominal frequency.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-08-08 10:44:44 -05:00
Yangbo Lu
2d82a0dcab drivers: eth_e1000: adjust ptp clock rate based on nominal frequency
Adjusted ptp clock rate based on nominal frequency.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-08-08 10:44:44 -05:00
Yangbo Lu
76b7bcc0b2 drivers: eth_stm32_hal: adjust ptp clock rate based on nominal frequency
Adjusted ptp clock rate based on nominal frequency.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-08-08 10:44:44 -05:00
Khoa Nguyen
836e55f724 drivers: ethernet: Update the variable type for R_ETHER_CallbackSet
- Update the variable type for R_ETHER_CallbackSet in
eth_renesas_ra.c
- Update HAL callback event handler to be compatible with FSP 6.0.0

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
Signed-off-by: Ta Minh Nhat <nhat-minh.ta.yn@bp.renesas.com>
2025-08-08 11:52:13 +03:00
Declan Snyder
b901daa8e2 eth_nxp_enet_qos: Fixup logging in driver
Some of the logging was not very useful and missing info, some were the
wrong level. Such as routine drops of packets, this happens sometimes
and is not ideal but not going to cause things to fall apart, so demote
those messages. RX buffer underrun for example is pretty unavoidable
with enough traffic going on the local network.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-06 12:11:38 +03:00
Declan Snyder
6267ec59ef drivers: eth_nxp_enet_qos: Move RX underrun code
Extract the RX underrun handle code to a separate function.

Named the function like "dma_rx_resume" to make it clear what the
function is really supposed to do.

Demote the error about not being a first descriptor to a warning.
Because most likely we already got an error about something else which
caused us to drop the packet in the first place. The rest of the frames
are expected to be dropped. And make the string shorter.

Also remove the debug message because the control bits do not tell us
any more information than we don't know already. They only tell us that
we own the descriptor (known since we are processing the frame), that it
is not a first descriptor (known since that is the reason we would drop
it at this point, as indicated by the warning).

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-06 12:11:38 +03:00
Declan Snyder
735412b59c drivers: eth_nxp_enet_qos: Update as many desc as possible
Instead of looping through only the amount of descriptors there are,
maybe it is possible to get some more things received in one work item
than even the max number of descriptors if RX is processed fast enough,
instead of waiting for work to be scheduled again.

So change to go around the ring until we actually hit a DMA owned
descriptor.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-06 12:11:38 +03:00
Declan Snyder
17db8f7975 eth_nxp_enet_qos: Turn on interrupt after init
Don't enable interrupt until after init because there can be a interrupt
mistakenly happen during the init process which can cause various
problems.

Along similar lines, avoid issue for sporadic TX interrupt with no
packet in tx done handler.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-06 12:11:38 +03:00
Declan Snyder
3db8bf7689 drivers: eth_nxp_enet_qos: Don't block TX send
Instead of blocking forever if TX is busy, return an error. This can
avoid deadlock situations.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-06 12:11:38 +03:00
Declan Snyder
02eafc19a1 drivers: eth_nxp_enet_qos: Fix deadlock in system workqueue
There was a deadlock occurring, exposed by http server sample because of
situations like this caused by tx done work being blocked in deadlock:
1) The TX would be started by some thread and the driver TX sem would be
   taken.
2) The http server socket would get scheduled on the system workqueue to
   send something, claim the network TX interface mutex,
   and be blocked taking the semaphore.
3) The RX traffic class handler would get blocked trying to claim the
   network interface TX mutex, while trying to send an ACK in the TCP
   callback. This means the RX packets would not be processed.
4) Lots of RX unable to allocate packets errors would happen, and all RX
   would be dropped. This was the main symptom of the deadlock, which
   made it look like a memory leak but actually had nothing to do with
   the RX code nor any memory leak.
5) The TX DMA would finish and schedule the TX DMA done work onto the
   system work queue, behind the http server socket which is blocked on
   the waiting for the driver TX semaphore.
6) If the TX DMA done work would have ran, that's what gives the TX
   driver semaphore. So this is the reason for the deadlock of all these
   different threads and work items, the misqueue in the system
   workqueue.

Fix by just calling the TX DMA done code directly from the ISR, it
should be ISR safe, and really not a lot of code to execute, just
freeing some net buffers and the packet and updating the stats.
An optimization can be made later if needed, but for now,
solving the deadlock is a more urgent priority.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-06 12:11:38 +03:00
Parthiban Veerasooran
0261a7db22 ethernet: eth_sam_gmac: enable multiple TX pkt support for max throughput
This change enables GMAC_MULTIPLE_TX_PACKETS to allow multiple TX packets
to be pushed to the DMA engine, improving transmit performance. Previously,
older Zephyr versions (pre-v2.6.0) lacked thread-safe handling in net_pkt
and net_buf, making multiple TX enqueuing unreliable. Issue #32564
("net_buf reference count not protected") was fixed in v2.6.0, providing
proper thread safety. The changes have been tested on SAME54 Curiosity
Ultra with EVB-LAN8670-RMII and KSZ8061 PHY daughter card, and the
expected performance of 9.5Mbps at 10Mbps PHY link speed was observed.

Signed-off-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
2025-08-04 11:54:18 +01:00
Daniel Coffey
68c6b6ca0c drivers: ethernet: ksz8081: support 25MHz RMII
Configure KSZ8081 phy drivers to set strapping mode override
for RMII mode without setting reference clock to 50MHz when
"RMII 25MHz" operation is selected in device tree node.

Signed-off-by: Daniel Coffey <danielcoffey@carallon.com>
2025-07-29 11:25:14 -04:00
Gaetan Perrot
8434b01bcc drivers: ethernet: add check for null fragment before TX loop
In eth_cyclonev_send(), add a guard to detect if the net_pkt has no data
buffer (i.e., pkt->buffer is NULL) before starting the TX descriptor loop.

This prevents a potential null pointer dereference on frag->data in the
first iteration of the do-while loop.

The previous in-loop check for frag was redundant and misleading: it still
allowed access to frag->data even when frag could be NULL, making the code
both unnecessary and potentially unsafe.

The new check ensures frag is valid before entering the loop, covering the
rare case where net_pkt has no associated buffer.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-29 09:31:29 -04:00
Georgij Černyšiov
447e11885e drivers: eth: oa_tc6: fix status check garbage value
If reading the status register fails, the register
`sts` will contain meaningless data.

In such cases, the function should return an error
and not attempt to clear any pending interrupts
with invalid data.

Signed-off-by: Georgij Černyšiov <geo.cgv@gmail.com>
2025-07-29 09:31:18 -04:00
Jakub Michalski
37f9aed22b net: ethernet: e1000: add queue support
Before this commit size of rx and tx queues was set to 1, which is out of
spec. This commit adds queue logic, ability to set their size and exposes
configuration options w.r.t rx queue interrupts

Signed-off-by: Jakub Michalski <jmichalski@antmicro.com>
2025-07-29 09:31:07 -04:00