diff mbox series

[iproute2-next,v2,4/4] devlink: Add man page for devlink-trap

Message ID 20190813083143.13509-5-idosch@idosch.org
State Accepted
Delegated to: David Ahern
Headers show
Series Add devlink-trap support | expand

Commit Message

Ido Schimmel Aug. 13, 2019, 8:31 a.m. UTC
From: Ido Schimmel <idosch@mellanox.com>

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 man/man8/devlink-monitor.8 |   3 +-
 man/man8/devlink-trap.8    | 138 +++++++++++++++++++++++++++++++++++++
 man/man8/devlink.8         |  11 ++-
 3 files changed, 150 insertions(+), 2 deletions(-)
 create mode 100644 man/man8/devlink-trap.8

Comments

Jiri Pirko Aug. 13, 2019, 10:20 a.m. UTC | #1
Tue, Aug 13, 2019 at 10:31:43AM CEST, idosch@idosch.org wrote:
>From: Ido Schimmel <idosch@mellanox.com>
>
>Signed-off-by: Ido Schimmel <idosch@mellanox.com>
>---
> man/man8/devlink-monitor.8 |   3 +-
> man/man8/devlink-trap.8    | 138 +++++++++++++++++++++++++++++++++++++
> man/man8/devlink.8         |  11 ++-
> 3 files changed, 150 insertions(+), 2 deletions(-)
> create mode 100644 man/man8/devlink-trap.8
>
>diff --git a/man/man8/devlink-monitor.8 b/man/man8/devlink-monitor.8
>index 13fe641dc8f5..fffab3a4ce88 100644
>--- a/man/man8/devlink-monitor.8
>+++ b/man/man8/devlink-monitor.8
>@@ -21,7 +21,7 @@ command is the first in the command line and then the object list.
> .I OBJECT-LIST
> is the list of object types that we want to monitor.
> It may contain
>-.BR dev ", " port ".
>+.BR dev ", " port ", " trap ", " trap-group .

Looks like "trap-group" is a leftover here, isn't it?


> 
> .B devlink
> opens Devlink Netlink socket, listens on it and dumps state changes.
>@@ -31,6 +31,7 @@ opens Devlink Netlink socket, listens on it and dumps state changes.
> .BR devlink-dev (8),
> .BR devlink-sb (8),
> .BR devlink-port (8),
>+.BR devlink-trap (8),
> .br
> 
> .SH AUTHOR
>diff --git a/man/man8/devlink-trap.8 b/man/man8/devlink-trap.8
>new file mode 100644
>index 000000000000..4f079eb86d7b
>--- /dev/null
>+++ b/man/man8/devlink-trap.8
>@@ -0,0 +1,138 @@
>+.TH DEVLINK\-TRAP 8 "2 August 2019" "iproute2" "Linux"
>+.SH NAME
>+devlink-trap \- devlink trap configuration
>+.SH SYNOPSIS
>+.sp
>+.ad l
>+.in +8
>+.ti -8
>+.B devlink
>+.RI "[ " OPTIONS " ]"
>+.B trap
>+.RI "{ " COMMAND " |"
>+.BR help " }"
>+.sp
>+
>+.ti -8
>+.IR OPTIONS " := { "
>+\fB\-v\fR[\fIerbose\fR] |
>+\fB\-s\fR[\fItatistics\fR] }

Not sure you need to put generic option here. But I don't mind much.

Otherwise this looks fine.
Acked-by: Jiri Pirko <jiri@mellanox.com>

