netlink: rss: Add set support
Subsystems (2)
PATCH 1/1 netlink: rss: Add set support
The kernel has exposed ETHTOOL_MSG_RSS_SET, RSS_CREATE_ACT and RSS_DELETE_ACT since v6.17, but ethtool's -X has remained ioctl only. Add nl_srss() so the command goes through netlink by default, the ioctl path remains as fallback for older kernels.
All CLI keywords accepted by the ioctl path are handled. nl_srss() dispatches by parsed args:
context new -> ETHTOOL_MSG_RSS_CREATE_ACT context N delete -> ETHTOOL_MSG_RSS_DELETE_ACT otherwise -> ETHTOOL_MSG_RSS_SET
Reviewed-by Nimrod Oren <[email protected]>
Signed-off-by Gal Pressman <[email protected]>
--- ethtool.c | 10 +- internal.h | 5 + netlink/extapi.h | 2 + netlink/rss.c | 510 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 522 insertions(+), 5 deletions(-)
ethtool.c +5 -5
@@ -1207,8 +1207,7 @@ err:return 2 ; } -static int parse_hkey (char **rss_hkey,u32 key_size, -const char *rss_hkey_string) +int parse_hkey (char **rss_hkey,u32 key_size,const char *rss_hkey_string) {if (!key_size) { fprintf(stderr,
@@ -4207,9 +4206,9 @@ out:return 0 ; } -static int fill_indir_table (u32 *indir_size,u32 *indir,int rxfhindir_default, -int rxfhindir_start,int rxfhindir_equal, -char **rxfhindir_weight,u32 num_weights) +int fill_indir_table (u32 *indir_size,u32 *indir,int rxfhindir_default, +int rxfhindir_start,int rxfhindir_equal, +char **rxfhindir_weight,u32 num_weights) {u32 i;
@@ -6215,6 +6214,7 @@ static const struct option args[] = { { .opts = "-X|--set-rxfh-indir|--rxfh", .func = do_srxfh, + .nlfunc = nl_srss, .help ="Set Rx flow hash indirection table and/or RSS hash key" , .xhelp = " [ context %d|new ]\n"" [ equal N | weight W0 W1 ... | default ]\n"
internal.h +5 -0
@@ -286,6 +286,11 @@ int test_fclose(FILE *fh);int ioctl_init (struct cmd_context *ctx,bool no_dev);int send_ioctl (struct cmd_context *ctx,void *cmd); +int parse_hkey (char **rss_hkey,u32 key_size,const char *rss_hkey_string); +int fill_indir_table (u32 *indir_size,u32 *indir,int rxfhindir_default, +int rxfhindir_start,int rxfhindir_equal, +char **rxfhindir_weight,u32 num_weights); +void dump_hex (FILE *f,const u8 *data,int len,int offset);/* National Semiconductor DP83815, DP83816 */
netlink/extapi.h +2 -0
@@ -50,6 +50,7 @@ int nl_smodule(struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);int nl_getmodule (struct cmd_context *ctx);int nl_grss (struct cmd_context *ctx); +int nl_srss (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);
@@ -130,6 +131,7 @@ nl_get_eeprom_page(struct cmd_context *ctx __maybe_unused,#define nl_gmodule NULL#define nl_smodule NULL#define nl_grss NULL +#define nl_srss NULL#define nl_plca_get_cfg NULL#define nl_plca_set_cfg NULL#define nl_plca_get_status NULL
netlink/rss.c +510 -0
520 lines not on this page · raw message
Signature · 1 line
2.54.0