0001-ethtool-make-building-for-RSS-input-xfrm-optional.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. From c88eb6f4e9b2d8f71f3391db2bf0ec82ecccae81 Mon Sep 17 00:00:00 2001
  2. From: Daniel Golle <[email protected]>
  3. Date: Wed, 12 Feb 2025 04:12:42 +0000
  4. Subject: [PATCH] ethtool: make building for RSS input xfrm optional
  5. Unfortunately there is no way to detect at runtime if the kernel the
  6. support for RSS input transformation, and the default value
  7. RXH_XFRM_NO_CHANGE (0xff) used by newer ethtool results in breakage
  8. with older kernels.
  9. As a stop-gap solution simply don't compile with support for input
  10. xfrm by default.
  11. Signed-off-by: Daniel Golle <[email protected]>
  12. ---
  13. configure.ac | 10 ++++++++++
  14. ethtool.c | 10 ++++++++++
  15. 2 files changed, 20 insertions(+)
  16. --- a/configure.ac
  17. +++ b/configure.ac
  18. @@ -45,6 +45,16 @@ if test x$enable_pretty_dump = xyes; the
  19. fi
  20. AM_CONDITIONAL([ETHTOOL_ENABLE_PRETTY_DUMP], [test x$enable_pretty_dump = xyes])
  21. +AC_ARG_ENABLE(rss-input-xfrm,
  22. + [ --enable-rss-input-xfrm build with support for RSS input transformation (disabled by default)],
  23. + ,
  24. + enable_rss_input_xfrm=no)
  25. +if test x$enable_rss_input_xfrm = xyes; then
  26. + AC_DEFINE(ETHTOOL_ENABLE_RSS_INPUT_XFRM, 1,
  27. + [Define this to enable building with support for RSS input transformation.])
  28. +fi
  29. +AM_CONDITIONAL([ETHTOOL_ENABLE_RSS_INPUT_XFRM], [test x$enable_rss_input_xfrm = xyes])
  30. +
  31. AC_ARG_WITH([bash-completion-dir],
  32. AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
  33. [Install the bash-completion script in this directory. @<:@default=yes@:>@]),
  34. --- a/ethtool.c
  35. +++ b/ethtool.c
  36. @@ -4114,7 +4114,7 @@ static int do_grxfh(struct cmd_context *
  37. }
  38. if (rss->hfunc)
  39. printf(" Unknown hash function: 0x%x\n", rss->hfunc);
  40. -
  41. +#ifdef ETHTOOL_ENABLE_RSS_INPUT_XFRM
  42. printf("RSS input transformation:\n");
  43. printf(" symmetric-xor: %s\n",
  44. (rss->input_xfrm & RXH_XFRM_SYM_XOR) ? "on" : "off");
  45. @@ -4123,6 +4123,7 @@ static int do_grxfh(struct cmd_context *
  46. if (rss->input_xfrm)
  47. printf(" Unknown bits in RSS input transformation: 0x%x\n",
  48. rss->input_xfrm);
  49. +#endif
  50. out:
  51. free(hfuncs);
  52. @@ -4442,7 +4443,15 @@ static int do_srxfh(struct cmd_context *
  53. rss->cmd = ETHTOOL_SRSSH;
  54. rss->rss_context = rss_context;
  55. rss->hfunc = req_hfunc;
  56. +#ifdef ETHTOOL_ENABLE_RSS_INPUT_XFRM
  57. rss->input_xfrm = req_input_xfrm;
  58. +#else
  59. + if (req_input_xfrm != 0xff) {
  60. + perror("Compiled for kernel without support for input transformation");
  61. + err = 1;
  62. + goto free;
  63. + }
  64. +#endif
  65. if (delete) {
  66. rss->indir_size = rss->key_size = 0;
  67. } else {