[...]
Ido Schimmel Aug. 13, 2019, 10:39 a.m. UTC | #2
On Tue, Aug 13, 2019 at 12:20:37PM +0200, Jiri Pirko wrote:
> Tue, Aug 13, 2019 at 10:31:43AM CEST, idosch@idosch.org wrote:
> >From: Ido Schimmel <idosch@mellanox.com>
> >
> >Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> >---
> > man/man8/devlink-monitor.8 |   3 +-
> > man/man8/devlink-trap.8    | 138 +++++++++++++++++++++++++++++++++++++
> > man/man8/devlink.8         |  11 ++-
> > 3 files changed, 150 insertions(+), 2 deletions(-)
> > create mode 100644 man/man8/devlink-trap.8
> >
> >diff --git a/man/man8/devlink-monitor.8 b/man/man8/devlink-monitor.8
> >index 13fe641dc8f5..fffab3a4ce88 100644
> >--- a/man/man8/devlink-monitor.8
> >+++ b/man/man8/devlink-monitor.8
> >@@ -21,7 +21,7 @@ command is the first in the command line and then the object list.
> > .I OBJECT-LIST
> > is the list of object types that we want to monitor.
> > It may contain
> >-.BR dev ", " port ".
> >+.BR dev ", " port ", " trap ", " trap-group .
> 
> Looks like "trap-group" is a leftover here, isn't it?

You get events when traps and groups are created / destroyed. See below output
when creating a new netdevsim device:

$ devlink mon trap-group
[trap-group,new] netdevsim/netdevsim20: name l2_drops generic true
[trap-group,new] netdevsim/netdevsim20: name l3_drops generic true
[trap-group,new] netdevsim/netdevsim20: name buffer_drops generic true

$ devlink mon trap
[trap,new] netdevsim/netdevsim10: name source_mac_is_multicast type drop generic true action drop group l2_drops
[trap,new] netdevsim/netdevsim10: name vlan_tag_mismatch type drop generic true action drop group l2_drops
[trap,new] netdevsim/netdevsim10: name ingress_vlan_filter type drop generic true action drop group l2_drops
[trap,new] netdevsim/netdevsim10: name ingress_spanning_tree_filter type drop generic true action drop group l2_drops
[trap,new] netdevsim/netdevsim10: name port_list_is_empty type drop generic true action drop group l2_drops
[trap,new] netdevsim/netdevsim10: name port_loopback_filter type drop generic true action drop group l2_drops
[trap,new] netdevsim/netdevsim10: name fid_miss type exception generic false action trap group l2_drops
[trap,new] netdevsim/netdevsim10: name blackhole_route type drop generic true action drop group l3_drops
[trap,new] netdevsim/netdevsim10: name ttl_value_is_too_small type exception generic true action trap group l3_drops
[trap,new] netdevsim/netdevsim10: name tail_drop type drop generic true action drop group buffer_drops
Jiri Pirko Aug. 13, 2019, 10:52 a.m. UTC | #3
Tue, Aug 13, 2019 at 12:39:04PM CEST, idosch@idosch.org wrote:
>On Tue, Aug 13, 2019 at 12:20:37PM +0200, Jiri Pirko wrote:
>> Tue, Aug 13, 2019 at 10:31:43AM CEST, idosch@idosch.org wrote:
>> >From: Ido Schimmel <idosch@mellanox.com>
>> >
>> >Signed-off-by: Ido Schimmel <idosch@mellanox.com>
>> >---
>> > man/man8/devlink-monitor.8 |   3 +-
>> > man/man8/devlink-trap.8    | 138 +++++++++++++++++++++++++++++++++++++
>> > man/man8/devlink.8         |  11 ++-
>> > 3 files changed, 150 insertions(+), 2 deletions(-)
>> > create mode 100644 man/man8/devlink-trap.8
>> >
>> >diff --git a/man/man8/devlink-monitor.8 b/man/man8/devlink-monitor.8
>> >index 13fe641dc8f5..fffab3a4ce88 100644
>> >--- a/man/man8/devlink-monitor.8
>> >+++ b/man/man8/devlink-monitor.8
>> >@@ -21,7 +21,7 @@ command is the first in the command line and then the object list.
>> > .I OBJECT-LIST
>> > is the list of object types that we want to monitor.
>> > It may contain
>> >-.BR dev ", " port ".
>> >+.BR dev ", " port ", " trap ", " trap-group .
>> 
>> Looks like "trap-group" is a leftover here, isn't it?
>
>You get events when traps and groups are created / destroyed. See below output
>when creating a new netdevsim device:

