summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-03-03 23:15:46 +0000
committerdim <dim@FreeBSD.org>2016-03-03 23:15:46 +0000
commit9ac7ec88271f4a2dca21389be4d8f3c51f6b66f4 (patch)
tree933ca1d4eee78dcba4bd7cb9578fbf354cd90bbb /tools
parentd50a25246889bd164391143e1394f0c845d954ae (diff)
parentaa85fc5f7d9ad16a9160db16293329e874f53bc4 (diff)
downloadFreeBSD-src-9ac7ec88271f4a2dca21389be4d8f3c51f6b66f4.zip
FreeBSD-src-9ac7ec88271f4a2dca21389be4d8f3c51f6b66f4.tar.gz
Merge ^/head r296007 through r296368.
Diffstat (limited to 'tools')
-rw-r--r--tools/build/options/WITHOUT_AUTOFS2
-rw-r--r--tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY1
-rw-r--r--tools/build/options/WITHOUT_LEGACY_CONSOLE4
-rw-r--r--tools/build/options/WITHOUT_QUOTAS2
-rw-r--r--tools/build/options/WITHOUT_TELNET2
-rw-r--r--tools/regression/capsicum/libcasper/Makefile (renamed from tools/regression/capsicum/libcapsicum/Makefile)3
-rw-r--r--tools/regression/capsicum/libcasper/dns.c (renamed from tools/regression/capsicum/libcapsicum/dns.c)6
-rw-r--r--tools/regression/capsicum/libcasper/grp.c (renamed from tools/regression/capsicum/libcapsicum/grp.c)6
-rw-r--r--tools/regression/capsicum/libcasper/pwd.c (renamed from tools/regression/capsicum/libcapsicum/pwd.c)6
-rw-r--r--tools/regression/capsicum/libcasper/sysctl.c (renamed from tools/regression/capsicum/libcapsicum/sysctl.c)6
-rw-r--r--tools/tools/ath/athregs/Makefile3
-rw-r--r--tools/tools/ath/athregs/dumpregs.c27
-rw-r--r--tools/tools/ath/athstats/Makefile4
-rw-r--r--tools/tools/ath/athstats/athstats.c35
-rw-r--r--tools/tools/ath/common/ctrl.c218
-rw-r--r--tools/tools/ath/common/ctrl.h59
-rw-r--r--tools/tools/cxgbetool/cxgbetool.c24
17 files changed, 355 insertions, 53 deletions
diff --git a/tools/build/options/WITHOUT_AUTOFS b/tools/build/options/WITHOUT_AUTOFS
index f9c5c2c..e8a9799 100644
--- a/tools/build/options/WITHOUT_AUTOFS
+++ b/tools/build/options/WITHOUT_AUTOFS
@@ -1,4 +1,4 @@
.\" $FreeBSD$
Set to not build
-.Xr autofs 4
+.Xr autofs 5
related programs, libraries, and kernel modules.
diff --git a/tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY b/tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY
index f06a606..1fcde11 100644
--- a/tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY
+++ b/tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY
@@ -2,3 +2,4 @@
Set to build and install
.Xr objcopy 1
from GNU Binutils, instead of the one from ELF Tool Chain.
+This option is provided as a transition aid and will be removed in due time.
diff --git a/tools/build/options/WITHOUT_LEGACY_CONSOLE b/tools/build/options/WITHOUT_LEGACY_CONSOLE
index 8f21d1e..4da663c 100644
--- a/tools/build/options/WITHOUT_LEGACY_CONSOLE
+++ b/tools/build/options/WITHOUT_LEGACY_CONSOLE
@@ -1,5 +1,5 @@
.\" $FreeBSD$
Set to not build programs that support a legacy PC console; e.g.,
-.Xr kbdcontrol 8
+.Xr kbdcontrol 1
and
-.Xr vidcontrol 8 .
+.Xr vidcontrol 1 .
diff --git a/tools/build/options/WITHOUT_QUOTAS b/tools/build/options/WITHOUT_QUOTAS
index 9b2d458..00a67d7 100644
--- a/tools/build/options/WITHOUT_QUOTAS
+++ b/tools/build/options/WITHOUT_QUOTAS
@@ -1,4 +1,4 @@
.\" $FreeBSD$
Set to not build
-.Xr quota 8
+.Xr quota 1
and related programs.
diff --git a/tools/build/options/WITHOUT_TELNET b/tools/build/options/WITHOUT_TELNET
index 353cc31..49c246c 100644
--- a/tools/build/options/WITHOUT_TELNET
+++ b/tools/build/options/WITHOUT_TELNET
@@ -1,4 +1,4 @@
.\" $FreeBSD$
Set to not build
-.Xr telnet 8
+.Xr telnet 1
and related programs.
diff --git a/tools/regression/capsicum/libcapsicum/Makefile b/tools/regression/capsicum/libcasper/Makefile
index 468fa33..b024c3b 100644
--- a/tools/regression/capsicum/libcapsicum/Makefile
+++ b/tools/regression/capsicum/libcasper/Makefile
@@ -12,7 +12,6 @@ CFLAGS+= -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter
CFLAGS+= -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
CFLAGS+= -Wold-style-definition -Wno-pointer-sign
-CFLAGS+= -I${.CURDIR}/../../../../lib/libcapsicum
CFLAGS+= -ggdb
SERVTEST= ${SERVICES:=.t}
@@ -22,7 +21,7 @@ all: ${SERVTEST}
.for SERVICE in ${SERVICES}
${SERVICE}.t: ${SERVICE}.c
- ${CC} ${CFLAGS} ${@:.t=.c} -o $@ -lcapsicum -lnv
+ ${CC} ${CFLAGS} ${@:.t=.c} -o $@ -lnv -lcasper -lcap_${@:.t=}
.endfor
diff --git a/tools/regression/capsicum/libcapsicum/dns.c b/tools/regression/capsicum/libcasper/dns.c
index 4426bf3..eb364da 100644
--- a/tools/regression/capsicum/libcapsicum/dns.c
+++ b/tools/regression/capsicum/libcasper/dns.c
@@ -44,9 +44,9 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
-#include <libcapsicum.h>
-#include <libcapsicum_dns.h>
-#include <libcapsicum_service.h>
+#include <libcasper.h>
+
+#include <casper/cap_dns.h>
static int ntest = 1;
diff --git a/tools/regression/capsicum/libcapsicum/grp.c b/tools/regression/capsicum/libcasper/grp.c
index dbffeaf..7b8ada5 100644
--- a/tools/regression/capsicum/libcapsicum/grp.c
+++ b/tools/regression/capsicum/libcasper/grp.c
@@ -41,9 +41,9 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
-#include <libcapsicum.h>
-#include <libcapsicum_grp.h>
-#include <libcapsicum_service.h>
+#include <libcasper.h>
+
+#include <casper/cap_grp.h>
static int ntest = 1;
diff --git a/tools/regression/capsicum/libcapsicum/pwd.c b/tools/regression/capsicum/libcasper/pwd.c
index 23e81a3..b102700 100644
--- a/tools/regression/capsicum/libcapsicum/pwd.c
+++ b/tools/regression/capsicum/libcasper/pwd.c
@@ -41,9 +41,9 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
-#include <libcapsicum.h>
-#include <libcapsicum_pwd.h>
-#include <libcapsicum_service.h>
+#include <libcasper.h>
+
+#include <casper/cap_pwd.h>
static int ntest = 1;
diff --git a/tools/regression/capsicum/libcapsicum/sysctl.c b/tools/regression/capsicum/libcasper/sysctl.c
index f3ae307..f326820 100644
--- a/tools/regression/capsicum/libcapsicum/sysctl.c
+++ b/tools/regression/capsicum/libcasper/sysctl.c
@@ -44,9 +44,9 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
-#include <libcapsicum.h>
-#include <libcapsicum_service.h>
-#include <libcapsicum_sysctl.h>
+#include <libcasper.h>
+
+#include <casper/cap_sysctl.h>
/*
* We need some sysctls to perform the tests on.
diff --git a/tools/tools/ath/athregs/Makefile b/tools/tools/ath/athregs/Makefile
index 6b61b32..20e2489 100644
--- a/tools/tools/ath/athregs/Makefile
+++ b/tools/tools/ath/athregs/Makefile
@@ -2,9 +2,12 @@
PROG= athregs
+CFLAGS+= -I${.CURDIR}/../common/
+
.PATH.c: ${.CURDIR}/../common
SRCS= dumpregs.c
+SRCS+= ctrl.c
SRCS+= dumpregs_5210.c
SRCS+= dumpregs_5211.c
SRCS+= dumpregs_5212.c
diff --git a/tools/tools/ath/athregs/dumpregs.c b/tools/tools/ath/athregs/dumpregs.c
index 472df05..a5f510a 100644
--- a/tools/tools/ath/athregs/dumpregs.c
+++ b/tools/tools/ath/athregs/dumpregs.c
@@ -43,6 +43,8 @@
#include <ctype.h>
#include <err.h>
+#include "ctrl.h"
+
typedef struct {
HAL_REVS revs;
u_int32_t regdata[0xffff / sizeof(u_int32_t)];
@@ -93,11 +95,11 @@ main(int argc, char *argv[])
const char *ifname;
u_int32_t *data;
u_int32_t *dp, *ep;
- int what, c, s, i;
+ int what, c, i;
+ struct ath_driver_req req;
+
+ ath_driver_req_init(&req);
- s = socket(AF_INET, SOCK_DGRAM, 0);
- if (s < 0)
- err(1, "socket");
ifname = getenv("ATH");
if (!ifname)
ifname = ATH_DEFAULT;
@@ -144,6 +146,16 @@ main(int argc, char *argv[])
usage();
/*NOTREACHED*/
}
+
+ /* Initialise the driver interface */
+ if (ath_driver_req_open(&req, ifname) < 0) {
+ exit(127);
+ }
+
+ /*
+ * Whilst we're doing the ath_diag pieces, we have to set this
+ * ourselves.
+ */
strncpy(atd.ad_name, ifname, sizeof (atd.ad_name));
argc -= optind;
@@ -154,7 +166,8 @@ main(int argc, char *argv[])
atd.ad_id = HAL_DIAG_REVS;
atd.ad_out_data = (caddr_t) &state.revs;
atd.ad_out_size = sizeof(state.revs);
- if (ioctl(s, SIOCGATHDIAG, &atd) < 0)
+
+ if (ath_driver_req_fetch_diag(&req, SIOCGATHDIAG, &atd) < 0)
err(1, "%s", atd.ad_name);
if (ath_hal_setupregs(&atd, what) == 0)
@@ -172,7 +185,8 @@ main(int argc, char *argv[])
exit(-1);
}
atd.ad_id = HAL_DIAG_REGS | ATH_DIAG_IN | ATH_DIAG_DYN;
- if (ioctl(s, SIOCGATHDIAG, &atd) < 0)
+
+ if (ath_driver_req_fetch_diag(&req, SIOCGATHDIAG, &atd) < 0)
err(1, "%s", atd.ad_name);
/*
@@ -238,6 +252,7 @@ main(int argc, char *argv[])
fprintf(stdout, "\n");
ath_hal_dumpbb(stdout, what);
}
+ ath_driver_req_close(&req);
return 0;
}
diff --git a/tools/tools/ath/athstats/Makefile b/tools/tools/ath/athstats/Makefile
index 93f98ae..95b01fd 100644
--- a/tools/tools/ath/athstats/Makefile
+++ b/tools/tools/ath/athstats/Makefile
@@ -10,6 +10,10 @@ PROG= athstats
SRCS= main.c athstats.c opt_ah.h ah_osdep.h
+CFLAGS+= -I${.CURDIR}/../common/
+.PATH.c: ${.CURDIR}/../common/
+SRCS+= ctrl.c
+
CLEANFILES+= opt_ah.h
.include <../Makefile.inc>
diff --git a/tools/tools/ath/athstats/athstats.c b/tools/tools/ath/athstats/athstats.c
index bffc512..9115267 100644
--- a/tools/tools/ath/athstats/athstats.c
+++ b/tools/tools/ath/athstats/athstats.c
@@ -60,6 +60,8 @@
#include "athstats.h"
+#include "ctrl.h"
+
#ifdef ATH_SUPPORT_ANI
#define HAL_EP_RND(x,mul) \
((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
@@ -441,10 +443,9 @@ struct _athstats {
struct athstatfoo_p {
struct athstatfoo base;
- int s;
int optstats;
+ struct ath_driver_req req;
#define ATHSTATS_ANI 0x0001
- struct ifreq ifr;
struct ath_diag atd;
struct _athstats cur;
struct _athstats total;
@@ -455,7 +456,8 @@ ath_setifname(struct athstatfoo *wf0, const char *ifname)
{
struct athstatfoo_p *wf = (struct athstatfoo_p *) wf0;
- strncpy(wf->ifr.ifr_name, ifname, sizeof (wf->ifr.ifr_name));
+ ath_driver_req_close(&wf->req);
+ (void) ath_driver_req_open(&wf->req, ifname);
#ifdef ATH_SUPPORT_ANI
strncpy(wf->atd.ad_name, ifname, sizeof (wf->atd.ad_name));
wf->optstats |= ATHSTATS_ANI;
@@ -467,30 +469,34 @@ ath_zerostats(struct athstatfoo *wf0)
{
struct athstatfoo_p *wf = (struct athstatfoo_p *) wf0;
- if (ioctl(wf->s, SIOCZATHSTATS, &wf->ifr) < 0)
- err(-1, "ioctl: %s", wf->ifr.ifr_name);
+ if (ath_driver_req_zero_stats(&wf->req) < 0)
+ exit(-1);
}
static void
ath_collect(struct athstatfoo_p *wf, struct _athstats *stats)
{
- wf->ifr.ifr_data = (caddr_t) &stats->ath;
- if (ioctl(wf->s, SIOCGATHSTATS, &wf->ifr) < 0)
- err(1, "ioctl: %s", wf->ifr.ifr_name);
+
+ if (ath_driver_req_fetch_stats(&wf->req, &stats->ath) < 0)
+ exit(1);
#ifdef ATH_SUPPORT_ANI
if (wf->optstats & ATHSTATS_ANI) {
+
+ /* XXX TODO: convert */
wf->atd.ad_id = HAL_DIAG_ANI_CURRENT; /* HAL_DIAG_ANI_CURRENT */
wf->atd.ad_out_data = (caddr_t) &stats->ani_state;
wf->atd.ad_out_size = sizeof(stats->ani_state);
- if (ioctl(wf->s, SIOCGATHDIAG, &wf->atd) < 0) {
- warn("ioctl: %s", wf->atd.ad_name);
+ if (ath_driver_req_fetch_diag(&wf->req, SIOCGATHDIAG,
+ &wf->atd) < 0) {
wf->optstats &= ~ATHSTATS_ANI;
}
+
+ /* XXX TODO: convert */
wf->atd.ad_id = HAL_DIAG_ANI_STATS; /* HAL_DIAG_ANI_STATS */
wf->atd.ad_out_data = (caddr_t) &stats->ani_stats;
wf->atd.ad_out_size = sizeof(stats->ani_stats);
- if (ioctl(wf->s, SIOCGATHDIAG, &wf->atd) < 0)
- warn("ioctl: %s", wf->atd.ad_name);
+ (void) ath_driver_req_fetch_diag(&wf->req, SIOCGATHDIAG,
+ &wf->atd);
}
#endif /* ATH_SUPPORT_ANI */
}
@@ -1064,6 +1070,7 @@ athstats_new(const char *ifname, const char *fmtstring)
wf = calloc(1, sizeof(struct athstatfoo_p));
if (wf != NULL) {
+ ath_driver_req_init(&wf->req);
bsdstat_init(&wf->base.base, "athstats", athstats,
nitems(athstats));
/* override base methods */
@@ -1083,10 +1090,6 @@ athstats_new(const char *ifname, const char *fmtstring)
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");
-
ath_setifname(&wf->base, ifname);
wf->base.setfmt(&wf->base, fmtstring);
}
diff --git a/tools/tools/ath/common/ctrl.c b/tools/tools/ath/common/ctrl.c
new file mode 100644
index 0000000..e5de77d
--- /dev/null
+++ b/tools/tools/ath/common/ctrl.c
@@ -0,0 +1,218 @@
+/*-
+ * Copyright (c) 2016 Adrian Chadd <adrian@FreeBSD.org>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * This is a simple abstraction of the control channel used to access
+ * device specific data.
+ *
+ * In the past it used a ifnet socket on athX, but since those devices
+ * are now gone, they can use wlanX. However, there are debug cases
+ * where you'll instead want to talk to the hardware before any VAPs are
+ * up, so we should also handle the case of talking to /dev/athX.
+ *
+ * For now this'll be a drop-in replacement for the existing ioctl()
+ * based method until the /dev/athX (and associated new ioctls) land
+ * in the tree.
+ */
+
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/sockio.h>
+#include <sys/socket.h>
+
+#include <net/if.h>
+#include <net/if_media.h>
+#include <net/if_var.h>
+
+#include <err.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "ah.h"
+#include "ah_desc.h"
+#include "net80211/ieee80211_ioctl.h"
+#include "net80211/ieee80211_radiotap.h"
+#include "if_athioctl.h"
+#include "if_athrate.h"
+
+#include "ctrl.h"
+
+int
+ath_driver_req_init(struct ath_driver_req *req)
+{
+
+ bzero(req, sizeof(*req));
+ req->s = -1;
+ return (0);
+}
+
+/*
+ * Open a suitable file descriptor and populate the relevant interface
+ * information for ioctls.
+ *
+ * For file path based access the ifreq isn't required; it'll just be
+ * a direct ioctl on the file descriptor.
+ */
+int
+ath_driver_req_open(struct ath_driver_req *req, const char *ifname)
+{
+ int s;
+
+ if (s != -1)
+ ath_driver_req_close(req);
+
+ /* For now, netif socket, not /dev/ filedescriptor */
+ s = socket(AF_INET, SOCK_DGRAM, 0);
+ if (s < 0) {
+ warn("%s: socket", __func__);
+ return (-1);
+ }
+ req->ifname = strdup(ifname);
+ req->s = s;
+
+ return (0);
+}
+
+/*
+ * Close an open descriptor.
+ */
+int
+ath_driver_req_close(struct ath_driver_req *req)
+{
+ if (req->s == -1)
+ return (0);
+ close(req->s);
+ free(req->ifname);
+ req->s = -1;
+ req->ifname = NULL;
+ return (0);
+}
+
+/*
+ * Issue a diagnostic API request.
+ */
+int
+ath_driver_req_fetch_diag(struct ath_driver_req *req, unsigned long cmd,
+ struct ath_diag *ad)
+{
+ int ret;
+
+ ret = ioctl(req->s, cmd, ad);
+ if (ret < 0)
+ warn("%s: ioctl", __func__);
+ return (ret);
+}
+
+/*
+ * Issue a zero statistics API request.
+ */
+int
+ath_driver_req_zero_stats(struct ath_driver_req *req)
+{
+ struct ifreq ifr;
+ int ret;
+
+ /* Setup ifreq */
+ bzero(&ifr, sizeof(ifr));
+ strncpy(ifr.ifr_name, req->ifname, sizeof (ifr.ifr_name));
+ ifr.ifr_data = NULL;
+
+ /* ioctl */
+ ret = ioctl(req->s, SIOCZATHSTATS, &ifr);
+ if (ret < 0)
+ warn("%s: ioctl", __func__);
+ return (ret);
+}
+
+/*
+ * Fetch general statistics.
+ */
+int
+ath_driver_req_fetch_stats(struct ath_driver_req *req, struct ath_stats *st)
+{
+ struct ifreq ifr;
+ int ret;
+
+ /* Setup ifreq */
+ bzero(&ifr, sizeof(ifr));
+ strncpy(ifr.ifr_name, req->ifname, sizeof (ifr.ifr_name));
+ ifr.ifr_data = (caddr_t) st;
+
+ /* ioctl */
+ ret = ioctl(req->s, SIOCGATHSTATS, &ifr);
+ if (ret < 0)
+ warn("%s: ioctl", __func__);
+ return (ret);
+}
+
+/*
+ * Fetch aggregate statistics.
+ */
+int
+ath_drive_req_fetch_aggr_stats(struct ath_driver_req *req,
+ struct ath_tx_aggr_stats *tx)
+{
+ struct ifreq ifr;
+ int ret;
+
+ /* Setup ifreq */
+ bzero(&ifr, sizeof(ifr));
+ strncpy(ifr.ifr_name, req->ifname, sizeof (ifr.ifr_name));
+ ifr.ifr_data = (caddr_t) tx;
+
+ /* ioctl */
+ ret = ioctl(req->s, SIOCGATHAGSTATS, &ifr);
+ if (ret < 0)
+ warn("%s: ioctl", __func__);
+ return (ret);
+
+}
+
+/*
+ * Fetch rate control statistics.
+ *
+ * Caller has to populate the interface name and MAC address.
+ */
+int
+ath_drive_req_fetch_ratectrl_stats(struct ath_driver_req *req,
+ struct ath_rateioctl *r)
+{
+ int ret;
+
+ /* ioctl */
+ ret = ioctl(req->s, SIOCGATHNODERATESTATS, r);
+ if (ret < 0)
+ warn("%s: ioctl", __func__);
+ return (ret);
+}
diff --git a/tools/tools/ath/common/ctrl.h b/tools/tools/ath/common/ctrl.h
new file mode 100644
index 0000000..ca95e58
--- /dev/null
+++ b/tools/tools/ath/common/ctrl.h
@@ -0,0 +1,59 @@
+/*-
+ * Copyright (c) 2016 Adrian Chadd <adrian@FreeBSD.org>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD$
+ */
+#ifndef __ATH_CTRL_H__
+#define __ATH_CTRL_H__
+
+struct ath_stats;
+struct ath_diag;
+struct ath_tx_aggr_stats;
+struct ath_rateioctl;
+
+struct ath_driver_req {
+ /* Open socket, or -1 */
+ int s;
+ /* The interface name in question */
+ char *ifname;
+};
+
+extern int ath_driver_req_init(struct ath_driver_req *req);
+extern int ath_driver_req_open(struct ath_driver_req *req, const char *ifname);
+extern int ath_driver_req_close(struct ath_driver_req *req);
+extern int ath_driver_req_fetch_diag(struct ath_driver_req *req,
+ unsigned long cmd, struct ath_diag *ad);
+extern int ath_driver_req_zero_stats(struct ath_driver_req *req);
+extern int ath_driver_req_fetch_stats(struct ath_driver_req *req,
+ struct ath_stats *st);
+extern int ath_drive_req_fetch_aggr_stats(struct ath_driver_req *req,
+ struct ath_tx_aggr_stats *tx);
+extern int ath_drive_req_fetch_ratectrl_stats(struct ath_driver_req *req,
+ struct ath_rateioctl *r);
+
+#endif
diff --git a/tools/tools/cxgbetool/cxgbetool.c b/tools/tools/cxgbetool/cxgbetool.c
index da04099..d634af2 100644
--- a/tools/tools/cxgbetool/cxgbetool.c
+++ b/tools/tools/cxgbetool/cxgbetool.c
@@ -446,47 +446,47 @@ do_show_info_header(uint32_t mode)
{
uint32_t i;
- printf ("%4s %8s", "Idx", "Hits");
+ printf("%4s %8s", "Idx", "Hits");
for (i = T4_FILTER_FCoE; i <= T4_FILTER_IP_FRAGMENT; i <<= 1) {
switch (mode & i) {
case T4_FILTER_FCoE:
- printf (" FCoE");
+ printf(" FCoE");
break;
case T4_FILTER_PORT:
- printf (" Port");
+ printf(" Port");
break;
case T4_FILTER_VNIC:
- printf (" vld:VNIC");
+ printf(" vld:VNIC");
break;
case T4_FILTER_VLAN:
- printf (" vld:VLAN");
+ printf(" vld:VLAN");
break;
case T4_FILTER_IP_TOS:
- printf (" TOS");
+ printf(" TOS");
break;
case T4_FILTER_IP_PROTO:
- printf (" Prot");
+ printf(" Prot");
break;
case T4_FILTER_ETH_TYPE:
- printf (" EthType");
+ printf(" EthType");
break;
case T4_FILTER_MAC_IDX:
- printf (" MACIdx");
+ printf(" MACIdx");
break;
case T4_FILTER_MPS_HIT_TYPE:
- printf (" MPS");
+ printf(" MPS");
break;
case T4_FILTER_IP_FRAGMENT:
- printf (" Frag");
+ printf(" Frag");
break;
default:
@@ -866,7 +866,7 @@ get_filter_mode(void)
if (mode & T4_FILTER_IP_SADDR)
printf("sip ");
-
+
if (mode & T4_FILTER_IP_DADDR)
printf("dip ");
OpenPOWER on IntegriCloud