From owner-freebsd-net@FreeBSD.ORG Tue Oct 1 00:52:37 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2D853882 for ; Tue, 1 Oct 2013 00:52:37 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-la0-x231.google.com (mail-la0-x231.google.com [IPv6:2a00:1450:4010:c03::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 97EAA20C8 for ; Tue, 1 Oct 2013 00:52:36 +0000 (UTC) Received: by mail-la0-f49.google.com with SMTP id ev20so5141595lab.36 for ; Mon, 30 Sep 2013 17:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=GWGNEUYd+7aKqNRkFQobuD+CfiiA17gIaG+2X/yCO38=; b=ZX07X0prFUKZVayvns53IEROIij5/3QVJKLvu3535twdNJ6g6QANfO+qWA/FSBrFIy dJqO1aE5SPbkgnqh8OFs2o+4wORLNP0F8O6SIs1CsHyDJDm6B18IFLySLdoLF2MYhPWR Q1wYgOgVIMoCCtPjcYl1sfSqruRV+CUuWsT1tS1GJqC3gtCjNjigZr0OlfE2IKZzArY8 UhPAKtS/EQ+1HYpQUJyxo8m2IvAWLwqxDnK8V3vq+iugM/7Mcr1r5VurbfAeDuixCvBF Qbmzn/KhIu1kjOuuBMp7X+wkBaYp6va+DJHxjCL7c+YnEfvRCGCnEq0b9k6SV4oNyTdt pheg== MIME-Version: 1.0 X-Received: by 10.152.116.109 with SMTP id jv13mr9071546lab.30.1380588754618; Mon, 30 Sep 2013 17:52:34 -0700 (PDT) Sender: rizzo.unipi@gmail.com Received: by 10.114.172.105 with HTTP; Mon, 30 Sep 2013 17:52:34 -0700 (PDT) In-Reply-To: References: Date: Tue, 1 Oct 2013 02:52:34 +0200 X-Google-Sender-Auth: l3waRe2DsxJb2wHefjOO5a6Cp1M Message-ID: Subject: Re: Flow Director statistics for ixgbe(4) From: Luigi Rizzo To: Takuya ASADA Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: FreeBSD Net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Oct 2013 00:52:37 -0000 Wouldn't it be better to make this type of code (sysctl and stat fetching) table-driven so that it has a smaller footprint in the source (better readability, less error prone) and binary code ? One static table could store the various per-counter info (stat_list offset, sysctl name, REG_NAME, REG_MASK, supported_hw ...) and then one loop in the add_hw_stats and one in update_stats_counters does the job. cheers luigi On Mon, Sep 30, 2013 at 9:02 PM, Takuya ASADA wrote: > Hi, > > This is originally part of "ixgbetool" patch, but I think it can be discuss > separately: > > http://freebsd.1045724.n5.nabble.com/Adding-Flow-Director-sysctls-to-ixgbe-4-was-netmap-traffic-distribution-tp5847066p5847789.html > > I implemented sysctls to expose Flow Director statistics. > It works like this: > $ sysctl dev.ix.0.mac_stats|grep fdir > dev.ix.0.mac_stats.fdirfree_free: 8192 > dev.ix.0.mac_stats.fdirfree_coll: 0 > dev.ix.0.mac_stats.fdirustat_add: 0 > dev.ix.0.mac_stats.fdirustat_remove: 0 > dev.ix.0.mac_stats.fdirfstat_fadd: 0 > dev.ix.0.mac_stats.fdirfstat_fremove: 0 > dev.ix.0.mac_stats.fdirmatch: 0 > dev.ix.0.mac_stats.fdirmiss: 23 > > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > -- -----------------------------------------+------------------------------- Prof. Luigi RIZZO, rizzo@iet.unipi.it . Dip. di Ing. dell'Informazione http://www.iet.unipi.it/~luigi/ . Universita` di Pisa TEL +39-050-2211611 . via Diotisalvi 2 Mobile +39-338-6809875 . 56122 PISA (Italy) -----------------------------------------+-------------------------------