From: Stephen Hemminger <shemminger@vyatta.com>
To: Trent Piepho <tpiepho@freescale.com>
Cc: netdev@vger.kernel.org, Trent Piepho <tpiepho@freescale.com>,
Andy Fleming <afleming@freescale.com>
Subject: Re: [PATCH 7/9] [ETH]: Start net device with carrier down
Date: Wed, 24 Sep 2008 14:32:03 -0700 [thread overview]
Message-ID: <20080924143203.1eba6bbe@extreme> (raw)
In-Reply-To: <ebb4b9e34a594b9ca0fda9042bfa12bff9e9fac2.1221537369.git.tpiepho@freescale.com>
On Wed, 24 Sep 2008 14:20:55 -0700
Trent Piepho <tpiepho@freescale.com> wrote:
> Because it _is_ down when the device starts.
>
> The device's carrier status is controlled via the functions
> netif_carrier_on() and netif_carrier_off(). These set or clear a bit
> indicating the lower level link aka carrier is down, and if the state
> changed, they fire off a routing netlink event.
>
> The problem is that when the device is first created and opened, the state
> bit indicating the carrier is down isn't set, i.e. the state is wrong.
> When the carrier comes up for the first time no netlink event is sent,
> since the device state indicated the carrier was already up.
>
> Signed-off-by: Trent Piepho <tpiepho@freescale.com>
> CC: Andy Fleming <afleming@freescale.com>
> ---
> net/ethernet/eth.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
> index a80839b..cdba6d0 100644
> --- a/net/ethernet/eth.c
> +++ b/net/ethernet/eth.c
> @@ -333,6 +333,7 @@ void ether_setup(struct net_device *dev)
> dev->addr_len = ETH_ALEN;
> dev->tx_queue_len = 1000; /* Ethernet wants good queues */
> dev->flags = IFF_BROADCAST|IFF_MULTICAST;
> + dev->state = 1 << __LINK_STATE_NOCARRIER;
>
> memset(dev->broadcast, 0xFF, ETH_ALEN);
>
This breaks devices that never call netif_carrier_on.
Standard practice is to call netif_carrier_off after allocation but before
register_netdev
next prev parent reply other threads:[~2008-09-24 21:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <e665d9ff8b50796ce65c503604453056217bfc8a.1221537369.git.tpiepho@freescale.com>
2008-09-24 21:20 ` [PATCH 7/9] [ETH]: Start net device with carrier down Trent Piepho
2008-09-24 21:32 ` Stephen Hemminger [this message]
2008-09-24 22:25 ` David Miller
2008-09-24 22:24 ` David Miller
2008-09-24 22:43 ` Trent Piepho
2008-10-02 21:12 ` [PATCH v2] gianfar: Create " Trent Piepho
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=20080924143203.1eba6bbe@extreme \
--to=shemminger@vyatta.com \
--cc=afleming@freescale.com \
--cc=netdev@vger.kernel.org \
--cc=tpiepho@freescale.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).