Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Jan 2011 00:09:52 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r218114 - head/sys/compat/linprocfs
Message-ID:  <201101310009.p0V09qia091016@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Mon Jan 31 00:09:52 2011
New Revision: 218114
URL: http://svn.freebsd.org/changeset/base/218114

Log:
  Update interface stats counters to match the current format in linux and
  try to export as much information as we can match.
  
  Requested on:	Debian GNU/kFreeBSD list (debian-bsd lists.debian.org) 2010-12
  Tested by:	Mats Erik Andersson (mats.andersson gisladisker.se)
  MFC after:	10 days

Modified:
  head/sys/compat/linprocfs/linprocfs.c

Modified: head/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- head/sys/compat/linprocfs/linprocfs.c	Sun Jan 30 23:55:48 2011	(r218113)
+++ head/sys/compat/linprocfs/linprocfs.c	Mon Jan 31 00:09:52 2011	(r218114)
@@ -1215,20 +1215,43 @@ linprocfs_donetdev(PFS_FILL_ARGS)
 	char ifname[16]; /* XXX LINUX_IFNAMSIZ */
 	struct ifnet *ifp;
 
-	sbuf_printf(sb, "%6s|%58s|%s\n%6s|%58s|%58s\n",
-	    "Inter-", "   Receive", "  Transmit", " face",
-	    "bytes    packets errs drop fifo frame compressed",
-	    "bytes    packets errs drop fifo frame compressed");
+	sbuf_printf(sb, "%6s|%58s|%s\n"
+	    "%6s|%58s|%58s\n",
+	    "Inter-", "   Receive", "  Transmit",
+	    " face",
+	    "bytes    packets errs drop fifo frame compressed multicast",
+	    "bytes    packets errs drop fifo colls carrier compressed");
 
 	CURVNET_SET(TD_TO_VNET(curthread));
 	IFNET_RLOCK();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		linux_ifname(ifp, ifname, sizeof ifname);
-			sbuf_printf(sb, "%6.6s:", ifname);
-		sbuf_printf(sb, "%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu ",
-		    0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL);
+		sbuf_printf(sb, "%6.6s: ", ifname);
+		sbuf_printf(sb, "%7lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu ",
+		    ifp->if_ibytes,	/* rx_bytes */
+		    ifp->if_ipackets,	/* rx_packets */
+		    ifp->if_ierrors,	/* rx_errors */
+		    ifp->if_iqdrops,	/* rx_dropped +
+					 * rx_missed_errors */
+		    0UL,		/* rx_fifo_errors */
+		    0UL,		/* rx_length_errors +
+					 * rx_over_errors +
+		    			 * rx_crc_errors +
+					 * rx_frame_errors */
+		    0UL,		/* rx_compressed */
+		    ifp->if_imcasts);	/* multicast, XXX-BZ rx only? */
 		sbuf_printf(sb, "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
-		    0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL);
+		    ifp->if_obytes,	/* tx_bytes */
+		    ifp->if_opackets,	/* tx_packets */
+		    ifp->if_oerrors,	/* tx_errors */
+		    0UL,		/* tx_dropped */
+		    0UL,		/* tx_fifo_errors */
+		    ifp->if_collisions,	/* collisions */
+		    0UL,		/* tx_carrier_errors +
+					 * tx_aborted_errors +
+					 * tx_window_errors +
+					 * tx_heartbeat_errors */
+		    0UL);		/* tx_compressed */
 	}
 	IFNET_RUNLOCK();
 	CURVNET_RESTORE();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101310009.p0V09qia091016>