Accepting request 44060 from network:utilities

Copy from network:utilities/ethtool based on submit request 44060 from user puzel

OBS-URL: https://build.opensuse.org/request/show/44060
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ethtool?expand=0&rev=13
This commit is contained in:
OBS User autobuild 2010-07-30 15:23:06 +00:00 committed by Git OBS Bridge
commit 27c0262469
8 changed files with 38 additions and 468 deletions

3
ethtool-2.6.34.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c52ac6929a8db3fb6eec6c841552867ea42f1a601aeb6c4a158a2636606887ef
size 131026

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6f189674d49acd82ee329520a62de360805332daa424c69fce0a0fa08c31f17d
size 108984

View File

@ -1,137 +0,0 @@
Add lro support to command in similar manner to TSO, GSO, etc.
Based on patch by Stephen Hemminger
<http://article.gmane.org/gmane.linux.network/88124>.
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 <bhutchings@solarflare.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
--- 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");
}

View File

@ -1,20 +0,0 @@
ethtool: display all speed values, not just the predefined ones
Some NICs report speeds other than 10, 100, 1000, 10000 to user land.
At least display them properly.
Signed-off-by: Olaf Kirch <okir@suse.de>
------------------------------------------------------------------
diff -ur ethtool-6//ethtool.c speed//ethtool.c
--- ethtool-6.orig/ethtool.c 2009-11-19 08:28:23.000000000 +0100
+++ ethtool-6/ethtool.c 2009-11-19 08:22:46.000000000 +0100
@@ -819,7 +819,7 @@
fprintf(stdout, "10000Mb/s\n");
break;
default:
- fprintf(stdout, "Unknown! (%i)\n", ethtool_cmd_speed(ep));
+ fprintf(stdout, "%iMb/s\n", ethtool_cmd_speed(ep));
break;
};

View File

