From patchwork Wed Apr 1 15:40:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lutomirski X-Patchwork-Id: 25489 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 6795CDDE00 for ; Thu, 2 Apr 2009 02:40:15 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753984AbZDAPkM (ORCPT ); Wed, 1 Apr 2009 11:40:12 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752660AbZDAPkL (ORCPT ); Wed, 1 Apr 2009 11:40:11 -0400 Received: from mail-bw0-f169.google.com ([209.85.218.169]:46853 "EHLO mail-bw0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751730AbZDAPkK (ORCPT ); Wed, 1 Apr 2009 11:40:10 -0400 Received: by bwz17 with SMTP id 17so90649bwz.37 for ; Wed, 01 Apr 2009 08:40:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=jtYZUmajjxJtjBHAF55Y/8+qf7wtPGzusZomejrvnaM=; b=Gd25WhqV4tNcXT7HDgJCXwXwZwdeL8ZvYpaHXH1PFzaC3qD4BDV8cUq7/J5kiK0tbV mS/VfUuWrQrl13VXQ9LJeR/mnjbtXwqIM4b+TNTYGoT2h9OcH0pCvBG4WeQAU/ayC8Ns tJHNTNcIMUXDIDzREhktxW+jIy4BiJdegkXQo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=hJ6qaj+1gYixK1E4rlFE9jDbNNQ66gQXkZwwi2+QQvp23ule/7dnmRUayCFuzHiuc3 MNS+wjEKJJTppU1WbQIIgeyN9fIAPXzc3tRzzcO21eYi8iSpTpySJCeDlSVU5MdKCxBA RBDq6PVfVbR1Dl8+N09aECq1MNB2cZpfHDYEA= MIME-Version: 1.0 Received: by 10.223.114.68 with SMTP id d4mr6273981faq.86.1238600406458; Wed, 01 Apr 2009 08:40:06 -0700 (PDT) Date: Wed, 1 Apr 2009 11:40:06 -0400 Message-ID: Subject: [PATCH 1/1] Tell linkwatch about new interfaces From: Andrew Lutomirski To: netdev@vger.kernel.org, LKML Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Andrew Lutomirski When a network driver registers a new interface, linkwatch will not notice, and hence not set the rfc2863 operstate, until netif_carrier_on gets called. If the new interface has no carrier when it is connected, then a status of "unknown" is reported to userspace, which confuses various tools (NetworkManager, for example). This fires a linkwatch event for all new interfaces, so that operstate gets set reasonably quickly. Signed-off-by: Andrew Lutomirski --- This looks like the root cause of the bug I reported here: http://lkml.org/lkml/2009/3/24/499 Without knowing all the locking and ordering constraints imposed on network drivers, this seemed like the safest way to fix the bug. Alternative approaches would be to call rfc2863_policy directly or to initialize the relevent fields to sane values (for the carrier off state) in alloc_netdev. This applies to 2.6.29. I can rediff it for any other tree, but I didn't see any changes that would conflict. the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/core/dev.c b/net/core/dev.c index e438f54..45911fd 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4445,6 +4445,9 @@ int register_netdevice(struct net_device *dev) dev->reg_state = NETREG_UNREGISTERED; } + /* Update link state. */ + linkwatch_fire_event(dev); + out: return ret; -- To unsubscribe from this list: send the line "unsubscribe netdev" in