mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Sebastian Claßen" <Sebastian.Classen@freenet-ag.de>
To: linux-kernel@vger.kernel.org
Subject: overflows in /proc/net/dev
Date: Thu, 18 Aug 2005 09:28:10 +0200	[thread overview]
Message-ID: <1124350090.29902.8.camel@basti79.freenet-ag.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 851 bytes --]

Hi all...

in struct net_device_stats all members are defined as unsgined long. In
time of gigabit ethernet this takes not long to overflow. Are there any
plans to change these coutners to unsigned long long? I saw in ifconfig
source code the byte and packet counters are already defined as unsigned
long long.

I've tried the attached little patch which seems to work well. Are there
any good reasons against this changes?

-- 
Mit freundlichen Grüßen / Yours sincerely

Sebastian Claßen, Postmaster
freenet.de AG, Willstätterstraße 13, D-40549 Düsseldorf
Phone: +49 (0) 211 / 53087-522
----------------------------------------------------------------------
Vorsitzender des Aufsichtsrates: Prof. Dr. Helmut Thoma
Vorstand: Eckhard Spoerr (Vors.), Axel Krieger,
          Stephan Esch, Eric Berger
Amtsgericht Hamburg HRB 74048

[-- Attachment #2: proc_net_dev.diff --]
[-- Type: text/x-patch, Size: 1496 bytes --]

--- include/linux/netdevice.h.orig	2005-08-17 15:28:05.000000000 +0200
+++ include/linux/netdevice.h	2005-08-17 15:27:02.000000000 +0200
@@ -107,10 +107,10 @@ struct netpoll;
  
 struct net_device_stats
 {
-	unsigned long rx_packets;		/* total packets received	*/
-	unsigned long tx_packets;		/* total packets transmitted	*/
-	unsigned long rx_bytes;		/* total bytes received 	*/
-	unsigned long tx_bytes;		/* total bytes transmitted	*/
+	unsigned long long rx_packets;		/* total packets received	*/
+	unsigned long long tx_packets;		/* total packets transmitted	*/
+	unsigned long long rx_bytes;		/* total bytes received 	*/
+	unsigned long long tx_bytes;		/* total bytes transmitted	*/
 	unsigned long rx_errors;		/* bad packets received		*/
 	unsigned long tx_errors;		/* packet transmit problems	*/
 	unsigned long rx_dropped;		/* no space in linux buffers	*/
--- net/core/dev.c.orig	2005-08-17 15:29:40.000000000 +0200
+++ net/core/dev.c	2005-08-17 15:30:53.000000000 +0200
@@ -1984,8 +1984,8 @@ static void dev_seq_printf_stats(struct 
 	if (dev->get_stats) {
 		struct net_device_stats *stats = dev->get_stats(dev);
 
-		seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
-				"%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
+		seq_printf(seq, "%6s:%8llu %7llu %4lu %4lu %4lu %5lu %10lu %9lu "
+				"%8llu %7llu %4lu %4lu %4lu %5lu %7lu %10lu\n",
 			   dev->name, stats->rx_bytes, stats->rx_packets,
 			   stats->rx_errors,
 			   stats->rx_dropped + stats->rx_missed_errors,

             reply	other threads:[~2005-08-18  7:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-18  7:28 Sebastian Claßen [this message]
2005-08-18 16:33 ` Chris Wedgwood
2005-08-18 17:30   ` Mario 'BitKoenig' Holbe
2005-08-18 21:32   ` David S. Miller
2005-08-18 22:13     ` Stephen Hemminger

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=1124350090.29902.8.camel@basti79.freenet-ag.de \
    --to=sebastian.classen@freenet-ag.de \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®