* [PATCH v3 ethtool 0/4] MAC Merge layer support
@ 2023-02-10 21:33 Vladimir Oltean
2023-02-10 21:33 ` [PATCH v3 ethtool 1/4] netlink: add support for MAC Merge layer Vladimir Oltean
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Vladimir Oltean @ 2023-02-10 21:33 UTC (permalink / raw)
To: netdev; +Cc: Michal Kubecek, Pranavi Somisetty, Piergiorgio Beruto
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).
This patch set applies on top of "[v5,ethtool-next,1/1] add support for
IEEE 802.3cg-2019 Clause 148", because otherwise it would conflict with it:
https://patchwork.kernel.org/project/netdevbpf/patch/d51013e0bc617651c0e6d298f47cc6b82c0ffa88.1675327734.git.piergiorgio.beruto@gmail.com/
I believe Michal hasn't gotten to it yet, but I'm putting Piergiorgio on
CC too, in case there are other reasons why I shouldn't wait for his patch
to be merged first.
Vladimir Oltean (4):
netlink: add support for MAC Merge layer
netlink: pass the source of statistics for pause stats
netlink: pass the source of statistics for port stats
ethtool.8: update documentation with MAC Merge related bits
Makefile.am | 2 +-
ethtool.8.in | 107 +++++++++++++++++++
ethtool.c | 16 +++
netlink/extapi.h | 4 +
netlink/mm.c | 270 +++++++++++++++++++++++++++++++++++++++++++++++
netlink/pause.c | 33 +++++-
netlink/stats.c | 14 +++
7 files changed, 440 insertions(+), 6 deletions(-)
create mode 100644 netlink/mm.c
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 ethtool 1/4] netlink: add support for MAC Merge layer
2023-02-10 21:33 [PATCH v3 ethtool 0/4] MAC Merge layer support Vladimir Oltean
@ 2023-02-10 21:33 ` Vladimir Oltean
2023-02-10 21:33 ` [PATCH v3 ethtool 2/4] netlink: pass the source of statistics for pause stats Vladimir Oltean
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Vladimir Oltean @ 2023-02-10 21:33 UTC (permalink / raw)
To: netdev; +Cc: Michal Kubecek, Pranavi Somisetty, Piergiorgio Beruto
$ ethtool --include-statistics --show-mm eno0
MAC merge layer state for eno0:
pMAC enabled: on
TX enabled: on
TX active: on
TX minimum fragment size: 60
RX minimum fragment size: 60
Verify enabled: off
Verify time: 127 ms
Max verify time: 127 ms
Verification status: SUCCEEDED
Statistics:
MACMergeFrameAssErrorCount: 0
MACMergeFrameSmdErrorCount: 0
MACMergeFrameAssOkCount: 0
MACMergeFragCountRx: 0
MACMergeFragCountTx: 0
MACMergeHoldCount: 0
$ ethtool --include-statistics --json --show-mm eno0
[ {
"ifname": "eno0",
"pmac-enabled": true,
"tx-enabled": true,
"tx-active": true,
"tx-min-frag-size": 60,
"rx-min-frag-size": 60,
"verify-enabled": true,
"verify-time": 127,
"max-verify-time": 127,
"verify-status": "SUCCEEDED",
"statistics": {
"MACMergeFrameAssErrorCount": 0,
"MACMergeFrameSmdErrorCount": 0,
"MACMergeFrameAssOkCount": 0,
"MACMergeFragCountRx": 0,
"MACMergeFragCountTx": 0,
"MACMergeHoldCount": 0
}
} ]
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Pranavi Somisetty <pranavi.somisetty@amd.com>
---
v2->v3:
- the pretty nlattr descriptions have already been generated by Michal
- fix stray %u in show_u32()
- remove unintended changes to netlink/parser.c and netlink/parser.h
v1->v2:
- rebase on top of PLCA changes
- ETHTOOL_A_MM_ADD_FRAG_SIZE became ETHTOOL_A_MM_TX_MIN_FRAG_SIZE
- ETHTOOL_A_MM_RX_MIN_FRAG_SIZE was introduced
- ETHTOOL_A_MM_SUPPORTED disappeared
- fix help text for --show-mm
- use the newly introduced show_u32() instead of hand-rolling own
implementation - show_u32_json()
Makefile.am | 2 +-
ethtool.c | 16 +++
netlink/extapi.h | 4 +
netlink/mm.c | 270 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 291 insertions(+), 1 deletion(-)
create mode 100644 netlink/mm.c
diff --git a/Makefile.am b/Makefile.am
index cbc1f4f5fdf2..c83cb18173db 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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 \
diff --git a/ethtool.c b/ethtool.c
index 16c88bf7f527..74dfc9dfb66b 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -6101,6 +6101,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,
diff --git a/netlink/extapi.h b/netlink/extapi.h
index ce5748ec0532..bbe063342f60 100644
--- a/netlink/extapi.h
+++ b/netlink/extapi.h
@@ -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);
@@ -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 */
diff --git a/netlink/mm.c b/netlink/mm.c
new file mode 100644
index 000000000000..d026bc33239e
--- /dev/null
+++ b/netlink/mm.c
@@ -0,0 +1,270 @@
+/*
+ * mm.c - netlink implementation of MAC merge layer settings
+ *
+ * Implementation of "ethtool --show-mm <dev>" and "ethtool --set-mm <dev> ..."
+ */
+
+#include <errno.h>
+#include <inttypes.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "../internal.h"
+#include "../common.h"
+#include "netlink.h"
+#include "bitset.h"
+#include "parser.h"
+
+/* MM_GET */
+
+static const char *
+mm_verify_state_to_string(enum ethtool_mm_verify_status state)
+{
+ switch (state) {
+ case ETHTOOL_MM_VERIFY_STATUS_INITIAL:
+ return "INITIAL";
+ case ETHTOOL_MM_VERIFY_STATUS_VERIFYING:
+ return "VERIFYING";
+ case ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED:
+ return "SUCCEEDED";
+ case ETHTOOL_MM_VERIFY_STATUS_FAILED:
+ return "FAILED";
+ case ETHTOOL_MM_VERIFY_STATUS_DISABLED:
+ return "DISABLED";
+ default:
+ return "UNKNOWN";
+ }
+}
+
+static int show_mm_stats(const struct nlattr *nest)
+{
+ const struct nlattr *tb[ETHTOOL_A_MM_STAT_MAX + 1] = {};
+ DECLARE_ATTR_TB_INFO(tb);
+ static const struct {
+ unsigned int attr;
+ char *name;
+ } stats[] = {
+ { ETHTOOL_A_MM_STAT_REASSEMBLY_ERRORS, "MACMergeFrameAssErrorCount" },
+ { ETHTOOL_A_MM_STAT_SMD_ERRORS, "MACMergeFrameSmdErrorCount" },
+ { ETHTOOL_A_MM_STAT_REASSEMBLY_OK, "MACMergeFrameAssOkCount" },
+ { ETHTOOL_A_MM_STAT_RX_FRAG_COUNT, "MACMergeFragCountRx" },
+ { ETHTOOL_A_MM_STAT_TX_FRAG_COUNT, "MACMergeFragCountTx" },
+ { ETHTOOL_A_MM_STAT_HOLD_COUNT, "MACMergeHoldCount" },
+ };
+ bool header = false;
+ unsigned int i;
+ size_t n;
+ int ret;
+
+ ret = mnl_attr_parse_nested(nest, attr_cb, &tb_info);
+ if (ret < 0)
+ return ret;
+
+ open_json_object("statistics");
+ for (i = 0; i < ARRAY_SIZE(stats); i++) {
+ char fmt[64];
+
+ if (!tb[stats[i].attr])
+ continue;
+
+ if (!header && !is_json_context()) {
+ printf("Statistics:\n");
+ header = true;
+ }
+
+ if (mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U64)) {
+ fprintf(stderr, "malformed netlink message (statistic)\n");
+ goto err_close_stats;
+ }
+
+ n = snprintf(fmt, sizeof(fmt), " %s: %%" PRIu64 "\n",
+ stats[i].name);
+ if (n >= sizeof(fmt)) {
+ fprintf(stderr, "internal error - malformed label\n");
+ continue;
+ }
+
+ print_u64(PRINT_ANY, stats[i].name, fmt,
+ mnl_attr_get_u64(tb[stats[i].attr]));
+ }
+ close_json_object();
+
+ return 0;
+
+err_close_stats:
+ close_json_object();
+ return -1;
+}
+
+int mm_reply_cb(const struct nlmsghdr *nlhdr, void *data)
+{
+ const struct nlattr *tb[ETHTOOL_A_MM_MAX + 1] = {};
+ struct nl_context *nlctx = data;
+ DECLARE_ATTR_TB_INFO(tb);
+ bool silent;
+ int err_ret;
+ int ret;
+
+ silent = nlctx->is_dump || nlctx->is_monitor;
+ err_ret = silent ? MNL_CB_OK : MNL_CB_ERROR;
+ ret = mnl_attr_parse(nlhdr, GENL_HDRLEN, attr_cb, &tb_info);
+ if (ret < 0)
+ return err_ret;
+ nlctx->devname = get_dev_name(tb[ETHTOOL_A_MM_HEADER]);
+ if (!dev_ok(nlctx))
+ return err_ret;
+
+ if (silent)
+ print_nl();
+
+ open_json_object(NULL);
+
+ print_string(PRINT_ANY, "ifname", "MAC Merge layer state for %s:\n",
+ nlctx->devname);
+
+ show_bool("pmac-enabled", "pMAC enabled: %s\n",
+ tb[ETHTOOL_A_MM_PMAC_ENABLED]);
+ show_bool("tx-enabled", "TX enabled: %s\n",
+ tb[ETHTOOL_A_MM_TX_ENABLED]);
+ show_bool("tx-active", "TX active: %s\n", tb[ETHTOOL_A_MM_TX_ACTIVE]);
+ show_u32("tx-min-frag-size", "TX minimum fragment size: ",
+ tb[ETHTOOL_A_MM_TX_MIN_FRAG_SIZE]);
+ show_u32("rx-min-frag-size", "RX minimum fragment size: ",
+ tb[ETHTOOL_A_MM_RX_MIN_FRAG_SIZE]);
+ show_bool("verify-enabled", "Verify enabled: %s\n",
+ tb[ETHTOOL_A_MM_VERIFY_ENABLED]);
+ show_u32("verify-time", "Verify time: ",
+ tb[ETHTOOL_A_MM_VERIFY_TIME]);
+ show_u32("max-verify-time", "Max verify time: ",
+ tb[ETHTOOL_A_MM_MAX_VERIFY_TIME]);
+
+ if (tb[ETHTOOL_A_MM_VERIFY_STATUS]) {
+ u8 val = mnl_attr_get_u8(tb[ETHTOOL_A_MM_VERIFY_STATUS]);
+
+ print_string(PRINT_ANY, "verify-status", "Verification status: %s\n",
+ mm_verify_state_to_string(val));
+ }
+
+ if (tb[ETHTOOL_A_MM_STATS]) {
+ ret = show_mm_stats(tb[ETHTOOL_A_MM_STATS]);
+ if (ret) {
+ fprintf(stderr, "Failed to print stats: %d\n", ret);
+ goto err;
+ }
+ }
+
+ if (!silent)
+ print_nl();
+
+ close_json_object();
+
+ return MNL_CB_OK;
+
+err:
+ close_json_object();
+ return err_ret;
+}
+
+int nl_get_mm(struct cmd_context *ctx)
+{
+ struct nl_context *nlctx = ctx->nlctx;
+ struct nl_socket *nlsk = nlctx->ethnl_socket;
+ u32 flags;
+ int ret;
+
+ if (netlink_cmd_check(ctx, ETHTOOL_MSG_MM_GET, true))
+ return -EOPNOTSUPP;
+ if (ctx->argc > 0) {
+ fprintf(stderr, "ethtool: unexpected parameter '%s'\n",
+ *ctx->argp);
+ return 1;
+ }
+
+ flags = get_stats_flag(nlctx, ETHTOOL_MSG_MM_GET, ETHTOOL_A_MM_HEADER);
+ ret = nlsock_prep_get_request(nlsk, ETHTOOL_MSG_MM_GET,
+ ETHTOOL_A_MM_HEADER, flags);
+ if (ret)
+ return ret;
+
+ new_json_obj(ctx->json);
+ ret = nlsock_send_get_request(nlsk, mm_reply_cb);
+ delete_json_obj();
+ return ret;
+}
+
+/* MM_SET */
+
+static const struct param_parser mm_set_params[] = {
+ {
+ .arg = "verify-enabled",
+ .type = ETHTOOL_A_MM_VERIFY_ENABLED,
+ .handler = nl_parse_u8bool,
+ .min_argc = 1,
+ },
+ {
+ .arg = "verify-time",
+ .type = ETHTOOL_A_MM_VERIFY_TIME,
+ .handler = nl_parse_direct_u32,
+ .min_argc = 1,
+ },
+ {
+ .arg = "tx-enabled",
+ .type = ETHTOOL_A_MM_TX_ENABLED,
+ .handler = nl_parse_u8bool,
+ .min_argc = 1,
+ },
+ {
+ .arg = "pmac-enabled",
+ .type = ETHTOOL_A_MM_PMAC_ENABLED,
+ .handler = nl_parse_u8bool,
+ .min_argc = 1,
+ },
+ {
+ .arg = "tx-min-frag-size",
+ .type = ETHTOOL_A_MM_TX_MIN_FRAG_SIZE,
+ .handler = nl_parse_direct_u32,
+ .min_argc = 1,
+ },
+ {}
+};
+
+int nl_set_mm(struct cmd_context *ctx)
+{
+ struct nl_context *nlctx = ctx->nlctx;
+ struct nl_msg_buff *msgbuff;
+ struct nl_socket *nlsk;
+ int ret;
+
+ if (netlink_cmd_check(ctx, ETHTOOL_MSG_MM_SET, false))
+ return -EOPNOTSUPP;
+
+ nlctx->cmd = "--set-mm";
+ nlctx->argp = ctx->argp;
+ nlctx->argc = ctx->argc;
+ nlctx->devname = ctx->devname;
+ nlsk = nlctx->ethnl_socket;
+ msgbuff = &nlsk->msgbuff;
+
+ ret = msg_init(nlctx, msgbuff, ETHTOOL_MSG_MM_SET,
+ NLM_F_REQUEST | NLM_F_ACK);
+ if (ret)
+ return ret;
+
+ if (ethnla_fill_header(msgbuff, ETHTOOL_A_MM_HEADER,
+ ctx->devname, 0))
+ return -EMSGSIZE;
+
+ ret = nl_parser(nlctx, mm_set_params, NULL, PARSER_GROUP_NONE, NULL);
+ if (ret)
+ return ret;
+
+ ret = nlsock_sendmsg(nlsk, NULL);
+ if (ret < 0)
+ return ret;
+
+ ret = nlsock_process_reply(nlsk, nomsg_reply_cb, nlctx);
+ if (ret)
+ return nlctx->exit_code;
+
+ return 0;
+}
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 ethtool 2/4] netlink: pass the source of statistics for pause stats
2023-02-10 21:33 [PATCH v3 ethtool 0/4] MAC Merge layer support Vladimir Oltean
2023-02-10 21:33 ` [PATCH v3 ethtool 1/4] netlink: add support for MAC Merge layer Vladimir Oltean
@ 2023-02-10 21:33 ` Vladimir Oltean
2023-02-10 21:33 ` [PATCH v3 ethtool 3/4] netlink: pass the source of statistics for port stats Vladimir Oltean
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Vladimir Oltean @ 2023-02-10 21:33 UTC (permalink / raw)
To: netdev; +Cc: Michal Kubecek, Pranavi Somisetty, Piergiorgio Beruto
Support adding and parsing the ETHTOOL_A_PAUSE_STATS_SRC attribute from
the request header.
$ ethtool -I --show-pause eno2 --src aggregate
Pause parameters for eno2:
Autonegotiate: on
RX: off
TX: off
RX negotiated: on
TX negotiated: on
Statistics:
tx_pause_frames: 0
rx_pause_frames: 0
$ ethtool -I --show-pause eno0 --src pmac
$ ethtool -I --show-pause eno0 --src emac
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Pranavi Somisetty <pranavi.somisetty@amd.com>
---
v2->v3: none
v1->v2:
- ETHTOOL_STATS_SRC* macro names changed to ETHTOOL_MAC_STATS_SRC*
netlink/pause.c | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/netlink/pause.c b/netlink/pause.c
index 867d0da71f72..da444bdeb13f 100644
--- a/netlink/pause.c
+++ b/netlink/pause.c
@@ -216,6 +216,24 @@ err_close_dev:
return err_ret;
}
+static const struct lookup_entry_u32 stats_src_values[] = {
+ { .arg = "aggregate", .val = ETHTOOL_MAC_STATS_SRC_AGGREGATE },
+ { .arg = "emac", .val = ETHTOOL_MAC_STATS_SRC_EMAC },
+ { .arg = "pmac", .val = ETHTOOL_MAC_STATS_SRC_PMAC },
+ {}
+};
+
+static const struct param_parser gpause_params[] = {
+ {
+ .arg = "--src",
+ .type = ETHTOOL_A_PAUSE_STATS_SRC,
+ .handler = nl_parse_lookup_u32,
+ .handler_data = stats_src_values,
+ .min_argc = 1,
+ },
+ {}
+};
+
int nl_gpause(struct cmd_context *ctx)
{
struct nl_context *nlctx = ctx->nlctx;
@@ -225,11 +243,6 @@ int nl_gpause(struct cmd_context *ctx)
if (netlink_cmd_check(ctx, ETHTOOL_MSG_PAUSE_GET, true))
return -EOPNOTSUPP;
- if (ctx->argc > 0) {
- fprintf(stderr, "ethtool: unexpected parameter '%s'\n",
- *ctx->argp);
- return 1;
- }
flags = get_stats_flag(nlctx, ETHTOOL_MSG_PAUSE_GET,
ETHTOOL_A_PAUSE_HEADER);
@@ -238,6 +251,16 @@ int nl_gpause(struct cmd_context *ctx)
if (ret < 0)
return ret;
+ nlctx->cmd = "-a";
+ nlctx->argp = ctx->argp;
+ nlctx->argc = ctx->argc;
+ nlctx->devname = ctx->devname;
+ nlsk = nlctx->ethnl_socket;
+
+ ret = nl_parser(nlctx, gpause_params, NULL, PARSER_GROUP_NONE, NULL);
+ if (ret < 0)
+ return 1;
+
new_json_obj(ctx->json);
ret = nlsock_send_get_request(nlsk, pause_reply_cb);
delete_json_obj();
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 ethtool 3/4] netlink: pass the source of statistics for port stats
2023-02-10 21:33 [PATCH v3 ethtool 0/4] MAC Merge layer support Vladimir Oltean
2023-02-10 21:33 ` [PATCH v3 ethtool 1/4] netlink: add support for MAC Merge layer Vladimir Oltean
2023-02-10 21:33 ` [PATCH v3 ethtool 2/4] netlink: pass the source of statistics for pause stats Vladimir Oltean
@ 2023-02-10 21:33 ` Vladimir Oltean
2023-02-10 21:33 ` [PATCH v3 ethtool 4/4] ethtool.8: update documentation with MAC Merge related bits Vladimir Oltean
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Vladimir Oltean @ 2023-02-10 21:33 UTC (permalink / raw)
To: netdev; +Cc: Michal Kubecek, Pranavi Somisetty, Piergiorgio Beruto
Use the ETHTOOL_STATS_SRC_AGGREGATE attribute for the following
structured port groups, to allow looking at eMAC and pMAC counters
individually:
$ ethtool -S eno2 --groups eth-mac eth-phy eth-ctrl rmon -- --src pmac
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Pranavi Somisetty <pranavi.somisetty@amd.com>
---
v2->v3: none
v1->v2:
- ETHTOOL_STATS_SRC* macro names changed to ETHTOOL_MAC_STATS_SRC*
netlink/stats.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/netlink/stats.c b/netlink/stats.c
index 9f609a4ec550..8620d8de1555 100644
--- a/netlink/stats.c
+++ b/netlink/stats.c
@@ -268,6 +268,13 @@ err_free:
return ret;
}
+static const struct lookup_entry_u32 stats_src_values[] = {
+ { .arg = "aggregate", .val = ETHTOOL_MAC_STATS_SRC_AGGREGATE },
+ { .arg = "emac", .val = ETHTOOL_MAC_STATS_SRC_EMAC },
+ { .arg = "pmac", .val = ETHTOOL_MAC_STATS_SRC_PMAC },
+ {}
+};
+
static const struct param_parser stats_params[] = {
{
.arg = "--groups",
@@ -283,6 +290,13 @@ static const struct param_parser stats_params[] = {
.handler = stats_parse_all_groups,
.alt_group = 1,
},
+ {
+ .arg = "--src",
+ .type = ETHTOOL_A_STATS_SRC,
+ .handler = nl_parse_lookup_u32,
+ .handler_data = stats_src_values,
+ .min_argc = 1,
+ },
{}
};
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 ethtool 4/4] ethtool.8: update documentation with MAC Merge related bits
2023-02-10 21:33 [PATCH v3 ethtool 0/4] MAC Merge layer support Vladimir Oltean
` (2 preceding siblings ...)
2023-02-10 21:33 ` [PATCH v3 ethtool 3/4] netlink: pass the source of statistics for port stats Vladimir Oltean
@ 2023-02-10 21:33 ` Vladimir Oltean
2023-02-12 19:13 ` [PATCH v3 ethtool 0/4] MAC Merge layer support piergiorgio.beruto
2023-02-13 18:10 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: Vladimir Oltean @ 2023-02-10 21:33 UTC (permalink / raw)
To: netdev; +Cc: Michal Kubecek, Pranavi Somisetty, Piergiorgio Beruto
Update the man page with the new --src argument for --show-pause, as
well as with the new --show-mm and --set-mm commands.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Pranavi Somisetty <pranavi.somisetty@amd.com>
---
v2->v3:
- fix tx-min-frag-size formula
- specify values for verify-status
v1->v2: document --show-mm too
ethtool.8.in | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 107 insertions(+)
diff --git a/ethtool.8.in b/ethtool.8.in
index c43c6d8b5263..03e149876c3f 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -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
@@ -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.
@@ -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
@@ -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
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [PATCH v3 ethtool 0/4] MAC Merge layer support
2023-02-10 21:33 [PATCH v3 ethtool 0/4] MAC Merge layer support Vladimir Oltean
` (3 preceding siblings ...)
2023-02-10 21:33 ` [PATCH v3 ethtool 4/4] ethtool.8: update documentation with MAC Merge related bits Vladimir Oltean
@ 2023-02-12 19:13 ` piergiorgio.beruto
2023-02-13 18:10 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: piergiorgio.beruto @ 2023-02-12 19:13 UTC (permalink / raw)
To: 'Vladimir Oltean', netdev
Cc: 'Michal Kubecek', 'Pranavi Somisetty'
Hi all,
From my perspective, it would be better to merge it on top of
"[v5,ethtool-next,1/1] add support for IEEE 802.3cg-2019 Clause 148".
Thanks,
Piergiorgio
-----Original Message-----
From: Vladimir Oltean <vladimir.oltean@nxp.com>
Sent: 10 February, 2023 22:33
To: netdev@vger.kernel.org
Cc: Michal Kubecek <mkubecek@suse.cz>; Pranavi Somisetty
<pranavi.somisetty@amd.com>; Piergiorgio Beruto
<piergiorgio.beruto@gmail.com>
Subject: [PATCH v3 ethtool 0/4] MAC Merge layer support
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).
This patch set applies on top of "[v5,ethtool-next,1/1] add support for IEEE
802.3cg-2019 Clause 148", because otherwise it would conflict with it:
https://patchwork.kernel.org/project/netdevbpf/patch/d51013e0bc617651c0e6d29
8f47cc6b82c0ffa88.1675327734.git.piergiorgio.beruto@gmail.com/
I believe Michal hasn't gotten to it yet, but I'm putting Piergiorgio on CC
too, in case there are other reasons why I shouldn't wait for his patch to
be merged first.
Vladimir Oltean (4):
netlink: add support for MAC Merge layer
netlink: pass the source of statistics for pause stats
netlink: pass the source of statistics for port stats
ethtool.8: update documentation with MAC Merge related bits
Makefile.am | 2 +-
ethtool.8.in | 107 +++++++++++++++++++
ethtool.c | 16 +++
netlink/extapi.h | 4 +
netlink/mm.c | 270 +++++++++++++++++++++++++++++++++++++++++++++++
netlink/pause.c | 33 +++++-
netlink/stats.c | 14 +++
7 files changed, 440 insertions(+), 6 deletions(-) create mode 100644
netlink/mm.c
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 ethtool 0/4] MAC Merge layer support
2023-02-10 21:33 [PATCH v3 ethtool 0/4] MAC Merge layer support Vladimir Oltean
` (4 preceding siblings ...)
2023-02-12 19:13 ` [PATCH v3 ethtool 0/4] MAC Merge layer support piergiorgio.beruto
@ 2023-02-13 18:10 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-02-13 18:10 UTC (permalink / raw)
To: Vladimir Oltean; +Cc: netdev, mkubecek, pranavi.somisetty, piergiorgio.beruto
Hello:
This series was applied to ethtool/ethtool.git (next)
by Michal Kubecek <mkubecek@suse.cz>:
On Fri, 10 Feb 2023 23:33:07 +0200 you wrote:
> Add support for the following 2 new commands:
>
> $ ethtool [ --include-statistics ] --show-mm <eth>
> $ ethtool --set-mm <eth> [ ... ]
>
> as well as for:
>
> [...]
Here is the summary with links:
- [v3,ethtool,1/4] netlink: add support for MAC Merge layer
https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=877c4c587cab
- [v3,ethtool,2/4] netlink: pass the source of statistics for pause stats
https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=21810d54d28b
- [v3,ethtool,3/4] netlink: pass the source of statistics for port stats
https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=c4342291d8b5
- [v3,ethtool,4/4] ethtool.8: update documentation with MAC Merge related bits
https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=75f446cdb77a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-02-13 18:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-10 21:33 [PATCH v3 ethtool 0/4] MAC Merge layer support Vladimir Oltean
2023-02-10 21:33 ` [PATCH v3 ethtool 1/4] netlink: add support for MAC Merge layer Vladimir Oltean
2023-02-10 21:33 ` [PATCH v3 ethtool 2/4] netlink: pass the source of statistics for pause stats Vladimir Oltean
2023-02-10 21:33 ` [PATCH v3 ethtool 3/4] netlink: pass the source of statistics for port stats Vladimir Oltean
2023-02-10 21:33 ` [PATCH v3 ethtool 4/4] ethtool.8: update documentation with MAC Merge related bits Vladimir Oltean
2023-02-12 19:13 ` [PATCH v3 ethtool 0/4] MAC Merge layer support piergiorgio.beruto
2023-02-13 18:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).