From owner-svn-src-projects@FreeBSD.ORG Fri Feb 13 05:52:43 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9522610656C0; Fri, 13 Feb 2009 05:52:43 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78C078FC0A; Fri, 13 Feb 2009 05:52:43 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1D5qhcE078256; Fri, 13 Feb 2009 05:52:43 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1D5qhhx078253; Fri, 13 Feb 2009 05:52:43 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902130552.n1D5qhhx078253@svn.freebsd.org> From: Sam Leffler Date: Fri, 13 Feb 2009 05:52:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188567 - in projects/vap7/tools/tools/ath: . athstats X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Feb 2009 05:52:43 -0000 Author: sam Date: Fri Feb 13 05:52:43 2009 New Revision: 188567 URL: http://svn.freebsd.org/changeset/base/188567 Log: merge r188560: add -z option to zero driver statistics Modified: projects/vap7/tools/tools/ath/ (props changed) projects/vap7/tools/tools/ath/athstats/athstats.c projects/vap7/tools/tools/ath/athstats/athstats.h projects/vap7/tools/tools/ath/athstats/main.c Modified: projects/vap7/tools/tools/ath/athstats/athstats.c ============================================================================== --- projects/vap7/tools/tools/ath/athstats/athstats.c Fri Feb 13 05:52:10 2009 (r188566) +++ projects/vap7/tools/tools/ath/athstats/athstats.c Fri Feb 13 05:52:43 2009 (r188567) @@ -436,6 +436,15 @@ ath_setifname(struct athstatfoo *wf0, co #endif } +static void +ath_zerostats(struct athstatfoo *wf0) +{ + struct athstatfoo_p *wf = (struct athstatfoo_p *) wf0; + + if (ioctl(wf->s, SIOCZATHSTATS, &wf->ifr) < 0) + err(-1, wf->ifr.ifr_name); +} + static void ath_collect(struct athstatfoo_p *wf, struct _athstats *stats) { @@ -997,6 +1006,7 @@ athstats_new(const char *ifname, const c #if 0 wf->base.setstamac = wlan_setstamac; #endif + wf->base.zerostats = ath_zerostats; wf->s = socket(AF_INET, SOCK_DGRAM, 0); if (wf->s < 0) err(1, "socket"); Modified: projects/vap7/tools/tools/ath/athstats/athstats.h ============================================================================== --- projects/vap7/tools/tools/ath/athstats/athstats.h Fri Feb 13 05:52:10 2009 (r188566) +++ projects/vap7/tools/tools/ath/athstats/athstats.h Fri Feb 13 05:52:43 2009 (r188567) @@ -46,6 +46,8 @@ struct athstatfoo { void (*setifname)(struct athstatfoo *, const char *ifname); /* set the mac address of the associated station/ap */ void (*setstamac)(struct athstatfoo *, const uint8_t mac[]); + /* zero in-kernel statistics */ + void (*zerostats)(struct athstatfoo *); }; struct athstatfoo *athstats_new(const char *ifname, const char *fmtstring); Modified: projects/vap7/tools/tools/ath/athstats/main.c ============================================================================== --- projects/vap7/tools/tools/ath/athstats/main.c Fri Feb 13 05:52:10 2009 (r188566) +++ projects/vap7/tools/tools/ath/athstats/main.c Fri Feb 13 05:52:43 2009 (r188567) @@ -33,7 +33,7 @@ * Simple Atheros-specific tool to inspect and monitor network traffic * statistics. * - * athstats [-i interface] [-l] [-o fmtstring] [interval] + * athstats [-i interface] [-z] [-l] [-o fmtstring] [interval] * * (default interface is ath0). If interval is specified a rolling output * a la netstat -i is displayed every interval seconds. The format of @@ -95,7 +95,7 @@ main(int argc, char *argv[]) if (ifname == NULL) ifname = "ath0"; wf = athstats_new(ifname, getfmt("default")); - while ((c = getopt(argc, argv, "i:lo:")) != -1) { + while ((c = getopt(argc, argv, "i:lo:z")) != -1) { switch (c) { case 'i': wf->setifname(wf, optarg); @@ -106,8 +106,11 @@ main(int argc, char *argv[]) case 'o': wf->setfmt(wf, getfmt(optarg)); break; + case 'z': + wf->zerostats(wf); + break; default: - errx(-1, "usage: %s [-a] [-i ifname] [-l] [-o fmt] [interval]\n", argv[0]); + errx(-1, "usage: %s [-a] [-i ifname] [-l] [-o fmt] [-z] [interval]\n", argv[0]); /*NOTREACHED*/ } }