From: Stephen Hemminger <shemminger@vyatta.com>
To: Jiri Pirko <jpirko@redhat.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
eric.dumazet@gmail.com, bridge@lists.linux-foundation.org
Subject: Re: [patch net-next-2.6] br: remove redundant check and init
Date: Thu, 1 Sep 2011 09:07:41 -0700 [thread overview]
Message-ID: <20110901090741.4ce49e76@nehalam.ftrdhcpuser.net> (raw)
In-Reply-To: <1314883778-2706-1-git-send-email-jpirko@redhat.com>
On Thu, 1 Sep 2011 15:29:38 +0200
Jiri Pirko <jpirko@redhat.com> wrote:
> Since these checks and initialization are done in
> dev_ethtool_get_settings called later on, remove this redundancy.
>
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
> ---
> net/bridge/br_if.c | 24 +++++++++++-------------
> 1 files changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
> index 2cdf007..b365bba 100644
> --- a/net/bridge/br_if.c
> +++ b/net/bridge/br_if.c
> @@ -33,20 +33,18 @@
> */
> static int port_cost(struct net_device *dev)
> {
> - if (dev->ethtool_ops && dev->ethtool_ops->get_settings) {
> - struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET, };
> -
> - if (!dev_ethtool_get_settings(dev, &ecmd)) {
> - switch (ethtool_cmd_speed(&ecmd)) {
> - case SPEED_10000:
> - return 2;
> - case SPEED_1000:
> - return 4;
> - case SPEED_100:
> - return 19;
> - case SPEED_10:
> - return 100;
> - }
> + struct ethtool_cmd ecmd;
> +
> + if (!dev_ethtool_get_settings(dev, &ecmd)) {
> + switch (ethtool_cmd_speed(&ecmd)) {
> + case SPEED_10000:
> + return 2;
> + case SPEED_1000:
> + return 4;
> + case SPEED_100:
> + return 19;
> + case SPEED_10:
> + return 100;
> }
> }
>
Yeah, this code predates when ethtool was sane about ops
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
next prev parent reply other threads:[~2011-09-01 16:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-01 13:29 [patch net-next-2.6] br: remove redundant check and init Jiri Pirko
2011-09-01 16:07 ` Stephen Hemminger [this message]
2011-09-15 19:43 ` David Miller
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=20110901090741.4ce49e76@nehalam.ftrdhcpuser.net \
--to=shemminger@vyatta.com \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=jpirko@redhat.com \
--cc=netdev@vger.kernel.org \
/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