Ah! Makes sense. Thanks!

>
>$ devlink mon trap-group
>[trap-group,new] netdevsim/netdevsim20: name l2_drops generic true
>[trap-group,new] netdevsim/netdevsim20: name l3_drops generic true
>[trap-group,new] netdevsim/netdevsim20: name buffer_drops generic true
>
>$ devlink mon trap
>[trap,new] netdevsim/netdevsim10: name source_mac_is_multicast type drop generic true action drop group l2_drops
>[trap,new] netdevsim/netdevsim10: name vlan_tag_mismatch type drop generic true action drop group l2_drops
>[trap,new] netdevsim/netdevsim10: name ingress_vlan_filter type drop generic true action drop group l2_drops
>[trap,new] netdevsim/netdevsim10: name ingress_spanning_tree_filter type drop generic true action drop group l2_drops
>[trap,new] netdevsim/netdevsim10: name port_list_is_empty type drop generic true action drop group l2_drops
>[trap,new] netdevsim/netdevsim10: name port_loopback_filter type drop generic true action drop group l2_drops
>[trap,new] netdevsim/netdevsim10: name fid_miss type exception generic false action trap group l2_drops
>[trap,new] netdevsim/netdevsim10: name blackhole_route type drop generic true action drop group l3_drops
>[trap,new] netdevsim/netdevsim10: name ttl_value_is_too_small type exception generic true action trap group l3_drops
>[trap,new] netdevsim/netdevsim10: name tail_drop type drop generic true action drop group buffer_drops
diff mbox series

Patch

diff --git a/man/man8/devlink-monitor.8 b/man/man8/devlink-monitor.8
index 13fe641dc8f5..fffab3a4ce88 100644
--- a/man/man8/devlink-monitor.8
+++ b/man/man8/devlink-monitor.8
@@ -21,7 +21,7 @@  command is the first in the command line and then the object list.
 .I OBJECT-LIST
 is the list of object types that we want to monitor.
 It may contain
-.BR dev ", " port ".
+.BR dev ", " port ", " trap ", " trap-group .
 
 .B devlink
 opens Devlink Netlink socket, listens on it and dumps state changes.
@@ -31,6 +31,7 @@  opens Devlink Netlink socket, listens on it and dumps state changes.
 .BR devlink-dev (8),
 .BR devlink-sb (8),
 .BR devlink-port (8),
+.BR devlink-trap (8),
 .br
 
 .SH AUTHOR
