Messages in this thread Patch in this message | | | From | Michal Kubecek <> | Subject | [RFC PATCH ethtool v2 19/23] netlink: add netlink handler for sring (-G) | Date | Mon, 30 Jul 2018 14:57:19 +0200 (CEST) |
| |
Implement "ethtool -G <dev>" subcommand using netlink interface command ETHNL_CMD_SET_PARAMS.
Signed-off-by: Michal Kubecek <mkubecek@suse.cz> --- ethtool.c | 3 ++- netlink/extapi.h | 1 + netlink/params.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/ethtool.c b/ethtool.c index 8d755b3933a9..792283c46d35 100644 --- a/ethtool.c +++ b/ethtool.c @@ -4886,6 +4886,7 @@ static int show_usage(struct cmd_context *ctx); #define nl_geee NULL #define nl_gfec NULL #define nl_scoalesce NULL +#define nl_sring NULL #endif static const struct option { @@ -4944,7 +4945,7 @@ static const struct option { " [sample-interval N]\n" }, { "-g|--show-ring", 1, do_gring, nl_gring, "Query RX/TX ring parameters" }, - { "-G|--set-ring", 1, do_sring, NULL, + { "-G|--set-ring", 1, do_sring, nl_sring, "Set RX/TX ring parameters", " [ rx N ]\n" " [ rx-mini N ]\n" diff --git a/netlink/extapi.h b/netlink/extapi.h index 2379309f084e..d6d01ee9eae3 100644 --- a/netlink/extapi.h +++ b/netlink/extapi.h @@ -25,6 +25,7 @@ int nl_gchannels(struct cmd_context *ctx); int nl_geee(struct cmd_context *ctx); int nl_gfec(struct cmd_context *ctx); int nl_scoalesce(struct cmd_context *ctx); +int nl_sring(struct cmd_context *ctx); int nl_monitor(struct cmd_context *ctx); void monitor_usage(); diff --git a/netlink/params.c b/netlink/params.c index b86922b8d215..ee0d5e0c51c6 100644 --- a/netlink/params.c +++ b/netlink/params.c @@ -510,3 +510,37 @@ int nl_scoalesce(struct cmd_context *ctx) return nl_set_param(ctx, "-C", scoalesce_params, ETHA_PARAMS_COALESCE, ETHA_COALESCE_MAX); } + +static const struct param_parser sring_params[] = { + { + .arg = "rx", + .type = ETHA_RING_RX_PENDING, + .handler = nl_parse_direct_u32, + .min_argc = 1, + }, + { + .arg = "rx-mini", + .type = ETHA_RING_RX_MINI_PENDING, + .handler = nl_parse_direct_u32, + .min_argc = 1, + }, + { + .arg = "rx-jumbo", + .type = ETHA_RING_RX_JUMBO_PENDING, + .handler = nl_parse_direct_u32, + .min_argc = 1, + }, + { + .arg = "tx", + .type = ETHA_RING_TX_PENDING, + .handler = nl_parse_direct_u32, + .min_argc = 1, + }, + {} +}; + +int nl_sring(struct cmd_context *ctx) +{ + return nl_set_param(ctx, "-G", sring_params, ETHA_PARAMS_RING, + ETHA_RING_MAX); +} -- 2.18.0
| |