* Re: [PATCH] Make possible speeds known to ethtool
@ 2009-01-09 3:48 Herbert Xu
2009-01-09 3:58 ` Jeff Garzik
0 siblings, 1 reply; 21+ messages in thread
From: Herbert Xu @ 2009-01-09 3:48 UTC (permalink / raw)
To: jgarzik; +Cc: herbert, bhutchings, rick.jones2, davem, netdev
Jeff Garzik <jgarzik@pobox.com> wrote:
>
> The person who added this should have used the new flags interface, and
> added ETH_FLAG_GRO right next to the pre-existing ETH_FLAG_LRO.
>
> It is incorrect to add new ioctls just to toggle a boolean value.
Well you missed my earlier explanation. GRO is a stack flag,
it's not something we want the device drivers to touch at all.
The generic flags interface appears to be designed for flags
that the device driver directly controls, such as LRO. That's
why it is inappropriate for GRO, which like GSO is entirely done
in software.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH] Make possible speeds known to ethtool 2009-01-09 3:48 [PATCH] Make possible speeds known to ethtool Herbert Xu @ 2009-01-09 3:58 ` Jeff Garzik 0 siblings, 0 replies; 21+ messages in thread From: Jeff Garzik @ 2009-01-09 3:58 UTC (permalink / raw) To: Herbert Xu; +Cc: bhutchings, rick.jones2, davem, netdev Herbert Xu wrote: > Jeff Garzik <jgarzik@pobox.com> wrote: >> The person who added this should have used the new flags interface, and >> added ETH_FLAG_GRO right next to the pre-existing ETH_FLAG_LRO. >> >> It is incorrect to add new ioctls just to toggle a boolean value. > > Well you missed my earlier explanation. GRO is a stack flag, > it's not something we want the device drivers to touch at all. > > The generic flags interface appears to be designed for flags > that the device driver directly controls, such as LRO. That's > why it is inappropriate for GRO, which like GSO is entirely done > in software. Nope, the generic flags interface is for any time you have a boolean flag to control on a per-interface basis. The generic flags interface was created precisely because it is silly to keep creating _two_ ethtool sub-ioctls (get, set) just for single boolean flags. For generic net stack flags outside the driver's control, that can easily be added to ethtool_{get,set}_flags() overriding or ignoring whatever the driver may have done. Jeff ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool
@ 2009-01-09 4:19 Herbert Xu
2009-01-09 5:00 ` David Miller
2009-01-09 5:03 ` Jeff Garzik
0 siblings, 2 replies; 21+ messages in thread
From: Herbert Xu @ 2009-01-09 4:19 UTC (permalink / raw)
To: jgarzik; +Cc: bhutchings, rick.jones2, davem, netdev
Jeff Garzik <jgarzik@pobox.com> wrote:
>
> For generic net stack flags outside the driver's control, that can
> easily be added to ethtool_{get,set}_flags() overriding or ignoring
> whatever the driver may have done.
To use the flags interface as is, you'd have to go through every
single driver to get them to call ethtool_op_set_flags. I'm sorry
but I'm sticking with the current interface.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH] Make possible speeds known to ethtool 2009-01-09 4:19 Herbert Xu @ 2009-01-09 5:00 ` David Miller 2009-01-09 5:05 ` Jeff Garzik 2009-01-09 5:03 ` Jeff Garzik 1 sibling, 1 reply; 21+ messages in thread From: David Miller @ 2009-01-09 5:00 UTC (permalink / raw) To: herbert; +Cc: jgarzik, bhutchings, rick.jones2, netdev From: Herbert Xu <herbert@gondor.apana.org.au> Date: Fri, 9 Jan 2009 15:19:53 +1100 > Jeff Garzik <jgarzik@pobox.com> wrote: > > > > For generic net stack flags outside the driver's control, that can > > easily be added to ethtool_{get,set}_flags() overriding or ignoring > > whatever the driver may have done. > > To use the flags interface as is, you'd have to go through every > single driver to get them to call ethtool_op_set_flags. I'm sorry > but I'm sticking with the current interface. Right, the flags thing is inappropriate without major reworking for Herbert's GRO case and therefore his choice was completely appropriate. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-01-09 5:00 ` David Miller @ 2009-01-09 5:05 ` Jeff Garzik 0 siblings, 0 replies; 21+ messages in thread From: Jeff Garzik @ 2009-01-09 5:05 UTC (permalink / raw) To: David Miller; +Cc: herbert, bhutchings, rick.jones2, netdev David Miller wrote: > From: Herbert Xu <herbert@gondor.apana.org.au> > Date: Fri, 9 Jan 2009 15:19:53 +1100 > >> Jeff Garzik <jgarzik@pobox.com> wrote: >>> For generic net stack flags outside the driver's control, that can >>> easily be added to ethtool_{get,set}_flags() overriding or ignoring >>> whatever the driver may have done. >> To use the flags interface as is, you'd have to go through every >> single driver to get them to call ethtool_op_set_flags. I'm sorry >> but I'm sticking with the current interface. > > Right, the flags thing is inappropriate without major reworking for > Herbert's GRO case and therefore his choice was completely > appropriate. It took about ten minutes of coding to disprove this... Jeff ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-01-09 4:19 Herbert Xu 2009-01-09 5:00 ` David Miller @ 2009-01-09 5:03 ` Jeff Garzik 2009-01-09 5:15 ` Herbert Xu 1 sibling, 1 reply; 21+ messages in thread From: Jeff Garzik @ 2009-01-09 5:03 UTC (permalink / raw) To: Herbert Xu; +Cc: bhutchings, rick.jones2, davem, netdev [-- Attachment #1: Type: text/plain, Size: 847 bytes --] Herbert Xu wrote: > Jeff Garzik <jgarzik@pobox.com> wrote: >> For generic net stack flags outside the driver's control, that can >> easily be added to ethtool_{get,set}_flags() overriding or ignoring >> whatever the driver may have done. > > To use the flags interface as is, you'd have to go through every > single driver to get them to call ethtool_op_set_flags. I'm sorry > but I'm sticking with the current interface. I think you misunderstand. You don't have touch any drivers at all... see attached demonstration patch. The more general point is that it is silly to add two ethtool ioctls each time you want to twiddle a single boolean flag (whatever that flag may be, generic or driver-specific or whatnot). If you still desire separation from ->{get,set}_flags() ops, then at least create an ETHTOOL_[GS]STACK_FLAGS. Jeff [-- Attachment #2: patch --] [-- Type: text/plain, Size: 2511 bytes --] diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 27c67a5..75fab70 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -285,6 +285,7 @@ struct ethtool_perm_addr { */ enum ethtool_flags { ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ + ETH_FLAG_GRO = (1 << 14), /* GRO is enabled */ }; struct ethtool_rxnfc { diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 947710a..a114afa 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -864,6 +864,60 @@ static int ethtool_set_value(struct net_device *dev, char __user *useraddr, return actor(dev, edata.data); } +static int ethtool_get_generic_flags(struct net_device *dev, u32 *val_out) +{ + if (dev->features & NETIF_F_GRO) + *val_out |= ETH_FLAG_GRO; + + return 0; +} + +static int ethtool_set_generic_flags(struct net_device *dev, u32 val_in) +{ + if (val_in & ETH_FLAG_GRO) { + if (!dev->ethtool_ops->get_rx_csum || + !dev->ethtool_ops->get_rx_csum(dev)) + return -EINVAL; + dev->features |= NETIF_F_GRO; + } else + dev->features &= ~NETIF_F_GRO; + + return 0; +} + +static int ethtool_get_flags(struct net_device *dev, char __user *useraddr) +{ + struct ethtool_value edata = { ETHTOOL_GFLAGS }; + int rc; + + if (dev->ethtool_ops->get_flags) + edata.data = dev->ethtool_ops->get_flags(dev); + + rc = ethtool_get_generic_flags(dev, &edata.data); + if (rc) + return rc; + + if (copy_to_user(useraddr, &edata, sizeof(edata))) + return -EFAULT; + return 0; +} + +static int ethtool_set_flags(struct net_device *dev, char __user *useraddr) +{ + struct ethtool_value edata; + int rc; + + if (copy_from_user(&edata, useraddr, sizeof(edata))) + return -EFAULT; + + rc = ethtool_set_generic_flags(dev, edata.data); + + if (rc == 0 && dev->ethtool_ops->set_flags) + rc = dev->ethtool_ops->set_flags(dev, edata.data); + + return rc; +} + /* The main entry point in this file. Called from net/core/dev.c */ int dev_ethtool(struct net *net, struct ifreq *ifr) @@ -1036,12 +1090,10 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) rc = ethtool_set_gso(dev, useraddr); break; case ETHTOOL_GFLAGS: - rc = ethtool_get_value(dev, useraddr, ethcmd, - dev->ethtool_ops->get_flags); + rc = ethtool_get_flags(dev, useraddr); break; case ETHTOOL_SFLAGS: - rc = ethtool_set_value(dev, useraddr, - dev->ethtool_ops->set_flags); + rc = ethtool_set_flags(dev, useraddr); break; case ETHTOOL_GPFLAGS: rc = ethtool_get_value(dev, useraddr, ethcmd, ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-01-09 5:03 ` Jeff Garzik @ 2009-01-09 5:15 ` Herbert Xu 2009-01-09 5:30 ` Jeff Garzik 0 siblings, 1 reply; 21+ messages in thread From: Herbert Xu @ 2009-01-09 5:15 UTC (permalink / raw) To: Jeff Garzik; +Cc: bhutchings, rick.jones2, davem, netdev On Fri, Jan 09, 2009 at 12:03:57AM -0500, Jeff Garzik wrote: > > I think you misunderstand. You don't have touch any drivers at all... > see attached demonstration patch. > > The more general point is that it is silly to add two ethtool ioctls > each time you want to twiddle a single boolean flag (whatever that flag > may be, generic or driver-specific or whatnot). > > If you still desire separation from ->{get,set}_flags() ops, then at > least create an ETHTOOL_[GS]STACK_FLAGS. OK, however I'm still not convinced that this is a good idea. First of all we don't have a shortage in the ethtool name space, we've only used up two hex digits worth of a 32-bit integer field. More importantly, making multiple bit changes at the same time may create semantic nightmares in future. For example, imagine if we started out with this generic flag function and TX checksum offload, SG, TSO were done using it. Now the user issues a request changing all of these bits, we'd then have to either validate it for contradictory settings, or devise some ad-hoc ordering in which the settings are applied. This just seems to be unnecessary penny-pinching that doesn't save much but may end up costing us down the road. Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-01-09 5:15 ` Herbert Xu @ 2009-01-09 5:30 ` Jeff Garzik 2009-01-09 5:35 ` Herbert Xu 0 siblings, 1 reply; 21+ messages in thread From: Jeff Garzik @ 2009-01-09 5:30 UTC (permalink / raw) To: Herbert Xu; +Cc: bhutchings, rick.jones2, davem, netdev Herbert Xu wrote: > On Fri, Jan 09, 2009 at 12:03:57AM -0500, Jeff Garzik wrote: >> I think you misunderstand. You don't have touch any drivers at all... >> see attached demonstration patch. >> >> The more general point is that it is silly to add two ethtool ioctls >> each time you want to twiddle a single boolean flag (whatever that flag >> may be, generic or driver-specific or whatnot). >> >> If you still desire separation from ->{get,set}_flags() ops, then at >> least create an ETHTOOL_[GS]STACK_FLAGS. > > OK, however I'm still not convinced that this is a good idea. > First of all we don't have a shortage in the ethtool name space, > we've only used up two hex digits worth of a 32-bit integer field. > > More importantly, making multiple bit changes at the same time > may create semantic nightmares in future. > > For example, imagine if we started out with this generic flag > function and TX checksum offload, SG, TSO were done using it. > Now the user issues a request changing all of these bits, we'd > then have to either validate it for contradictory settings, or > devise some ad-hoc ordering in which the settings are applied. Actually it's just the opposite -- _the_ most common complaint from users and driver developers of the ethtool interface, over the years, has been that there is no way to collect all the modifications and then commit it to hardware all in one go. Each new ethtool command added often winds up pausing and resetting the hardware completely, and ETHTOOL_SGRO is no exception. Now consider what happens when you have a lot of settings to tweak... reset, reset, reset, reset, reset. That's a lot of needless hardware banging. If I could redesign everything from scratch, I would make the interface flexible enough to input a list of changed settings, and then commit those all at once. Lists of flags make that possible to a limited extent, at least. > This just seems to be unnecessary penny-pinching that doesn't > save much but may end up costing us down the road. This sort of interface was added because the current "multi-reset" interface has already cost us. A multi-flag interface is also more flexible and future-proof, as you can deploy new flags without having to update any userland utility... ethtool can permit input of the raw value as well as a more refined command interface. That's another facet of the driver-private flag interfaces, too. The ETHTOOL_[GS]PFLAGS interface is flexible enough to permit a wide variety of feature flags to be exported by various drivers; userland ethtool automatically supports all flags a driver supports, and never needs updating even if the list of supported driver-private flags change. Jeff ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-01-09 5:30 ` Jeff Garzik @ 2009-01-09 5:35 ` Herbert Xu 2009-01-09 6:28 ` Jeff Garzik 0 siblings, 1 reply; 21+ messages in thread From: Herbert Xu @ 2009-01-09 5:35 UTC (permalink / raw) To: Jeff Garzik; +Cc: bhutchings, rick.jones2, davem, netdev On Fri, Jan 09, 2009 at 12:30:21AM -0500, Jeff Garzik wrote: > > Actually it's just the opposite -- _the_ most common complaint from > users and driver developers of the ethtool interface, over the years, > has been that there is no way to collect all the modifications and then > commit it to hardware all in one go. Yes that's a problem for flags that require the drivers to reset itself. > Each new ethtool command added often winds up pausing and resetting the > hardware completely, and ETHTOOL_SGRO is no exception. But as I explained before, GRO (like GSO) is purely a software setting, it has nothing to do with the driver at all. In other words we don't need the driver to reset or do anything. If anything by going into the driver's set_flags function as you suggested may cause a spurious reset that wouldn't have happened otherwise. So for software flags like GSO/GRO at least, I don't see any benefit in going to a multi-bit interface. On the flip side, I see potential complications with a multi-bit interfaces that simply don't exist with a single-bit interface. Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-01-09 5:35 ` Herbert Xu @ 2009-01-09 6:28 ` Jeff Garzik 2009-01-09 6:30 ` Herbert Xu 0 siblings, 1 reply; 21+ messages in thread From: Jeff Garzik @ 2009-01-09 6:28 UTC (permalink / raw) To: Herbert Xu; +Cc: bhutchings, rick.jones2, davem, netdev Herbert Xu wrote: > On Fri, Jan 09, 2009 at 12:30:21AM -0500, Jeff Garzik wrote: >> Actually it's just the opposite -- _the_ most common complaint from >> users and driver developers of the ethtool interface, over the years, >> has been that there is no way to collect all the modifications and then >> commit it to hardware all in one go. > > Yes that's a problem for flags that require the drivers to reset > itself. > >> Each new ethtool command added often winds up pausing and resetting the >> hardware completely, and ETHTOOL_SGRO is no exception. > > But as I explained before, GRO (like GSO) is purely a software > setting, it has nothing to do with the driver at all. In other Not quite true... it touches the driver's rx-csum hook. > If anything by going into the driver's set_flags function as you > suggested may cause a spurious reset that wouldn't have happened > otherwise. > > So for software flags like GSO/GRO at least, I don't see any > benefit in going to a multi-bit interface. On the flip side, > I see potential complications with a multi-bit interfaces that > simply don't exist with a single-bit interface. Well, whichever. Overall, if [GS]GRO remains I am happy to take patches supporting it in the userspace utility... Jeff ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-01-09 6:28 ` Jeff Garzik @ 2009-01-09 6:30 ` Herbert Xu 0 siblings, 0 replies; 21+ messages in thread From: Herbert Xu @ 2009-01-09 6:30 UTC (permalink / raw) To: Jeff Garzik; +Cc: bhutchings, rick.jones2, davem, netdev On Fri, Jan 09, 2009 at 01:28:22AM -0500, Jeff Garzik wrote: > > Not quite true... it touches the driver's rx-csum hook. Only because we never put the RX offload flag in a place that's independent of the driver. Also GRO never sets the RX offload flag (or clears it). > Well, whichever. Overall, if [GS]GRO remains I am happy to take patches > supporting it in the userspace utility... Thanks, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] Make possible speeds known to ethtool
@ 2009-01-08 2:03 Rick Jones
2009-01-08 3:14 ` Ben Hutchings
0 siblings, 1 reply; 21+ messages in thread
From: Rick Jones @ 2009-01-08 2:03 UTC (permalink / raw)
To: davem, jgarzik, netdev
Certain Broadcom 10Gb Ethernet solutions (e.g. the 57711E) can have a
10Gb port split into multiple virtual NICs each with an instance of
the bnx2x driver. These virtual NICs can be configured for any speed
which is an integer multiple of 100 Mb/s from 100 to 10,000 Mbit/s
inclusive. Since this is "normal" for such systems an "Unknown!" is
not indicated.
Signed-off-by: Rick Jones <rick.jones2@hp.com>
---
Rather than make a wholesale change to the existing "speed vetting"
code, it seemed least invasive to escape-out to a new routine in the
default case. Should other "unfamiliar" speeds surface in the future
the checks can be put there.
Where the original would say this:
Speed: Unknown! (1600)
for a FlexNIC link set to 1600 Mbit/s the changed version will
say:
Speed: 1600Mb/s
There is presently no way to alter this speed setting from within the
host, so there is no need/point to altering the ethtool "set" path.
--- ethtool.c.orig 2008-11-17 11:53:40.000000000 -0800
+++ ethtool.c 2008-11-17 13:14:55.000000000 -0800
@@ -806,6 +806,14 @@ static void dump_advertised(struct ethto
fprintf(stdout, "No\n");
}
+static void vet_unfamiliar_speed(struct ethtool_cmd *ep)
+{
+ if ((!ep->speed) || (ep->speed % 100))
+ fprintf(stdout, "Unknown! (%i)\n", ep->speed);
+ else
+ fprintf(stdout,"%dMb/s\n",ep->speed);
+}
+
static int dump_ecmd(struct ethtool_cmd *ep)
{
dump_supported(ep);
@@ -829,7 +837,7 @@ static int dump_ecmd(struct ethtool_cmd
fprintf(stdout, "10000Mb/s\n");
break;
default:
- fprintf(stdout, "Unknown! (%i)\n", ep->speed);
+ vet_unfamiliar_speed(ep);
break;
};
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH] Make possible speeds known to ethtool 2009-01-08 2:03 Rick Jones @ 2009-01-08 3:14 ` Ben Hutchings 2009-01-08 3:12 ` Jeff Garzik 0 siblings, 1 reply; 21+ messages in thread From: Ben Hutchings @ 2009-01-08 3:14 UTC (permalink / raw) To: Rick Jones; +Cc: davem, jgarzik, netdev On Wed, 2009-01-07 at 18:03 -0800, Rick Jones wrote: > Certain Broadcom 10Gb Ethernet solutions (e.g. the 57711E) can have a > 10Gb port split into multiple virtual NICs each with an instance of > the bnx2x driver. These virtual NICs can be configured for any speed > which is an integer multiple of 100 Mb/s from 100 to 10,000 Mbit/s > inclusive. Since this is "normal" for such systems an "Unknown!" is > not indicated. [...] The vetting of speeds is kind of silly. Given that speed is established as being a number of Mbit/s (hence the need for speed_hi), why not remove the warning and the checks for known values and report it as such? Ben. -- Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-01-08 3:14 ` Ben Hutchings @ 2009-01-08 3:12 ` Jeff Garzik 2009-01-08 19:11 ` Rick Jones 2009-01-09 2:52 ` Herbert Xu 0 siblings, 2 replies; 21+ messages in thread From: Jeff Garzik @ 2009-01-08 3:12 UTC (permalink / raw) To: Ben Hutchings; +Cc: Rick Jones, davem, netdev Ben Hutchings wrote: > On Wed, 2009-01-07 at 18:03 -0800, Rick Jones wrote: >> Certain Broadcom 10Gb Ethernet solutions (e.g. the 57711E) can have a >> 10Gb port split into multiple virtual NICs each with an instance of >> the bnx2x driver. These virtual NICs can be configured for any speed >> which is an integer multiple of 100 Mb/s from 100 to 10,000 Mbit/s >> inclusive. Since this is "normal" for such systems an "Unknown!" is >> not indicated. > [...] > > The vetting of speeds is kind of silly. Given that speed is established > as being a number of Mbit/s (hence the need for speed_hi), why not > remove the warning and the checks for known values and report it as > such? I'm ok with that route. Historically it made sense, but AFAICS the driver _must_ verify the speed anyway, so removing the limitation in the userspace tool seems reasonable. The next release of ethtool is coming in about 4 weeks, and we can definitely get something like this in there. Jeff ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-01-08 3:12 ` Jeff Garzik @ 2009-01-08 19:11 ` Rick Jones 2009-01-08 19:25 ` Ben Hutchings 2009-01-09 2:52 ` Herbert Xu 1 sibling, 1 reply; 21+ messages in thread From: Rick Jones @ 2009-01-08 19:11 UTC (permalink / raw) To: Jeff Garzik; +Cc: Ben Hutchings, netdev Jeff Garzik wrote: > Ben Hutchings wrote: >> The vetting of speeds is kind of silly. Given that speed is established >> as being a number of Mbit/s (hence the need for speed_hi), why not >> remove the warning and the checks for known values and report it as >> such? > > > I'm ok with that route. Historically it made sense, but AFAICS the > driver _must_ verify the speed anyway, so removing the limitation in the > userspace tool seems reasonable. > > The next release of ethtool is coming in about 4 weeks, and we can > definitely get something like this in there. I have a simple patch which does just that ready to post, but will point-out that removing the checks entirely will result in the speed being reported as 65535 (without Unknown) for an interface with its cable disconnected. This however is is based only on "testing" on a 2.6.24-22-generic (hardy) kernel with 7.3.20-k2-NAPI of the e1000 driver driving an Intel 82566MM (rev 03). rick jones ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-01-08 19:11 ` Rick Jones @ 2009-01-08 19:25 ` Ben Hutchings 2009-01-08 19:50 ` Rick Jones 0 siblings, 1 reply; 21+ messages in thread From: Ben Hutchings @ 2009-01-08 19:25 UTC (permalink / raw) To: Rick Jones; +Cc: Jeff Garzik, netdev On Thu, 2009-01-08 at 11:11 -0800, Rick Jones wrote: > Jeff Garzik wrote: > > Ben Hutchings wrote: > >> The vetting of speeds is kind of silly. Given that speed is established > >> as being a number of Mbit/s (hence the need for speed_hi), why not > >> remove the warning and the checks for known values and report it as > >> such? > > > > > > I'm ok with that route. Historically it made sense, but AFAICS the > > driver _must_ verify the speed anyway, so removing the limitation in the > > userspace tool seems reasonable. > > > > The next release of ethtool is coming in about 4 weeks, and we can > > definitely get something like this in there. > > I have a simple patch which does just that ready to post, but will > point-out that removing the checks entirely will result in the speed > being reported as 65535 (without Unknown) for an interface with its > cable disconnected. This however is is based only on "testing" on a > 2.6.24-22-generic (hardy) kernel with 7.3.20-k2-NAPI of the e1000 driver > driving an Intel 82566MM (rev 03). I think 0, (u32)(-1) and (u16)(-1) may have to be special-cased as unknown, but everything else can be treated as a number of Mbit/s. I don't know what a driver should do about an interface that really runs at 65.535 Gbit/s though... Ben. -- Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-01-08 19:25 ` Ben Hutchings @ 2009-01-08 19:50 ` Rick Jones 0 siblings, 0 replies; 21+ messages in thread From: Rick Jones @ 2009-01-08 19:50 UTC (permalink / raw) To: Ben Hutchings; +Cc: Jeff Garzik, netdev > > I think 0, (u32)(-1) and (u16)(-1) may have to be special-cased as > unknown, but everything else can be treated as a number of Mbit/s. I > don't know what a driver should do about an interface that really runs > at 65.535 Gbit/s though... Something along these lines then? (assuming my mailer doesn't fubar this :( - I normally send matches via mailx) --- ethtool.c.orig 2008-11-17 11:53:40.000000000 -0800 +++ ethtool.c 2009-01-08 11:41:54.000000000 -0800 @@ -813,23 +813,12 @@ static int dump_ecmd(struct ethtool_cmd fprintf(stdout, " Speed: "); switch (ep->speed) { - case SPEED_10: - fprintf(stdout, "10Mb/s\n"); - break; - case SPEED_100: - fprintf(stdout, "100Mb/s\n"); - break; - case SPEED_1000: - fprintf(stdout, "1000Mb/s\n"); - break; - case SPEED_2500: - fprintf(stdout, "2500Mb/s\n"); - break; - case SPEED_10000: - fprintf(stdout, "10000Mb/s\n"); + case 0: + case (u16)(-1): + fprintf(stdout, "Unknown! (%i)\n", ep->speed); break; default: - fprintf(stdout, "Unknown! (%i)\n", ep->speed); + fprintf(stdout, "%dMb/s\n", ep->speed); break; }; If that looks reasonable I'll post a proper one with the apropriate text and such with mailx... rick jones ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-01-08 3:12 ` Jeff Garzik 2009-01-08 19:11 ` Rick Jones @ 2009-01-09 2:52 ` Herbert Xu 2009-01-09 3:20 ` Jeff Garzik 2009-03-06 11:19 ` Jeff Garzik 1 sibling, 2 replies; 21+ messages in thread From: Herbert Xu @ 2009-01-09 2:52 UTC (permalink / raw) To: Jeff Garzik; +Cc: Ben Hutchings, Rick Jones, davem, netdev On Thu, Jan 08, 2009 at 03:12:01AM +0000, Jeff Garzik wrote: > > The next release of ethtool is coming in about 4 weeks, and we can > definitely get something like this in there. Jeff, any chance you can stick this patch in there to add the GRO toggle? ethtool: Add GRO toggle This patch adds the -k toggles to query and set GRO on a device. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> diff --git a/ethtool-copy.h b/ethtool-copy.h index eadba25..3ca4e2c 100644 --- a/ethtool-copy.h +++ b/ethtool-copy.h @@ -336,6 +336,8 @@ struct ethtool_rxnfc { #define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ +#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ +#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET diff --git a/ethtool.c b/ethtool.c index a7c02d0..502fc8f 100644 --- a/ethtool.c +++ b/ethtool.c @@ -160,6 +160,7 @@ static struct option { " [ tso on|off ]\n" " [ ufo on|off ]\n" " [ gso on|off ]\n" + " [ gro on|off ]\n" " [ lro on|off ]\n" }, { "-i", "--driver", MODE_GDRV, "Show driver information" }, @@ -218,6 +219,7 @@ static int off_sg_wanted = -1; static int off_tso_wanted = -1; static int off_ufo_wanted = -1; static int off_gso_wanted = -1; +static int off_gro_wanted = -1; static int off_lro_wanted = -1; static struct ethtool_pauseparam epause; @@ -333,6 +335,7 @@ static struct cmdline_info cmdline_offload[] = { { "tso", CMDL_BOOL, &off_tso_wanted, NULL }, { "ufo", CMDL_BOOL, &off_ufo_wanted, NULL }, { "gso", CMDL_BOOL, &off_gso_wanted, NULL }, + { "gro", CMDL_BOOL, &off_gro_wanted, NULL }, { "lro", CMDL_BOOL, &off_lro_wanted, NULL }, }; @@ -1387,7 +1390,8 @@ static int dump_coalesce(void) return 0; } -static int dump_offload(int rx, int tx, int sg, int tso, int ufo, int gso, int lro) +static int dump_offload(int rx, int tx, int sg, int tso, int ufo, int gso, + int gro, int lro) { fprintf(stdout, "rx-checksumming: %s\n" @@ -1396,6 +1400,7 @@ static int dump_offload(int rx, int tx, int sg, int tso, int ufo, int gso, int l "tcp segmentation offload: %s\n" "udp fragmentation offload: %s\n" "generic segmentation offload: %s\n" + "generic receive offload: %s\n" "large receive offload: %s\n", rx ? "on" : "off", tx ? "on" : "off", @@ -1403,6 +1408,7 @@ static int dump_offload(int rx, int tx, int sg, int tso, int ufo, int gso, int l tso ? "on" : "off", ufo ? "on" : "off", gso ? "on" : "off", + gro ? "on" : "off", lro ? "on" : "off"); return 0; @@ -1714,7 +1720,7 @@ static int do_goffload(int fd, struct ifreq *ifr) { struct ethtool_value eval; int err, allfail = 1, rx = 0, tx = 0, sg = 0; - int tso = 0, ufo = 0, gso = 0, lro = 0; + int tso = 0, ufo = 0, gso = 0, gro = 0, lro = 0; fprintf(stdout, "Offload parameters for %s:\n", devname); @@ -1778,6 +1784,16 @@ static int do_goffload(int fd, struct ifreq *ifr) allfail = 0; } + eval.cmd = ETHTOOL_GGRO; + ifr->ifr_data = (caddr_t)&eval; + err = ioctl(fd, SIOCETHTOOL, ifr); + if (err) + perror("Cannot get device generic receive offload settings"); + else { + gro = eval.data; + allfail = 0; + } + eval.cmd = ETHTOOL_GFLAGS; ifr->ifr_data = (caddr_t)&eval; err = ioctl(fd, SIOCETHTOOL, ifr); @@ -1793,7 +1809,7 @@ static int do_goffload(int fd, struct ifreq *ifr) return 83; } - return dump_offload(rx, tx, sg, tso, ufo, gso, lro); + return dump_offload(rx, tx, sg, tso, ufo, gso, gro, lro); } static int do_soffload(int fd, struct ifreq *ifr) @@ -1870,6 +1886,17 @@ static int do_soffload(int fd, struct ifreq *ifr) return 90; } } + if (off_gro_wanted >= 0) { + changed = 1; + eval.cmd = ETHTOOL_SGRO; + eval.data = (off_gro_wanted == 1); + ifr->ifr_data = (caddr_t)&eval; + err = ioctl(fd, SIOCETHTOOL, ifr); + if (err) { + perror("Cannot set device generic receive offload settings"); + return 93; + } + } if (off_lro_wanted >= 0) { changed = 1; eval.cmd = ETHTOOL_GFLAGS; Thanks, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-01-09 2:52 ` Herbert Xu @ 2009-01-09 3:20 ` Jeff Garzik 2009-03-06 11:19 ` Jeff Garzik 1 sibling, 0 replies; 21+ messages in thread From: Jeff Garzik @ 2009-01-09 3:20 UTC (permalink / raw) To: Herbert Xu; +Cc: Ben Hutchings, Rick Jones, davem, netdev Herbert Xu wrote: > On Thu, Jan 08, 2009 at 03:12:01AM +0000, Jeff Garzik wrote: >> The next release of ethtool is coming in about 4 weeks, and we can >> definitely get something like this in there. > > Jeff, any chance you can stick this patch in there to add the GRO > toggle? > > ethtool: Add GRO toggle > > This patch adds the -k toggles to query and set GRO on a device. > > Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> > > diff --git a/ethtool-copy.h b/ethtool-copy.h > index eadba25..3ca4e2c 100644 > --- a/ethtool-copy.h > +++ b/ethtool-copy.h > @@ -336,6 +336,8 @@ struct ethtool_rxnfc { > > #define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ > #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ > +#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ > +#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ Ugh... is it too late to change this interface? The person who added this should have used the new flags interface, and added ETH_FLAG_GRO right next to the pre-existing ETH_FLAG_LRO. It is incorrect to add new ioctls just to toggle a boolean value. Jeff ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-01-09 2:52 ` Herbert Xu 2009-01-09 3:20 ` Jeff Garzik @ 2009-03-06 11:19 ` Jeff Garzik 2009-03-06 13:52 ` Herbert Xu 1 sibling, 1 reply; 21+ messages in thread From: Jeff Garzik @ 2009-03-06 11:19 UTC (permalink / raw) To: Herbert Xu; +Cc: Ben Hutchings, Rick Jones, davem, netdev Herbert Xu wrote: > On Thu, Jan 08, 2009 at 03:12:01AM +0000, Jeff Garzik wrote: >> The next release of ethtool is coming in about 4 weeks, and we can >> definitely get something like this in there. > > Jeff, any chance you can stick this patch in there to add the GRO > toggle? > > ethtool: Add GRO toggle > > This patch adds the -k toggles to query and set GRO on a device. > > Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> ugh. this got buried in my mailbox, sorry. I missed it completely... and recreated it from scratch just now. Check the git repo, it should work now. Jeff ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] Make possible speeds known to ethtool 2009-03-06 11:19 ` Jeff Garzik @ 2009-03-06 13:52 ` Herbert Xu 0 siblings, 0 replies; 21+ messages in thread From: Herbert Xu @ 2009-03-06 13:52 UTC (permalink / raw) To: Jeff Garzik; +Cc: Ben Hutchings, Rick Jones, davem, netdev On Fri, Mar 06, 2009 at 06:19:04AM -0500, Jeff Garzik wrote: > > I missed it completely... and recreated it from scratch just now. Check > the git repo, it should work now. Thanks Jeff! -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2009-03-06 13:52 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-01-09 3:48 [PATCH] Make possible speeds known to ethtool Herbert Xu 2009-01-09 3:58 ` Jeff Garzik -- strict thread matches above, loose matches on Subject: below -- 2009-01-09 4:19 Herbert Xu 2009-01-09 5:00 ` David Miller 2009-01-09 5:05 ` Jeff Garzik 2009-01-09 5:03 ` Jeff Garzik 2009-01-09 5:15 ` Herbert Xu 2009-01-09 5:30 ` Jeff Garzik 2009-01-09 5:35 ` Herbert Xu 2009-01-09 6:28 ` Jeff Garzik 2009-01-09 6:30 ` Herbert Xu 2009-01-08 2:03 Rick Jones 2009-01-08 3:14 ` Ben Hutchings 2009-01-08 3:12 ` Jeff Garzik 2009-01-08 19:11 ` Rick Jones 2009-01-08 19:25 ` Ben Hutchings 2009-01-08 19:50 ` Rick Jones 2009-01-09 2:52 ` Herbert Xu 2009-01-09 3:20 ` Jeff Garzik 2009-03-06 11:19 ` Jeff Garzik 2009-03-06 13:52 ` Herbert Xu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).