Commit 819b6e3d authored by Jacky Chou's avatar Jacky Chou Committed by Wen Zhiwei
Browse files

net: ftgmac100: Ensure tx descriptor updates are visible

stable inclusion
from stable-v6.6.53
commit d44cfa992b6b29476081b5f1e67c67b4201b0ccd
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAZ0GM

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=d44cfa992b6b29476081b5f1e67c67b4201b0ccd



--------------------------------

[ Upstream commit 4186c8d9e6af57bab0687b299df10ebd47534a0a ]

The driver must ensure TX descriptor updates are visible
before updating TX pointer and TX clear pointer.

This resolves TX hangs observed on AST2600 when running
iperf3.

Signed-off-by: default avatarJacky Chou <jacky_chou@aspeedtech.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent 2a698c96
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -656,6 +656,11 @@ static bool ftgmac100_tx_complete_packet(struct ftgmac100 *priv)
	ftgmac100_free_tx_packet(priv, pointer, skb, txdes, ctl_stat);
	txdes->txdes0 = cpu_to_le32(ctl_stat & priv->txdes0_edotr_mask);

	/* Ensure the descriptor config is visible before setting the tx
	 * pointer.
	 */
	smp_wmb();

	priv->tx_clean_pointer = ftgmac100_next_tx_pointer(priv, pointer);

	return true;
@@ -809,6 +814,11 @@ static netdev_tx_t ftgmac100_hard_start_xmit(struct sk_buff *skb,
	dma_wmb();
	first->txdes0 = cpu_to_le32(f_ctl_stat);

	/* Ensure the descriptor config is visible before setting the tx
	 * pointer.
	 */
	smp_wmb();

	/* Update next TX pointer */
	priv->tx_pointer = pointer;