Skip to content

Commit

Permalink
Merge branch 'review/mac-merge-v3' into next
Browse files Browse the repository at this point in the history
Vladimir Oltean:

Add support for the following 2 new commands:

$ ethtool [ --include-statistics ] --show-mm <eth>
$ ethtool --set-mm <eth> [ ... ]

as well as for:

$ ethtool --include-statistics --show-pause <eth> --src pmac|emac|aggregate
$ ethtool --include-statistics --show-pause <eth> --src pmac|emac|aggregate
$ ethtool -S <eth> --groups eth-mac eth-phy eth-ctrl rmon -- --src pmac

and some modest amount of documentation (the bulk of it is already
distributed with the kernel's ethtool netlink rst).
  • Loading branch information
mkubecek committed Feb 13, 2023
2 parents cf02fc1 + e38f6db commit c6d8f26
Show file tree
Hide file tree
Showing 7 changed files with 443 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ethtool_SOURCES += \
netlink/features.c netlink/privflags.c netlink/rings.c \
netlink/channels.c netlink/coalesce.c netlink/pause.c \
netlink/eee.c netlink/tsinfo.c netlink/fec.c \
netlink/stats.c \
netlink/stats.c netlink/mm.c \
netlink/desc-ethtool.c netlink/desc-genlctrl.c \
netlink/module-eeprom.c netlink/module.c netlink/rss.c \
netlink/desc-rtnl.c netlink/cable_test.c netlink/tunnels.c \
Expand Down
107 changes: 107 additions & 0 deletions ethtool.8.in
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,22 @@ ethtool \- query or control network driver and hardware settings
.HP
.B ethtool \-\-get\-plca\-status
.I devname
.HP
.B ethtool \-\-show\-mm
.I devname
.HP
.B ethtool \-\-set\-mm
.I devname
.RB [ verify\-enabled
.BR on | off ]
.RB [ verify\-time
.BR N ]
.RB [ tx\-enabled
.BR on | off ]
.RB [ pmac\-enabled
.BR on | off ]
.RB [ tx\-min\-frag\-size
.BR N ]
.
.\" Adjust lines (i.e. full justification) and hyphenate.
.ad
Expand Down Expand Up @@ -548,6 +564,15 @@ displaying relevant device statistics for selected get commands.
.TP
.B \-a \-\-show\-pause
Queries the specified Ethernet device for pause parameter information.
.RS 4
.TP
.A3 \fB\-\-src \fBaggregate\fP \fBemac\fP \fBpmac\fP
If the MAC Merge layer is supported, request a particular source of device
statistics (eMAC or pMAC, or their aggregate). Only valid if ethtool was
invoked with the
.B \-I \-\-include\-statistics
argument.
.RE
.TP
.B \-A \-\-pause
Changes the pause parameters of the specified Ethernet device.
Expand Down Expand Up @@ -713,6 +738,10 @@ naming of NIC- and driver-specific statistics across vendors.
.TP
.B \fB\-\-groups [\fBeth\-phy\fP] [\fBeth\-mac\fP] [\fBeth\-ctrl\fP] [\fBrmon\fP]
Request groups of standard device statistics.
.TP
.A3 \fB\-\-src \fBaggregate\fP \fBemac\fP \fBpmac\fP
If the MAC Merge layer is supported, request a particular source of device
statistics (eMAC or pMAC, or their aggregate).
.RE
.TP
.B \-\-phy\-statistics
Expand Down Expand Up @@ -1592,6 +1621,84 @@ for PLCA burst mode to work as intended.
Show the current PLCA status for the given interface. If \fBon\fR, the PHY is
successfully receiving or generating the BEACON signal. If \fBoff\fR, the PLCA
function is temporarily disabled and the PHY is operating in plain CSMA/CD mode.
.RE
.TP
.B \-\-show\-mm
Show the MAC Merge layer state. The ethtool argument
.B \-I \-\-include\-statistics
can be used with this command, and MAC Merge layer statistics counters will
also be retrieved.
.RS 4
.TP
.B pmac-enabled
Shows whether the pMAC is enabled and capable of receiving traffic and SMD-V
frames (and responding to them with SMD-R replies).
.TP
.B tx-enabled
Shows whether transmission on the pMAC is administratively enabled.
.TP
.B tx-active
Shows whether transmission on the pMAC is active (verification is either
successful, or was disabled).
.TP
.B tx-min-frag-size
Shows the minimum size (in octets) of transmitted non-final fragments which
can be received by the link partner. Corresponds to the standard addFragSize
variable using the formula:

tx-min-frag-size = 64 * (1 + addFragSize) - 4
.TP
.B rx-min-frag-size
Shows the minimum size (in octets) of non-final fragments which the local
device supports receiving.
.TP
.B verify-enabled
Shows whether the verification state machine is enabled. This process, if
successful, ensures that preemptible frames transmitted by the local device
will not be dropped as error frames by the link partner.
.TP
.B verify-time
Shows the interval in ms between verification attempts, represented as an
integer between 1 and 128 ms. The standard defines a fixed number of
verification attempts (verifyLimit) before failing the verification process.
.TP
.B max-verify-time
Shows the maximum value for verify-time accepted by the local device, which
may be less than 128 ms.
.TP
.B verify-status
Shows the current state of the verification state machine of the local device.
Values can be
.B INITIAL,
.B VERIFYING,
.B SUCCEEDED,
.B FAILED
or
.B DISABLED.

.RE
.TP
.B \-\-set\-mm
Set the MAC Merge layer parameters.
.RS 4
.TP
.A2 pmac-enabled \ on off
Enable reception for the pMAC.
.TP
.A2 tx-enabled \ on off
Administatively enable transmission for the pMAC.
.TP
.B tx-min-frag-size \ N
Set the minimum size (in octets) of transmitted non-final fragments which can
be received by the link partner.
.TP
.A2 verify-enabled \ on off
Enable or disable the verification state machine.
.TP
.B verify-time \ N
Set the interval in ms between verification attempts.

.RE
.SH BUGS
Not supported (in part or whole) on all network drivers.
.SH AUTHOR
Expand Down
20 changes: 19 additions & 1 deletion ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -5682,7 +5682,8 @@ static const struct option args[] = {
.json = true,
.func = do_gpause,
.nlfunc = nl_gpause,
.help = "Show pause options"
.help = "Show pause options",
.xhelp = " [ --src aggregate | emac | pmac ]\n"
},
{
.opts = "-A|--pause",
Expand Down Expand Up @@ -5818,6 +5819,7 @@ static const struct option args[] = {
.nlfunc = nl_gstats,
.help = "Show adapter statistics",
.xhelp = " [ --all-groups | --groups [eth-phy] [eth-mac] [eth-ctrl] [rmon] ]\n"
" [ --src aggregate | emac | pmac ]\n"
},
{
.opts = "--phy-statistics",
Expand Down Expand Up @@ -6101,6 +6103,22 @@ static const struct option args[] = {
.nlfunc = nl_plca_get_status,
.help = "Get PLCA status information",
},
{
.opts = "--show-mm",
.json = true,
.nlfunc = nl_get_mm,
.help = "Show MAC merge layer state",
},
{
.opts = "--set-mm",
.nlfunc = nl_set_mm,
.help = "Set MAC merge layer parameters",
" [ verify-enabled on|off ]\n"
" [ verify-time N ]\n"
" [ tx-enabled on|off ]\n"
" [ pmac-enabled on|off ]\n"
" [ tx-min-frag-size 60-252 ]\n"
},
{
.opts = "-h|--help",
.no_dev = true,
Expand Down
4 changes: 4 additions & 0 deletions netlink/extapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ int nl_grss(struct cmd_context *ctx);
int nl_plca_get_cfg(struct cmd_context *ctx);
int nl_plca_set_cfg(struct cmd_context *ctx);
int nl_plca_get_status(struct cmd_context *ctx);
int nl_get_mm(struct cmd_context *ctx);
int nl_set_mm(struct cmd_context *ctx);

void nl_monitor_usage(void);

Expand Down Expand Up @@ -122,6 +124,8 @@ nl_get_eeprom_page(struct cmd_context *ctx __maybe_unused,
#define nl_plca_get_cfg NULL
#define nl_plca_set_cfg NULL
#define nl_plca_get_status NULL
#define nl_get_mm NULL
#define nl_set_mm NULL

#endif /* ETHTOOL_ENABLE_NETLINK */

Expand Down
Loading

0 comments on commit c6d8f26

Please sign in to comment.