From 7e6013611d4d8ef423a4f61a019e49d9c7783370 Mon Sep 17 00:00:00 2001 From: jhb Date: Fri, 4 Nov 2016 18:16:00 +0000 Subject: [PATCH] MFC 287297,296236: Cleanups to cxgbetool. 287297: - Replace N(a)/N(i)/N(T)/LEN(a)/ARRAY_SIZE(a) with nitems() - Add missing for err() and 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 git-svn-id: svn://svn.freebsd.org/base/stable/10@308303 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- tools/tools/cxgbetool/cxgbetool.c | 60 +++++++++++++++---------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/tools/tools/cxgbetool/cxgbetool.c b/tools/tools/cxgbetool/cxgbetool.c index bb27cdbd3..d634af224 100644 --- a/tools/tools/cxgbetool/cxgbetool.c +++ b/tools/tools/cxgbetool/cxgbetool.c @@ -28,29 +28,30 @@ #include __FBSDID("$FreeBSD$"); -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include #include -#include #include #include -#include -#include + #include +#include #include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #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 "); -- 2.45.0