netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: netdev <netdev@vger.kernel.org>
Cc: sf-linux-drivers <linux-net-drivers@solarflare.com>
Subject: Behaviour of ETHTOOL_GLINK for an interface that's down
Date: Mon, 06 Dec 2010 21:59:46 +0000	[thread overview]
Message-ID: <1291672786.5405.23.camel@bwh-desktop> (raw)

ETHTOOL_GLINK is yet another ethtool operation that has unclear
semantics that results in differing behaviour when the interface is
down.

The two reasonable semantics I can see are:
1. Report whether the host has a working link, i.e. netif_running() &&
netif_carrier_on().
2. Report whether the port has a working link.  For hardware interfaces,
poll the PHY or firmware unless the port is powered-off.  For software
interfaces, report whether the interface could plausibly pass traffic.

The default implementation (ethtool_op_get_link) uses
netif_carrier_ok(), implementing the rather unreasonable semantics:
3. Report whether the port had a working link when the interface was
last up.

At least one driver works around this by setting carrier off in its
ndo_stop() operation.

Here's a small sample of driver behaviours:

bnx2: (1)
bnx2x: (1) (I think)
cxgb3: (1) (but also (2) because PHY is powered off)
e1000e: (2)
gianfar: (3)
igb: (2)
ixgbe: (1)
niu: (3)
sfc: (3) (approximately)
sky2: (3)
tg3: (3) (but also (1) due to setting carrier off in tg3_close())

DaveM said that Network Manager may require (2), although I don't think
this is correct.  At least the current version brings all managed
interfaces up whether or not they have link-up already.

My personal preference is for (1).

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.


             reply	other threads:[~2010-12-06 21:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-06 21:59 Ben Hutchings [this message]
2010-12-09  5:47 ` Behaviour of ETHTOOL_GLINK for an interface that's down Dan Williams
2010-12-09  6:02   ` Dan Williams
2010-12-09 18:05     ` Ben Hutchings
2010-12-09 18:29       ` Dan Williams

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=1291672786.5405.23.camel@bwh-desktop \
    --to=bhutchings@solarflare.com \
    --cc=linux-net-drivers@solarflare.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;
as well as URLs for NNTP newsgroup(s).