@ -1,282 +0,0 @@
ethtool: ethtool_cmd->speed use full variable
The ethtool_cmd struct now has a speed_hi field to support more than 65535 Mb
devices, use it. Also, pull in the ethtool-copy.h file without the __KERNEL__
sections.
Signed-off-by: Brandon Philips <bphilips@suse.de>
---
ethtool-copy.h | 184 +++++++++++++++++++--------------------------------------
ethtool.c | 6 -
2 files changed, 67 insertions(+), 123 deletions(-)
Index: ethtool-6/ethtool.c
===================================================================
--- ethtool-6.orig/ethtool.c
+++ ethtool-6/ethtool.c
@@ -798,7 +798,7 @@ static int dump_ecmd(struct ethtool_cmd
dump_advertised(ep);
fprintf(stdout, " Speed: ");
- switch (ep->speed) {
+ switch (ethtool_cmd_speed(ep)) {
case SPEED_10:
fprintf(stdout, "10Mb/s\n");
break;
@@ -815,7 +815,7 @@ static int dump_ecmd(struct ethtool_cmd
fprintf(stdout, "10000Mb/s\n");
break;
default:
- fprintf(stdout, "Unknown! (%i)\n", ep->speed);
+ fprintf(stdout, "Unknown! (%i)\n", ethtool_cmd_speed(ep));
break;
};
@@ -1716,7 +1716,7 @@ static int do_sset(int fd, struct ifreq
} else {
/* Change everything the user specified. */
if (speed_wanted != -1)
- ecmd.speed = speed_wanted;
+ ethtool_cmd_speed_set(&ecmd, speed_wanted);
if (duplex_wanted != -1)
ecmd.duplex = duplex_wanted;
if (port_wanted != -1)
Index: ethtool-6/ethtool-copy.h
===================================================================
--- ethtool-6.orig/ethtool-copy.h
+++ ethtool-6/ethtool-copy.h
@@ -12,7 +12,6 @@
#ifndef _LINUX_ETHTOOL_H
#define _LINUX_ETHTOOL_H
-
/* This should work for both 32 and 64 bit userland. */
struct ethtool_cmd {
__u32 cmd;
@@ -26,8 +25,23 @@ struct ethtool_cmd {
__u8 autoneg; /* Enable or disable autonegotiation */
__u32 maxtxpkt; /* Tx pkts before generating tx int */
__u32 maxrxpkt; /* Rx pkts before generating rx int */
- __u32 reserved[4];
-};
+ __u16 speed_hi;
+ __u16 reserved2;
+ __u32 reserved[3];
+};
+
+static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
+ __u32 speed)
+{
+
+ ep->speed = (__u16)speed;
+ ep->speed_hi = (__u16)(speed >> 16);
+}
+
+static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
+{
+ return (ep->speed_hi << 16) | ep->speed;
+}
#define ETHTOOL_BUSINFO_LEN 32
/* these strings are set to whatever the driver author decides... */
@@ -39,7 +53,8 @@ struct ethtool_drvinfo {
char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */
/* For PCI devices, use pci_name(pci_dev). */
char reserved1[32];
- char reserved2[16];
+ char reserved2[12];
+ __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */
__u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
__u32 testinfo_len;
__u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */
@@ -219,6 +234,7 @@ struct ethtool_pauseparam {
enum ethtool_stringset {
ETH_SS_TEST = 0,
ETH_SS_STATS,
+ ETH_SS_PRIV_FLAGS,
};
/* for passing string sets for data tagging */
@@ -256,125 +272,24 @@ struct ethtool_perm_addr {
__u8 data[0];
};
-#ifdef __KERNEL__
-
-struct net_device;
-
-/* Some generic methods drivers may use in their ethtool_ops */
-u32 ethtool_op_get_link(struct net_device *dev);
-u32 ethtool_op_get_tx_csum(struct net_device *dev);
-int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
-int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data);
-int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data);
-u32 ethtool_op_get_sg(struct net_device *dev);
-int ethtool_op_set_sg(struct net_device *dev, u32 data);
-u32 ethtool_op_get_tso(struct net_device *dev);
-int ethtool_op_set_tso(struct net_device *dev, u32 data);
-int ethtool_op_get_perm_addr(struct net_device *dev,
- struct ethtool_perm_addr *addr, u8 *data);
-u32 ethtool_op_get_ufo(struct net_device *dev);
-int ethtool_op_set_ufo(struct net_device *dev, u32 data);
-
-/**
- * &ethtool_ops - Alter and report network device settings
- * get_settings: Get device-specific settings
- * set_settings: Set device-specific settings
- * get_drvinfo: Report driver information
- * get_regs: Get device registers
- * get_wol: Report whether Wake-on-Lan is enabled
- * set_wol: Turn Wake-on-Lan on or off
- * get_msglevel: Report driver message level
- * set_msglevel: Set driver message level
- * nway_reset: Restart autonegotiation
- * get_link: Get link status
- * get_eeprom: Read data from the device EEPROM
- * set_eeprom: Write data to the device EEPROM
- * get_coalesce: Get interrupt coalescing parameters
- * set_coalesce: Set interrupt coalescing parameters
- * get_ringparam: Report ring sizes
- * set_ringparam: Set ring sizes
- * get_pauseparam: Report pause parameters
- * set_pauseparam: Set pause paramters
- * get_rx_csum: Report whether receive checksums are turned on or off
- * set_rx_csum: Turn receive checksum on or off
- * get_tx_csum: Report whether transmit checksums are turned on or off
- * set_tx_csum: Turn transmit checksums on or off
- * get_sg: Report whether scatter-gather is enabled
- * set_sg: Turn scatter-gather on or off
- * get_tso: Report whether TCP segmentation offload is enabled
- * set_tso: Turn TCP segmentation offload on or off
- * get_ufo: Report whether UDP fragmentation offload is enabled
- * set_ufo: Turn UDP fragmentation offload on or off
- * self_test: Run specified self-tests
- * get_strings: Return a set of strings that describe the requested objects
- * phys_id: Identify the device
- * get_stats: Return statistics about the device
- * get_perm_addr: Gets the permanent hardware address
- *
- * Description:
- *
- * get_settings:
- * @get_settings is passed an &ethtool_cmd to fill in. It returns
- * an negative errno or zero.
- *
- * set_settings:
- * @set_settings is passed an &ethtool_cmd and should attempt to set
- * all the settings this device supports. It may return an error value
- * if something goes wrong (otherwise 0).
+/* boolean flags controlling per-interface behavior characteristics.
+ * When reading, the flag indicates whether or not a certain behavior
+ * is enabled/present. When writing, the flag indicates whether
+ * or not the driver should turn on (set) or off (clear) a behavior.
*
- * get_eeprom:
- * Should fill in the magic field. Don't need to check len for zero
- * or wraparound. Fill in the data argument with the eeprom values
- * from offset to offset + len. Update len to the amount read.
- * Returns an error or zero.
- *
- * set_eeprom:
- * Should validate the magic field. Don't need to check len for zero
- * or wraparound. Update len to the amount written. Returns an error
- * or zero.
+ * Some behaviors may read-only (unconditionally absent or present).
+ * If such is the case, return EINVAL in the set-flags operation if the
+ * flag differs from the read-only value.
*/
-struct ethtool_ops {
- int (*get_settings)(struct net_device *, struct ethtool_cmd *);
- int (*set_settings)(struct net_device *, struct ethtool_cmd *);
- void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
- int (*get_regs_len)(struct net_device *);
- void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
- void (*get_wol)(struct net_device *, struct ethtool_wolinfo *);
- int (*set_wol)(struct net_device *, struct ethtool_wolinfo *);
- u32 (*get_msglevel)(struct net_device *);
- void (*set_msglevel)(struct net_device *, u32);
- int (*nway_reset)(struct net_device *);
- u32 (*get_link)(struct net_device *);
- int (*get_eeprom_len)(struct net_device *);
- int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
- int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
- int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
- int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
- void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *);
- int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *);
- void (*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*);
- int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*);
- u32 (*get_rx_csum)(struct net_device *);
- int (*set_rx_csum)(struct net_device *, u32);
- u32 (*get_tx_csum)(struct net_device *);
- int (*set_tx_csum)(struct net_device *, u32);
- u32 (*get_sg)(struct net_device *);
- int (*set_sg)(struct net_device *, u32);
- u32 (*get_tso)(struct net_device *);
- int (*set_tso)(struct net_device *, u32);
- int (*self_test_count)(struct net_device *);
- void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
- void (*get_strings)(struct net_device *, u32 stringset, u8 *);
- int (*phys_id)(struct net_device *, u32);
- int (*get_stats_count)(struct net_device *);
- void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *);
- int (*get_perm_addr)(struct net_device *, struct ethtool_perm_addr *, u8 *);
- int (*begin)(struct net_device *);
- void (*complete)(struct net_device *);
- u32 (*get_ufo)(struct net_device *);
- int (*set_ufo)(struct net_device *, u32);
+enum ethtool_flags {
+ ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
+};
+
+struct ethtool_rxnfc {
+ __u32 cmd;
+ __u32 flow_type;
+ __u64 data;
};
-#endif /* __KERNEL__ */
/* CMDs currently supported */
#define ETHTOOL_GSET 0x00000001 /* Get settings. */
@@ -414,6 +329,13 @@ struct ethtool_ops {
#define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
#define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */
#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
+#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
+#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
+#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
+#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
+
+#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
+#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
/* compatibility with older code */
#define SPARC_ETH_GSET ETHTOOL_GSET
@@ -501,4 +423,26 @@ struct ethtool_ops {
#define WAKE_MAGIC (1 << 5)
#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
+/* L3-L4 network traffic flow types */
+#define TCP_V4_FLOW 0x01
+#define UDP_V4_FLOW 0x02
+#define SCTP_V4_FLOW 0x03
+#define AH_ESP_V4_FLOW 0x04
+#define TCP_V6_FLOW 0x05
+#define UDP_V6_FLOW 0x06
+#define SCTP_V6_FLOW 0x07
+#define AH_ESP_V6_FLOW 0x08
+
+/* L3-L4 network traffic flow hash options */
+#define RXH_DEV_PORT (1 << 0)
+#define RXH_L2DA (1 << 1)
+#define RXH_VLAN (1 << 2)
+#define RXH_L3_PROTO (1 << 3)
+#define RXH_IP_SRC (1 << 4)
+#define RXH_IP_DST (1 << 5)
+#define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */
+#define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
+#define RXH_DISCARD (1 << 31)
+
+
#endif /* _LINUX_ETHTOOL_H */

View File

@ -1,13 +0,0 @@
Index: ethtool-6/ethtool.c
===================================================================
--- ethtool-6.orig/ethtool.c
+++ ethtool-6/ethtool.c
@@ -528,7 +528,7 @@ static void parse_cmdline(int argc, char
speed_wanted = SPEED_1000;
else if (!strcmp(argp[i], "2500"))
speed_wanted = SPEED_2500;
- else if (!strcmp(argp[1], "10000"))
+ else if (!strcmp(argp[i], "10000"))
speed_wanted = SPEED_10000;
else
show_usage(1);

View File

@ -1,3 +1,34 @@
-------------------------------------------------------------------
Tue Jul 27 12:08:56 UTC 2010 - puzel@novell.com
- update to ethtool-2.6.34
* Feature: Support n-tuple filter programming
* Feature: Support rx hashing, v2 (targetted for 2.6.35)
* Feature: Add names of newer Marvell chips
* new release numbering scheme, based
on the latest upstream kernel interface supported.
* Fix: several man page corrections
* Feature: rx flow hash configuration
* Feature: report 10000baseT support, where available
* Feature: report MDI-X status, pause auto-neg, link partner
adverts
* Feature: support additional port types
* Feature: support arbitrary speeds, faster than 65535 Mb
* Feature: large and generic receive offload (LRO, GRO) support
* Feature: option to flash firmware image from specified file
* Feature: support for block writing of EEPROMs
* Feature: marvell register dump update
* Feature: at76c50x-usb, e1000e, igb, ixgbe, r8169 register
dump support
* Cleanup: remove support for RX hashing by port
* Doc: Explicitly ship GPLv2 license
- drop all patches (fixed upstream)
-------------------------------------------------------------------
Mon Jul 12 08:01:51 UTC 2010 - puzel@novell.com
- add get-set-gro-settings.patch (bnc#616263)
-------------------------------------------------------------------
Fri Jan 8 22:19:41 CET 2010 - jengelh@medozas.de

View File

@ -1,5 +1,5 @@
#
# spec file for package ethtool (Version 6)
# spec file for package ethtool (Version 2.6.34)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -23,17 +23,12 @@ License: GPLv2+
Group: Productivity/Networking/Diagnostic
AutoReqProv: on
Summary: Examine and Tune Ethernet-Based Network Interfaces
Version: 6
Release: 80
Version: 2.6.34
Release: 1
# Tarballs: http://sourceforge.net/projects/gkernel/
Url: http://git.kernel.org/?p=network/ethtool/ethtool.git
Source: %{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Patch0: ethtool-cmd-speed-use-full-variable.patch
Patch1: ethtool-LRO_support.patch
#PATCH-FIX-UPSTREAM Some NICs report speeds other than 10, 100, 1000, 10000 to user land. At least display them properly (FATE#305494)
Patch2: ethtool-cmd-speed-display-all.patch
#PATCH-FIX-UPSTREAM fix parse of 10Gbe option (bnc#557016)
Patch3: ethtool-speed-parse.patch
%description
Ethtool is a small utility for examining and tuning ethernet-based
@ -50,10 +45,6 @@ Authors:
%prep
%setup -q
%patch0 -p1
%patch1
%patch2 -p1
%patch3 -p1
%build
%{suse_update_config -f}