summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2020-03-04 11:34:31 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2020-03-04 11:34:31 +0000
commitc175f5f01ce89aee1b6fd2e10a595027710c9832 (patch)
treed7e810d8438c73ff1f705f851dea54fc2f1f8be2
parent8b3260f28797ca8e7c1d1573394f2eaa32abb5be (diff)
parent3d349c3119b5b6e21daba1ce004cf4625b25d67f (diff)
downloadillumos-joyent-c175f5f01ce89aee1b6fd2e10a595027710c9832.tar.gz
[illumos-gate merge]
commit 3d349c3119b5b6e21daba1ce004cf4625b25d67f 12342 bandwidth display badly formatted in flowstat, dlstat, and dladm commit 9dc2843d4266243e87f5d9de7a90b86235a6da08 4508 flowadm not working as documented, or documentation incorrect 4538 flowadm man page does not list lport and rport as output fields for show-flow 7210 flowadm does not have show-usage command described in the manual page commit bc576fff266b5ed3db0ef5d8196b7440cdefbb8b 12325 ahci: variable may be used uninitialized commit 45948e49c407e4fc264fdd289ed632d6639e009d 11493 aggr needs support for multiple pseudo rx groups commit b69c34dad3717624ff6b4f32b71014ee05b6a678 12271 "name" member of "struct option" should be const commit 84de666edc7f7d835057ae4807a387447c086bcf 11490 SRS ring polling disabled for VLANs 11491 Want DLS bypass for VLAN traffic 11492 add VLVF bypass to ixgbe core 2869 duplicate packets with vnics over aggrs 11489 DLS stat delete and aggr kstat can deadlock commit 20f5062b9c5143e4b4bd21245fcebdb21d40c08c 12344 zpool iostat output formatting error Conflicts: usr/src/uts/common/sys/mac_impl.h usr/src/uts/common/io/mac/mac_datapath_setup.c usr/src/uts/common/io/mac/mac.c usr/src/uts/common/io/ixgbe/ixgbe_sw.h usr/src/uts/common/io/ixgbe/ixgbe_main.c usr/src/uts/common/io/aggr/aggr_grp.c usr/src/man/man1m/flowadm.1m
-rw-r--r--usr/src/cmd/dladm/dladm.c9
-rw-r--r--usr/src/cmd/dlstat/dlstat.c26
-rw-r--r--usr/src/cmd/flowstat/flowstat.c16
-rw-r--r--usr/src/cmd/iscsiadm/cmdparse.c10
-rw-r--r--usr/src/cmd/isns/isnsadm/cmdparse.c9
-rw-r--r--usr/src/cmd/mpathadm/cmdparse.c10
-rw-r--r--usr/src/cmd/zpool/zpool_main.c3
-rw-r--r--usr/src/common/cmdparse/cmdparse.c8
-rw-r--r--usr/src/head/getopt.h16
-rw-r--r--usr/src/lib/libdladm/common/libdladm.c44
-rw-r--r--usr/src/man/man1m/flowadm.1m392
-rw-r--r--usr/src/uts/common/io/aggr/aggr_grp.c5
-rw-r--r--usr/src/uts/common/io/aggr/aggr_port.c2
-rw-r--r--usr/src/uts/common/io/ixgbe/ixgbe_main.c10
-rw-r--r--usr/src/uts/common/io/ixgbe/ixgbe_sw.h1
-rw-r--r--usr/src/uts/common/io/mac/mac.c30
-rw-r--r--usr/src/uts/common/io/mac/mac_datapath_setup.c2
-rw-r--r--usr/src/uts/common/io/mac/mac_provider.c2
-rw-r--r--usr/src/uts/common/io/mac/mac_stat.c16
-rw-r--r--usr/src/uts/common/io/sata/adapters/ahci/ahci.c4
-rw-r--r--usr/src/uts/common/io/vnic/vnic_dev.c4
-rw-r--r--usr/src/uts/common/sys/mac_client_impl.h2
-rw-r--r--usr/src/uts/common/sys/mac_impl.h48
-rw-r--r--usr/src/uts/common/sys/mac_provider.h12
-rw-r--r--usr/src/uts/sun4v/io/vnet.c10
25 files changed, 302 insertions, 389 deletions
diff --git a/usr/src/cmd/dladm/dladm.c b/usr/src/cmd/dladm/dladm.c
index 92f3bfb665..a69b3da081 100644
--- a/usr/src/cmd/dladm/dladm.c
+++ b/usr/src/cmd/dladm/dladm.c
@@ -23,6 +23,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2017 Joyent, Inc.
* Copyright 2016 Nexenta Systems, Inc.
+ * Copyright 2020 Peter Tribble.
*/
#include <stdio.h>
@@ -1148,7 +1149,7 @@ typedef struct usage_fields_buf_s {
char usage_rbytes[10];
char usage_opackets[9];
char usage_obytes[10];
- char usage_bandwidth[14];
+ char usage_bandwidth[15];
} usage_fields_buf_t;
static const ofmt_field_t usage_fields[] = {
@@ -1164,7 +1165,7 @@ static const ofmt_field_t usage_fields[] = {
offsetof(usage_fields_buf_t, usage_opackets), print_default_cb},
{ "OBYTES", 11,
offsetof(usage_fields_buf_t, usage_obytes), print_default_cb},
-{ "BANDWIDTH", 15,
+{ "BANDWIDTH", 16,
offsetof(usage_fields_buf_t, usage_bandwidth), print_default_cb},
{ NULL, 0, 0, NULL}}
;
@@ -1180,7 +1181,7 @@ typedef struct usage_l_fields_buf_s {
char usage_l_etime[13];
char usage_l_rbytes[8];
char usage_l_obytes[8];
- char usage_l_bandwidth[14];
+ char usage_l_bandwidth[15];
} usage_l_fields_buf_t;
static const ofmt_field_t usage_l_fields[] = {
@@ -1195,7 +1196,7 @@ static const ofmt_field_t usage_l_fields[] = {
offsetof(usage_l_fields_buf_t, usage_l_rbytes), print_default_cb},
{ "OBYTES", 9,
offsetof(usage_l_fields_buf_t, usage_l_obytes), print_default_cb},
-{ "BANDWIDTH", 15,
+{ "BANDWIDTH", 16,
offsetof(usage_l_fields_buf_t, usage_l_bandwidth), print_default_cb},
{ NULL, 0, 0, NULL}}
;
diff --git a/usr/src/cmd/dlstat/dlstat.c b/usr/src/cmd/dlstat/dlstat.c
index 8c1749475b..d11e623206 100644
--- a/usr/src/cmd/dlstat/dlstat.c
+++ b/usr/src/cmd/dlstat/dlstat.c
@@ -27,6 +27,10 @@
* Copyright 2017 Joyent, Inc.
*/
+/*
+ * Copyright 2020 Peter Tribble.
+ */
+
#include <stdio.h>
#include <ctype.h>
#include <locale.h>
@@ -417,7 +421,7 @@ typedef struct history_fields_buf_s {
char h_rbytes[10];
char h_opackets[9];
char h_obytes[10];
- char h_bandwidth[14];
+ char h_bandwidth[15];
} history_fields_buf_t;
static ofmt_field_t history_fields[] = {
@@ -433,7 +437,7 @@ static ofmt_field_t history_fields[] = {
offsetof(history_fields_buf_t, h_opackets), print_default_cb},
{ "OBYTES", 11,
offsetof(history_fields_buf_t, h_obytes), print_default_cb},
-{ "BANDWIDTH", 15,
+{ "BANDWIDTH", 16,
offsetof(history_fields_buf_t, h_bandwidth), print_default_cb},
{ NULL, 0, 0, NULL}};
@@ -446,7 +450,7 @@ typedef struct history_l_fields_buf_s {
char hl_etime[13];
char hl_rbytes[8];
char hl_obytes[8];
- char hl_bandwidth[14];
+ char hl_bandwidth[15];
} history_l_fields_buf_t;
static ofmt_field_t history_l_fields[] = {
@@ -461,7 +465,7 @@ static ofmt_field_t history_l_fields[] = {
offsetof(history_l_fields_buf_t, hl_rbytes), print_default_cb},
{ "OBYTES", 9,
offsetof(history_l_fields_buf_t, hl_obytes), print_default_cb},
-{ "BANDWIDTH", 15,
+{ "BANDWIDTH", 16,
offsetof(history_l_fields_buf_t, hl_bandwidth), print_default_cb},
{ NULL, 0, 0, NULL}}
;
@@ -569,7 +573,7 @@ show_history_time(dladm_usage_t *history, void *arg)
{
show_history_state_t *state = arg;
char buf[DLADM_STRSIZE];
- history_l_fields_buf_t ubuf;
+ history_l_fields_buf_t ubuf;
time_t time;
double bw;
dladm_status_t status;
@@ -754,7 +758,7 @@ do_show_history(int argc, char *argv[], const char *use)
die("show-link -h requires a file");
if (optind == (argc-1)) {
- uint32_t flags;
+ uint32_t flags;
resource = argv[optind];
if (!state.hs_showall &&
@@ -1500,7 +1504,7 @@ static int
show_queried_stats(dladm_handle_t dh, datalink_id_t linkid, void *arg)
{
show_state_t *state = arg;
- int i;
+ int i;
dladm_stat_chain_t *diff_stat;
char linkname[DLPI_LINKNAME_MAX];
char zonename[DLADM_PROP_VAL_MAX + 1];
@@ -1654,7 +1658,7 @@ do_show(int argc, char *argv[], const char *use)
ofmt_handle_t ofmt;
ofmt_status_t oferr;
uint_t ofmtflags = OFMT_RIGHTJUST;
- ofmt_field_t *oftemplate;
+ ofmt_field_t *oftemplate;
bzero(&state, sizeof (state));
opterr = 0;
@@ -1855,7 +1859,7 @@ do_show_phys(int argc, char *argv[], const char *use)
ofmt_handle_t ofmt;
ofmt_status_t oferr;
uint_t ofmtflags = OFMT_RIGHTJUST;
- ofmt_field_t *oftemplate;
+ ofmt_field_t *oftemplate;
bzero(&state, sizeof (state));
opterr = 0;
@@ -2037,7 +2041,7 @@ do_show_link(int argc, char *argv[], const char *use)
ofmt_handle_t ofmt;
ofmt_status_t oferr;
uint_t ofmtflags = OFMT_RIGHTJUST;
- ofmt_field_t *oftemplate;
+ ofmt_field_t *oftemplate;
bzero(&state, sizeof (state));
opterr = 0;
@@ -2242,7 +2246,7 @@ do_show_aggr(int argc, char *argv[], const char *use)
ofmt_handle_t ofmt;
ofmt_status_t oferr;
uint_t ofmtflags = OFMT_RIGHTJUST;
- ofmt_field_t *oftemplate;
+ ofmt_field_t *oftemplate;
bzero(&state, sizeof (state));
opterr = 0;
diff --git a/usr/src/cmd/flowstat/flowstat.c b/usr/src/cmd/flowstat/flowstat.c
index e772470f9d..a0e2b85f32 100644
--- a/usr/src/cmd/flowstat/flowstat.c
+++ b/usr/src/cmd/flowstat/flowstat.c
@@ -31,6 +31,10 @@
* Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
*/
+/*
+ * Copyright 2020 Peter Tribble.
+ */
+
#include <stdio.h>
#include <locale.h>
#include <stdarg.h>
@@ -139,7 +143,7 @@ typedef struct history_fields_buf_s {
char history_rbytes[10];
char history_opackets[9];
char history_obytes[10];
- char history_bandwidth[14];
+ char history_bandwidth[15];
} history_fields_buf_t;
static ofmt_field_t history_fields[] = {
@@ -156,7 +160,7 @@ static ofmt_field_t history_fields[] = {
offsetof(history_fields_buf_t, history_opackets), print_default_cb},
{ "OBYTES", 11,
offsetof(history_fields_buf_t, history_obytes), print_default_cb},
-{ "BANDWIDTH", 15,
+{ "BANDWIDTH", 16,
offsetof(history_fields_buf_t, history_bandwidth), print_default_cb},
NULL_OFMT}
;
@@ -167,7 +171,7 @@ typedef struct history_l_fields_buf_s {
char history_l_etime[13];
char history_l_rbytes[8];
char history_l_obytes[8];
- char history_l_bandwidth[14];
+ char history_l_bandwidth[15];
} history_l_fields_buf_t;
static ofmt_field_t history_l_fields[] = {
@@ -182,7 +186,7 @@ static ofmt_field_t history_l_fields[] = {
offsetof(history_l_fields_buf_t, history_l_rbytes), print_default_cb},
{ "OBYTES", 9,
offsetof(history_l_fields_buf_t, history_l_obytes), print_default_cb},
-{ "BANDWIDTH", 15,
+{ "BANDWIDTH", 16,
offsetof(history_l_fields_buf_t, history_l_bandwidth),
print_default_cb},
NULL_OFMT}
@@ -544,7 +548,7 @@ dump_all_flow_stats(dladm_flow_attr_t *attrp, void *arg, datalink_id_t linkid,
int
main(int argc, char *argv[])
{
- dladm_status_t status;
+ dladm_status_t status;
int option;
boolean_t r_arg = B_FALSE;
boolean_t t_arg = B_FALSE;
@@ -790,7 +794,7 @@ show_history_time(dladm_usage_t *history, void *arg)
{
show_history_state_t *state = (show_history_state_t *)arg;
char buf[DLADM_STRSIZE];
- history_l_fields_buf_t ubuf;
+ history_l_fields_buf_t ubuf;
time_t time;
double bw;
dladm_flow_attr_t attr;
diff --git a/usr/src/cmd/iscsiadm/cmdparse.c b/usr/src/cmd/iscsiadm/cmdparse.c
index 882ff3c673..b1a2f84692 100644
--- a/usr/src/cmd/iscsiadm/cmdparse.c
+++ b/usr/src/cmd/iscsiadm/cmdparse.c
@@ -23,6 +23,10 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright 2020 Joyent Inc.
+ */
+
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
@@ -70,7 +74,7 @@ static void subUsage(uint_t, subcommand_t *);
static void subUsageObject(uint_t, subcommand_t *, object_t *);
static int getObject(char *, object_t **);
static int getObjectRules(uint_t, objectRules_t **);
-static char *getLongOption(int);
+static const char *getLongOption(int);
static optionProp_t *getOptions(uint_t, uint_t);
static char *getOptionArgDesc(int);
extern void seeMan(void);
@@ -208,7 +212,7 @@ getOptions(uint_t object, uint_t subcommand)
* on success, long option name
* on failure, NULL
*/
-static char *
+static const char *
getLongOption(int shortOption)
{
struct option *op;
@@ -319,7 +323,7 @@ subUsageObject(uint_t usageType, subcommand_t *subcommand, object_t *objp)
opCmd_t *opCmd = NULL;
optionProp_t *options;
char *optionArgDesc;
- char *longOpt;
+ const char *longOpt;
if (getObjectRules(objp->value, &objRules) != 0) {
diff --git a/usr/src/cmd/isns/isnsadm/cmdparse.c b/usr/src/cmd/isns/isnsadm/cmdparse.c
index ccad6df26c..7303b347ac 100644
--- a/usr/src/cmd/isns/isnsadm/cmdparse.c
+++ b/usr/src/cmd/isns/isnsadm/cmdparse.c
@@ -22,6 +22,9 @@
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright 2020 Joyent Inc.
+ */
#include <stdlib.h>
#include <stdio.h>
@@ -69,7 +72,7 @@ static int getSubcommandProps(char *, subCommandProps_t **);
static char *getExecBasename(char *);
static void usage(uint_t);
static void subUsage(uint_t, subCommandProps_t *);
-static char *getLongOption(int);
+static const char *getLongOption(int);
static char *getOptionArgDesc(int);
/* global data */
@@ -119,7 +122,7 @@ getSubcommandProps(char *subCommand, subCommandProps_t **subCommandProps)
* on success, long option name
* on failure, NULL
*/
-static char *
+static const char *
getLongOption(int shortOption)
{
struct option *op;
@@ -169,7 +172,7 @@ subUsage(uint_t usageType, subCommandProps_t *subcommand)
{
int i;
char *optionArgDesc;
- char *longOpt;
+ const char *longOpt;
if (usageType == GENERAL_USAGE) {
(void) printf("%s:\t%s %s [", gettext("Usage"), commandName,
diff --git a/usr/src/cmd/mpathadm/cmdparse.c b/usr/src/cmd/mpathadm/cmdparse.c
index 9080e1cfdd..c4c2dd744a 100644
--- a/usr/src/cmd/mpathadm/cmdparse.c
+++ b/usr/src/cmd/mpathadm/cmdparse.c
@@ -22,6 +22,10 @@
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright 2020 Joyent Inc.
+ */
+
#include <stdlib.h>
#include <stdio.h>
@@ -70,7 +74,7 @@ static void subUsage(uint_t, subcommand_t *);
static void subUsageObject(uint_t, subcommand_t *, object_t *);
static int getObject(char *, object_t **);
static int getObjectRules(uint_t, objectRules_t **);
-static char *getLongOption(int);
+static const char *getLongOption(int);
static optionProp_t *getOptions(uint_t, uint_t);
static char *getOptionArgDesc(int);
@@ -207,7 +211,7 @@ getOptions(uint_t object, uint_t subcommand)
* on success, long option name
* on failure, NULL
*/
-static char *
+static const char *
getLongOption(int shortOption)
{
struct option *op;
@@ -317,7 +321,7 @@ subUsageObject(uint_t usageType, subcommand_t *subcommand, object_t *objp)
opCmd_t *opCmd = NULL;
optionProp_t *options;
char *optionArgDesc;
- char *longOpt;
+ const char *longOpt;
if (getObjectRules(objp->value, &objRules) != 0) {
diff --git a/usr/src/cmd/zpool/zpool_main.c b/usr/src/cmd/zpool/zpool_main.c
index 7242a156c7..31ce0c7e11 100644
--- a/usr/src/cmd/zpool/zpool_main.c
+++ b/usr/src/cmd/zpool/zpool_main.c
@@ -350,7 +350,7 @@ get_usage(zpool_help_t idx)
case HELP_IOSTAT:
return (gettext("\tiostat "
"[[-lq]|[-rw]] [-T d | u] [-ghHLpPvy]\n"
- "\t [pool] ..."
+ "\t [[pool] ...]|[pool vdev ...]|[vdev ...]]"
" [[-n] interval [count]]\n"));
case HELP_LABELCLEAR:
return (gettext("\tlabelclear [-f] <vdev>\n"));
@@ -4987,6 +4987,7 @@ zpool_do_iostat(int argc, char **argv)
cb.cb_vdev_names_count)) &&
!cb.cb_scripted) {
print_iostat_separator(&cb);
+ printf("\n");
}
}
diff --git a/usr/src/common/cmdparse/cmdparse.c b/usr/src/common/cmdparse/cmdparse.c
index 07ad6ed13a..bc55dc8dce 100644
--- a/usr/src/common/cmdparse/cmdparse.c
+++ b/usr/src/common/cmdparse/cmdparse.c
@@ -24,7 +24,7 @@
*/
/*
- * Copyright (c) 2018, Joyent, Inc.
+ * Copyright 2020 Joyent Inc.
*/
#include <stdlib.h>
@@ -71,7 +71,7 @@ static int getSubcommandProps(char *, subCommandProps_t **);
static char *getExecBasename(char *);
static void usage(uint_t);
static void subUsage(uint_t, subCommandProps_t *);
-static char *getLongOption(int);
+static const char *getLongOption(int);
static char *getOptionArgDesc(int);
/* global data */
@@ -121,7 +121,7 @@ getSubcommandProps(char *subCommand, subCommandProps_t **subCommandProps)
* on success, long option name
* on failure, NULL
*/
-static char *
+static const char *
getLongOption(int shortOption)
{
struct option *op;
@@ -171,7 +171,7 @@ subUsage(uint_t usageType, subCommandProps_t *subcommand)
{
int i;
char *optionArgDesc;
- char *longOpt;
+ const char *longOpt;
if (usageType == GENERAL_USAGE) {
(void) printf("%s:\t%s %s [", gettext("Usage"), commandName,
diff --git a/usr/src/head/getopt.h b/usr/src/head/getopt.h
index adf98d096c..2b72c23ddc 100644
--- a/usr/src/head/getopt.h
+++ b/usr/src/head/getopt.h
@@ -27,6 +27,10 @@
*/
/*
+ * Copyright 2020 Joyent Inc.
+ */
+
+/*
* GNU-like getopt_long(), getopt_long_only().
* Solaris-specific getopt_clip().
*/
@@ -49,11 +53,13 @@ extern "C" {
#define optional_argument 2
struct option {
- char *name; /* name of long option */
- int has_arg; /* whether option takes an argument */
- int *flag; /* if not NULL, set *flag to val when option found */
- int val; /* if flag is not NULL, value to set *flag to. */
- /* if flag is NULL, return value */
+ const char *name; /* name of long option */
+ int has_arg; /* whether option takes an argument */
+ int *flag; /* if not NULL, set *flag to val when option */
+ /* found */
+ int val; /* if flag is not NULL, value to set *flag */
+ /* to. */
+ /* if flag is NULL, return value */
};
/*
diff --git a/usr/src/lib/libdladm/common/libdladm.c b/usr/src/lib/libdladm/common/libdladm.c
index d0a34ef23d..5f98de4e70 100644
--- a/usr/src/lib/libdladm/common/libdladm.c
+++ b/usr/src/lib/libdladm/common/libdladm.c
@@ -27,6 +27,10 @@
* Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
*/
+/*
+ * Copyright 2020 Peter Tribble.
+ */
+
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
@@ -70,23 +74,23 @@ static media_type_t media_type_table[] = {
{ DL_HDLC, "HDLC" },
{ DL_CHAR, "SyncCharacter" },
{ DL_CTCA, "CTCA" },
- { DL_FDDI, "FDDI" },
- { DL_FC, "FiberChannel" },
- { DL_ATM, "ATM" },
- { DL_IPATM, "ATM(ClassicIP)" },
- { DL_X25, "X.25" },
- { DL_IPX25, "X.25(ClassicIP)" },
- { DL_ISDN, "ISDN" },
- { DL_HIPPI, "HIPPI" },
- { DL_100VG, "100BaseVGEthernet" },
- { DL_100VGTPR, "100BaseVGTokenRing" },
- { DL_ETH_CSMA, "IEEE802.3" },
- { DL_100BT, "100BaseT" },
- { DL_FRAME, "FrameRelay" },
- { DL_MPFRAME, "MPFrameRelay" },
- { DL_ASYNC, "AsyncCharacter" },
- { DL_IPNET, "IPNET" },
- { DL_OTHER, "Other" }
+ { DL_FDDI, "FDDI" },
+ { DL_FC, "FiberChannel" },
+ { DL_ATM, "ATM" },
+ { DL_IPATM, "ATM(ClassicIP)" },
+ { DL_X25, "X.25" },
+ { DL_IPX25, "X.25(ClassicIP)" },
+ { DL_ISDN, "ISDN" },
+ { DL_HIPPI, "HIPPI" },
+ { DL_100VG, "100BaseVGEthernet" },
+ { DL_100VGTPR, "100BaseVGTokenRing" },
+ { DL_ETH_CSMA, "IEEE802.3" },
+ { DL_100BT, "100BaseT" },
+ { DL_FRAME, "FrameRelay" },
+ { DL_MPFRAME, "MPFrameRelay" },
+ { DL_ASYNC, "AsyncCharacter" },
+ { DL_IPNET, "IPNET" },
+ { DL_OTHER, "Other" }
};
#define MEDIATYPECOUNT (sizeof (media_type_table) / sizeof (media_type_t))
@@ -594,11 +598,7 @@ dladm_bw2str(int64_t bw, char *buf)
kbps = (bw%1000000)/1000;
mbps = bw/1000000;
if (kbps != 0) {
- if (mbps == 0)
- (void) snprintf(buf, DLADM_STRSIZE, "0.%03u", kbps);
- else
- (void) snprintf(buf, DLADM_STRSIZE, "%5u.%03u", mbps,
- kbps);
+ (void) snprintf(buf, DLADM_STRSIZE, "%5u.%03u", mbps, kbps);
} else {
(void) snprintf(buf, DLADM_STRSIZE, "%5u", mbps);
}
diff --git a/usr/src/man/man1m/flowadm.1m b/usr/src/man/man1m/flowadm.1m
index 860d5f1faa..fcaa518a41 100644
--- a/usr/src/man/man1m/flowadm.1m
+++ b/usr/src/man/man1m/flowadm.1m
@@ -1,10 +1,11 @@
'\" te
+.\" Copyright 2020 Peter Tribble
.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
.\" Copyright (c) 2011, Joyent, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH FLOWADM 1M "April 9, 2016"
+.TH FLOWADM 1M "February 26, 2020"
.SH NAME
flowadm \- administer bandwidth resource control and priority for protocols,
services, containers, and virtual machines
@@ -30,14 +31,7 @@ services, containers, and virtual machines
[\fB-p\fR \fIprop\fR[,...]] [\fIflow\fR]
.fi
-.LP
-.nf
-\fBflowadm show-usage\fR [\fB-a\fR] [\fB-d\fR | {\fB-p\fR \fIplotfile\fR \fB-F\fR \fIformat\fR}] [\fB-s\fR \fItime\fR]
- [\fB-e\fR \fItime\fR] \fB-f\fR \fIfilename\fR [\fIflow\fR]
-.fi
-
.SH DESCRIPTION
-.LP
The \fBflowadm\fR command is used to create, modify, remove, and show
networking bandwidth and associated resources for a type of traffic on a
particular link.
@@ -62,7 +56,7 @@ Inbound and outbound packet are matched to flows in a very fast and scalable
way, so that limits can be enforced with minimal performance impact.
.sp
.LP
-The \fBflowadm\fR command can be used to identify a flow without imposing any
+The \fBflowadm\fR command can be used to define a flow without imposing any
bandwidth resource control. This would result in the traffic type getting its
own resources and queues so that it is isolated from rest of the networking
traffic for more observable and deterministic behavior.
@@ -71,7 +65,6 @@ traffic for more observable and deterministic behavior.
\fBflowadm\fR is implemented as a set of subcommands with corresponding
options. Options are described in the context of each subcommand.
.SH SUBCOMMANDS
-.LP
The following subcommands are supported:
.sp
.ne 2
@@ -80,140 +73,139 @@ The following subcommands are supported:
.ad
.sp .6
.RS 4n
-Show flow configuration information (the default) or statistics, either for all
-flows, all flows on a link, or for the specified \fIflow\fR.
+Adds a flow to the system. The flow is identified by its flow attributes and
+properties.
.sp
-.ne 2
-.na
-\fB\fB-o\fR \fIfield\fR[,...]\fR
-.ad
-.sp .6
-.RS 4n
-A case-insensitive, comma-separated list of output fields to display. The field
-name must be one of the fields listed below, or a special value \fBall\fR, to
-display all fields. For each flow found, the following fields can be displayed:
+As part of identifying a particular flow, its bandwidth resource can be limited
+and its relative priority to other traffic can be specified. If no bandwidth
+limit or priority is specified, the traffic still gets its unique layer 2, 3,
+and 4 queues and processing threads, including NIC hardware resources (when
+supported), so that the selected traffic can be separated from others and can
+flow with minimal impact from other traffic.
.sp
.ne 2
.na
-\fB\fBflow\fR\fR
+\fB\fB-t\fR, \fB--temporary\fR\fR
.ad
.sp .6
.RS 4n
-The name of the flow.
+The changes are temporary and will not persist across reboots. Persistence is
+the default.
.RE
.sp
.ne 2
.na
-\fB\fBlink\fR\fR
+\fB\fB-R\fR \fIroot-dir\fR, \fB--root-dir\fR=\fIroot-dir\fR\fR
.ad
.sp .6
.RS 4n
-The name of the link the flow is on.
+Specifies an alternate root directory where \fBflowadm\fR should apply
+persistent creation.
.RE
.sp
.ne 2
.na
-\fB\fBipaddr\fR\fR
+\fB\fB-l\fR \fIlink\fR, \fB--link\fR=\fIlink\fR\fR
.ad
.sp .6
.RS 4n
-IP address of the flow. This can be either local or remote depending on how the
-flow was defined.
+Specify the link to which the flow will be added.
.RE
.sp
.ne 2
.na
-\fB\fBtransport\fR\fR
+\fB\fB-a\fR \fIattr\fR=\fIvalue\fR[,...], \fB--attr\fR=\fIvalue\fR\fR
.ad
.sp .6
.RS 4n
-The name of the layer for protocol to be used.
+A mandatory comma-separated list of attributes to be set to the specified
+values.
.RE
.sp
.ne 2
.na
-\fB\fBport\fR\fR
+\fB\fB-p\fR \fIprop\fR=\fIvalue\fR[,...], \fB--prop\fR=\fIvalue\fR[,...]\fR
.ad
.sp .6
.RS 4n
-Local port of service for flow.
+An optional comma-separated list of properties to be set to the specified
+values. Flow properties are documented in the "Flow Properties" section, below.
+.RE
+
.RE
.sp
.ne 2
.na
-\fB\fBdsfield\fR\fR
+\fB\fBflowadm remove-flow\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] \fB-l\fR
+{\fIlink\fR | \fIflow\fR}\fR
.ad
.sp .6
.RS 4n
-Differentiated services value for flow and mask used with \fBDSFIELD\fR value
-to state the bits of interest in the differentiated services field of the IP
-header.
-.RE
-
-.RE
-
+Remove an existing flow identified by its link or name.
.sp
.ne 2
.na
-\fB\fB-p\fR, \fB--parsable\fR\fR
+\fB\fB-t\fR, \fB--temporary\fR\fR
.ad
.sp .6
.RS 4n
-Display using a stable machine-parsable format.
+The changes are temporary and will not persist across reboots. Persistence is
+the default.
.RE
.sp
.ne 2
.na
-\fB\fB-P\fR, \fB--persistent\fR\fR
+\fB\fB-R\fR \fIroot-dir\fR, \fB--root-dir\fR=\fIroot-dir\fR\fR
.ad
.sp .6
.RS 4n
-Display persistent flow property information.
+Specifies an alternate root directory where \fBflowadm\fR should apply
+persistent removal.
.RE
.sp
.ne 2
.na
-\fB\fB-S\fR, \fB--continuous\fR\fR
+\fB\fB-l\fR \fIlink\fR | \fIflow\fR, \fB--link\fR=\fIlink\fR | \fIflow\fR\fR
.ad
.sp .6
.RS 4n
-Continuously display network utilization by flow in a manner similar to the way
-that \fBprstat\fR(1M) displays CPU utilization by process.
+If a link is specified, remove all flows from that link. If a single flow is
+specified, remove only that flow.
+.RE
+
.RE
.sp
.ne 2
.na
-\fB\fB-s\fR, \fB--statistics\fR\fR
+\fB\fBflowadm show-flow\fR [\fB-pP\fR] [\fB-s\fR [\fB-i\fR \fIinterval\fR]]
+[\fB-o\fR \fIfield\fR[,...]] [\fB-l\fR \fIlink\fR] [\fIflow\fR]\fR
.ad
.sp .6
.RS 4n
-Displays flow statistics.
-.RE
-
+Show flow configuration information, either for all
+flows, all flows on a link, or for the specified \fIflow\fR.
.sp
.ne 2
.na
-\fB\fB-i\fR \fIinterval\fR, \fB--interval\fR=\fIinterval\fR\fR
+\fB\fB-o\fR \fIfield\fR[,...]\fR
.ad
.sp .6
.RS 4n
-Used with the \fB-s\fR option to specify an interval, in seconds, at which
-statistics should be displayed. If this option is not specified, statistics are
-displayed once.
-.RE
-
+A case-insensitive, comma-separated list of output fields to display. The field
+name must be one of the fields listed below, or a special value \fBall\fR, to
+display all fields. For each flow found, the following fields can be displayed:
.sp
.ne 2
.na
-\fB\fB-l\fR \fIlink\fR, \fB--link\fR=\fIlink\fR | \fIflow\fR\fR
+\fB\fBflow\fR\fR
.ad
.sp .6
.RS 4n
@@ -240,35 +232,28 @@ Operate on a link that has been delegated to the specified zone.
.ad
.sp .6
.RS 4n
-Adds a flow to the system. The flow is identified by its flow attributes and
-properties.
-.sp
-As part of identifying a particular flow, its bandwidth resource can be limited
-and its relative priority to other traffic can be specified. If no bandwidth
-limit or priority is specified, the traffic still gets its unique layer 2, 3,
-and 4 queues and processing threads, including NIC hardware resources (when
-supported), so that the selected traffic can be separated from others and can
-flow with minimal impact from other traffic.
+The name of the link the flow is on.
+.RE
+
.sp
.ne 2
.na
-\fB\fB-t\fR, \fB--temporary\fR\fR
+\fB\fBipaddr\fR\fR
.ad
.sp .6
.RS 4n
-The changes are temporary and will not persist across reboots. Persistence is
-the default.
+IP address of the flow. This can be either local or remote depending on how the
+flow was defined.
.RE
.sp
.ne 2
.na
-\fB\fB-R\fR \fIroot-dir\fR, \fB--root-dir\fR=\fIroot-dir\fR\fR
+\fB\fBproto\fR\fR
.ad
.sp .6
.RS 4n
-Specifies an alternate root directory where \fBflowadm\fR should apply
-persistent creation.
+The name of the layer for protocol to be used.
.RE
.sp
@@ -288,27 +273,29 @@ Operate on a link that has been delegated to the specified zone.
.ad
.sp .6
.RS 4n
-Specify the link to which the flow will be added.
+Local port of service for flow.
.RE
.sp
.ne 2
.na
-\fB\fB-a\fR \fIattr\fR=\fIvalue\fR[,...], \fB--attr\fR=\fIvalue\fR\fR
+\fB\fBrport\fR\fR
.ad
.sp .6
.RS 4n
-A comma-separated list of attributes to be set to the specified values.
+Remote port of service for flow.
.RE
.sp
.ne 2
.na
-\fB\fB-p\fR \fIprop\fR=\fIvalue\fR[,...], \fB--prop\fR=\fIvalue\fR[,...]\fR
+\fB\fBdsfld\fR\fR
.ad
.sp .6
.RS 4n
-A comma-separated list of properties to be set to the specified values.
+Differentiated services value for flow and mask used with \fBDSFIELD\fR value
+to state the bits of interest in the differentiated services field of the IP
+header.
.RE
.RE
@@ -328,19 +315,17 @@ Remove an existing flow identified by its link or name.
.ad
.sp .6
.RS 4n
-The changes are temporary and will not persist across reboots. Persistence is
-the default.
+Display using a stable machine-parsable format.
.RE
.sp
.ne 2
.na
-\fB\fB-R\fR \fIroot-dir\fR, \fB--root-dir\fR=\fIroot-dir\fR\fR
+\fB\fB-P\fR, \fB--persistent\fR\fR
.ad
.sp .6
.RS 4n
-Specifies an alternate root directory where \fBflowadm\fR should apply
-persistent removal.
+Display persistent flow property information.
.RE
.sp
@@ -360,8 +345,8 @@ Operate on a link that has been delegated to the specified zone.
.ad
.sp .6
.RS 4n
-If a link is specified, remove all flows from that link. If a single flow is
-specified, remove only that flow.
+Display information for all flows on the named link or information for the
+named flow.
.RE
.RE
@@ -375,7 +360,7 @@ specified, remove only that flow.
.sp .6
.RS 4n
Set values of one or more properties on the flow specified by name. The
-complete list of properties can be retrieved using the \fBshow-flow\fR
+complete list of properties can be retrieved using the \fBshow-flowprop\fR
subcommand.
.sp
.ne 2
@@ -561,100 +546,7 @@ A comma-separated list of properties to show.
.RE
-.sp
-.ne 2
-.na
-\fB\fBflowadm show-usage\fR [\fB-a\fR] [\fB-d\fR | {\fB-p\fR \fIplotfile\fR
-\fB-F\fR \fIformat\fR}] [\fB-s\fR \fItime\fR] [\fB-e\fR \fItime\fR]
-[\fIflow\fR]\fR
-.ad
-.sp .6
-.RS 4n
-Show the historical network flow usage from a stored extended accounting file.
-Configuration and enabling of network accounting through \fBacctadm\fR(1M) is
-required. The default output will be the summary of flow usage for the entire
-period of time in which extended accounting was enabled.
-.sp
-.ne 2
-.na
-\fB\fB-a\fR\fR
-.ad
-.sp .6
-.RS 4n
-Display all historical network usage for the specified period of time during
-which extended accounting is enabled. This includes the usage information for
-the flows that have already been deleted.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-d\fR\fR
-.ad
-.sp .6
-.RS 4n
-Display the dates for which there is logging information. The date is in the
-format \fIDD\fR/\fIMM\fR/\fIYYYY\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-F\fR \fIformat\fR\fR
-.ad
-.sp .6
-.RS 4n
-Specifies the format of \fIplotfile\fR that is specified by the \fB-p\fR
-option. As of this release, \fBgnuplot\fR is the only supported format.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-p\fR \fIplotfile\fR\fR
-.ad
-.sp .6
-.RS 4n
-When specified with \fB-s\fR or \fB-e\fR (or both), outputs flow usage data to
-a file of the format specified by the \fB-F\fR option, which is required.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-s\fR \fItime\fR, \fB-e\fR \fItime\fR\fR
-.ad
-.sp .6
-.RS 4n
-Start and stop times for data display. Time is in the format
-\fIYYYY\fR.\fIMM\fR.\fIDD\fR,\fIhh\fR:\fImm\fR:\fIss\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-f\fR \fIfilename\fR\fR
-.ad
-.sp .6
-.RS 4n
-Read extended accounting records of network flow usage from \fIfilename\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIflow\fR\fR
-.ad
-.sp .6
-.RS 4n
-If specified, display the network flow usage only from the named flow.
-Otherwise, display network usage from all flows.
-.RE
-
-.RE
-
.SS "Flow Attributes"
-.LP
The flow operand that identify a flow in a \fBflowadm\fR command is a
comma-separated list of one or more keyword, value pairs from the list below.
.sp
@@ -683,7 +575,7 @@ address is \fB/32\fR and for IPv6 is \fB/128\fR.
.sp .6
.RS 4n
Identifies a network flow by the remote IP address. The syntax is the same as
-\fBlocal_ip\fR attributes
+the \fBlocal_ip\fR attribute.
.RE
.sp
@@ -710,6 +602,16 @@ Identifies a service specified by the local port.
.sp
.ne 2
.na
+\fB\fBremote_port\fR\fR
+.ad
+.sp .6
+.RS 4n
+Identifies a service specified by the remote port.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fBdsfield\fR[\fB:\fR\fIdsfield_mask\fR]\fR
.ad
.sp .6
@@ -726,7 +628,7 @@ is used. Both the \fBdsfield\fR value and mask must be in hexadecimal.
.sp
.LP
-The following five types of combinations of attributes are supported:
+The following six types of combinations of attributes are supported:
.sp
.in +2
.nf
@@ -734,6 +636,7 @@ local_ip[/\fIprefixlen\fR]=\fIaddress\fR
remote_ip[/\fIprefixlen\fR]=\fIaddress\fR
transport={tcp|udp|sctp|icmp|icmpv6}
transport={tcp|udp|sctp},local_port=\fIport\fR
+transport={tcp|udp|sctp},remote_port=\fIport\fR
dsfield=\fIval\fR[:\fIdsfield_mask\fR]
.fi
.in -2
@@ -741,13 +644,11 @@ dsfield=\fIval\fR[:\fIdsfield_mask\fR]
.sp
.LP
-On a given link, the combinations above are mutually exclusive. An attempt to
-create flows of different combinations will fail.
+On a given link, the types of combinations above are mutually exclusive. An
+attempt to create flows of different types on a given link will fail.
.SS "Restrictions"
-.LP
There are individual flow restrictions and flow restrictions per zone.
.SS "Individual Flow Restrictions"
-.LP
Restrictions on individual flows do not require knowledge of other flows that
have been added to the link.
.sp
@@ -793,12 +694,10 @@ flow16\fR
.sp
.SS "Flow Restrictions Per Zone"
-.LP
Within a zone, no two flows can have the same name. After adding a flow with
the link specified, the link will not be required for display, modification, or
deletion of the flow.
.SS "Flow Properties"
-.LP
The following flow properties are supported. Note that the ability to set a
given property to a given value depends on the driver and hardware.
.sp
@@ -826,7 +725,6 @@ tokens \fBhigh\fR, \fBmedium\fR, or \fBlow\fR. The default is \fBmedium\fR.
.RE
.SH EXAMPLES
-.LP
\fBExample 1 \fRCreating a Policy Around a Mission-Critical Port
.sp
.LP
@@ -840,8 +738,8 @@ delete the policy.
.nf
# \fBflowadm add-flow -l bge0 -a transport=TCP,local_port=443 https-1\fR
# \fBflowadm show-flow -l bge0\fR
-FLOW LINK IP ADDR PROTO PORT DSFLD
-https1 bge0 -- tcp 443 --
+FLOW LINK IPADDR PROTO LPORT RPORT DSFLD
+https1 bge0 -- tcp 443 -- --
.fi
.in -2
.sp
@@ -859,13 +757,13 @@ priority.
.nf
# \fBflowadm set-flowprop -p maxbw=500M,priority=high https-1\fR
# \fBflowadm show-flow https-1\fR
-FLOW LINK IP ADDR PROTO PORT DSFLD
-https1 bge0 -- tcp 443 --
+FLOW LINK IPADDR PROTO LPORT RPORT DSFLD
+https-1 bge0 -- tcp 443 -- --
# \fBflowadm show-flowprop https-1\fR
-FLOW PROPERTY VALUE DEFAULT POSSIBLE
-https-1 maxbw 500 -- --
-https-1 priority HIGH -- LOW,NORMAL,HIGH
+FLOW PROPERTY VALUE DEFAULT POSSIBLE
+https-1 maxbw 500 -- --
+https-1 priority high -- low,medium,high
.fi
.in -2
.sp
@@ -888,33 +786,7 @@ priority=low limit-udp-1\fR
.sp
.LP
-\fBExample 4 \fRShowing Flow Usage
-.sp
-.LP
-Flow usage statistics can be stored using the extended accounting facility,
-\fBacctadm\fR(1M).
-
-.sp
-.in +2
-.nf
-# \fBacctadm -e extended -f /var/log/net.log net\fR
-
-# \fBacctadm net\fR
-Network accounting: active
-Network accounting file: /var/log/net.log
-Tracked Network resources: extended
-Untracked Network resources: none
-.fi
-.in -2
-.sp
-
-.sp
-.LP
-The historical data that was saved can be retrieved in summary form using the
-\fBshow-usage\fR subcommand of \fBflowadm\fR.
-
-.LP
-\fBExample 5 \fRSetting Policy, Making Use of \fBdsfield\fR Attribute
+\fBExample 4 \fRSetting Policy, Making Use of \fBdsfield\fR Attribute
.sp
.LP
The following command sets a policy for EF PHB (DSCP value of 101110 from RFC
@@ -931,71 +803,6 @@ for this flow will be \fB0x2e\fR (101110) with the \fBdsfield_mask\fR being
.in -2
.sp
-.sp
-.LP
-Display summary information:
-
-.sp
-.in +2
-.nf
-# \fBflowadm show-usage -f /var/log/net.log\fR
-FLOW DURATION IPACKETS RBYTES OPACKETS OBYTES BANDWIDTH
-flowtcp 100 1031 546908 0 0 43.76 Kbps
-flowudp 0 0 0 0 0 0.00 Mbps
-.fi
-.in -2
-.sp
-
-.sp
-.LP
-Display dates for which logging information is available:
-
-.sp
-.in +2
-.nf
-# \fBflowadm show-usage -d -f /var/log/net.log\fR
-02/19/2008
-.fi
-.in -2
-.sp
-
-.sp
-.LP
-Display logging information for \fBflowtcp\fR starting at 02/19/2008, 10:38:46
-and ending at 02/19/2008, 10:40:06:
-
-.sp
-.in +2
-.nf
-# \fBflowadm show-usage -s 02/19/2008,10:39:06 -e 02/19/2008,10:40:06 \e
--f /var/log/net.log flowtcp\fR
-FLOW TIME IPACKETS RBYTES OPACKETS OBYTES BANDWIDTH
-flowtcp 10:39:06 1 1546 4 6539 3.23 Kbps
-flowtcp 10:39:26 2 3586 5 9922 5.40 Kbps
-flowtcp 10:39:46 1 240 1 216 182.40 bps
-flowtcp 10:40:06 0 0 0 0 0.00 bps
-.fi
-.in -2
-.sp
-
-.sp
-.LP
-Output the same information as above as a plotfile:
-
-.sp
-.in +2
-.nf
-# \fBflowadm show-usage -s 02/19/2008,10:39:06 -e 02/19/2008,10:40:06 \e
--p /home/plot/myplot -F gnuplot -f /var/log/net.log flowtcp\fR
-# \fBTime tcp-flow\fR
-10:39:06 3.23
-10:39:26 5.40
-10:39:46 0.18
-10:40:06 0.00
-.fi
-.in -2
-.sp
-
.SH EXIT STATUS
.ne 2
.na
@@ -1017,7 +824,6 @@ An error occurred.
.RE
.SH ATTRIBUTES
-.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -1032,6 +838,10 @@ Interface Stability Committed
.TE
.SH SEE ALSO
-.LP
-\fBacctadm\fR(1M), \fBdladm\fR(1M), \fBifconfig\fR(1M), \fBprstat\fR(1M),
-\fBroute\fR(1M), \fBattributes\fR(5), \fBdlpi\fR(7P)
+\fBdladm\fR(1M), \fBflowstat\fR(1M), \fBifconfig\fR(1M),
+\fBroute\fR(1M), \fBattributes\fR(5)
+
+.SH NOTES
+The display of statistics by the \fBshow-flow\fR subcommand, and the
+\fBshow-usage\fR subcommand, have been removed. This functionality can
+now be accessed using the \fBflowstat\fR(1M) utility.
diff --git a/usr/src/uts/common/io/aggr/aggr_grp.c b/usr/src/uts/common/io/aggr/aggr_grp.c
index 9097e059b5..82f3989f42 100644
--- a/usr/src/uts/common/io/aggr/aggr_grp.c
+++ b/usr/src/uts/common/io/aggr/aggr_grp.c
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2018 Joyent, Inc.
+ * Copyright 2020 Joyent, Inc.
*/
/*
@@ -1442,8 +1442,7 @@ aggr_grp_create(datalink_id_t linkid, uint32_t key, uint_t nports,
grp->lg_rx_group_count = 1;
- for (i = 0, port = grp->lg_ports; port != NULL;
- i++, port = port->lp_next) {
+ for (port = grp->lg_ports; port != NULL; port = port->lp_next) {
uint_t num_rgroups;
mac_perim_enter_by_mh(port->lp_mh, &mph);
diff --git a/usr/src/uts/common/io/aggr/aggr_port.c b/usr/src/uts/common/io/aggr/aggr_port.c
index c8dbe00336..e764dd104e 100644
--- a/usr/src/uts/common/io/aggr/aggr_port.c
+++ b/usr/src/uts/common/io/aggr/aggr_port.c
@@ -22,7 +22,7 @@
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2012 OmniTI Computer Consulting, Inc All rights reserved.
- * Copyright 2018 Joyent, Inc.
+ * Copyright 2020 Joyent, Inc.
*/
/*
diff --git a/usr/src/uts/common/io/ixgbe/ixgbe_main.c b/usr/src/uts/common/io/ixgbe/ixgbe_main.c
index d6200a93b4..b52483d3de 100644
--- a/usr/src/uts/common/io/ixgbe/ixgbe_main.c
+++ b/usr/src/uts/common/io/ixgbe/ixgbe_main.c
@@ -25,7 +25,7 @@
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2019 Joyent, Inc.
+ * Copyright 2020 Joyent, Inc.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2013 Saso Kiselkov. All rights reserved.
* Copyright (c) 2013 OSN Online Service Nuernberg GmbH. All rights reserved.
@@ -6546,8 +6546,10 @@ ixgbe_remvlan(mac_group_driver_t gdriver, uint16_t vid)
}
vlp = ixgbe_find_vlan(rx_group, vid);
- if (vlp == NULL)
+ if (vlp == NULL) {
+ mutex_exit(&ixgbe->gen_lock);
return (ENOENT);
+ }
/*
* See the comment in ixgbe_addvlan() about is_def_grp and
@@ -6601,8 +6603,10 @@ ixgbe_remvlan(mac_group_driver_t gdriver, uint16_t vid)
/* This shouldn't fail, but if it does return EIO. */
ret = ixgbe_set_vfta(hw, vid, rx_group->index, B_TRUE,
B_TRUE);
- if (ret != IXGBE_SUCCESS)
+ if (ret != IXGBE_SUCCESS) {
+ mutex_exit(&ixgbe->gen_lock);
return (EIO);
+ }
}
}
diff --git a/usr/src/uts/common/io/ixgbe/ixgbe_sw.h b/usr/src/uts/common/io/ixgbe/ixgbe_sw.h
index 0dbb3288c3..cfd987787a 100644
--- a/usr/src/uts/common/io/ixgbe/ixgbe_sw.h
+++ b/usr/src/uts/common/io/ixgbe/ixgbe_sw.h
@@ -92,6 +92,7 @@ extern "C" {
#define MAX_NUM_UNICAST_ADDRESSES 0x80
#define MAX_NUM_MULTICAST_ADDRESSES 0x1000
#define MAX_NUM_VLAN_FILTERS 0x40
+
#define IXGBE_INTR_NONE 0
#define IXGBE_INTR_MSIX 1
#define IXGBE_INTR_MSI 2
diff --git a/usr/src/uts/common/io/mac/mac.c b/usr/src/uts/common/io/mac/mac.c
index f4074a2b91..ee50778ebb 100644
--- a/usr/src/uts/common/io/mac/mac.c
+++ b/usr/src/uts/common/io/mac/mac.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2019 Joyent, Inc.
+ * Copyright 2020 Joyent, Inc.
* Copyright 2015 Garrett D'Amore <garrett@damore.org>
*/
@@ -1648,7 +1648,8 @@ mac_hwrings_idx_get(mac_handle_t mh, uint_t idx, mac_group_handle_t *hwgh,
if (rtype == MAC_RING_TYPE_RX) {
grp = mip->mi_rx_groups;
- } else if (rtype == MAC_RING_TYPE_TX) {
+ } else {
+ ASSERT(rtype == MAC_RING_TYPE_TX);
grp = mip->mi_tx_groups;
}
@@ -1752,7 +1753,7 @@ mac_client_clear_flow_cb(mac_client_handle_t mch)
flow_entry_t *flent = mcip->mci_flent;
mutex_enter(&flent->fe_lock);
- flent->fe_cb_fn = (flow_fn_t)mac_rx_def;
+ flent->fe_cb_fn = (flow_fn_t)mac_pkt_drop;
flent->fe_cb_arg1 = NULL;
flent->fe_cb_arg2 = NULL;
flent->fe_flags |= FE_MC_NO_DATAPATH;
@@ -5536,6 +5537,11 @@ mac_add_macaddr_vlan(mac_impl_t *mip, mac_group_t *group, uint8_t *addr,
return (0);
}
+ /*
+ * We failed to set promisc mode and we are about to free 'map'.
+ */
+ map->ma_nusers = 0;
+
bail:
if (hw_vlan) {
int err2 = mac_group_remvlan(group, vid);
@@ -5591,6 +5597,8 @@ mac_remove_macaddr_vlan(mac_address_t *map, uint16_t vid)
if (map->ma_nusers > 0)
return (0);
+ VERIFY3S(map->ma_nusers, ==, 0);
+
/*
* The MAC address is no longer used by any MAC client, so
* remove it from its associated group. Turn off promiscuous
@@ -5615,7 +5623,16 @@ mac_remove_macaddr_vlan(mac_address_t *map, uint16_t vid)
* If we fail to remove the MAC address HW
* filter but then also fail to re-add the
* VLAN HW filter then we are in a busted
- * state and should just crash.
+ * state. We do our best by logging a warning
+ * and returning the original 'err' that got
+ * us here. At this point, traffic for this
+ * address + VLAN combination will be dropped
+ * until the user reboots the system. In the
+ * future, it would be nice to have a system
+ * that can compare the state of expected
+ * classification according to mac to the
+ * actual state of the provider, and report
+ * and fix any inconsistencies.
*/
if (MAC_GROUP_HW_VLAN(group)) {
int err2;
@@ -5629,6 +5646,7 @@ mac_remove_macaddr_vlan(mac_address_t *map, uint16_t vid)
}
}
+ map->ma_nusers = 1;
return (err);
}
@@ -5642,8 +5660,10 @@ mac_remove_macaddr_vlan(mac_address_t *map, uint16_t vid)
map->ma_type, __FILE__, __LINE__);
}
- if (err != 0)
+ if (err != 0) {
+ map->ma_nusers = 1;
return (err);
+ }
/*
* We created MAC address for the primary one at registration, so we
diff --git a/usr/src/uts/common/io/mac/mac_datapath_setup.c b/usr/src/uts/common/io/mac/mac_datapath_setup.c
index 656c598e53..e1dbf9a953 100644
--- a/usr/src/uts/common/io/mac/mac_datapath_setup.c
+++ b/usr/src/uts/common/io/mac/mac_datapath_setup.c
@@ -2892,8 +2892,8 @@ mac_datapath_setup(mac_client_impl_t *mcip, flow_entry_t *flent,
mac_group_t *default_rgroup;
mac_group_t *default_tgroup;
int err;
- uint8_t *mac_addr;
uint16_t vid;
+ uint8_t *mac_addr;
mac_group_state_t next_state;
mac_client_impl_t *group_only_mcip;
mac_resource_props_t *mrp = MCIP_RESOURCE_PROPS(mcip);
diff --git a/usr/src/uts/common/io/mac/mac_provider.c b/usr/src/uts/common/io/mac/mac_provider.c
index 2c4ac0a1af..0f917cd8ca 100644
--- a/usr/src/uts/common/io/mac/mac_provider.c
+++ b/usr/src/uts/common/io/mac/mac_provider.c
@@ -735,7 +735,7 @@ mac_rx_common(mac_handle_t mh, mac_resource_handle_t mrh, mblk_t *mp_chain)
{
mac_impl_t *mip = (mac_impl_t *)mh;
mac_ring_t *mr = (mac_ring_t *)mrh;
- mac_soft_ring_set_t *mac_srs;
+ mac_soft_ring_set_t *mac_srs;
mblk_t *bp = mp_chain;
/*
diff --git a/usr/src/uts/common/io/mac/mac_stat.c b/usr/src/uts/common/io/mac/mac_stat.c
index 2244218f20..e1151565a6 100644
--- a/usr/src/uts/common/io/mac/mac_stat.c
+++ b/usr/src/uts/common/io/mac/mac_stat.c
@@ -262,7 +262,7 @@ static stat_info_t rx_srs_stats_list[] = {
{RX_SRS_STAT_OFF(mrs_chaincntover50)},
{RX_SRS_STAT_OFF(mrs_ierrors)}
};
-#define RX_SRS_STAT_SIZE \
+#define RX_SRS_STAT_SIZE \
(sizeof (rx_srs_stats_list) / sizeof (stat_info_t))
#define TX_SOFTRING_STAT_OFF(f) (offsetof(mac_tx_stats_t, f))
@@ -274,14 +274,14 @@ static stat_info_t tx_softring_stats_list[] = {
{TX_SOFTRING_STAT_OFF(mts_unblockcnt)},
{TX_SOFTRING_STAT_OFF(mts_sdrops)},
};
-#define TX_SOFTRING_STAT_SIZE \
+#define TX_SOFTRING_STAT_SIZE \
(sizeof (tx_softring_stats_list) / sizeof (stat_info_t))
static void
i_mac_add_stats(void *sum, void *op1, void *op2,
stat_info_t stats_list[], uint_t size)
{
- int i;
+ int i;
for (i = 0; i < size; i++) {
uint64_t *op1_val = (uint64_t *)
@@ -679,8 +679,8 @@ i_mac_rx_hwlane_stat_create(mac_soft_ring_set_t *mac_srs, const char *modname,
static uint64_t
i_mac_misc_stat_get(void *handle, uint_t stat)
{
- flow_entry_t *flent = handle;
- mac_client_impl_t *mcip = flent->fe_mcip;
+ flow_entry_t *flent = handle;
+ mac_client_impl_t *mcip = flent->fe_mcip;
mac_misc_stats_t *mac_misc_stat = &mcip->mci_misc_stat;
mac_rx_stats_t *mac_rx_stat;
mac_tx_stats_t *mac_tx_stat;
@@ -871,9 +871,9 @@ i_mac_tx_hwlane_stat_create(mac_soft_ring_t *ringp, const char *modname,
static uint64_t
i_mac_rx_fanout_stat_get(void *handle, uint_t stat)
{
- mac_soft_ring_t *tcp_ringp = (mac_soft_ring_t *)handle;
+ mac_soft_ring_t *tcp_ringp = (mac_soft_ring_t *)handle;
mac_soft_ring_t *udp_ringp = NULL, *oth_ringp = NULL;
- mac_soft_ring_set_t *mac_srs = tcp_ringp->s_ring_set;
+ mac_soft_ring_set_t *mac_srs = tcp_ringp->s_ring_set;
int index;
uint64_t val;
@@ -1037,7 +1037,7 @@ void
mac_srs_stat_create(mac_soft_ring_set_t *mac_srs)
{
flow_entry_t *flent = mac_srs->srs_flent;
- char statname[MAXNAMELEN];
+ char statname[MAXNAMELEN];
boolean_t is_tx_srs;
/* No hardware/software lanes for user defined flows */
diff --git a/usr/src/uts/common/io/sata/adapters/ahci/ahci.c b/usr/src/uts/common/io/sata/adapters/ahci/ahci.c
index 0e342e8bcc..721aead599 100644
--- a/usr/src/uts/common/io/sata/adapters/ahci/ahci.c
+++ b/usr/src/uts/common/io/sata/adapters/ahci/ahci.c
@@ -1432,6 +1432,7 @@ ahci_tran_probe_port(dev_info_t *dip, sata_device_t *sd)
uint8_t port;
int rval = SATA_SUCCESS, rval_init;
+ port_state = 0;
ahci_ctlp = ddi_get_soft_state(ahci_statep, ddi_get_instance(dip));
port = ahci_ctlp->ahcictl_cport_to_port[cport];
@@ -1996,6 +1997,7 @@ ahci_claim_free_slot(ahci_ctl_t *ahci_ctlp, ahci_port_t *ahci_portp,
ahci_portp->ahciport_pending_tags,
ahci_portp->ahciport_pending_ncq_tags);
+ free_slots = 0;
/*
* According to the AHCI spec, system software is responsible to
* ensure that queued and non-queued commands are not mixed in
@@ -9837,6 +9839,8 @@ ahci_watchdog_handler(ahci_ctl_t *ahci_ctlp)
AHCIDBG(AHCIDBG_ENTRY, ahci_ctlp,
"ahci_watchdog_handler entered", NULL);
+ current_slot = 0;
+ current_tags = 0;
for (port = 0; port < ahci_ctlp->ahcictl_num_ports; port++) {
if (!AHCI_PORT_IMPLEMENTED(ahci_ctlp, port)) {
continue;
diff --git a/usr/src/uts/common/io/vnic/vnic_dev.c b/usr/src/uts/common/io/vnic/vnic_dev.c
index e532a551e7..0bd0d8d104 100644
--- a/usr/src/uts/common/io/vnic/vnic_dev.c
+++ b/usr/src/uts/common/io/vnic/vnic_dev.c
@@ -1060,7 +1060,7 @@ static int
vnic_m_setprop(void *m_driver, const char *pr_name, mac_prop_id_t pr_num,
uint_t pr_valsize, const void *pr_val)
{
- int err = 0;
+ int err = 0;
vnic_t *vn = m_driver;
switch (pr_num) {
@@ -1158,7 +1158,7 @@ vnic_m_getprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
uint_t pr_valsize, void *pr_val)
{
vnic_t *vn = arg;
- int ret = 0;
+ int ret = 0;
boolean_t out;
switch (pr_num) {
diff --git a/usr/src/uts/common/sys/mac_client_impl.h b/usr/src/uts/common/sys/mac_client_impl.h
index 21641b884d..0f8be50fde 100644
--- a/usr/src/uts/common/sys/mac_client_impl.h
+++ b/usr/src/uts/common/sys/mac_client_impl.h
@@ -230,7 +230,7 @@ extern int mac_tx_percpu_cnt;
&(mcip)->mci_flent->fe_resource_props)
#define MCIP_EFFECTIVE_PROPS(mcip) \
- (mcip->mci_flent == NULL ? NULL : \
+ (mcip->mci_flent == NULL ? NULL : \
&(mcip)->mci_flent->fe_effective_props)
#define MCIP_RESOURCE_PROPS_MASK(mcip) \
diff --git a/usr/src/uts/common/sys/mac_impl.h b/usr/src/uts/common/sys/mac_impl.h
index 21f2c10a8e..3c103c073a 100644
--- a/usr/src/uts/common/sys/mac_impl.h
+++ b/usr/src/uts/common/sys/mac_impl.h
@@ -290,6 +290,54 @@ struct mac_group_s {
#define GROUP_INTR_ENABLE_FUNC(g) (g)->mrg_info.mgi_intr.mi_enable
#define GROUP_INTR_DISABLE_FUNC(g) (g)->mrg_info.mgi_intr.mi_disable
+#define MAC_RING_TX(mhp, rh, mp, rest) { \
+ mac_ring_handle_t mrh = rh; \
+ mac_impl_t *mimpl = (mac_impl_t *)mhp; \
+ /* \
+ * Send packets through a selected tx ring, or through the \
+ * default handler if there is no selected ring. \
+ */ \
+ if (mrh == NULL) \
+ mrh = mimpl->mi_default_tx_ring; \
+ if (mrh == NULL) { \
+ rest = mimpl->mi_tx(mimpl->mi_driver, mp); \
+ } else { \
+ rest = mac_hwring_tx(mrh, mp); \
+ } \
+}
+
+/*
+ * This is the final stop before reaching the underlying driver
+ * or aggregation, so this is where the bridging hook is implemented.
+ * Packets that are bridged will return through mac_bridge_tx(), with
+ * rh nulled out if the bridge chooses to send output on a different
+ * link due to forwarding.
+ */
+#define MAC_TX(mip, rh, mp, src_mcip) { \
+ mac_ring_handle_t rhandle = (rh); \
+ /* \
+ * If there is a bound Hybrid I/O share, send packets through \
+ * the default tx ring. (When there's a bound Hybrid I/O share, \
+ * the tx rings of this client are mapped in the guest domain \
+ * and not accessible from here.) \
+ */ \
+ _NOTE(CONSTANTCONDITION) \
+ if ((src_mcip)->mci_state_flags & MCIS_SHARE_BOUND) \
+ rhandle = (mip)->mi_default_tx_ring; \
+ if (mip->mi_promisc_list != NULL) \
+ mac_promisc_dispatch(mip, mp, src_mcip); \
+ /* \
+ * Grab the proper transmit pointer and handle. Special \
+ * optimization: we can test mi_bridge_link itself atomically, \
+ * and if that indicates no bridge send packets through tx ring.\
+ */ \
+ if (mip->mi_bridge_link == NULL) { \
+ MAC_RING_TX(mip, rhandle, mp, mp); \
+ } else { \
+ mp = mac_bridge_tx(mip, rhandle, mp); \
+ } \
+}
+
/* mci_tx_flag */
#define MCI_TX_QUIESCE 0x1
diff --git a/usr/src/uts/common/sys/mac_provider.h b/usr/src/uts/common/sys/mac_provider.h
index 2dea3a4758..fc3b3892bd 100644
--- a/usr/src/uts/common/sys/mac_provider.h
+++ b/usr/src/uts/common/sys/mac_provider.h
@@ -567,14 +567,14 @@ extern void mac_free(mac_register_t *);
extern int mac_register(mac_register_t *, mac_handle_t *);
extern int mac_disable_nowait(mac_handle_t);
extern int mac_disable(mac_handle_t);
-extern int mac_unregister(mac_handle_t);
-extern void mac_rx(mac_handle_t, mac_resource_handle_t,
+extern int mac_unregister(mac_handle_t);
+extern void mac_rx(mac_handle_t, mac_resource_handle_t,
mblk_t *);
-extern void mac_rx_ring(mac_handle_t, mac_ring_handle_t,
+extern void mac_rx_ring(mac_handle_t, mac_ring_handle_t,
mblk_t *, uint64_t);
-extern void mac_link_update(mac_handle_t, link_state_t);
-extern void mac_link_redo(mac_handle_t, link_state_t);
-extern void mac_unicst_update(mac_handle_t,
+extern void mac_link_update(mac_handle_t, link_state_t);
+extern void mac_link_redo(mac_handle_t, link_state_t);
+extern void mac_unicst_update(mac_handle_t,
const uint8_t *);
extern void mac_dst_update(mac_handle_t, const uint8_t *);
extern void mac_tx_update(mac_handle_t);
diff --git a/usr/src/uts/sun4v/io/vnet.c b/usr/src/uts/sun4v/io/vnet.c
index f30ef8e2d4..96fb04175d 100644
--- a/usr/src/uts/sun4v/io/vnet.c
+++ b/usr/src/uts/sun4v/io/vnet.c
@@ -1133,9 +1133,9 @@ vnet_mac_register(vnet_t *vnetp)
static int
vnet_read_mac_address(vnet_t *vnetp)
{
- uchar_t *macaddr;
- uint32_t size;
- int rv;
+ uchar_t *macaddr;
+ uint32_t size;
+ int rv;
rv = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, vnetp->dip,
DDI_PROP_DONTPASS, macaddr_propname, &macaddr, &size);
@@ -2318,7 +2318,7 @@ vnet_get_ring(void *arg, mac_ring_type_t rtype, const int g_index,
*/
static void
vnet_get_group(void *arg, mac_ring_type_t type, const int index,
- mac_group_info_t *infop, mac_group_handle_t handle)
+ mac_group_info_t *infop, mac_group_handle_t handle)
{
vnet_t *vnetp = (vnet_t *)arg;
@@ -2631,7 +2631,7 @@ vnet_rx_poll(void *arg, int bytes_to_pickup)
/* ARGSUSED */
void
vnet_hio_rx_cb(void *arg, mac_resource_handle_t mrh, mblk_t *mp,
- boolean_t loopback)
+ boolean_t loopback)
{
vnet_t *vnetp = (vnet_t *)arg;
vnet_pseudo_rx_ring_t *ringp = (vnet_pseudo_rx_ring_t *)mrh;