ethtool: add support for RSS input transformation
Subsystems (2)
PATCH v2 1/1 ethtool: add support for RSS input transformation
Add support for RSS input transformation [1]. Currently, only symmetric-xor is supported. The user can set the RSS input transformation via:
# ethtool -X <dev> xfrm symmetric-xor
and sets it off (default) by:
# ethtool -X <dev> xfrm none
The status of the transformation is reported by a new section at the end of "ethtool -x":
# ethtool -x <dev>
.
.
.
.
RSS hash function:
toeplitz: on
xor: off
crc32: off
RSS input transformation:
symmetric-xor: on---
v2: add a note in the man page on the loss of entropy due to XORing.
ethtool.8.in | 14 ++++++++++++++ ethtool.c | 16 ++++++++++++++++ netlink/rss.c | 19 +++++++++++++++++-- 3 files changed, 47 insertions(+), 2 deletions(-)
ethtool.8.in +14 -0
@@ -351,6 +351,7 @@ ethtool \- query or control network driver and hardware settings .RB ...\ | \ default \ ] .RB [ hfunc .IR FUNC ] +.B2 xfrm symmetric-xor none .RB [ context .I CTX .RB |\ new ]
@@ -1201,6 +1202,19 @@ even if a nibble is zero. Sets RSS hash function of the specified network device. List of RSS hash functions which kernel supports is shown as a part of the --show-rxfh command output. .TP +.BI xfrm +Sets the RSS input transformation. Currently, only the +.B symmetric-xor +transformation is supported where the NIC XORs the L3 and/or L4 source and +destination fields (as selected by +.B --config-nfc rx-flow-hash +) before passing them to the hash algorithm. The RSS hash function will +then yield the same hash for the other flow direction where the source and +destination fields are swapped (i.e. Symmetric RSS). Note that XORing the +input parameters reduces the entropy of the input set and the hash algorithm +could potentially be exploited. Switch off (default) by +.B xfrm none. +.TP .BI start\ N For the \fBequal\fR and \fBweight\fR options, sets the starting receive queue for spreading flows to \fIN\fR.
ethtool.c +16 -0
@@ -4029,6 +4029,10 @@ static int do_grxfh(struct cmd_context *ctx) (const char *)hfuncs->data + i *ETH_GSTRING_LEN , (rss->hfunc & (1 << i)) ? "on" : "off"); +printf ("RSS input transformation:\n" ); +printf (" symmetric-xor: %s\n" , + (rss->input_xfrm &RXH_XFRM_SYM_XOR ) ?"on" :"off" ); + out:free (hfuncs);free (rss);
@@ -4146,6 +4150,7 @@ static int do_srxfh(struct cmd_context *ctx)u32 arg_num =0 , indir_bytes =0 ;u32 req_hfunc =0 ;u32 entry_size =sizeof (rss_head.rss_config[0 ]); +u32 req_input_xfrm =0xff ;u32 num_weights =0 ;u32 rss_context =0 ;int delete =0 ;
@@ -4189,6 +4194,15 @@ static int do_srxfh(struct cmd_context *ctx)if (!req_hfunc_name)exit_bad_args (); ++arg_num; + }else if (!strcmp (ctx->argp[arg_num],"xfrm" )) { + ++arg_num; +if (!strcmp (ctx->argp[arg_num],"symmetric-xor" )) + req_input_xfrm =RXH_XFRM_SYM_XOR ; +else if (!strcmp (ctx->argp[arg_num],"none" )) + req_input_xfrm =0 ; +else +exit_bad_args (); + ++arg_num; }else if (!strcmp (ctx->argp[arg_num],"context" )) { ++arg_num;if (!strcmp (ctx->argp[arg_num],"new" ))
@@ -4333,6 +4347,7 @@ static int do_srxfh(struct cmd_context *ctx) rss->cmd =ETHTOOL_SRSSH ; rss->rss_context = rss_context; rss->hfunc = req_hfunc; + rss->input_xfrm = req_input_xfrm;if (delete) { rss->indir_size = rss->key_size =0 ; }else {
@@ -5887,6 +5902,7 @@ static const struct option args[] = {" [ equal N | weight W0 W1 ... | default ]\n" " [ hkey %x:%x:%x:%x:%x:.... ]\n" " [ hfunc FUNC ]\n" +" [ xfrm symmetric-xor|none ]\n" " [ delete ]\n" }, {
netlink/rss.c +17 -2
@@ -21,7 +21,8 @@ struct cb_args {void dump_json_rss_info (struct cmd_context *ctx,u32 *indir_table,u32 indir_size,u8 *hkey,u32 hkey_size, -const struct stringset *hash_funcs,u8 hfunc) +const struct stringset *hash_funcs,u8 hfunc, +u32 input_xfrm) {unsigned int i;
@@ -46,6 +47,12 @@ void dump_json_rss_info(struct cmd_context *ctx, u32 *indir_table,if (hfunc & (1 << i)) {print_string (PRINT_JSON ,"rss-hash-function" ,NULL ,get_string (hash_funcs, i)); +open_json_object ("rss-input-transformation" ); +print_bool (PRINT_JSON ,"symmetric-xor" ,NULL , + (input_xfrm &RXH_XFRM_SYM_XOR ) ? + true : false); + +close_json_object ();break ; } }
@@ -89,6 +96,7 @@ int rss_reply_cb(const struct nlmsghdr *nlhdr, void *data)const struct stringset *hash_funcs;u32 rss_hfunc =0 , indir_size;u32 *indir_table =NULL ; +u32 input_xfrm =0 ;u8 *hkey =NULL ;bool silent;int err_ret;
@@ -118,6 +126,9 @@ int rss_reply_cb(const struct nlmsghdr *nlhdr, void *data) hkey =mnl_attr_get_payload (tb[ETHTOOL_A_RSS_HKEY ]); } +if (tb[ETHTOOL_A_RSS_INPUT_XFRM ]) + input_xfrm =mnl_attr_get_u32 (tb[ETHTOOL_A_RSS_INPUT_XFRM ]); +/* Fetch RSS hash functions and their status and print */ if (!nlctx->is_monitor) { ret =netlink_init_ethnl2_socket (nlctx);
@@ -153,7 +164,8 @@ int rss_reply_cb(const struct nlmsghdr *nlhdr, void *data) indir_size = indir_bytes /sizeof (u32);if (is_json_context ()) {dump_json_rss_info (nlctx->ctx, (u32 *)indir_table, indir_size, - hkey, hkey_bytes, hash_funcs, rss_hfunc); + hkey, hkey_bytes, hash_funcs, rss_hfunc, + input_xfrm); }else {print_indir_table (nlctx->ctx, args->num_rings, indir_size, (u32 *)indir_table);
@@ -167,6 +179,9 @@ int rss_reply_cb(const struct nlmsghdr *nlhdr, void *data)printf (" %s: %s\n" ,get_string (hash_funcs, i), (rss_hfunc & (1 << i)) ?"on" :"off" ); } +printf ("RSS input transformation:\n" ); +printf (" symmetric-xor: %s\n" , + (input_xfrm &RXH_XFRM_SYM_XOR ) ?"on" :"off" ); }return MNL_CB_OK ;
Signature · 1 line
2.34.1
Quoted 24 lines · On Fri, 2 Feb 2024 13:25:20 -0700 Ahmed Zaki wrote:
Add support for RSS input transformation [1]. Currently, only symmetric-xor is supported. The user can set the RSS input transformation via:
# ethtool -X <dev> xfrm symmetric-xorand sets it off (default) by:
# ethtool -X <dev> xfrm noneThe status of the transformation is reported by a new section at the end of "ethtool -x":
# ethtool -x <dev> . . . . RSS hash function: toeplitz: on xor: off crc32: off RSS input transformation: symmetric-xor: on
Quoted 4 lines
Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Michal Swiatkowski <[email protected]>Signed-off-by Ahmed Zaki <[email protected]>
Thanks!
Quoted 25 lines · Jakub Kicinski
Quoted 24 lines · On Fri, 2 Feb 2024 13:25:20 -0700 Ahmed Zaki wrote:
Add support for RSS input transformation [1]. Currently, only symmetric-xor is supported. The user can set the RSS input transformation via:
# ethtool -X <dev> xfrm symmetric-xorand sets it off (default) by:
# ethtool -X <dev> xfrm noneThe status of the transformation is reported by a new section at the end of "ethtool -x":
# ethtool -x <dev> . . . . RSS hash function: toeplitz: on xor: off crc32: off RSS input transformation: symmetric-xor: on
Quoted 8 lines
Quoted 4 lines
Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Michal Swiatkowski <[email protected]>Signed-off-by Ahmed Zaki <[email protected]>Acked-by Jakub Kicinski <[email protected]>Thanks!
I am not sure what is the status with this. patchwork is showing it as archived.
We are close to the end of the release cycle and I am worried there might be last minute requests.
Thanks.
Jakub Kicinski
maintainerQuoted 33 lines · On Wed, 21 Feb 2024 07:54:13 -0700 Ahmed Zaki wrote:
Quoted 32 lines · Jakub Kicinski
Quoted 24 lines · On Fri, 2 Feb 2024 13:25:20 -0700 Ahmed Zaki wrote:
Add support for RSS input transformation [1]. Currently, only symmetric-xor is supported. The user can set the RSS input transformation via:
# ethtool -X <dev> xfrm symmetric-xorand sets it off (default) by:
# ethtool -X <dev> xfrm noneThe status of the transformation is reported by a new section at the end of "ethtool -x":
# ethtool -x <dev> . . . . RSS hash function: toeplitz: on xor: off crc32: off RSS input transformation: symmetric-xor: onQuoted 4 lines
Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Michal Swiatkowski <[email protected]>Signed-off-by Ahmed Zaki <[email protected]>Acked-by Jakub Kicinski <[email protected]>
Quoted 7 lines
Quoted 1 line
Thanks!
I am not sure what is the status with this. patchwork is showing it as archived.
We are close to the end of the release cycle and I am worried there might be last minute requests.
patchwork auto-archives after a month. Michal, would you be able to scan thru ethtool patches at least once every three weeks to avoid this?
Quoted 36 lines · Jakub Kicinski
Quoted 35 lines · On Wed, 21 Feb 2024 07:54:13 -0700 Ahmed Zaki wrote:
Quoted 33 lines · Jakub Kicinski
Quoted 24 lines · On Fri, 2 Feb 2024 13:25:20 -0700 Ahmed Zaki wrote:
Add support for RSS input transformation [1]. Currently, only symmetric-xor is supported. The user can set the RSS input transformation via:
# ethtool -X <dev> xfrm symmetric-xorand sets it off (default) by:
# ethtool -X <dev> xfrm noneThe status of the transformation is reported by a new section at the end of "ethtool -x":
# ethtool -x <dev> . . . . RSS hash function: toeplitz: on xor: off crc32: off RSS input transformation: symmetric-xor: onQuoted 4 lines
Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Michal Swiatkowski <[email protected]>Signed-off-by Ahmed Zaki <[email protected]>Acked-by Jakub Kicinski <[email protected]>Thanks!
Quoted 8 lines
Quoted 5 lines
I am not sure what is the status with this. patchwork is showing it as archived.
We are close to the end of the release cycle and I am worried there might be last minute requests.
patchwork auto-archives after a month. Michal, would you be able to scan thru ethtool patches at least once every three weeks to avoid this?
Hello Michal,
This was auto-archived a while ago by patchwork, but it should be included in ethtool 6.8.
Please let me know if you need a RESEND or any other changes.
Thanks.