zephyr/drivers/ethernet
Xavier Ruppen 06b7dc81a5 drivers: ethernet: enc28j60: disable/enable interrupts to avoid races
Currently, there is a small race window where we can miss an interrupt.
Right after we're done reading the RX buffer but just before decrementing
the RX counter to zero, the ENC28J60 may receive a packet. The chip will
raise an interrupt, but the line is still asserted. That means that the
callback will not be invoked since it is edge-triggered.

To avoid that, disable interrupts on the chip itself before processing
the RX buffer.

In fact, the ENC28J60 datasheet specifically says:

	"After an interrupt occurs, the host controller should
	clear the global enable bit for the interrupt pin before
	servicing the interrupt. Clearing the enable bit will
	cause the interrupt pin to return to the non-asserted
	state (high). Doing so will prevent the host controller
	from missing a falling edge should another interrupt
	occur while the immediate interrupt is being serviced.
	After the interrupt has been serviced, the global enable
	bit may be restored. If an interrupt event occurred while
	the previous interrupt was being processed, the act of
	resetting the global enable bit will cause a new falling
	edge on the interrupt pin to occur."

This is also what is being done in the Linux driver [1].

[1] https://elixir.bootlin.com/linux/v6.11.2/source/drivers/net/ethernet/microchip/enc28j60.c#L1126

