From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Andy Gospodarek <andy@greyhouse.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH v2] bond: add support to read speed and duplex via ethtool
Date: Wed, 17 Apr 2013 02:33:02 +0400 [thread overview]
Message-ID: <516DD19E.5070803@cogentembedded.com> (raw)
In-Reply-To: <1366146607-12343-1-git-send-email-andy@greyhouse.net>
Hello.
On 04/17/2013 01:10 AM, Andy Gospodarek wrote:
> This patch adds support for the get_settings ethtool op to the bonding
> driver. This was motivated by users who wanted to get the speed of the
> bond and compare that against throughput to understand utilization.
> The behavior before this patch was added was problematic when computing
> line utilization after trying to get link-speed and throughput via SNMP.
>
> Output from ethtool looks like this for a round-robin bond:
>
> Settings for bond0:
> Supported ports: [ ]
> Supported link modes: Not reported
> Supported pause frame use: No
> Supports auto-negotiation: No
> Advertised link modes: Not reported
> Advertised pause frame use: No
> Advertised auto-negotiation: No
> Speed: 11000Mb/s
> Duplex: Full
> Port: Other
> PHYAD: 0
> Transceiver: internal
> Auto-negotiation: off
> MDI-X: Unknown
> Link detected: yes
>
> I tested this and verified it works as expected. A test was also done
> on a version backported to an older kernel and it worked well there.
>
> v2: switch to using ethtool_cmd_speed_set to set speed, added check to
> SLAVE_IS_OK for each slave in bond, dropped mode-specific calculations
> as they were not needed, and set port type to 'Other.'
>
> Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
> ---
> drivers/net/bonding/bond_main.c | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 07401a3..da2dd38 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -4222,6 +4222,39 @@ void bond_set_mode_ops(struct bonding *bond, int mode)
> }
> }
>
> +static int bond_ethtool_get_settings(struct net_device *bond_dev,
> + struct ethtool_cmd *ecmd)
> +{
[...]
> + if (slave->speed != SPEED_UNKNOWN) {
> + speed += slave->speed;
> + }
{} not needed. scripts/checkpatch.pl should have probably complained.
WBR, Sergei
prev parent reply other threads:[~2013-04-16 22:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-06 18:39 [PATCH net-next] bond: add support to read speed and duplex via ethtool Andy Gospodarek
2013-03-06 19:13 ` Veaceslav Falico
2013-03-06 19:48 ` Andy Gospodarek
2013-03-06 19:25 ` Jay Vosburgh
2013-03-06 20:01 ` Andy Gospodarek
2013-03-06 21:46 ` Jay Vosburgh
2013-03-07 12:11 ` Glen Turner
2013-03-08 15:35 ` Andy Gospodarek
2013-03-14 6:57 ` Glen Turner
2013-03-06 20:17 ` Ben Hutchings
2013-03-08 14:57 ` Andy Gospodarek
2013-04-16 21:10 ` [PATCH v2] " Andy Gospodarek
2013-04-16 21:32 ` Ben Hutchings
2013-04-16 22:33 ` Sergei Shtylyov [this message]
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=516DD19E.5070803@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=andy@greyhouse.net \
--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;
as well as URLs for NNTP newsgroup(s).