From: Arvid Brodin <arvid.brodin@xdin.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Joe Perches <joe@perches.com>,
Javier Boticario <jboticario@gmail.com>,
"balferreira@googlemail.com" <balferreira@googlemail.com>,
Arvid Brodin <Arvid.Brodin@xdin.com>
Subject: Re: [PATCH] net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)
Date: Wed, 26 Jun 2013 01:36:47 +0200 [thread overview]
Message-ID: <51CA298F.7060600@xdin.com> (raw)
In-Reply-To: <20130625154638.357e4764@nehalam.linuxnetplumber.net>
On 2013-06-26 00:46, Stephen Hemminger wrote:
> On Wed, 26 Jun 2013 00:30:51 +0200
> Arvid Brodin <arvid.brodin@xdin.com> wrote:
>
>> On 2013-06-25 02:07, Stephen Hemminger wrote:
>>> On Mon, 24 Jun 2013 09:44:01 -0700
>>> Arvid Brodin <arvid.brodin@xdin.com> wrote:
>>>
>>>> +
>>>> +
>>>> +static bool is_admin_up(struct net_device *dev)
>>>> +{
>>>> + return dev && (dev->flags & IFF_UP);
>>>> +}
>>>> +
>>>> +static bool is_operstate_up(struct net_device *dev)
>>>> +{
>>>> + return (dev && (dev->operstate == IF_OPER_UP));
>>>> +}
>>>> +
>>>
>>> Isn't is_admin_up the same as netif_running()?
>>
>> I don't think so (but I'm unsure). This is netif_running() (from include/linux/netdevice.h):
>>
>> static inline bool netif_running(const struct net_device *dev)
>> {
>> return test_bit(__LINK_STATE_START, &dev->state);
>> }
>>
>> I'm not sure what this does. I don't think it's the same as checking whether the admin has
>> issued an UP command?
>>
>>
>>> And is_operstate_up the same as netif_oper_up()?
>>
>> netif_oper_up() also returns true if the device state is IF_OPER_UNKNOWN. A device can
>> have that state without even having carrier, so that's not OK for the HSR driver.
>>
>
> Then use netif_oper_up(dev) && netif_carrier_on(dev)
That would be very weird since netif_carrier_on() signals that the carrier is on (and
returns void). :) But I get your point - i.e. check for carrier state.
This is netif_oper_up() in include/linux/netdevice.h:
static inline bool netif_oper_up(const struct net_device *dev)
{
return (dev->operstate == IF_OPER_UP ||
dev->operstate == IF_OPER_UNKNOWN /* backward compat */);
}
I'm guessing that IF_OPER_UNKNOWN is just a default state and that some (old or buggy)
network drivers simply does not set this as they should? I.e. they should call
netif_carrier_off() on open, but they don't. The "backward compat" may be a way around
that? (We had problems with this on an old version of the macb driver; I think that's why
we wrote our own is_operstate_up().)
If so, I guess you are right and I should use netif_oper_up() (and any problems arising
from that would be due to bugs in the respective device driver). Does this sound reasonable?
--
Arvid Brodin | Consultant (Linux)
T: +46-8-56254286 | M: +46-70-9714286 | arvid.brodin@xdin.com
XDIN AB | Knarrarnäsgatan 7 | SE-164 40 Kista | Sweden | xdin.com
next prev parent reply other threads:[~2013-06-25 23:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1902752B0C92F943AB7EA9EE13E2DEEC126CC8C873@HQ1-EXCH02.corp.brocade.com>
[not found] ` <20130624170727.4d7893a1@nehalam.linuxnetplumber.net>
2013-06-25 22:30 ` [PATCH] net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0) Arvid Brodin
2013-06-25 22:46 ` Stephen Hemminger
2013-06-25 23:36 ` Arvid Brodin [this message]
[not found] ` <20130624171151.7b2b342a@nehalam.linuxnetplumber.net>
2013-06-25 22:57 ` Arvid Brodin
2013-06-24 16:43 Arvid Brodin
2013-06-24 18:16 ` Joe Perches
2013-06-25 21:16 ` Arvid Brodin
2013-06-25 21:31 ` Joe Perches
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=51CA298F.7060600@xdin.com \
--to=arvid.brodin@xdin.com \
--cc=balferreira@googlemail.com \
--cc=jboticario@gmail.com \
--cc=joe@perches.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.