netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Wu <lekensteyn@gmail.com>
To: Ben Hutchings <bhutchings@solarflare.com>,
	Francois Romieu <romieu@fr.zoreil.com>
Cc: netdev@vger.kernel.org
Subject: [ethtool] Add new Realtek devices
Date: Tue, 23 Jul 2013 10:51:04 +0200	[thread overview]
Message-ID: <3162188.mmLmSZRt9A@al> (raw)

Hi,

The list of devices supported by `ethtool -d eth0` was quite outdated
and did not support my onboard NIC. With the following two patches, the
supported devices list will be in sync with the r8169 kernel driver
(r8169 as of 3.11). Note that no new registers have been added, I am
sure that some registers are incorrect (like the Power Management wakeup
frames), but important information such as MAC address is still correct.

Another note, I have observed that memcpy_fromio results in invalid
reads for the RTL8111E (via `ethtool -d`). In fact, any reads of size
greater than or equal to 8 result in a sequence of FFs. As a quick hack,
I patched r8169 to perform reads of word size (see bottom), but I am not
sure what the cause is of this strange behavior. Francois, perhaps you
have an idea why reading in blocks of larger than 7 results in a error?

Regards,
Peter
---
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1897,12 +2050,17 @@ static void rtl8169_get_regs(struct net_device *dev, 
struct ethtool_regs *regs,
 			     void *p)
 {
 	struct rtl8169_private *tp = netdev_priv(dev);
+	char *bytes = p;
+	int i;
 
 	if (regs->len > R8169_REGS_SIZE)
 		regs->len = R8169_REGS_SIZE;
 
 	rtl_lock_work(tp);
-	memcpy_fromio(p, tp->mmio_addr, regs->len);
+	for (i = 0; i < regs->len - 4; i += 4)
+		memcpy_fromio(bytes + i, tp->mmio_addr + i, 4);
+	if (i < regs->len)
+		memcpy_fromio(bytes + i, tp->mmio_addr + i, regs->len - i);
 	rtl_unlock_work(tp);
 }

             reply	other threads:[~2013-07-23  8:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23  8:51 Peter Wu [this message]
2013-07-23  8:51 ` [PATCH 1/2] realtek: convert to per-chip mask Peter Wu
2013-07-23 17:56   ` Ben Hutchings
2013-07-23  8:51 ` [PATCH 2/2] realtek: update devices to 3.11 Peter Wu
2013-07-23 18:04 ` [PATCH v2 " Peter Wu
2013-07-23 18:05 ` [PATCH v2 1/2] realtek: convert to per-chip mask Peter Wu
2013-07-23 20:24   ` Francois Romieu
2013-07-23 21:03     ` Peter Wu
2013-07-23 20:25 ` [ethtool] Add new Realtek devices Francois Romieu
2013-07-23 21:08   ` Peter Wu

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=3162188.mmLmSZRt9A@al \
    --to=lekensteyn@gmail.com \
    --cc=bhutchings@solarflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=romieu@fr.zoreil.com \
    --subject='Re: [ethtool] Add new Realtek devices' \
    /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

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).