summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2016-11-04 18:16:00 +0000
committerjhb <jhb@FreeBSD.org>2016-11-04 18:16:00 +0000
commitd0d0f648f604c9ca282aed80a50a7aa1bcdc72df (patch)
tree1741f8e4e6fb1f047a7dbcfbb6bb374aa897d969 /tools
parent70abead4e0230e093e460214ec210f8842f0f59f (diff)
downloadFreeBSD-src-d0d0f648f604c9ca282aed80a50a7aa1bcdc72df.zip
FreeBSD-src-d0d0f648f604c9ca282aed80a50a7aa1bcdc72df.tar.gz
MFC 287297,296236: Cleanups to cxgbetool.
287297: - Replace N(a)/N(i)/N(T)/LEN(a)/ARRAY_SIZE(a) with nitems() - Add missing <err.h> for err() and <sys/sysctl.h> for sysctlbyname() - NULL -> 0 for 5th parameter of sysctlbyname() Note, the original commit touched several files under tools/tools, but this commit only includes changes to cxgbetool. 296236: Fix some whitespace nits in cxgbetool.c. No functional change. Sponsored by: Chelsio Communications
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/cxgbetool/cxgbetool.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/tools/tools/cxgbetool/cxgbetool.c b/tools/tools/cxgbetool/cxgbetool.c
index bb27cdb..d634af2 100644
--- a/tools/tools/cxgbetool/cxgbetool.c
+++ b/tools/tools/cxgbetool/cxgbetool.c
@@ -28,29 +28,30 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <errno.h>
-#include <err.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
+#include <sys/param.h>
#include <sys/ioctl.h>
-#include <limits.h>
#include <sys/mman.h>
-#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
-#include <net/ethernet.h>
-#include <netinet/in.h>
+
#include <arpa/inet.h>
+#include <net/ethernet.h>
#include <net/sff8472.h>
+#include <netinet/in.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include "t4_ioctl.h"
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#define in_range(val, lo, hi) ( val < 0 || (val <= hi && val >= lo))
#define max(x, y) ((x) > (y) ? (x) : (y))
@@ -345,7 +346,7 @@ dump_regs_t4(int argc, const char *argv[], const uint32_t *regs)
T4_MODREGS(xgmac)
};
- return dump_regs_table(argc, argv, regs, t4_mod, ARRAY_SIZE(t4_mod));
+ return dump_regs_table(argc, argv, regs, t4_mod, nitems(t4_mod));
}
#undef T4_MODREGS
@@ -360,8 +361,7 @@ dump_regs_t4vf(int argc, const char *argv[], const uint32_t *regs)
{ "cim", t4vf_cim_regs },
};
- return dump_regs_table(argc, argv, regs, t4vf_mod,
- ARRAY_SIZE(t4vf_mod));
+ return dump_regs_table(argc, argv, regs, t4vf_mod, nitems(t4vf_mod));
}
#define T5_MODREGS(name) { #name, t5_##name##_regs }
@@ -398,7 +398,7 @@ dump_regs_t5(int argc, const char *argv[], const uint32_t *regs)
{ "hma", t5_hma_t5_regs }
};
- return dump_regs_table(argc, argv, regs, t5_mod, ARRAY_SIZE(t5_mod));
+ return dump_regs_table(argc, argv, regs, t5_mod, nitems(t5_mod));
}
#undef T5_MODREGS
@@ -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