From owner-svn-src-all@freebsd.org Tue Mar 15 19:12:45 2016 Return-Path: Delivered-To: svn-src-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 AA1EFAD12E0; Tue, 15 Mar 2016 19:12:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F3A128F8; Tue, 15 Mar 2016 19:12:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id u2FJCTi0069931 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 15 Mar 2016 12:12:29 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id u2FJCTjA069930; Tue, 15 Mar 2016 12:12:29 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 15 Mar 2016 12:12:29 -0700 From: Gleb Smirnoff To: Ravi Pokala Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys Message-ID: <20160315191229.GU1328@FreeBSD.org> References: <201603150005.u2F050ps086390@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2016 19:12:45 -0000 Ravi, On Mon, Mar 14, 2016 at 05:33:06PM -0700, Ravi Pokala wrote: R> To make sure I'm reading this correctly: R> R> (1) The sysctl operates on an opaque array of (uint64_t)s. The elements of the array are not individually accessible. On array of counter_u64_t. The elements are individually accessible of course, but not by this sysctl API. R> (2) Reading the sysctl populates each element of the userspace array by calling counter_u64_fetch() on the corresponding element of the kernelspace array. Right. R> (3) Writing the sysctl clears the kernelspace array by calling counter_u64_zero() on each element. Right. R> For example, if you have a bunch of device statistics, this interface will let you get or clear them all in one shot, but they won't have distinct names. You would have to define an enum to set up names for the array indices. Something what you want is already provided by VNET_PCPUSTAT* macros. The idea is that you declare a struct, whose members all are uint64_t. This struct becomes an API between userland and kernel. The VNET_PCPUSTAT* macros then are used to allocate nameless arrays of counter(9)s, with number of elements equal to number of members in the API struct. Each counter array element accumulates statistics for its corresponding struct member. The only problem, is that VIMAGE is mixed into this set of macros. What needs to be done is separate logic of making correspondence of array of counters to struct members and VIMAGE, yielding in a more generic and network unaware KPI. This KPI should be moved from vnet.h into counter.h, and in vnet.h there should remain macros that summon VIMAGE awareness upon the new macros in counter.h. See struct tcpstat as example usage of VNET_PCPUSTAT* macros. -- Totus tuus, Glebius.