[PATCH v2 1/5] net: designware: eqos: initialize MAC address specific DMA channel configuration

Oleksij Rempel o.rempel at pengutronix.de
Sun Aug 13 22:32:25 PDT 2023


Make sure we use predictable DMA Channel Select configuration. Otherwise
bad things may happen.
So far this fix is not related to any known issue and was noticed by
investigating other bugs.

Signed-off-by: Oleksij Rempel <o.rempel at pengutronix.de>
---
 drivers/net/designware_eqos.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/designware_eqos.c b/drivers/net/designware_eqos.c
index 5e5c9ebe68..845f9f51ef 100644
--- a/drivers/net/designware_eqos.c
+++ b/drivers/net/designware_eqos.c
@@ -351,6 +351,11 @@ int eqos_set_ethaddr(struct eth_device *edev, const unsigned char *mac)
 
 	memcpy(eqos->macaddr, mac, ETH_ALEN);
 
+	/* mac_hi is only partially overwritten by the following code. Part of
+	 * this variable is DCS (DMA Channel Select). If this variable is not
+	 * zeroed, we may get some random DMA RX channel.
+	 */
+	mac_hi = 0;
 	/* Update the MAC address */
 	memcpy(&mac_hi, &mac[4], 2);
 	memcpy(&mac_lo, &mac[0], 4);
-- 
2.39.2




More information about the barebox mailing list