netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: dlink: add Kconfig option for RMON registers
@ 2025-05-19 21:40 Moon Yeounsu
  2025-05-19 23:57 ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Moon Yeounsu @ 2025-05-19 21:40 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Moon Yeounsu, netdev, linux-kernel

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@gmail.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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-22 15:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-19 21:40 [PATCH net-next] net: dlink: add Kconfig option for RMON registers Moon Yeounsu
2025-05-19 23:57 ` Jakub Kicinski
2025-05-22  6:20   ` Moon Yeounsu
2025-05-22 15:39     ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).