diff --git a/man/man8/devlink-trap.8 b/man/man8/devlink-trap.8
new file mode 100644
index 000000000000..4f079eb86d7b
--- /dev/null
+++ b/man/man8/devlink-trap.8
@@ -0,0 +1,138 @@ 
+.TH DEVLINK\-TRAP 8 "2 August 2019" "iproute2" "Linux"
+.SH NAME
+devlink-trap \- devlink trap configuration
+.SH SYNOPSIS
+.sp
+.ad l
+.in +8
+.ti -8
+.B devlink
+.RI "[ " OPTIONS " ]"
+.B trap
+.RI "{ " COMMAND " |"
+.BR help " }"
+.sp
+
+.ti -8
+.IR OPTIONS " := { "
+\fB\-v\fR[\fIerbose\fR] |
+\fB\-s\fR[\fItatistics\fR] }
+
+.ti -8
+.B "devlink trap show"
+.RI "[ " DEV
+.B trap
+.IR TRAP " ]"
+
+.ti -8
+.BI "devlink trap set " DEV " trap " TRAP
+.RB "[ " action " { " trap " | " drop " } ]"
+
+.ti -8
+.B "devlink trap group show"
+.RI "[ " DEV
+.B group
+.IR GROUP " ]"
+
+.ti -8
+.BI "devlink trap group set " DEV " group " GROUP
+.RB "[ " action " { " trap " | " drop " } ]"
+
+.ti -8
+.B devlink trap help
+
+.SH "DESCRIPTION"
+.SS devlink trap show - display available packet traps and their attributes
+
+.PP
+.I "DEV"
+- specifies the devlink device from which to show packet traps.
+If this argument is omitted all packet traps of all devices are listed.
+
+.PP
+.BI "trap " TRAP
+- specifies the packet trap.
+Only applicable if a devlink device is also specified.
+
+.SS devlink trap set - set attributes of a packet trap
+
+.PP
+.I "DEV"
+- specifies the devlink device the packet trap belongs to.
+
+.PP
+.BI "trap " TRAP
+- specifies the packet trap.
+
+.TP
+.BR action " { " trap " | " drop " } "
+packet trap action.
+
+.I trap
+- the sole copy of the packet is sent to the CPU.
+
+.I drop
+- the packet is dropped by the underlying device and a copy is not sent to the CPU.
+
+.SS devlink trap group show - display available packet trap groups and their attributes
+
+.PP
+.I "DEV"
+- specifies the devlink device from which to show packet trap groups.
+If this argument is omitted all packet trap groups of all devices are listed.
+
+.PP
+.BI "group " GROUP
+- specifies the packet trap group.
+Only applicable if a devlink device is also specified.
+
+.SS devlink trap group set - set attributes of a packet trap group
+
+.PP
+.I "DEV"
+- specifies the devlink device the packet trap group belongs to.
+
+.PP
+.BI "group " GROUP
+- specifies the packet trap group.
+
+.TP
+.BR action " { " trap " | " drop " } "
+packet trap action. The action is set for all the packet traps member in the
+trap group. The actions of non-drop traps cannot be changed and are thus
+skipped.
+
+.SH "EXAMPLES"
+.PP
+devlink trap show
+.RS 4
+List available packet traps.
+.RE
+.PP
+devlink trap group show
+.RS 4
+List available packet trap groups.
+.RE
+.PP
+devlink -vs trap show pci/0000:01:00.0 trap source_mac_is_multicast
+.RS 4
+Show attributes and statistics of a specific packet trap.
+.RE
+.PP
+devlink -s trap group show pci/0000:01:00.0 group l2_drops
+.RS 4
+Show attributes and statistics of a specific packet trap group.
+.RE
+.PP
+devlink trap set pci/0000:01:00.0 trap source_mac_is_multicast action trap
+.RS 4
+Set the action of a specific packet trap to 'trap'.
+
+.SH SEE ALSO
+.BR devlink (8),
+.BR devlink-dev (8),
+.BR devlink-monitor (8),
+.br
+
+.SH AUTHOR
+Ido Schimmel <idosch@mellanox.com>
diff --git a/man/man8/devlink.8 b/man/man8/devlink.8
index 13d4dcd908b3..12d489440a3d 100644
--- a/man/man8/devlink.8
+++ b/man/man8/devlink.8
@@ -7,7 +7,7 @@  devlink \- Devlink tool
 .in +8
 .ti -8
 .B devlink
-.RI "[ " OPTIONS " ] { " dev | port | monitor | sb | resource | region | health " } { " COMMAND " | "
+.RI "[ " OPTIONS " ] { " dev | port | monitor | sb | resource | region | health | trap " } { " COMMAND " | "
 .BR help " }"
 .sp
 
@@ -51,6 +51,10 @@  When combined with -j generate a pretty JSON output.
 .BR "\-v" , " --verbose"
 Turn on verbose output.
 
+.TP
+.BR "\-s" , " --statistics"
+Output statistics.
+
 .SS
 .I OBJECT
 
@@ -82,6 +86,10 @@  Turn on verbose output.
 .B health
 - devlink reporting and recovery
 
+.TP
+.B trap
+- devlink trap configuration
+
 .SS
 .I COMMAND
 
@@ -114,6 +122,7 @@  Exit status is 0 if command was successful or a positive integer upon failure.
 .BR devlink-resource (8),
 .BR devlink-region (8),
 .BR devlink-health (8),
+.BR devlink-trap (8),
 .br
 
 .SH REPORTING BUGS