From patchwork Tue May 10 00:19:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: david decotigny X-Patchwork-Id: 94925 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.180.67]) by ozlabs.org (Postfix) with ESMTP id C0211B6F1C for ; Tue, 10 May 2011 10:24:43 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755952Ab1EJAYZ (ORCPT ); Mon, 9 May 2011 20:24:25 -0400 Received: from smtp-out.google.com ([74.125.121.67]:45595 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755936Ab1EJAYY (ORCPT ); Mon, 9 May 2011 20:24:24 -0400 Received: from hpaq7.eem.corp.google.com (hpaq7.eem.corp.google.com [172.25.149.7]) by smtp-out.google.com with ESMTP id p4A0JD69018692; Mon, 9 May 2011 17:19:13 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1304986753; bh=v3RYU99OXu5ZOJQTgTh3Kbw9MJI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=UvuNPosi28ZqZGZofEfDGLrtfSl4aETpxux8cMn10eN7m1guerZCRsyT+Fh13P84t +z+V+7Ivn6CxtMQQ72yDw== DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to: references:organization; b=WuyOn1qSMM4dNmxZyjFJxy1tpuV5B+DXt4QSut5dv4zFcOTh20eSFG/Ui7MspQ7rF LNiv6l8oxHSX99+tPpO1w== Received: from decotigny.mtv.corp.google.com (decotigny.mtv.corp.google.com [172.18.124.45]) by hpaq7.eem.corp.google.com with ESMTP id p4A0JAqN003563; Mon, 9 May 2011 17:19:11 -0700 Received: by decotigny.mtv.corp.google.com (Postfix, from userid 128857) id 918FA2183F; Mon, 9 May 2011 17:19:10 -0700 (PDT) From: David Decotigny To: Giuseppe Cavallaro , "David S. Miller" , Joe Perches , Stanislaw Gruszka , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: David Decotigny Subject: [PATCH 2/2] net/dl2k: Don't reconfigure link @100Mbps when disabling autoneg @1Gbps Date: Mon, 9 May 2011 17:19:08 -0700 Message-Id: <1304986748-15809-3-git-send-email-decot@google.com> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1304986748-15809-1-git-send-email-decot@google.com> References: <1304986748-15809-1-git-send-email-decot@google.com> Organization: Google, Inc. Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The initial version of the driver used to force the link to 100Mbps when auto-negociation was disabled on a 1Gbps link, ignoring the requested link speed. Instead, this change refuses to change anything when it is asked to configure the link speed at 1Gbps without auto-negociation, but acts as requested in all the other cases. IMPORTANT: Previously, the return value from mii_set_media() was ignored. This patch uses it for its own return value. Tested: module compiling, NOT tested on real hardware. Signed-off-by: David Decotigny --- drivers/net/dl2k.c | 19 ++++++------------- 1 files changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index c445457..1a4856b 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c @@ -1211,24 +1211,17 @@ static int rio_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) if (cmd->autoneg == AUTONEG_ENABLE) { if (np->an_enable) return 0; - else { - np->an_enable = 1; - mii_set_media(dev); - return 0; - } + + np->an_enable = 1; } else { - np->an_enable = 0; - if (np->speed == 1000) { - ethtool_cmd_speed_set(cmd, SPEED_100); - cmd->duplex = DUPLEX_FULL; - printk("Warning!! Can't disable Auto negotiation in 1000Mbps, change to Manual 100Mbps, Full duplex.\n"); - } switch (ethtool_cmd_speed(cmd)) { case SPEED_10: + np->an_enable = 0; np->speed = 10; np->full_duplex = (cmd->duplex == DUPLEX_FULL); break; case SPEED_100: + np->an_enable = 0; np->speed = 100; np->full_duplex = (cmd->duplex == DUPLEX_FULL); break; @@ -1236,9 +1229,9 @@ static int rio_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) default: return -EINVAL; } - mii_set_media(dev); } - return 0; + + return mii_set_media(dev); } static u32 rio_get_link(struct net_device *dev)