Signed-off-by: Xavier Ruppen <xruppen@gmail.com>
2024-12-18 08:32:49 +01:00
..
dwc_xgmac drivers: ethernet: dwc_xgmac: Added dwc-xgmac 2024-09-05 17:03:05 -04:00
eth_nxp_enet_qos eth_nxp_enet_qos: implement set_config 2024-12-02 18:19:13 +01:00
nxp_enet drivers: ethernet: Optimize RxBD buffer configuration 2024-12-04 14:15:42 -05:00
phy drivers: gpio: phy: adin2111: Fix to allow the use of multiple models 2024-12-14 01:04:14 +01:00
CMakeLists.txt drivers: ethernet: add support for microchip lan9250 2024-12-10 11:10:34 +01:00
dsa_ksz8xxx.c
dsa_ksz8794.h
dsa_ksz8863.h
eth_adin2111_priv.h
eth_adin2111.c drivers: ethernet: adin2111: minor corrections of is_adin2111 2024-10-18 14:15:42 +02:00
eth_cyclonev_priv.h
eth_cyclonev.c
eth_dwmac_mmu.c
eth_dwmac_priv.h
eth_dwmac_stm32h7x.c
eth_dwmac.c
eth_e1000_priv.h drivers: eth: e1000: Use double with PTP clock 2024-06-29 05:50:04 -04:00
eth_e1000.c drivers: ptp_clock: Place API into iterable section 2024-12-02 23:04:22 +01:00
eth_enc28j60_priv.h drivers: eth: enc28j60: Misc fixes 2024-11-25 17:43:57 +01:00
eth_enc28j60.c drivers: ethernet: enc28j60: disable/enable interrupts to avoid races 2024-12-18 08:32:49 +01:00
eth_enc424j600_priv.h
eth_enc424j600.c drivers: ethernet: enc424j600: change mac addr runtime 2024-10-24 17:54:08 +02:00
eth_esp32.c drivers: esp32: Interrupts flags configuration 2024-08-22 14:25:25 -04:00
eth_gecko_priv.h
eth_gecko.c
eth_ivshmem_priv.h
eth_ivshmem_queue.c style: drivers: comply with MISRA C:2012 Rule 15.6 2024-08-20 10:33:51 +02:00
eth_ivshmem.c
eth_lan865x_priv.h drivers: ethernet: lan865x: Update initial setup guidelines (from AN1760) 2024-11-16 15:27:45 -05:00
eth_lan865x.c drivers: ethernet: lan865x: Avoid writing PLCA node count when nodeID not 0 2024-11-16 15:27:45 -05:00
eth_lan9250_priv.h drivers: ethernet: add support for microchip lan9250 2024-12-10 11:10:34 +01:00
eth_lan9250.c drivers: ethernet: lan9250: implement set_config 2024-12-18 01:00:00 +01:00
eth_litex_liteeth.c drivers: ethernet: litex: add phy 2024-08-05 16:29:06 +02:00
eth_native_posix_adapt.c
eth_native_posix_priv.h
eth_native_posix.c drivers: ptp_clock: Place API into iterable section 2024-12-02 23:04:22 +01:00
eth_numaker_priv.h
eth_numaker.c
eth_nxp_imx_netc_priv.h drivers: ethernet: add NXP i.MX NETC driver 2024-10-16 10:00:32 +02:00
eth_nxp_imx_netc_psi.c drivers: ethernet: add NXP i.MX NETC driver 2024-10-16 10:00:32 +02:00
eth_nxp_imx_netc.c drivers: ethernet: add NXP i.MX NETC driver 2024-10-16 10:00:32 +02:00
eth_nxp_s32_gmac.c drivers: ethernet: add get_phy function 2024-07-27 15:07:26 +03:00
eth_nxp_s32_netc_priv.h drivers: nxp_s32_netc_psi_vsi: update to RTD 2.0.0 2024-08-20 10:32:32 +02:00
eth_nxp_s32_netc_psi.c drivers: nxp_s32_netc_psi_vsi: update to RTD 2.0.0 2024-08-20 10:32:32 +02:00
eth_nxp_s32_netc_vsi.c drivers: nxp_s32_netc_psi_vsi: update to RTD 2.0.0 2024-08-20 10:32:32 +02:00
eth_nxp_s32_netc.c
eth_raw.c
eth_renesas_ra.c drivers: eth: Initial support for Renesas RA Ethernet driver 2024-12-05 07:45:19 +01:00
eth_sam0_gmac.h
eth_sam_gmac_priv.h
eth_sam_gmac.c drivers: ptp_clock: Place API into iterable section 2024-12-02 23:04:22 +01:00
eth_slip_tap.c
eth_smsc91x_priv.h
eth_smsc91x.c drivers: mdio: Place API into iterable section 2024-12-02 18:20:47 +01:00
eth_smsc911x_priv.h
eth_smsc911x.c
eth_stellaris_priv.h
eth_stellaris.c
eth_stm32_hal_priv.h Revert "drivers: ethernet: eth_stm32_hal" 2024-11-13 09:13:23 -06:00
eth_stm32_hal.c drivers: ptp_clock: Place API into iterable section 2024-12-02 23:04:22 +01:00
eth_test.c drivers: ethernet: Add dummy driver for vnd,ethernet 2024-10-22 20:42:05 +02:00
eth_w5500_priv.h
eth_w5500.c drivers: ethernet: w5500: improve type consistency 2024-11-19 17:50:58 -05:00
eth_xlnx_gem_priv.h
eth_xlnx_gem.c drivers: ethernet: xlnx_gem: enable querying of HW checksum support 2024-12-18 01:01:22 +01:00
eth_xmc4xxx.c drivers: ptp_clock: Place API into iterable section 2024-12-02 23:04:22 +01:00
eth.h
Kconfig drivers: ethernet: add support for microchip lan9250 2024-12-10 11:10:34 +01:00
Kconfig.adin2111
Kconfig.cyclonev
Kconfig.dsa
Kconfig.dwmac
Kconfig.e1000
Kconfig.enc28j60
Kconfig.enc424j600
Kconfig.esp32
Kconfig.gecko
Kconfig.ivshmem
Kconfig.lan865x
Kconfig.lan9250 drivers: ethernet: add support for microchip lan9250 2024-12-10 11:10:34 +01:00
Kconfig.litex drivers: ethernet: litex: add phy 2024-08-05 16:29:06 +02:00
Kconfig.native_posix
Kconfig.numaker boards: nuvoton: numaker: Drop PINCTRL from board defconfig 2024-11-20 08:23:58 -05:00
Kconfig.nxp_imx_netc drivers: ethernet: add NXP i.MX NETC driver 2024-10-16 10:00:32 +02:00
Kconfig.nxp_s32_gmac
Kconfig.nxp_s32_netc boards: nxp: Removing CONFIG_PINCTRL from the boards defconfig 2024-10-15 19:09:45 -04:00
Kconfig.renesas_ra drivers: eth: Initial support for Renesas RA Ethernet driver 2024-12-05 07:45:19 +01:00
Kconfig.sam_gmac soc: atmel: Drop PINCTRL from Kconfig.defconfig 2024-11-04 13:43:26 -06:00
Kconfig.smsc91x
Kconfig.smsc911x
Kconfig.stellaris
Kconfig.stm32_hal copyright: change email 2024-09-25 04:04:03 -04:00
Kconfig.test drivers: ethernet: Add dummy driver for vnd,ethernet 2024-10-22 20:42:05 +02:00
Kconfig.w5500
Kconfig.xlnx_gem
Kconfig.xmc4xxx SOC: Remove config PINCTRL from xmc4xxx soc 2024-12-02 22:05:16 +00:00
oa_tc6.c drivers: ethernet: tc6: Combine read chunks into continuous net buffer 2024-08-08 20:21:58 -04:00
oa_tc6.h drivers: ethernet: lan865x: Update initial setup guidelines (from AN1760) 2024-11-16 15:27:45 -05:00
phy_cyclonev.c
phy_gecko.c
phy_gecko.h
phy_xlnx_gem.c
phy_xlnx_gem.h