fix the ethtool set vxlan by ethtool -U/u not effective

Signed-off-by: Jiantao Xiao <xiaojiantao1@h-partners.com>
This commit is contained in:
Jiantao Xiao 2022-12-05 20:13:06 +08:00
parent 6d65158150
commit 1438020980
3 changed files with 163 additions and 96 deletions

View File

@ -1,4 +1,4 @@
From 1f3aea766d9bac15e39df06397943a261c10d17e Mon Sep 17 00:00:00 2001
From 45e990f49477923f818f454839c02e5ca8bab7bb Mon Sep 17 00:00:00 2001
From: Guangbin Huang <huangguangbin2@huawei.com>
Date: Wed, 1 Jun 2022 15:22:57 +0800
Subject: [PATCH] ethtool: add suppport specifications for vxlan by ethtool
@ -14,14 +14,146 @@ bugzilla:https://gitee.com/src-openeuler/ethtool/issues/I624AU
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Jiantao Xiao <xiaojiantao1@h-partners.com>
---
Makefile.in | 1 +
configure | 43 ++++++++-
configure.ac | 10 +++
ethtool-config.h.in | 3 +
ethtool.c | 5 ++
rxclass.c | 205 +++++++++++++++++++++++++++++++++++++++++++
uapi/linux/ethtool.h | 56 ++++++++++++
4 files changed, 276 insertions(+)
7 files changed, 322 insertions(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index c849d51..18ce5f9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -799,6 +799,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/configure b/configure
index 25be374..a7a084a 100755
--- a/configure
+++ b/configure
@@ -590,6 +590,8 @@ ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
+ETHTOOL_FD_VXLAN_FEATURE_FALSE
+ETHTOOL_FD_VXLAN_FEATURE_TRUE
ETHTOOL_ENABLE_NETLINK_FALSE
ETHTOOL_ENABLE_NETLINK_TRUE
MNL_LIBS
@@ -671,6 +673,7 @@ infodir
docdir
oldincludedir
includedir
+runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -699,6 +702,7 @@ enable_dependency_tracking
enable_pretty_dump
with_bash_completion_dir
enable_netlink
+enable_fd_vxlan
'
ac_precious_vars='build_alias
host_alias
@@ -752,6 +756,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1004,6 +1009,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1141,7 +1155,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+ libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1294,6 +1308,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1339,6 +1354,7 @@ Optional Features:
speeds up one-time build
--enable-pretty-dump enable registers, EEPROM and SFP pretty dumps (enabled by default)
--enable-netlink enable netlink interface (enabled by default)
+ --enable-fd-vxlan enable fd vxlan interface (enabled by default)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -4574,6 +4590,27 @@ else
fi
+# Check whether --enable-fd-vxlan was given.
+if test "${enable_fd_vxlan+set}" = set; then :
+ enableval=$enable_fd_vxlan;
+else
+ enable_fd_vxlan=no
+fi
+
+if test x$enable_fd_vxlan = xyes; then
+
+$as_echo "#define ETHTOOL_FD_VXLAN_FEATURE 1" >>confdefs.h
+
+fi
+ if test x$enable_fd_vxlan = xyes; then
+ ETHTOOL_FD_VXLAN_FEATURE_TRUE=
+ ETHTOOL_FD_VXLAN_FEATURE_FALSE='#'
+else
+ ETHTOOL_FD_VXLAN_FEATURE_TRUE='#'
+ ETHTOOL_FD_VXLAN_FEATURE_FALSE=
+fi
+
+
ac_config_files="$ac_config_files Makefile ethtool.spec ethtool.8"
cat >confcache <<\_ACEOF
@@ -4725,6 +4762,10 @@ if test -z "${ETHTOOL_ENABLE_NETLINK_TRUE}" && test -z "${ETHTOOL_ENABLE_NETLINK
as_fn_error $? "conditional \"ETHTOOL_ENABLE_NETLINK\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ETHTOOL_FD_VXLAN_FEATURE_TRUE}" && test -z "${ETHTOOL_FD_VXLAN_FEATURE_FALSE}"; then
+ as_fn_error $? "conditional \"ETHTOOL_FD_VXLAN_FEATURE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/configure.ac b/configure.ac
index 89d0e70..9c4aea4 100644
index d49eda6..f8e3839 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,5 +78,15 @@ if test x$enable_netlink = xyes; then
@ -40,11 +172,25 @@ index 89d0e70..9c4aea4 100644
+
AC_CONFIG_FILES([Makefile ethtool.spec ethtool.8])
AC_OUTPUT
diff --git a/ethtool-config.h.in b/ethtool-config.h.in
index 9bbf281..8d7e7b1 100644
--- a/ethtool-config.h.in
+++ b/ethtool-config.h.in
@@ -6,6 +6,9 @@
/* Define this to enable register, EEPROM and SFP pretty dumps. */
#undef ETHTOOL_ENABLE_PRETTY_DUMP
+/* Define this to enable vxlan interface to support ethtool fd vxlan. */
+#undef ETHTOOL_FD_VXLAN_FEATURE
+
/* Define to 1 if <linux/types.h> defines big-endian types */
#undef HAVE_BE_TYPES
diff --git a/ethtool.c b/ethtool.c
index 3207e49..bdd4f15 100644
index 09943fa..7354d44 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -5836,7 +5836,12 @@ static const struct option args[] = {
@@ -5823,7 +5823,12 @@ static const struct option args[] = {
.xhelp = " rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|"
"tcp6|udp6|ah6|esp6|sctp6 m|v|t|s|d|f|n|r... [context %d] |\n"
" flow-type ether|ip4|tcp4|udp4|sctp4|ah4|esp4|"
@ -373,10 +519,10 @@ index 6cf81fd..a43506b 100644
options = rule_nfc_ether;
n_opts = ARRAY_SIZE(rule_nfc_ether);
diff --git a/uapi/linux/ethtool.h b/uapi/linux/ethtool.h
index 944711c..9d69200 100644
index 4a36287..8e9054d 100644
--- a/uapi/linux/ethtool.h
+++ b/uapi/linux/ethtool.h
@@ -929,6 +929,30 @@ struct ethtool_usrip4_spec {
@@ -900,6 +900,30 @@ struct ethtool_usrip4_spec {
__u8 proto;
};
@ -407,7 +553,7 @@ index 944711c..9d69200 100644
/**
* struct ethtool_tcpip6_spec - flow specification for TCP/IPv6 etc.
* @ip6src: Source host
@@ -979,6 +1003,30 @@ struct ethtool_usrip6_spec {
@@ -950,6 +974,30 @@ struct ethtool_usrip6_spec {
__u8 l4_proto;
};
@ -438,7 +584,7 @@ index 944711c..9d69200 100644
union ethtool_flow_union {
struct ethtool_tcpip4_spec tcp_ip4_spec;
struct ethtool_tcpip4_spec udp_ip4_spec;
@@ -994,6 +1042,10 @@ union ethtool_flow_union {
@@ -965,6 +1013,10 @@ union ethtool_flow_union {
struct ethtool_usrip6_spec usr_ip6_spec;
struct ethhdr ether_spec;
__u8 hdata[52];
@ -449,7 +595,7 @@ index 944711c..9d69200 100644
};
/**
@@ -1898,6 +1950,10 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
@@ -1868,6 +1920,10 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
#define IPV4_FLOW 0x10 /* hash only */
#define IPV6_FLOW 0x11 /* hash only */
#define ETHER_FLOW 0x12 /* spec only (ether_spec) */

View File

@ -1,84 +0,0 @@
From fadc2a7e6eeeef3b129e4783009ac3c17fa7c43d Mon Sep 17 00:00:00 2001
From: Jiantao Xiao <xiaojiantao1@h-partners.com>
Date: Fri, 2 Dec 2022 18:01:11 +0800
Subject: [PATCH] configure update
The access control system lacks ./autogen.sh. Cannot update configure.
to add the configure for the --enable-fd-vxlan
Signed-off-by: Jiantao Xiao <xiaojiantao1@h-partners.com>
---
configure | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/configure b/configure
index 25be374..160e9f7 100755
--- a/configure
+++ b/configure
@@ -590,6 +590,8 @@ ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
+ETHTOOL_FD_VXLAN_FEATURE_FALSE
+ETHTOOL_FD_VXLAN_FEATURE_TRUE
ETHTOOL_ENABLE_NETLINK_FALSE
ETHTOOL_ENABLE_NETLINK_TRUE
MNL_LIBS
@@ -699,6 +701,7 @@ enable_dependency_tracking
enable_pretty_dump
with_bash_completion_dir
enable_netlink
+enable_fd_vxlan
'
ac_precious_vars='build_alias
host_alias
@@ -1339,6 +1342,7 @@ Optional Features:
speeds up one-time build
--enable-pretty-dump enable registers, EEPROM and SFP pretty dumps (enabled by default)
--enable-netlink enable netlink interface (enabled by default)
+ --enable-fd-vxlan enable fd vxlan interface (enabled by default)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -4574,6 +4578,27 @@ else
fi
+# Check whether --enable-fd-vxlan was given.
+if test "${enable_fd_vxlan+set}" = set; then :
+ enableval=$enable_fd_vxlan;
+else
+ enable_fd_vxlan=no
+fi
+
+if test x$enable_fd_vxlan = xyes; then
+
+$as_echo "#define ETHTOOL_FD_VXLAN_FEATURE 1" >>confdefs.h
+
+fi
+ if test x$enable_fd_vxlan = xyes; then
+ ETHTOOL_FD_VXLAN_FEATURE_TRUE=
+ ETHTOOL_FD_VXLAN_FEATURE_FALSE='#'
+else
+ ETHTOOL_FD_VXLAN_FEATURE_TRUE='#'
+ ETHTOOL_FD_VXLAN_FEATURE_FALSE=
+fi
+
+
ac_config_files="$ac_config_files Makefile ethtool.spec ethtool.8"
cat >confcache <<\_ACEOF
@@ -4725,6 +4750,10 @@ if test -z "${ETHTOOL_ENABLE_NETLINK_TRUE}" && test -z "${ETHTOOL_ENABLE_NETLINK
as_fn_error $? "conditional \"ETHTOOL_ENABLE_NETLINK\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ETHTOOL_FD_VXLAN_FEATURE_TRUE}" && test -z "${ETHTOOL_FD_VXLAN_FEATURE_FALSE}"; then
+ as_fn_error $? "conditional \"ETHTOOL_FD_VXLAN_FEATURE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
--
2.30.0

View File

@ -1,7 +1,7 @@
Name: ethtool
Epoch: 2
Version: 5.15
Release: 4
Release: 5
Summary: Settings tool for Ethernet NICs
License: GPLv2
URL: https://www.kernel.org/pub/software/network/ethtool
@ -13,7 +13,6 @@ Patch2: 0002-tunables-add-support-to-get-set-tx-copybreak-buf-siz.patch
Patch3: 0003-update-UAPI-header-copies.patch
Patch4: 0004-ethtool-add-support-to-get-set-tx-push-by-ethtool-G-.patch
Patch5: 0005-ethtool-add-suppport-specifications-for-vxlan-by-eth.patch
Patch6: 0006-configure-update.patch
BuildRequires: gcc
BuildRequires: libmnl-devel
@ -61,6 +60,12 @@ make check
%{_mandir}/man8/%{name}.8*
%changelog
* Mon Dec 5 2022 xiaojiantao <xiaojiantao1@h-partners.com> - 2:5.15-5
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:fix set vxlan by command ethtool -u/-U not effecti
* Tue Nov 15 2022 xiaojiantao <xiaojiantao1@h-partners.com> - 2:5.15-4
- Type:requirement
- Id:NA