From owner-svn-soc-all@freebsd.org Fri Aug 21 01:02:28 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 812B99BE1ED for ; Fri, 21 Aug 2015 01:02:28 +0000 (UTC) (envelope-from btw@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 712A21233 for ; Fri, 21 Aug 2015 01:02:28 +0000 (UTC) (envelope-from btw@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7L12SpG009039 for ; Fri, 21 Aug 2015 01:02:28 GMT (envelope-from btw@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7L12REi009036 for svn-soc-all@FreeBSD.org; Fri, 21 Aug 2015 01:02:27 GMT (envelope-from btw@FreeBSD.org) Date: Fri, 21 Aug 2015 01:02:27 GMT Message-Id: <201508210102.t7L12REi009036@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to btw@FreeBSD.org using -f From: btw@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r289992 - soc2015/btw/head/share/man/man9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2015 01:02:28 -0000 Author: btw Date: Fri Aug 21 01:02:27 2015 New Revision: 289992 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=289992 Log: Extend ifnet(9) to describe the ifring structure and related stuffs. Modified: soc2015/btw/head/share/man/man9/ifnet.9 Modified: soc2015/btw/head/share/man/man9/ifnet.9 ============================================================================== --- soc2015/btw/head/share/man/man9/ifnet.9 Thu Aug 20 22:44:26 2015 (r289991) +++ soc2015/btw/head/share/man/man9/ifnet.9 Fri Aug 21 01:02:27 2015 (r289992) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 29, 2014 +.Dd August 19, 2015 .Dt IFNET 9 .Os .Sh NAME @@ -133,7 +133,7 @@ .Sh DATA STRUCTURES The kernel mechanisms for handling network interfaces reside primarily in the -.Vt ifnet , if_data , ifaddr , +.Vt ifnet , if_data , ifaddr , ifring , and .Vt ifmultiaddr structures in @@ -155,7 +155,7 @@ The header file .In net/if_var.h defines the kernel-internal interfaces, including the -.Vt ifnet , ifaddr , +.Vt ifnet , ifaddr , ifring , and .Vt ifmultiaddr structures and the functions which manipulate them. @@ -181,7 +181,10 @@ Each interface structure contains an .Vt if_data -structure used for statistics and information. +structure used for statistics and information, +and an array of +.Vt ifring +structures used for per-ring statistics. Each interface also has a .Li TAILQ of interface addresses, described by @@ -440,6 +443,15 @@ but unlike .Va if_type , it would not be changed by drivers. +.It Va if_rings +.Pq Vt "struct ifring **" +A pointer to the array of rings, which contains the per-ring statistics. +(Initialized by +.Fn if_attach . ) +.It Va if_nrings +.Pq Vt int +The number of elements in +.Va if_rings . .El .Pp References to @@ -1111,6 +1123,72 @@ argument is the route in question; the .Fa info argument contains the specific destination being manipulated. +.Ss The Vt ifring Ss Structure +Every interface is associated with an array of rings pointed by the +interface structure's +.Va if_rings +member. +And the number of elements is indicated by the +.Va if_nrings +member. +The elements of this array consist of +.Vt ifring +structures. +The +.Vt ifring +structure contains the per-ring statistics, and which is exported to +user programs by way of the +.Xr ifmib 4 +branch of the +.Xr sysctl 3 +MIB. +.Pp +The members of +.Vt "struct ifring" +are as follows: +.Bl -tag -width ".Va ifr_stats" -offset indent +.It Va "ifr_stats" +.Pq Vt "struct ifrstat[MAXCPU]" +The per-cpu statistics of the ring. +.El +.Pp +The +.Vt "ifrstat" +structure is defined in +.In net/if_var.h . +The members of +.Vt "struct ifrstat" +are as follows: +.Bl -tag -width ".Va ifrs_ifinput" -offset indent +.It Va "ifrs_ifinput" +.Pq Vt "uint64_t" +The number of packets received on the corresponding ring and processed +on the corresponding CPU in the driver. +.It Va "ifrs_netisr" +.Pq Vt "uint64_t" +The number of packets received on the corresponding ring and processed +on the corresponding CPU in the netisr layer. +.It Va "ifrs_ether" +.Pq Vt "uint64_t" +The number of packets received on the corresponding ring and processed +on the corresponding CPU in the ethernet layer. +.It Va "ifrs_ip" +.Pq Vt "uint64_t" +The number of packets received on the corresponding ring and processed +on the corresponding CPU in the IP (version 4) layer. +.It Va "ifrs_ip6" +.Pq Vt "uint64_t" +The number of packets received on the corresponding ring and processed +on the corresponding CPU in the IP (version 6) layer. +.It Va "ifrs_tcp" +.Pq Vt "uint64_t" +The number of packets received on the corresponding ring and processed +on the corresponding CPU in the TCP layer. +.It Va "ifrs_udp" +.Pq Vt "uint64_t" +The number of packets received on the corresponding ring and processed +on the corresponding CPU in the UDP layer. +.El .Sh FUNCTIONS The functions provided by the generic interface code can be divided into two groups: those which manipulate interfaces, and those which @@ -1172,7 +1250,7 @@ (A pointer to this address structure is saved in the .Vt ifnet -structure and shall be accessed by the +structure and is accessed by the .Fn ifaddr_byindex function.) The