From owner-svn-src-all@freebsd.org Tue Mar 15 19:58:35 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 E0BDDAD224F; Tue, 15 Mar 2016 19:58:35 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp002.me.com (mr11p00im-asmtp002.me.com [17.110.69.253]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD0881A4C; Tue, 15 Mar 2016 19:58:35 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from [172.17.133.77] (dip-cali.panasas.com [64.80.217.3]) by mr11p00im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.36.0 64bit (built Sep 8 2015)) with ESMTPSA id <0O43008MXJHG9G30@mr11p00im-asmtp002.me.com>; Tue, 15 Mar 2016 19:58:29 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-03-15_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510270003 definitions=main-1603150275 User-Agent: Microsoft-MacOutlook/0.0.0.160212 Date: Tue, 15 Mar 2016 12:58:27 -0700 Subject: Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys From: Ravi Pokala Sender: "Pokala, Ravi" To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: <12F068CE-1975-4A6B-A2F7-756367B29972@panasas.com> Thread-topic: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys References: <201603150005.u2F050ps086390@repo.freebsd.org> <20160315191229.GU1328@FreeBSD.org> In-reply-to: <20160315191229.GU1328@FreeBSD.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit 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:58:36 -0000 Hi Gleb, -----Original Message----- From: Gleb Smirnoff Date: 2016-03-15, Tuesday at 12:12 To: Ravi Pokala Cc: , , Subject: Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys > 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. Got it. >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. Yeah. I think I looked at that stuff before, and got confused. Between this new change, and other uses of counter(9) which have been introduced since I last looked, I understand this quite a bit better now. >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. The one that clarified it the most for me was SFSTAT_ADD() - the use of offsetof() to map between the name of the stat field in (struct sfstat) and the array index. Thanks! -Ravi (rpokala@) >-- >Totus tuus, Glebius.