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-next>] [day] [month] [year] [list]
Message-ID: <20080805115018.GB22123@hmsreliant.think-freely.org>
Date:	Tue, 5 Aug 2008 07:50:18 -0400
From:	Neil Horman <nhorman@...driver.com>
To:	netdev@...r.kernel.org
Cc:	nhorman@...driver.com, e1000-devel@...ts.sourceforge.net,
	jeffrey.t.kirsher@...el.com, jesse.brandeburg@...el.com,
	bruce.w.allan@...el.com, john.ronciak@...el.com
Subject: [PATCH] catch up device stats when multicast > total frames

Hey-
	REcently observed a problem wherein, if a BMC or other IPMI device is
attached to a NIC, multicast frames can be consumed by the aformentioned device
without ever being seen by the driver.  Since multicast frames are counted in
the hardware and the total frame counter is counted in the driver napi routine,
its possible to have a condition in which the number of received multicast
frames exceeds the total number of frames.  This patch re-aligns those values on
receive, so that the total frame count is always at least as large as the
received frame count.

Signed-off-by: Neil Horman <nhorman@...driver.com>


 e1000_main.c |    6 ++++++
 1 file changed, 6 insertions(+)


diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 59579b1..66afee8 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3761,6 +3761,8 @@ e1000_update_stats(struct e1000_adapter *adapter)
 	/* Fill out the OS statistics structure */
 	adapter->net_stats.multicast = adapter->stats.mprc;
 	adapter->net_stats.collisions = adapter->stats.colc;
+	if (adapter->net_stats.rx_packets < adapter->net_stats.multicast)
+		adapter->net_stats.rx_packets = adapter->net_stats.multicast;
 
 	/* Rx Errors */
 
@@ -4347,6 +4349,8 @@ next_desc:
 		adapter->alloc_rx_buf(adapter, rx_ring, cleaned_count);
 
 	adapter->total_rx_packets += total_rx_packets;
+	if (adapter->total_rx_packets < adapter->net_stats.multicast)
+		adapter->total_rx_packets = adapter->net_stats.multicast;
 	adapter->total_rx_bytes += total_rx_bytes;
 	adapter->net_stats.rx_bytes += total_rx_bytes;
 	adapter->net_stats.rx_packets += total_rx_packets;
@@ -4536,6 +4540,8 @@ next_desc:
 		adapter->alloc_rx_buf(adapter, rx_ring, cleaned_count);
 
 	adapter->total_rx_packets += total_rx_packets;
+	if (adapter->total_rx_packets < adapter->net_stats.multicast)
+		adapter->total_rx_packets = adapter->net_stats.multicast;
 	adapter->total_rx_bytes += total_rx_bytes;
 	adapter->net_stats.rx_bytes += total_rx_bytes;
 	adapter->net_stats.rx_packets += total_rx_packets;
-- 
/****************************************************
 * Neil Horman <nhorman@...driver.com>
 * Software Engineer, Red Hat
 ****************************************************/
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