From: Peter Wu <lekensteyn@gmail.com>
To: Francois Romieu <romieu@fr.zoreil.com>,
Ben Hutchings <bhutchings@solarflare.com>
Cc: lekensteyn@gmail.com, netdev@vger.kernel.org,
nic_swsd <nic_swsd@realtek.com>
Subject: [PATCH v3] r8169: fix invalid register dump
Date: Sun, 18 Aug 2013 15:41:38 +0200 [thread overview]
Message-ID: <1376833298-7321-1-git-send-email-lekensteyn@gmail.com> (raw)
For some reason, my PCIe RTL8111E onboard NIC on a GA-Z68X-UD3H-B3
motherboard reads as FFs when reading from MMIO with a block size
larger than 7. Therefore change to reading blocks of four bytes.
Ben Hutchings noted that the buffer is large enough to hold all
registers, so now all registers are read. Since regs->len is not used
anymore, drop the superfluous range check as well. (ethtool would
already ensure that regs->len <= R8169_REGS_SIZE).
Signed-off-by: Peter Wu <lekensteyn@gmail.com>
---
Hi,
This partly obsoletes "r8169,sis190: remove unnecessary length
check"[1]. I do not have sis190 hardware, but since that is based on
this r8169 driver, would it make sense to apply this patch to sis190
too?
Regards,
Peter
[1]: http://www.spinics.net/lists/netdev/msg246824.html
---
drivers/net/ethernet/realtek/r8169.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index b5eb419..c0c9e14 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1897,12 +1897,13 @@ static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs,
void *p)
{
struct rtl8169_private *tp = netdev_priv(dev);
-
- if (regs->len > R8169_REGS_SIZE)
- regs->len = R8169_REGS_SIZE;
+ u32 __iomem *data = tp->mmio_addr;
+ u32 *dw = p;
+ int i;
rtl_lock_work(tp);
- memcpy_fromio(p, tp->mmio_addr, regs->len);
+ for (i = 0; i < R8169_REGS_SIZE; i += 4)
+ memcpy_fromio(dw++, data++, 4);
rtl_unlock_work(tp);
}
--
1.8.3.4
next reply other threads:[~2013-08-18 13:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-18 13:41 Peter Wu [this message]
2013-08-18 21:21 ` [PATCH v3] r8169: fix invalid register dump Francois Romieu
2013-08-20 22:02 ` David Miller
2013-08-21 20:40 ` Peter Wu
2013-08-21 20:53 ` Francois Romieu
2013-08-21 21:13 ` Peter Wu
2013-08-21 21:17 ` [PATCH net-next v4] " Peter Wu
2013-08-22 21:26 ` David Miller
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=1376833298-7321-1-git-send-email-lekensteyn@gmail.com \
--to=lekensteyn@gmail.com \
--cc=bhutchings@solarflare.com \
--cc=netdev@vger.kernel.org \
--cc=nic_swsd@realtek.com \
--cc=romieu@fr.zoreil.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;
as well as URLs for NNTP newsgroup(s).