From patchwork Tue Jul 23 08:51:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Wu X-Patchwork-Id: 260987 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 80CE32C00AC for ; Tue, 23 Jul 2013 18:54:30 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755977Ab3GWIy0 (ORCPT ); Tue, 23 Jul 2013 04:54:26 -0400 Received: from mail-ee0-f47.google.com ([74.125.83.47]:64548 "EHLO mail-ee0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755912Ab3GWIyV (ORCPT ); Tue, 23 Jul 2013 04:54:21 -0400 Received: by mail-ee0-f47.google.com with SMTP id e49so4261715eek.6 for ; Tue, 23 Jul 2013 01:54:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:user-agent:mime-version :content-transfer-encoding:content-type; bh=J0SxKBVoE7XK9b8BSMzcO8bsXFrAX1PGCgnK93UjkMI=; b=QLqHED5uzDq7ymXTvFNA32RNexq5wUU1hkOzSQj4OeTYU0OGZvAUFfBe7VRjAzIst1 lghAggOW711do/GjM6LcJhQ01z0cDoExx5oFkdlYm4ui82Jj8+G6e3y2naZCYed7NnY/ ciFlAGHp7WfOoeG+pvOH1Q4joWtUfwaAvDo0n23VMkFNJ64e5zKu5tGoyGYTgZGPmyZ+ 92VBe4RYC4IttI0V77PwVO1Vrt/HUx5cJZplG3yFA6VhradY5bG3RfA5qz/yNyJKj93h yHVYqlfBjbqya3lVAkdNpnsPFCrCgh0jv18w3UJ+mxniDcTvsNTV/YX3iZwKDe8sfZlg pxpw== X-Received: by 10.15.52.5 with SMTP id o5mr31942910eew.58.1374569660191; Tue, 23 Jul 2013 01:54:20 -0700 (PDT) Received: from al.localnet (al.lekensteyn.nl. [2001:470:1f15:b83::c0d1:f1ed]) by mx.google.com with ESMTPSA id m1sm56947971eex.17.2013.07.23.01.54.18 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Jul 2013 01:54:19 -0700 (PDT) From: Peter Wu To: Ben Hutchings , Francois Romieu Cc: netdev@vger.kernel.org Subject: [ethtool] Add new Realtek devices Date: Tue, 23 Jul 2013 10:51:04 +0200 Message-ID: <3162188.mmLmSZRt9A@al> User-Agent: KMail/4.10.5 (Linux/3.10.0-1-custom; KDE/4.10.5; x86_64; ; ) MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 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); }