The MAC_CONFIGURATION register was unconditionally OR'ed with the FES
(speed) and DM (duplex) bits, forcing 100 Mbps full-duplex during MAC
initialization. The PHY link callback later updates these bits to match
the actual link state, but on 10BASE-T1S (PLCA) links the temporary
100 Mbps/full-duplex setting causes the MAC to ignore the COL signal
from the internal TENBASET_PHY block. As a result the MAC transmits
during another node's transmit opportunity, producing collisions and
lost data.
Initialize MAC_CONFIGURATION with FES and DM cleared (10 Mbps,
half-duplex, which is also the register's reset value) and let the PHY
callback set the correct speed/duplex once the link is up. Read-modify-
write is done via a local variable so both the set and clear masks are
applied in a single register write.
Fixes#109682
Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
Remove the driver-local struct ring_buffer in favour of sys_ringq.
Pointers are stored directly in the ring queues, which removes the need
for the POINTER_TO_UINT casts and fixes a potential platform-specific
pointer truncation issue on 64-bit architectures.
gmac_desc_list rings are unchanged as they require
in-place DMA descriptor access.
closes: #21155
Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
Convert the ENC424J600 Ethernet driver from a single hardcoded
devicetree instance to the standard Zephyr multi-instance pattern using
DT_INST_FOREACH_STATUS_OKAY().
Before this change, only instance 0 was registered, so boards with
multiple microchip,enc424j600 nodes could only create one Ethernet
interface.
This allows all status = "okay" ENC424J600 devicetree instances to be
registered.
Fixes#109849
Signed-off-by: Arayik Gharibyan <arayik.gharibyan.1999@gmail.com>
The DM9051 IC automatically appends a 4-byte CRC to each frame
stored in internal SRAM. The original driver did not account for
this, causing potential buffer overflow for large frames.
Add ETH_DM9051_CRC_SIZE constant and increase TX/RX buffer sizes
accordingly. Use IN_RANGE macro for RX length validation and
sizeof(data->rx_buf) for length checks.
Fixes: buffer overflow when receiving frames close to MTU (1500 bytes)
Fixes: potential RX length check issues with hardcoded values
Fixes: missing minimum frame size validation
Suggested-by: jukkar
Signed-off-by: Ching Ping Sun <tom_sun@davicom.com.tw>
Handle GAMC register with device memory-mapped input/output management.
As the MMIO is used, remove the MMU configurations for GMAC accordingly.
Signed-off-by: Tony Han <tony.han@microchip.com>
Add a driver for the WIZnet W6300 stand-alone Ethernet controller
with SPI interface. The driver operates in MACRAW mode using Socket 0
to send and receive raw Ethernet frames via Zephyr's Ethernet L2 layer.
PHY link state is monitored via the W6300 interrupt pin combined with
a periodic polling thread. The SPI protocol uses a 4-byte command
frame (instruction + address high + address low + dummy) for both
read and write operations, as required by the W6300 hardware.
Signed-off-by: Manjae Cho <manjae.cho@samsung.com>
These functions are from phy_oa_tc14_plca.c, which
is only a helper for phys to implement the set_plca_cfg,
get_plca_cfg and get_plca_sts functions of the ethernet_phy
api, therefore they should be internal.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Follow the pattern used by other PHY drivers and expose the
RTL8211F RGMII clock delay mode in devicetree.
Some MAC drivers, such as Renesas RA RMAC, can provide part of
the RGMII delay themselves. Boards then need a way to avoid
enabling the same delay in the PHY.
Keep the fallback at RX and TX delay enabled, matching the old
driver behavior for existing users.
Signed-off-by: Shan Pen <bricle031@gmail.com>
Add a new PTP clock driver for the native_sim board, allowing
it to simulate a PTP clock for testing and development purposes.
This replaces the previous implementation of the PTP clock
functionality that was integrated into the eth_native_tap ethernet
driver.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Add a guard for `eth_esp32_iomux_rmii_clk_input` function to fix the
following error:
error: 'eth_esp32_iomux_rmii_clk_input' defined but not used
[-Werror=unused-function] 245 | static void
eth_esp32_iomux_rmii_clk_input(void)
Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
move qemu network interface selection, because it fits better in
cmake/emu/qemu.cmake than in cmake/modules/kernel.cmake.
It is also put at the end because for usb network cards, the usb bus
must be created before the network interface can be added. Also true
for other network cards on buses. Currently we don't have usb network
cards in zephyr, but it is better to be prepared for that.
Also use the separate netdev and device option.
The combined command line option didn't work for "usb-net" for example.
For the riscv qemu the -nic option is broken acording to the qemu issue
(https://gitlab.com/qemu-project/qemu/-/work_items/691), so we need to
use the -netdev and -device options.
Because of the change to -netdev and -device options, we need a new
Kconfig option to specify the extra arguments for the network device,
so we add NET_QEMU_DEVICE_EXTRA_ARGS option.
this can be used to customise the network device, like the mac address,
or more device specific options like setting f.e. the addresss/slot of
a pci card.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
the litex ethernet driver uses NET_IF_DT_INST_GET,
therefore we need to depend on NET_L2_ETHERNET, so
it can't be used with ETH_DRIVER_RAW_MODE.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Replace open-coded fragment loop with NET_PKT_FRAG_FOR_EACH() macro
in eth_dwc_xgmac_send().
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
Replace open-coded fragment loop with NET_PKT_FRAG_FOR_EACH() macro
in eth_intel_igc_tx_data().
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
Building mr_canhubk3 fails due to improper function declaration.
Fix issue by fixing declaration of eth_nxp_s32_start & eth_nxp_s32_stop.
Fixes issue #108630.
Signed-off-by: Gal Raifen <galraifen15@gmail.com>
Align eth_wch with updated ethernet API by passing net_if to
and eth_wch_stop/start() from PHY link state change handling.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Fix ENET QoS behavior needed for IEEE 802.3 PTP transport.
Strip received Ethernet FCS bytes before packets reach upper layers,
enable store-and-forward mode for reliable PTP timestamps, and only use
RX timestamp context descriptors when the normal RX descriptor reports a
valid timestamp. Also update the PTP clock callback signature to match
the current Ethernet API.
Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
Even though the ivshmem ethernet driver can't be
directly run in the regular qemu, with west build -t run
we set this here, as we otherwise would get a build error.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Introduces K_MEM_SLAB_DEFINE_TYPE() and K_MEM_SLAB_DEFINE_STATIC_TYPE()
helpers to allow the user to declare slabs for types without having to
manually ensure the alignment is correct.
Manual slab alignment was very error-prone and this change fixes several
instances of misalignment that would be trapped by the undefined
behavior sanitizer when running on 64-bit targets.
Signed-off-by: Egill Sigurdur <egill@egill.xyz>
Fix build error:
eth_nxp_imx_netc.c:304: error: too few arguments to function
'netc_eth_get_ptp_clock'
Add the missing argument tested with:
west build -p -b imx943_evk/mimx94398/m33/ddr
samples/net/ethernet/tsn-switch
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Used ptp_clock only when NETC_PTP_TIMESTAMPING_SUPPORT is true.
This is to keep same with driver timestamping operations code in
other places, and also to keep same with dsa core driver which uses
ptp_clock when NET_L2_PTP is true.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Avoid copying (cloning) the data to be transmitted and
just increase the reference count of the original buffer.
This is more efficient and reduces memory and CPU usage.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
the plca related api functions are only needed
for T1S ethernet phys, therefore hide them
behind a Kconfig, that is selected from the phy,
so we don't include these if they are not needed.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
The comment is correct, the code was wrong. Each chunk can be 64 bytes of
data, but they also have 4 byte headers. So to be able to read 255 chunks
with 64 bytes of data each, The buffer has to be 255 * 68.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
In #90652 we removed phy related config from eth api,
unfortunatly ETHERNET_CONFIG_TYPE_T1S_PARAM was forgotten
to be removed.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Add logging/log.h include instead of relaying on it being included
indirectly from other headers
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add logging/log.h include instead of relaying on it being
included indirectly from other headers
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
For ethernet and wifi drivers the carrier
is on by default, no need to set it up in the
iface init again.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Combine the Cortex-M7 ENET workaround updates into one commit.
- clear CACHE_ENET on i.MX RT11xx Cortex-M7 for ERR050396
- disable ETH_NXP_ENET_USE_DTCM_FOR_DMA_BUFFER by default on Cortex-M7
- keep the final Kconfig condition independent of
DT_HAS_NXP_ENET1G_ENABLED
This avoids touching the same Kconfig and SoC files in follow-up
commits while preserving the intended behavior for PR #106679.
Validation:
- branch history squashed so workaround files are updated once
in the series
Signed-off-by: Hake Huang <hake.huang@nxp.com>
Handle both RX frame and RX buffer interrupts in the NXP ENET driver.
This matches the MCUX HAL interrupt handling and avoids leaving RX work
queued behind an unhandled RX buffer interrupt source.
Validation:
- built samples/net/dhcpv4_client for mimxrt1170_evk@B/mimxrt1176/cm7
with boards/nxp/mimxrt1170_evk/dts/nxp,enet1g.overlay
- verified MCUX HAL uses RX frame and RX buffer interrupts together
Signed-off-by: Hake Huang <hake.huang@nxp.com>
We don't need to save the MAC address in the data
struct, therfore use a local var in the iface init for it.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>