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: <20250519214046.47856-2-yyyynoom@gmail.com>
Date: Tue, 20 May 2025 06:40:45 +0900
From: Moon Yeounsu <yyyynoom@...il.com>
To: Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>
Cc: Moon Yeounsu <yyyynoom@...il.com>,
	netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH net-next] net: dlink: add Kconfig option for RMON registers

This patch adds a Kconfig option to enable MMIO for RMON registers.

To read RMON registers, the code `dw32(RmonStatMask, 0x0007ffff);`
must also be skipped, so this patch adds a preprocessor directive to
that line as well.

On the `D-Link DGE-550T Rev-A3`, RMON statistics registers can be read
correctly and statistic data can be collected. However, the behavior on
other hardware is uncertain, and there may be undiscovered issues even
on this device. Thus, the default setting is `no`, allowing users to
enable it manually if necessary.

Tested-on: D-Link DGE-550T Rev-A3
Signed-off-by: Moon Yeounsu <yyyynoom@...il.com>
---
 drivers/net/ethernet/dlink/Kconfig | 18 ++++++++++++++++++
 drivers/net/ethernet/dlink/dl2k.c  |  2 ++
 drivers/net/ethernet/dlink/dl2k.h  |  4 ++++
 3 files changed, 24 insertions(+)

diff --git a/drivers/net/ethernet/dlink/Kconfig b/drivers/net/ethernet/dlink/Kconfig
index e9e13654812c..40c8c861c5a9 100644
--- a/drivers/net/ethernet/dlink/Kconfig
+++ b/drivers/net/ethernet/dlink/Kconfig
@@ -32,4 +32,22 @@ config DL2K
 	  To compile this driver as a module, choose M here: the
 	  module will be called dl2k.
 
+if DL2K
+
+config DL2K_MMIO
+	bool "RMON MMIO"
+	depends on DL2K
+	default n
+	help
+	  Enable memory-mapped I/O for RMON registers.
+
+	  Since this feature may have potential issues,
+	  it should default to 'no'.
+
+	  If unsure, say N.
+
+endif # DL2K
+
 endif # NET_VENDOR_DLINK
+
+
diff --git a/drivers/net/ethernet/dlink/dl2k.c b/drivers/net/ethernet/dlink/dl2k.c
index 232e839a9d07..197142aa63ff 100644
--- a/drivers/net/ethernet/dlink/dl2k.c
+++ b/drivers/net/ethernet/dlink/dl2k.c
@@ -576,7 +576,9 @@ static void rio_hw_init(struct net_device *dev)
 	dw8(TxDMAPollPeriod, 0xff);
 	dw8(RxDMABurstThresh, 0x30);
 	dw8(RxDMAUrgentThresh, 0x30);
+#ifndef MEM_MAPPING
 	dw32(RmonStatMask, 0x0007ffff);
+#endif
 	/* clear statistics */
 	clear_stats (dev);
 
diff --git a/drivers/net/ethernet/dlink/dl2k.h b/drivers/net/ethernet/dlink/dl2k.h
index 0e33e2eaae96..3a13068d89a2 100644
--- a/drivers/net/ethernet/dlink/dl2k.h
+++ b/drivers/net/ethernet/dlink/dl2k.h
@@ -38,6 +38,10 @@
 #define TX_TOTAL_SIZE	TX_RING_SIZE*sizeof(struct netdev_desc)
 #define RX_TOTAL_SIZE	RX_RING_SIZE*sizeof(struct netdev_desc)
 
+#ifdef CONFIG_DL2K_MMIO
+#define MEM_MAPPING
+#endif
+
 /* Offsets to the device registers.
    Unlike software-only systems, device drivers interact with complex hardware.
    It's not useful to define symbolic names for every register bit in the
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