u-boot-brain/drivers/net
Jason Wessel ac458dc823 bcmgenet: fix DMA buffer management
This commit fixes a serious issue occurring when several network
commands are run on a raspberry pi 4 board: for instance a "dhcp"
command and then one or several "tftp" commands. In this case,
packet recv callbacks were called several times on the same packets,
and send function was failing most of the time.

note: if the boot procedure is made of a single network
command, the issue is not visible.

The issue is related to management of the packet ring buffers
(producer / consumer) and DMA.
Each time a packet is received, the ethernet device stores it
in the buffer and increments an index called RDMA_PROD_INDEX.
Each time the driver outputs a received packet, it increments
another index called RDMA_CONS_INDEX.

Between each pair of network commands, as part of the driver
'start' function, previous code tried to reset both RDMA_CONS_INDEX
and RDMA_PROD_INDEX to 0. But RDMA_PROD_INDEX cannot be written from
driver side, thus its value was actually not updated, and only
RDMA_CONS_INDEX was reset to 0. This was resulting in a major
synchronization issue between the driver and the device. Most
visible behavior was that the driver seemed to receive again the
packets from the previous commands (e.g. DHCP response packets
"received" again when performing the first TFTP command).

This fix consists in setting RDMA_CONS_INDEX to the same
value as RDMA_PROD_INDEX, when resetting the driver.

The same kind of fix was needed on the TX side, and a few variables
had to be reset accordingly (c_index, tx_index, rx_index).

The rx_index and tx_index have only 256 entries so the bottom 8 bits
must be masked off.

Originated-by: Etienne Dublé <etienne.duble@imag.fr>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Tested-by: Petr Tesarik <ptesarik@suse.com>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
2020-09-08 16:43:02 +02:00
..
fm treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
fsl-mc treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
ldpaa_eth treewide: convert bd_t to struct bd_info manually 2020-07-17 10:46:44 -04:00
mscc_eswitch common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
pfe_eth armv8: ls1012a: RGMII ports require internal delay 2020-07-27 14:16:28 +05:30
phy net: phy: realtek: Introduce PHY_RTL8201F_S700_RMII_TIMINGS to adjust rx/tx timings 2020-07-07 16:09:22 -04:00
ti Convert CONFIG_DRIVER_TI_EMAC_USE_RMII to Kconfig 2020-07-28 16:18:10 -04:00
8390.h drivers/net : move net drivers to drivers/net 2007-11-25 18:35:17 +01:00
ag7xxx.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
altera_tse.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
altera_tse.h common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
armada100_fec.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
armada100_fec.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
at91_emac.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
ax88180.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
ax88180.h AX88180: use standard I/O accessors 2010-07-12 00:14:29 -07:00
ax88796.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
ax88796.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
bcm-sf2-eth-gmac.c common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
bcm-sf2-eth-gmac.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
bcm-sf2-eth.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
bcm-sf2-eth.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
bcm6348-eth.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
bcm6368-eth.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
bcmgenet.c bcmgenet: fix DMA buffer management 2020-09-08 16:43:02 +02:00
calxedaxgmac.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
cs8900.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
cs8900.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
dc2114x.c net: dc2114x: Add DM support 2020-07-25 14:20:56 +02:00
designware.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
designware.h common: Drop net.h from common header 2020-05-18 17:33:31 -04:00
dm9000x.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
dm9000x.h dm9000 remove dead external phy support, gpio fix 2008-08-26 23:08:19 -07:00
dnet.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
dnet.h dnet: driver for Dave DNET ethernet controller 2009-02-10 00:16:27 +01:00
dwc_eth_qos.c net: dwc_eth_qos: add Kconfig option to select supported configuration 2020-08-04 23:30:02 -04:00
dwmac_s700.c net: designware: s700: Add glue code for S700 mac 2020-07-07 17:11:58 -04:00
dwmac_socfpga.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
e1000_spi.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
e1000.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
e1000.h command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
eepro100.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
ep93xx_eth.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
ep93xx_eth.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
eth-phy-uclass.c net: Add eth phy generic driver for shared MDIO 2020-05-10 13:24:48 +02:00
ethoc.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
fec_mxc.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
fec_mxc.h treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
fsl_enetc_mdio.c drivers: net: fsl_enetc_mdio: return with time-out if HW is stuck 2019-12-09 09:47:43 -06:00
fsl_enetc.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
fsl_enetc.h common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
fsl_ls_mdio.c drivers: net: add Layerscape mEMAC MDIO driver 2020-04-29 10:49:20 +05:30
fsl_mcdmafec.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
fsl_mdio.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
ftgmac100.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
ftgmac100.h common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
ftmac100.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
ftmac100.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
ftmac110.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
ftmac110.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
gmac_rockchip.c common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
higmacv300.c common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
Kconfig xilinx: kconfig: Change Kconfig dependencies for Xilinx drivers 2020-08-20 09:46:55 +02:00
ks8851_mll.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
ks8851_mll.h net: ks8851_mll: add ethernet support 2013-06-24 19:11:14 -05:00
lan91c96.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
lan91c96.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
lpc32xx_eth.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
macb.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
macb.h net: macb: add support for faster clk rates 2019-07-25 13:13:30 -05:00
Makefile net: designware: s700: Add glue code for S700 mac 2020-07-07 17:11:58 -04:00
mcffec.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
mcfmii.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
mdio_mux_i2creg.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
mdio_mux_sandbox.c test: dm: add a test for MDIO MUX DM uclass 2019-07-18 16:37:13 -05:00
mdio_sandbox.c test: dm_mdio: avoid out of bounds access 2019-09-04 11:37:19 -05:00
mpc8xx_fec.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
mt7628-eth.c common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
mtk_eth.c eth: mtk-eth: enable mt7629 sgmii mode support in mediatek eth driver 2020-07-28 22:44:00 -04:00
mtk_eth.h eth: mtk-eth: enable mt7629 sgmii mode support in mediatek eth driver 2020-07-28 22:44:00 -04:00
mvgbe.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
mvgbe.h net: mvgbe: convert to DM 2018-07-26 14:08:21 -05:00
mvmdio.c common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
mvneta.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
mvpp2.c net: mvpp2: fix second cp110 initialization 2020-07-09 06:52:20 +02:00
natsemi.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
ne2000_base.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
ne2000_base.h common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
ne2000.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
ne2000.h NE2000: Fix regresssion introduced by e710185aae on non AX88796 2008-04-28 22:26:36 -07:00
netconsole.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
ns8382x.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
pch_gbe.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
pch_gbe.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pcnet.c net: Drop duplicate include of dm.h in pcnet.c 2020-08-03 22:19:54 -04:00
pic32_eth.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
pic32_eth.h common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
pic32_mdio.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
ravb.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
rtl8139.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
rtl8169.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
sandbox-raw-bus.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
sandbox-raw.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
sandbox.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
sh_eth.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
sh_eth.h net: sh_eth: Fix 64bit build warnings 2019-08-09 23:15:01 +02:00
smc911x.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
smc911x.h common: Drop net.h from common header 2020-05-18 17:33:31 -04:00
smc91111.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
smc91111.h common: Drop net.h from common header 2020-05-18 17:33:31 -04:00
sni_ave.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
sun8i_emac.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
sunxi_emac.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
tsec.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
uli526x.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
vsc7385.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
vsc9953.c treewide: convert bd_t to struct bd_info by coccinelle 2020-07-17 09:30:13 -04:00
xilinx_axi_emac.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
xilinx_emaclite.c treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
zynq_gem.c net: gem: Disable PCS autonegotiation in case of fixed-link 2020-06-24 13:11:06 +02:00