lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 11 Oct 2008 09:49:12 +0100
From:	"Alex Bennee" <kernel-hacker@...nee.com>
To:	"Bruno Prémont" <bonbons@...ux-vserver.org>
Cc:	linux-kernel@...r.kernel.org,
	"Francois Romieu" <romieu@...zoreil.com>,
	torvalds@...ux-foundation.org
Subject: Re: rtl8169_get_stats seems to be adding random crap to rx_missed_errors count

On Sat, Oct 11, 2008 at 7:42 AM, Alex Bennee <kernel-hacker@...nee.com> wrote:
> On Fri, Oct 10, 2008 at 10:27 PM, Bruno Prémont
> <bonbons@...ux-vserver.org> wrote:
>> Hi Alex,
>>
>> This issue has already been reported in
>>  http://lkml.org/lkml/2008/10/9/235
>> and a patch exists.
>>
>> Could you verify that patch #0009 at URL below fixes the issue for you:
>>  http://userweb.kernel.org/~romieu/r8169/2.6.27-rc9/20081007/
>
> I can confirm that patch works for me. I have further reviewed the
> code and it looks OK to me from here. Should I just forward the patch
> and tag it to the mailing list or is it now in a tree that gets picked
> up?


>From 96b79ad3d9e8c15a0118810e91f0e28ce5575493 Mon Sep 17 00:00:00 2001
From: Francois Romieu <romieu@...zoreil.com>
Date: Wed, 10 Sep 2008 22:28:56 +0200
Subject: [PATCH] r8169: fix RxMissed register access

- the register is defined for the 8169 chipset only and there is
  no 8169 beyond RTL_GIGA_MAC_VER_06.
- only the lower 3 bytes of the register are valid

Fixes:
1. http://bugzilla.kernel.org/show_bug.cgi?id=10180
2. http://bugzilla.kernel.org/show_bug.cgi?id=11062 (bits of)

Tested by Hermann Gausterer and Adam Huffman.

Signed-off-by: Francois Romieu <romieu@...zoreil.com>
Cc: Edward Hsu <edward_hsu@...ltek.com.tw>
Signed-off-by: Jeff Garzik <jgarzik@...hat.com>
Tested-by: Alex Bennee <kernel-hacker@...nee.com>
---
 drivers/net/r8169.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 0f6f974..4190ee7 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2099,8 +2099,6 @@ static void rtl_hw_start_8168(struct net_device *dev)

 	RTL_R8(IntrMask);

-	RTL_W32(RxMissed, 0);
-
 	rtl_set_rx_mode(dev);

 	RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
@@ -2143,8 +2141,6 @@ static void rtl_hw_start_8101(struct net_device *dev)

 	RTL_R8(IntrMask);

-	RTL_W32(RxMissed, 0);
-
 	rtl_set_rx_mode(dev);

 	RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
@@ -2922,6 +2918,17 @@ static int rtl8169_poll(struct napi_struct
*napi, int budget)
 	return work_done;
 }

+static void rtl8169_rx_missed(struct net_device *dev, void __iomem *ioaddr)
+{
+	struct rtl8169_private *tp = netdev_priv(dev);
+
+	if (tp->mac_version > RTL_GIGA_MAC_VER_06)
+		return;
+
+	dev->stats.rx_missed_errors += (RTL_R32(RxMissed) & 0xffffff);
+	RTL_W32(RxMissed, 0);
+}
+
 static void rtl8169_down(struct net_device *dev)
 {
 	struct rtl8169_private *tp = netdev_priv(dev);
@@ -2939,9 +2946,7 @@ core_down:

 	rtl8169_asic_down(ioaddr);

-	/* Update the error counts. */
-	dev->stats.rx_missed_errors += RTL_R32(RxMissed);
-	RTL_W32(RxMissed, 0);
+	rtl8169_rx_missed(dev, ioaddr);

 	spin_unlock_irq(&tp->lock);

@@ -3063,8 +3068,7 @@ static struct net_device_stats
*rtl8169_get_stats(struct net_device *dev)

 	if (netif_running(dev)) {
 		spin_lock_irqsave(&tp->lock, flags);
-		dev->stats.rx_missed_errors += RTL_R32(RxMissed);
-		RTL_W32(RxMissed, 0);
+		rtl8169_rx_missed(dev, ioaddr);
 		spin_unlock_irqrestore(&tp->lock, flags);
 	}

@@ -3089,8 +3093,7 @@ static int rtl8169_suspend(struct pci_dev *pdev,
pm_message_t state)

 	rtl8169_asic_down(ioaddr);

-	dev->stats.rx_missed_errors += RTL_R32(RxMissed);
-	RTL_W32(RxMissed, 0);
+	rtl8169_rx_missed(dev, ioaddr);

 	spin_unlock_irq(&tp->lock);

-- 
1.5.6.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