Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
David Ahern 2020-04-09 14:42:33 +00:00
commit 5c762c3bc2
10 changed files with 190 additions and 104 deletions

View File

@ -105,11 +105,11 @@ _devlink_dev_eswitch_set()
local -A settings=(
[mode]=notseen
[inline-mode]=notseen
[encap]=notseen
[encap-mode]=notseen
)
if [[ $cword -eq 5 ]]; then
COMPREPLY=( $( compgen -W "mode inline-mode encap" -- "$cur" ) )
COMPREPLY=( $( compgen -W "mode inline-mode encap-mode" -- "$cur" ) )
fi
# Mark seen settings
@ -132,8 +132,8 @@ _devlink_dev_eswitch_set()
"$cur" ) )
return
;;
encap)
COMPREPLY=( $( compgen -W "disable enable" -- "$cur" ) )
encap-mode)
COMPREPLY=( $( compgen -W "none basic" -- "$cur" ) )
return
;;
esac

View File

@ -41,6 +41,9 @@
#define ESWITCH_INLINE_MODE_NETWORK "network"
#define ESWITCH_INLINE_MODE_TRANSPORT "transport"
#define ESWITCH_ENCAP_MODE_NONE "none"
#define ESWITCH_ENCAP_MODE_BASIC "basic"
#define PARAM_CMODE_RUNTIME_STR "runtime"
#define PARAM_CMODE_DRIVERINIT_STR "driverinit"
#define PARAM_CMODE_PERMANENT_STR "permanent"
@ -283,8 +286,8 @@ struct dl_opts {
enum devlink_eswitch_mode eswitch_mode;
enum devlink_eswitch_inline_mode eswitch_inline_mode;
const char *dpipe_table_name;
bool dpipe_counters_enable;
bool eswitch_encap_mode;
bool dpipe_counters_enabled;
enum devlink_eswitch_encap_mode eswitch_encap_mode;
const char *resource_path;
uint64_t resource_size;
uint32_t resource_id;
@ -738,9 +741,11 @@ static int strtobool(const char *str, bool *p_val)
{
bool val;
if (!strcmp(str, "true") || !strcmp(str, "1"))
if (!strcmp(str, "true") || !strcmp(str, "1") ||
!strcmp(str, "enable"))
val = true;
else if (!strcmp(str, "false") || !strcmp(str, "0"))
else if (!strcmp(str, "false") || !strcmp(str, "0") ||
!strcmp(str, "disable"))
val = false;
else
return -EINVAL;
@ -1075,26 +1080,19 @@ static int eswitch_inline_mode_get(const char *typestr,
return 0;
}
static int dpipe_counters_enable_get(const char *typestr,
bool *counters_enable)
static int
eswitch_encap_mode_get(const char *typestr,
enum devlink_eswitch_encap_mode *p_encap_mode)
{
if (strcmp(typestr, "enable") == 0) {
*counters_enable = 1;
} else if (strcmp(typestr, "disable") == 0) {
*counters_enable = 0;
} else {
pr_err("Unknown counter_state \"%s\"\n", typestr);
return -EINVAL;
}
return 0;
}
static int eswitch_encap_mode_get(const char *typestr, bool *p_mode)
{
if (strcmp(typestr, "enable") == 0) {
*p_mode = true;
} else if (strcmp(typestr, "disable") == 0) {
*p_mode = false;
/* The initial implementation incorrectly accepted "enable"/"disable".
* Carry it to maintain backward compatibility.
*/
if (strcmp(typestr, "disable") == 0 ||
strcmp(typestr, ESWITCH_ENCAP_MODE_NONE) == 0) {
*p_encap_mode = DEVLINK_ESWITCH_ENCAP_MODE_NONE;
} else if (strcmp(typestr, "enable") == 0 ||
strcmp(typestr, ESWITCH_ENCAP_MODE_BASIC) == 0) {
*p_encap_mode = DEVLINK_ESWITCH_ENCAP_MODE_BASIC;
} else {
pr_err("Unknown eswitch encap mode \"%s\"\n", typestr);
return -EINVAL;
@ -1333,20 +1331,16 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required,
if (err)
return err;
o_found |= DL_OPT_DPIPE_TABLE_NAME;
} else if (dl_argv_match(dl, "counters") &&
} else if ((dl_argv_match(dl, "counters") ||
dl_argv_match(dl, "counters_enabled")) &&
(o_all & DL_OPT_DPIPE_TABLE_COUNTERS)) {
const char *typestr;
dl_arg_inc(dl);
err = dl_argv_str(dl, &typestr);
if (err)
return err;
err = dpipe_counters_enable_get(typestr,
&opts->dpipe_counters_enable);
err = dl_argv_bool(dl, &opts->dpipe_counters_enabled);
if (err)
return err;
o_found |= DL_OPT_DPIPE_TABLE_COUNTERS;
} else if (dl_argv_match(dl, "encap") &&
} else if ((dl_argv_match(dl, "encap") || /* Original incorrect implementation */
dl_argv_match(dl, "encap-mode")) &&
(o_all & DL_OPT_ESWITCH_ENCAP_MODE)) {
const char *typestr;
@ -1597,7 +1591,7 @@ static void dl_opts_put(struct nlmsghdr *nlh, struct dl *dl)
opts->dpipe_table_name);
if (opts->present & DL_OPT_DPIPE_TABLE_COUNTERS)
mnl_attr_put_u8(nlh, DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED,
opts->dpipe_counters_enable);
opts->dpipe_counters_enabled);
if (opts->present & DL_OPT_ESWITCH_ENCAP_MODE)
mnl_attr_put_u8(nlh, DEVLINK_ATTR_ESWITCH_ENCAP_MODE,
opts->eswitch_encap_mode);
@ -1717,7 +1711,7 @@ static void cmd_dev_help(void)
pr_err("Usage: devlink dev show [ DEV ]\n");
pr_err(" devlink dev eswitch set DEV [ mode { legacy | switchdev } ]\n");
pr_err(" [ inline-mode { none | link | network | transport } ]\n");
pr_err(" [ encap { disable | enable } ]\n");
pr_err(" [ encap-mode { none | basic } ]\n");
pr_err(" devlink dev eswitch show DEV\n");
pr_err(" devlink dev param set DEV name PARAMETER value VALUE cmode { permanent | driverinit | runtime }\n");
pr_err(" devlink dev param show [DEV name PARAMETER]\n");
@ -2147,6 +2141,18 @@ static const char *eswitch_inline_mode_name(uint32_t mode)
}
}
static const char *eswitch_encap_mode_name(uint32_t mode)
{
switch (mode) {
case DEVLINK_ESWITCH_ENCAP_MODE_NONE:
return ESWITCH_ENCAP_MODE_NONE;
case DEVLINK_ESWITCH_ENCAP_MODE_BASIC:
return ESWITCH_ENCAP_MODE_BASIC;
default:
return "<unknown mode>";
}
}
static void pr_out_eswitch(struct dl *dl, struct nlattr **tb)
{
__pr_out_handle_start(dl, tb, true, false);
@ -2164,11 +2170,10 @@ static void pr_out_eswitch(struct dl *dl, struct nlattr **tb)
tb[DEVLINK_ATTR_ESWITCH_INLINE_MODE])));
}
if (tb[DEVLINK_ATTR_ESWITCH_ENCAP_MODE]) {
bool encap_mode = !!mnl_attr_get_u8(tb[DEVLINK_ATTR_ESWITCH_ENCAP_MODE]);
check_indent_newline(dl);
print_string(PRINT_ANY, "encap", "encap %s",
encap_mode ? "enable" : "disable");
print_string(PRINT_ANY, "encap-mode", "encap-mode %s",
eswitch_encap_mode_name(mnl_attr_get_u8(
tb[DEVLINK_ATTR_ESWITCH_ENCAP_MODE])));
}
pr_out_handle_end(dl);
@ -2759,18 +2764,13 @@ static int cmd_dev_show(struct dl *dl)
return err;
}
static void cmd_dev_reload_help(void)
{
pr_err("Usage: devlink dev reload DEV [ netns { PID | NAME | ID } ]\n");
}
static int cmd_dev_reload(struct dl *dl)
{
struct nlmsghdr *nlh;
int err;
if (dl_argv_match(dl, "help") || dl_no_arg(dl)) {
cmd_dev_reload_help();
cmd_dev_help();
return 0;
}
@ -2892,11 +2892,6 @@ static int cmd_versions_show_cb(const struct nlmsghdr *nlh, void *data)
return MNL_CB_OK;
}
static void cmd_dev_info_help(void)
{
pr_err("Usage: devlink dev info [ DEV ]\n");
}
static int cmd_dev_info(struct dl *dl)
{
struct nlmsghdr *nlh;
@ -2904,7 +2899,7 @@ static int cmd_dev_info(struct dl *dl)
int err;
if (dl_argv_match(dl, "help")) {
cmd_dev_info_help();
cmd_dev_help();
return 0;
}
@ -2925,12 +2920,6 @@ static int cmd_dev_info(struct dl *dl)
return err;
}
static void cmd_dev_flash_help(void)
{
pr_err("Usage: devlink dev flash DEV file PATH [ component NAME ]\n");
}
struct cmd_dev_flash_status_ctx {
struct dl *dl;
char *last_msg;
@ -3078,7 +3067,7 @@ static int cmd_dev_flash(struct dl *dl)
int err;
if (dl_argv_match(dl, "help") || dl_no_arg(dl)) {
cmd_dev_flash_help();
cmd_dev_help();
return 0;
}
@ -4970,15 +4959,19 @@ static int cmd_dpipe_headers_show(struct dl *dl)
return err;
}
static void cmd_dpipe_header_help(void)
static void cmd_dpipe_help(void)
{
pr_err("Usage: devlink dpipe headers show DEV\n");
pr_err("Usage: devlink dpipe table show DEV [ name TABLE_NAME ]\n");
pr_err(" devlink dpipe table set DEV name TABLE_NAME\n");
pr_err(" [ counters_enabled { true | false } ]\n");
pr_err(" devlink dpipe table dump DEV name TABLE_NAME\n");
pr_err(" devlink dpipe header show DEV\n");
}
static int cmd_dpipe_header(struct dl *dl)
{
if (dl_argv_match(dl, "help") || dl_no_arg(dl)) {
cmd_dpipe_header_help();
cmd_dpipe_help();
return 0;
} else if (dl_argv_match(dl, "show")) {
dl_arg_inc(dl);
@ -5794,16 +5787,10 @@ out:
return err;
}
static void cmd_dpipe_table_help(void)
{
pr_err("Usage: devlink dpipe table [ OBJECT-LIST ]\n"
"where OBJECT-LIST := { show | set | dump }\n");
}
static int cmd_dpipe_table(struct dl *dl)
{
if (dl_argv_match(dl, "help") || dl_no_arg(dl)) {
cmd_dpipe_table_help();
cmd_dpipe_help();
return 0;
} else if (dl_argv_match(dl, "show")) {
dl_arg_inc(dl);
@ -5819,12 +5806,6 @@ static int cmd_dpipe_table(struct dl *dl)
return -ENOENT;
}
static void cmd_dpipe_help(void)
{
pr_err("Usage: devlink dpipe [ OBJECT-LIST ]\n"
"where OBJECT-LIST := { header | table }\n");
}
static int cmd_dpipe(struct dl *dl)
{
if (dl_argv_match(dl, "help") || dl_no_arg(dl)) {
@ -6941,7 +6922,9 @@ static void cmd_health_help(void)
pr_err(" devlink health diagnose DEV reporter REPORTER_NAME\n");
pr_err(" devlink health dump show DEV reporter REPORTER_NAME\n");
pr_err(" devlink health dump clear DEV reporter REPORTER_NAME\n");
pr_err(" devlink health set DEV reporter REPORTER_NAME { grace_period | auto_recover } { msec | boolean }\n");
pr_err(" devlink health set DEV reporter REPORTER_NAME\n");
pr_err(" [ grace_period MSEC ]\n");
pr_err(" [ auto_recover { true | false } ]\n");
}
static int cmd_health(struct dl *dl)

View File

@ -1 +1 @@
static const char SNAPSHOT[] = "200127";
static const char SNAPSHOT[] = "200330";

View File

@ -59,13 +59,13 @@ static int nh_dump_filter(struct nlmsghdr *nlh, int reqlen)
}
if (filter.groups) {
addattr_l(nlh, reqlen, NHA_GROUPS, NULL, 0);
err = addattr_l(nlh, reqlen, NHA_GROUPS, NULL, 0);
if (err)
return err;
}
if (filter.master) {
addattr32(nlh, reqlen, NHA_MASTER, filter.master);
err = addattr32(nlh, reqlen, NHA_MASTER, filter.master);
if (err)
return err;
}

View File

@ -420,9 +420,12 @@ link setting is configured on the software bridge (default)
.BR "\-t" , " \-timestamp"
display current time when using monitor option.
.SS bridge link show - list bridge port configuration.
.SS bridge link show - list ports configuration for all bridges.
This command displays the current bridge port configuration and flags.
This command displays port configuration and flags for all bridges.
To display port configuration and flags for a specific bridge, use the
"ip link show master <bridge_device>" command.
.SH bridge fdb - forwarding database management

View File

@ -35,7 +35,7 @@ devlink-dev \- devlink device configuration
.BR inline-mode " { " none " | " link " | " network " | " transport " } "
.RI "]"
.RI "[ "
.BR encap " { " disable " | " enable " } "
.BR encap-mode " { " none " | " basic " } "
.RI "]"
.ti -8
@ -125,13 +125,13 @@ Some HWs need the VF driver to put part of the packet headers on the TX descript
- L4 mode
.TP
.BR encap " { " disable " | " enable " } "
.BR encap-mode " { " none " | " basic " } "
Set eswitch encapsulation support
.I disable
.I none
- Disable encapsulation support
.I enable
.I basic
- Enable encapsulation support
.SS devlink dev param set - set new value to devlink device configuration parameter

99
man/man8/devlink-dpipe.8 Normal file
View File

@ -0,0 +1,99 @@
.TH DEVLINK\-DPIPE 8 "4 Apr 2020" "iproute2" "Linux"
.SH NAME
devlink-dpipe \- devlink dataplane pipeline visualization
.SH SYNOPSIS
.sp
.ad l
.in +8
.ti -8
.B devlink
.RI "[ " OPTIONS " ]"
.B dpipe
.RB "{ " table " | " header " }"
.RI "{ " COMMAND " | "
.BR help " }"
.sp
.ti -8
.IR OPTIONS " := { "
\fB\-V\fR[\fIersion\fR] }
.ti -8
.BI "devlink dpipe table show " DEV
.RB "[ " name
.IR TABLE_NAME " ]"
.ti -8
.BI "devlink dpipe table set " DEV
.BI name " TABLE_NAME "
.ti -8
.BI "devlink dpipe table dump " DEV
.BI name " TABLE_NAME "
.ti -8
.BI "devlink dpipe header show " DEV
.ti -8
.B devlink dpipe help
.SH "DESCRIPTION"
.SS devlink dpipe table show - display devlink dpipe table attributes
.TP
.BI name " TABLE_NAME"
Specifies the table to operate on.
.SS devlink dpipe table set - set devlink dpipe table attributes
.TP
.BI name " TABLE_NAME"
Specifies the table to operate on.
.SS devlink dpipe table dump - dump devlink dpipe table entries
.TP
.BI name " TABLE_NAME"
Specifies the table to operate on.
.SS devlink dpipe header show - display devlink dpipe header attributes
.TP
.BI name " TABLE_NAME"
Specifies the table to operate on.
.SH "EXAMPLES"
.PP
devlink dpipe table show pci/0000:01:00.0
.RS 4
Shows all dpipe tables on specified devlink device.
.RE
.PP
devlink dpipe table show pci/0000:01:00.0 name mlxsw_erif
.RS 4
Shows mlxsw_erif dpipe table on specified devlink device.
.RE
.PP
devlink dpipe table set pci/0000:01:00.0 name mlxsw_erif counters_enabled true
.RS 4
Turns on the counters on mlxsw_erif table.
.RE
.PP
devlink dpipe table dump pci/0000:01:00.0 name mlxsw_erif
.RS 4
Dumps content of mlxsw_erif table.
.RE
.PP
devlink dpipe header show pci/0000:01:00.0
.RS 4
Shows all dpipe headers on specified devlink device.
.RE
.SH SEE ALSO
.BR devlink (8),
.BR devlink-dev (8),
.BR devlink-monitor (8),
.br
.SH AUTHOR
Jiri Pirko <jiri@mellanox.com>

View File

@ -52,13 +52,13 @@ devlink-health \- devlink health reporting and recovery
.RI "" DEV ""
.B reporter
.RI "" REPORTER ""
.RI " { "
.B grace_period | auto_recover
.RI " } { "
.RI "" msec ""
.RI "|"
.RI "" boolean ""
.RI " } "
.RI "[ "
.BI "grace_period " MSEC "
.RI "]"
.RI "[ "
.BR auto_recover " { " true " | " false " } "
.RI "]"
.ti -8
.B devlink health help
@ -130,15 +130,9 @@ the next "devlink health dump show" command.
.I "REPORTER"
- specifies the reporter's name registered on the devlink device.
.SS devlink health set - Enable the user to configure:
.PD 0
1) grace_period [msec] - Time interval between consecutive auto recoveries.
.P
2) auto_recover [true/false] - Indicates whether the devlink should execute automatic recover on error.
.P
.SS devlink health set - Configure health reporter.
Please note that this command is not supported on a reporter which
doesn't support a recovery method.
.PD
.PP
.I "DEV"
@ -148,6 +142,14 @@ doesn't support a recovery method.
.I "REPORTER"
- specifies the reporter's name registered on the devlink device.
.TP
.BI grace_period " MSEC "
Time interval between consecutive auto recoveries.
.TP
.BR auto_recover " { " true " | " false " } "
Indicates whether the devlink should execute automatic recover on error.
.SH "EXAMPLES"
.PP
devlink health show

View File

@ -82,8 +82,7 @@ ACTNAME
.I HWSTATSSPEC
:=
.BR hw_stats " {"
.IR immediate " | " delayed " | " disabled
.R }
.IR immediate " | " delayed " | " disabled " }"
.I ACTDETAIL
:=

View File

@ -156,7 +156,7 @@ static int parse_mpls(struct action_util *a, int *argc_p, char ***argv_p,
}
}
if (action == TCA_MPLS_ACT_PUSH && !label)
if (action == TCA_MPLS_ACT_PUSH && label == 0xffffffff)
missarg("label");
if (action == TCA_MPLS_ACT_PUSH && proto &&