netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: David Decotigny <decot@google.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	mirq-linux@rere.qmqm.pl, Stanislaw Gruszka <sgruszka@redhat.com>,
	Alexander Duyck <alexander.h.duyck@intel.com>,
	Eilon Greenstein <eilong@broadcom.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCHv2 2/4] ethtool: Call ethtool's get/set_settings callbacks with cleaned data
Date: Wed, 27 Apr 2011 19:53:38 +0100	[thread overview]
Message-ID: <1303930418.2875.106.camel@bwh-desktop> (raw)
In-Reply-To: <1303929290-21037-3-git-send-email-decot@google.com>

On Wed, 2011-04-27 at 11:34 -0700, David Decotigny wrote:
> This makes sure that when a driver calls the ethtool's
> get/set_settings() callback of another driver, the data passed to it
> is clean. This guarantees that speed_hi will be zeroed correctly if
> the called callback doesn't explicitely set it: we are sure we don't
> get a corrupted speed from the underlying driver. We also take care of
> setting the cmd field appropriately (ETHTOOL_GSET/SSET).
> 
> This applies to dev_ethtool_get_settings(), which now makes sure it
> sets up that ethtool command parameter correctly before passing it to
> drivers. This also means that whoever calls dev_ethtool_get_settings()
> does not have to clean the ethtool command parameter. This function
> also becomes an exported symbol instead of an inline.
> 
> All drivers visible to make allyesconfig under x86_64 have been
> updated.
> 
> Signed-off-by: David Decotigny <decot@google.com>
[...]
> diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c
> index e85bf04..2e717a2 100644
> --- a/drivers/net/mdio.c
> +++ b/drivers/net/mdio.c
> @@ -176,6 +176,9 @@ static u32 mdio45_get_an(const struct mdio_if_info *mdio, u16 addr)
>   * @npage_adv: Modes currently advertised on next pages
>   * @npage_lpa: Modes advertised by link partner on next pages
>   *
> + * The @ecmd parameter is expected to have been cleared before calling
> + * mii_ethtool_gset().

Copy-pasta: should say mdio45_get_an() not mii_ethtool_gset().

[...]
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 3bbb4c2..36e57fb 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4496,6 +4496,30 @@ void dev_set_rx_mode(struct net_device *dev)
>  }
>  
>  /**
> + *	dev_ethtool_get_settings - call device's ethtool::get_settings()
> + *	@dev: device
> + *	@cmd: memory area for ethtool_cmd::get_settings() result
> + *
> + *      The cmd arg is initialized properly (cleared and
> + *      ethtoo_cmd::cmd field set to ETHTOOL_GSET).

Typo: 'ethtoo_cmd' should be 'ethtool_cmd'.

> + *	Return device's ethtool_cmd::get_settings() result value or
> + *	-EOPNOTSUPP when device doesn't expose
> + *	ethtool_cmd::get_settings() operation.
[...]

The operation is ethtool_ops::get_settings, not ethtool::get_settings or
ethtool_cmd::get_settings.

Other than that, this looks fine.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

  parent reply	other threads:[~2011-04-27 18:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-17  0:54 [PATCH 1/5] ethtool: cosmetics: enforce const-ness in ethtool_cmd_speed David Decotigny
2011-04-17  0:54 ` [PATCH 2/5] bnx2x: cosmetics: Using ethtool_cmd_speed() API David Decotigny
2011-04-17  0:54 ` [PATCH 3/5] ethtool: Call ethtool's get/set_settings callbacks with cleaned data David Decotigny
2011-04-17  0:54 ` [PATCH 4/5] ethtool: Use the full 32 bit speed range in ethtool's set_settings David Decotigny
2011-04-17  2:02   ` Ben Hutchings
2011-04-17  0:54 ` [PATCH 5/5] ethtool: cosmetic: Use the ethtool speed_cmd_speed API David Decotigny
     [not found] ` <1303001651-4074-3-git-send-email-decot@google.com>
2011-04-17  1:53   ` [PATCH 3/5] ethtool: Call ethtool's get/set_settings callbacks with cleaned data Ben Hutchings
2011-04-17  2:06 ` [PATCH 1/5] ethtool: cosmetics: enforce const-ness in ethtool_cmd_speed Ben Hutchings
2011-04-27 18:34 ` [PATCHv2 0/4] ethtool: generalize use of ethtool_cmd_speed API David Decotigny
2011-04-27 18:34 ` [PATCHv2 1/4] ethtool: cosmetics: enforce const-ness in ethtool_cmd_speed David Decotigny
2011-04-27 18:34 ` [PATCHv2 2/4] ethtool: Call ethtool's get/set_settings callbacks with cleaned data David Decotigny
2011-04-27 18:34 ` [PATCHv2 3/4] ethtool: Use the full 32 bit speed range in ethtool's set_settings David Decotigny
2011-04-27 19:27   ` Ben Hutchings
2011-04-27 22:05     ` David Decotigny
2011-04-27 23:10       ` Ben Hutchings
2011-04-27 22:23   ` Stephen Hemminger
2011-04-27 18:34 ` [PATCHv2 4/4] ethtool: cosmetic: Use ethtool ethtool_cmd_speed API David Decotigny
2011-04-27 18:34 ` [PATCHv2] acenic: Fix using the specified speed when configuring NIC David Decotigny
     [not found] ` <1303929290-21037-2-git-send-email-decot@google.com>
2011-04-27 18:41   ` [PATCHv2 1/4] ethtool: cosmetics: enforce const-ness in ethtool_cmd_speed Ben Hutchings
     [not found] ` <1303929290-21037-3-git-send-email-decot@google.com>
2011-04-27 18:53   ` Ben Hutchings [this message]
     [not found] ` <1303929290-21037-5-git-send-email-decot@google.com>
2011-04-27 19:43   ` [PATCHv2 4/4] ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 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=1303930418.2875.106.camel@bwh-desktop \
    --to=bhutchings@solarflare.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=davem@davemloft.net \
    --cc=decot@google.com \
    --cc=eilong@broadcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=netdev@vger.kernel.org \
    --cc=sgruszka@redhat.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).