From e7307cc6266393af7d5aa9eade1fbff7970c70a14e895195ecca6110331d177e Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Tue, 4 Nov 2008 16:34:03 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ethtool?expand=0&rev=6 --- ethtool-LRO_support.patch | 137 ++++++++++++++++++++++++++++++++++++++ ethtool.changes | 5 ++ ethtool.spec | 12 ++-- 3 files changed, 150 insertions(+), 4 deletions(-) create mode 100644 ethtool-LRO_support.patch diff --git a/ethtool-LRO_support.patch b/ethtool-LRO_support.patch new file mode 100644 index 0000000..adb3f10 --- /dev/null +++ b/ethtool-LRO_support.patch @@ -0,0 +1,137 @@ +Add lro support to command in similar manner to TSO, GSO, etc. + +Based on patch by Stephen Hemminger +. + +My changes: +- Changed error return codes for setting LRO to be unique. +- Report failure to get device flags, consistent with other offload settings. +- Fixed code spacing. + +Tested with the sfc driver. + +Signed-off-by: Ben Hutchings +Signed-off-by: Jeff Garzik + + +--- ethtool.c ++++ ethtool.c +@@ -151,7 +151,9 @@ + " [ sg on|off ]\n" + " [ tso on|off ]\n" + " [ ufo on|off ]\n" +- " [ gso on|off ]\n" }, ++ " [ gso on|off ]\n" ++ " [ lro on|off ]\n" ++ }, + { "-i", "--driver", MODE_GDRV, "Show driver information" }, + { "-d", "--register-dump", MODE_GREGS, "Do a register dump", + " [ raw on|off ]\n" +@@ -200,6 +202,7 @@ + static int off_tso_wanted = -1; + static int off_ufo_wanted = -1; + static int off_gso_wanted = -1; ++static int off_lro_wanted = -1; + + static struct ethtool_pauseparam epause; + static int gpause_changed = 0; +@@ -310,6 +313,7 @@ + { "tso", CMDL_BOOL, &off_tso_wanted, NULL }, + { "ufo", CMDL_BOOL, &off_ufo_wanted, NULL }, + { "gso", CMDL_BOOL, &off_gso_wanted, NULL }, ++ { "lro", CMDL_BOOL, &off_lro_wanted, NULL }, + }; + + static struct cmdline_info cmdline_pause[] = { +@@ -1207,7 +1211,7 @@ + return 0; + } + +-static int dump_offload (int rx, int tx, int sg, int tso, int ufo, int gso) ++static int dump_offload(int rx, int tx, int sg, int tso, int ufo, int gso, int lro) + { + fprintf(stdout, + "rx-checksumming: %s\n" +@@ -1215,13 +1219,15 @@ + "scatter-gather: %s\n" + "tcp segmentation offload: %s\n" + "udp fragmentation offload: %s\n" +- "generic segmentation offload: %s\n", ++ "generic segmentation offload: %s\n" ++ "large receive offload: %s\n", + rx ? "on" : "off", + tx ? "on" : "off", + sg ? "on" : "off", + tso ? "on" : "off", + ufo ? "on" : "off", +- gso ? "on" : "off"); ++ gso ? "on" : "off", ++ lro ? "on" : "off"); + + return 0; + } +@@ -1485,7 +1491,8 @@ + static int do_goffload(int fd, struct ifreq *ifr) + { + struct ethtool_value eval; +- int err, allfail = 1, rx = 0, tx = 0, sg = 0, tso = 0, ufo = 0, gso = 0; ++ int err, allfail = 1, rx = 0, tx = 0, sg = 0; ++ int tso = 0, ufo = 0, gso = 0, lro = 0; + + fprintf(stdout, "Offload parameters for %s:\n", devname); + +@@ -1549,12 +1556,22 @@ + allfail = 0; + } + ++ eval.cmd = ETHTOOL_GFLAGS; ++ ifr->ifr_data = (caddr_t)&eval; ++ err = ioctl(fd, SIOCETHTOOL, ifr); ++ if (err) { ++ perror("Cannot get device flags"); ++ } else { ++ lro = (eval.data & ETH_FLAG_LRO) != 0; ++ allfail = 0; ++ } ++ + if (allfail) { + fprintf(stdout, "no offload info available\n"); + return 83; + } + +- return dump_offload(rx, tx, sg, tso, ufo, gso); ++ return dump_offload(rx, tx, sg, tso, ufo, gso, lro); + } + + static int do_soffload(int fd, struct ifreq *ifr) +@@ -1631,6 +1648,30 @@ + return 90; + } + } ++ if (off_lro_wanted >= 0) { ++ changed = 1; ++ eval.cmd = ETHTOOL_GFLAGS; ++ eval.data = 0; ++ ifr->ifr_data = (caddr_t)&eval; ++ err = ioctl(fd, SIOCETHTOOL, ifr); ++ if (err) { ++ perror("Cannot get device flag settings"); ++ return 91; ++ } ++ ++ eval.cmd = ETHTOOL_SFLAGS; ++ if (off_lro_wanted == 1) ++ eval.data |= ETH_FLAG_LRO; ++ else ++ eval.data &= ~ETH_FLAG_LRO; ++ ++ err = ioctl(fd, SIOCETHTOOL, ifr); ++ if (err) { ++ perror("Cannot set large receive offload settings"); ++ return 92; ++ } ++ } ++ + if (!changed) { + fprintf(stdout, "no offload settings changed\n"); + } diff --git a/ethtool.changes b/ethtool.changes index d5067ff..71fe2ff 100644 --- a/ethtool.changes +++ b/ethtool.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Nov 4 11:41:01 CET 2008 - hvogel@suse.de + +- Add support for LRO (Large Receive Offload) [bnc#440003] + ------------------------------------------------------------------- Fri Sep 12 15:51:49 CEST 2008 - bphilips@suse.de diff --git a/ethtool.spec b/ethtool.spec index 9f5f1ea..efe8a44 100644 --- a/ethtool.spec +++ b/ethtool.spec @@ -24,11 +24,12 @@ Group: Productivity/Networking/Diagnostic AutoReqProv: on Summary: Examine and Tune Ethernet-Based Network Interfaces Version: 6 -Release: 75 -Url: http://sourceforge.net/projects/gkernel +Release: 78 +Url: http://git.kernel.org/?p=network/ethtool/ethtool.git Source: %{name}-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build -Patch: ethtool-cmd-speed-use-full-variable.patch +Patch0: ethtool-cmd-speed-use-full-variable.patch +Patch1: ethtool-LRO_support.patch %description Ethtool is a small utility for examining and tuning ethernet-based @@ -45,7 +46,8 @@ Authors: %prep %setup -q -%patch -p1 +%patch0 -p1 +%patch1 %build %{suse_update_config -f} @@ -67,6 +69,8 @@ rm -rf $RPM_BUILD_ROOT %doc AUTHORS COPYING NEWS README ChangeLog %changelog +* Tue Nov 04 2008 hvogel@suse.de +- Add support for LRO (Large Receive Offload) [bnc#440003] * Fri Sep 12 2008 bphilips@suse.de - Add support for larger speed field to do greater than 65535Mb/s devices * Wed Dec 19 2007 mskibbe@suse.de