From patchwork Sat Mar 14 10:40:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pantelis Koukousoulas X-Patchwork-Id: 24451 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 0CD64DE12C for ; Sat, 14 Mar 2009 21:40:44 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752159AbZCNKkk (ORCPT ); Sat, 14 Mar 2009 06:40:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751621AbZCNKkj (ORCPT ); Sat, 14 Mar 2009 06:40:39 -0400 Received: from ey-out-2122.google.com ([74.125.78.25]:21633 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751242AbZCNKki (ORCPT ); Sat, 14 Mar 2009 06:40:38 -0400 Received: by ey-out-2122.google.com with SMTP id 25so730169eya.37 for ; Sat, 14 Mar 2009 03:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=PQJnkkUWr8/2G+rFrEZsgukDe9BT8sY8aiGxVqeUwI8=; b=PrGV+XisMgTeNddExIl4yxzJ4nUBGoaXM/gdRqVAwF0F4gy1kIkr/45qRpkS+LUc9P QUcRF+BoO/futppzqetPbzQNE28qAwi2/C8+CTqwU9UBXZZkubESfCJfLBXi61RLgrhv 0nEZfNjPyEM2t8BO1WDsn+LUTJr67lDSXLnlM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=gB23efdbrXQr9V1F9Bzjd2rygFRWHcBHbAQpDgWF+dl7h+fOEv9jKBYi6DhufindPy R3aLGRM40kww5rJUbTxbeZxLsz7S1GcfqzZFE+MdTjVMwyqlXXqjRETG/bziGNi7SvzB 0E2ADgTxOlFZuBwM5zA723c5R4RVLDUaStht0= Received: by 10.210.11.17 with SMTP id 17mr1756601ebk.32.1237027235259; Sat, 14 Mar 2009 03:40:35 -0700 (PDT) Received: from localhost (athedsl-4564615.home.otenet.gr [94.70.114.143]) by mx.google.com with ESMTPS id 7sm3251964eyb.18.2009.03.14.03.40.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 14 Mar 2009 03:40:35 -0700 (PDT) From: Pantelis Koukousoulas To: netdev@vger.kernel.org Cc: Pantelis Koukousoulas Subject: [PATCH] Make virtio_net report carrier status ON. Date: Sat, 14 Mar 2009 12:40:49 +0200 Message-Id: <1237027249-10512-1-git-send-email-pktoss@gmail.com> X-Mailer: git-send-email 1.5.6.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The current versions of virtio hardware do not have a way to turn the link "OFF", so in practice, the status is always ON. Reporting that via ethtool instead of claiming "I have no idea", allows NetworkManager to configure the card automatically as preferred and gives users e.g., testing a new livecd in existing qemu/kvm the experience they expect. Note that for the next versions of the kernel and virtual hardware, there is a patch that adds proper link detection to the driver (since it will now be possible to turn it off). But even in the light of this, my patch is still valid because the "default ON" behavior will still be needed for current qemu / virtio versions that don't support this feature (VIRTIO_NET_F_STATUS). Signed-off-by: Pantelis Koukousoulas --- drivers/net/virtio_net.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index c688083..e67d16c 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -612,6 +612,7 @@ static struct ethtool_ops virtnet_ethtool_ops = { .set_tx_csum = virtnet_set_tx_csum, .set_sg = ethtool_op_set_sg, .set_tso = ethtool_op_set_tso, + .get_link = ethtool_op_get_link, }; #define MIN_MTU 68 @@ -739,6 +740,8 @@ static int virtnet_probe(struct virtio_device *vdev) goto unregister; } + netif_carrier_on(dev); + pr_debug("virtnet: registered device %s\n", dev->name); return 0;