From patchwork Wed Nov 17 23:29:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Brandeburg X-Patchwork-Id: 71639 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 1E057B85E4 for ; Thu, 18 Nov 2010 10:30:08 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751535Ab0KQX33 (ORCPT ); Wed, 17 Nov 2010 18:29:29 -0500 Received: from mga09.intel.com ([134.134.136.24]:55694 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751373Ab0KQX30 (ORCPT ); Wed, 17 Nov 2010 18:29:26 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 17 Nov 2010 15:29:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.59,213,1288594800"; d="scan'208";a="678541927" Received: from jbrandeb-ich9b.jf.intel.com ([134.134.3.214]) by orsmga001.jf.intel.com with ESMTP; 17 Nov 2010 15:29:16 -0800 Received: from jbrandeb-ich9b.jf.intel.com (localhost.localdomain [127.0.0.1]) by jbrandeb-ich9b.jf.intel.com (8.14.4/8.14.4) with ESMTP id oAHNTGu9003574 for ; Wed, 17 Nov 2010 15:29:16 -0800 From: Jesse Brandeburg Subject: [RFC PATCH 2/3] igb: update to allow reading/setting mdix To: netdev@vger.kernel.org Date: Wed, 17 Nov 2010 15:29:16 -0800 Message-ID: <20101117232915.3513.29988.stgit@jbrandeb-ich9b.jf.intel.com> In-Reply-To: <20101117232645.3513.20655.stgit@jbrandeb-ich9b.jf.intel.com> References: <20101117232645.3513.20655.stgit@jbrandeb-ich9b.jf.intel.com> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Jesse Brandeburg CC: Carolyn Wyborny --- drivers/net/igb/igb.h | 1 - drivers/net/igb/igb_ethtool.c | 14 ++++++++++++++ drivers/net/igb/igb_main.c | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h index edab9c4..04f7a05 100644 --- a/drivers/net/igb/igb.h +++ b/drivers/net/igb/igb.h @@ -120,7 +120,6 @@ struct vf_data_storage { /* How many Rx Buffers do we bundle into one write to the hardware ? */ #define IGB_RX_BUFFER_WRITE 16 /* Must be power of 2 */ -#define AUTO_ALL_MODES 0 #define IGB_EEPROM_APME 0x0400 #ifndef IGB_MASTER_SLAVE diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c index a70e16b..bfeee01 100644 --- a/drivers/net/igb/igb_ethtool.c +++ b/drivers/net/igb/igb_ethtool.c @@ -191,6 +191,15 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) } ecmd->autoneg = hw->mac.autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE; + + /* MDI-X => 2; MDI =>1; Invalid =>0 */ + if ((hw->phy.media_type == e1000_media_type_copper) && + netif_carrier_ok(netdev)) + ecmd->eth_tp_mdix = hw->phy.is_mdix ? ETH_TP_MDI_X : + ETH_TP_MDI; + else + ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID; + return 0; } @@ -225,6 +234,11 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) } } + /* MDI-X => 2; MDI =>1; Auto =>0 */ + if ((ecmd->eth_tp_mdix != -1) && + (hw->phy.media_type == e1000_media_type_copper)) + hw->phy.mdix = ecmd->eth_tp_mdix; + /* reset the link */ if (netif_running(adapter->netdev)) { igb_down(adapter); diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 892d196..338825f 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c @@ -1838,7 +1838,7 @@ static int __devinit igb_probe(struct pci_dev *pdev, /* Copper options */ if (hw->phy.media_type == e1000_media_type_copper) { - hw->phy.mdix = AUTO_ALL_MODES; + hw->phy.mdix = ETH_TP_MDI_INVALID; hw->phy.disable_polarity_correction = false; hw->phy.ms_type = e1000_ms_hw_default; }