From: Moon Yeounsu <yyyynoom@gmail.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Moon Yeounsu <yyyynoom@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next] net: dlink: add Kconfig option for RMON registers
Date: Tue, 20 May 2025 06:40:45 +0900 [thread overview]
Message-ID: <20250519214046.47856-2-yyyynoom@gmail.com> (raw)
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
next reply other threads:[~2025-05-19 21:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-19 21:40 Moon Yeounsu [this message]
2025-05-19 23:57 ` [PATCH net-next] net: dlink: add Kconfig option for RMON registers Jakub Kicinski
2025-05-22 6:20 ` Moon Yeounsu
2025-05-22 15:39 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250519214046.47856-2-yyyynoom@gmail.com \
--to=yyyynoom@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox