netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: Kieran Mansley <kmansley@solarflare.com>,
	Jeff Garzik <jgarzik@pobox.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH] ethtool: command line support for lro
Date: Mon, 10 Mar 2008 18:07:07 +0000	[thread overview]
Message-ID: <20080310180706.GF12660@solarflare.com> (raw)
In-Reply-To: <20080307134312.037e2cf6@extreme>

Stephen Hemminger wrote:
> Add lro support to command in similar manner to TSO, GSO, etc.
> The file ethtool-copy.h is updated to be sanitised version of
> ethtool.h from 2.6.25-rc4 (ie make headers_install)

I already posted a patch to do this, though I didn't update
ethtool-copy.h.

> Not tested on actual LRO hardware.

Mine was, and this looks very similar.

> @@ -1559,12 +1566,20 @@ static int do_goffload(int fd, struct ifreq *ifr)
>  		allfail = 0;
>  	}
>  
> +	eval.cmd = ETHTOOL_GFLAGS;
> +	ifr->ifr_data = (caddr_t)&eval;
> +	err = ioctl(fd, SIOCETHTOOL, ifr);
> +	if (!err) {
> +		lro = eval.data & ETH_FLAG_LRO;
> +		allfail = 0;
> +	}
> +

To be consistent, this should print a specific error if the ioctl
fails.

> @@ -1641,6 +1656,30 @@ static int do_soffload(int fd, struct ifreq *ifr)
>  			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 90;
> +		}

I didn't bother fetching the existing flags because only ETH_FLAG_LRO
is defined.  But this would be more future-proof.

> +
> +		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 90;
> +		}

The error return codes are unique so far, so these error paths
should return 91 and 92, not 90.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.

  reply	other threads:[~2008-03-10 18:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-07 14:09 LRO/GSO interaction when packets are forwarded Kieran Mansley
2008-03-07 16:25 ` Stephen Hemminger
2008-03-07 17:06   ` Kieran Mansley
2008-03-07 21:43     ` [PATCH] ethtool: command line support for lro Stephen Hemminger
2008-03-10 18:07       ` Ben Hutchings [this message]
2008-03-10 18:29         ` Stephen Hemminger
2008-03-10 18:50           ` Ben Hutchings
2008-04-17 12:11         ` Ben Hutchings
2008-04-30 18:36           ` Kok, Auke
2008-05-02 14:34             ` Ben Hutchings
2008-09-14  2:09           ` Jeff Garzik
2008-03-11 16:50     ` LRO/GSO interaction when packets are forwarded Kieran Mansley
2008-04-22 21:15     ` Ben Hutchings
2008-04-22 23:01       ` Stephen Hemminger
2008-04-23  6:00         ` Jarek Poplawski
2008-04-23  6:15           ` Jarek Poplawski
2008-04-23 10:07             ` Ben Hutchings
2008-04-23 10:38               ` Jarek Poplawski
2008-04-23 10:42                 ` David Miller
2008-04-23 11:09                   ` Jarek Poplawski
2008-04-23 10:04         ` Ben Hutchings

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080310180706.GF12660@solarflare.com \
    --to=bhutchings@solarflare.com \
    --cc=jgarzik@pobox.com \
    --cc=kmansley@solarflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).