lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <F19E93E071D95714+20240621101836.167600-1-wangyuli@uniontech.com>
Date: Fri, 21 Jun 2024 18:18:36 +0800
From: WangYuli <wangyuli@...ontech.com>
To: alexandre.torgue@...s.st.com,
	joabreu@...opsys.com,
	davem@...emloft.net,
	edumazet@...gle.com,
	kuba@...nel.org,
	pabeni@...hat.com,
	mcoquelin.stm32@...il.com
Cc: netdev@...r.kernel.org,
	linux-stm32@...md-mailman.stormreply.com,
	linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	guanwentao@...ontech.com,
	WangYuli <wangyuli@...ontech.com>,
	Wang Zhimin <wangzhimin1179@...tium.com.cn>,
	Li Wencheng <liwencheng@...tium.com.cn>,
	Chen Baozi <chenbaozi@...tium.com.cn>,
	Wang Yinfeng <wangyinfeng@...tium.com.cn>
Subject: [PATCH] net: stmmac: Add a barrier to make sure all access coherent

Add a memory barrier to sync TX descriptor to avoid data error.
Besides, increase the ring buffer size to avoid buffer overflow.

Signed-off-by: Wang Zhimin <wangzhimin1179@...tium.com.cn>
Signed-off-by: Li Wencheng <liwencheng@...tium.com.cn>
Signed-off-by: Chen Baozi <chenbaozi@...tium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@...tium.com.cn>
Signed-off-by: WangYuli <wangyuli@...ontech.com>
---
 drivers/net/ethernet/stmicro/stmmac/common.h    | 4 ++--
 drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 9cd62b2110a1..7cc2fecbaf18 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -50,10 +50,10 @@
  */
 #define DMA_MIN_TX_SIZE		64
 #define DMA_MAX_TX_SIZE		1024
-#define DMA_DEFAULT_TX_SIZE	512
+#define DMA_DEFAULT_TX_SIZE	1024
 #define DMA_MIN_RX_SIZE		64
 #define DMA_MAX_RX_SIZE		1024
-#define DMA_DEFAULT_RX_SIZE	512
+#define DMA_DEFAULT_RX_SIZE	1024
 #define STMMAC_GET_ENTRY(x, size)	((x + 1) & (size - 1))
 
 #undef FRAME_FILTER_DEBUG
diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
index 68a7cfcb1d8f..40088a390f7b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
@@ -200,6 +200,10 @@ static void ndesc_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
 	else
 		norm_set_tx_desc_len_on_ring(p, len);
 
+	/* The own bit must be the latest setting done when prepare the
+	 * descriptor and then barrier is needed to make sure that all is coherent.
+	 */
+	wmb();
 	if (tx_own)
 		p->des0 |= cpu_to_le32(TDES0_OWN);
 }
-- 
2.43.4


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