From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id D1FA8C3D6 for ; Mon, 4 May 2015 10:56:12 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 04 May 2015 01:56:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,365,1427785200"; d="scan'208";a="704790354" Received: from pgsmsx106.gar.corp.intel.com ([10.221.44.98]) by fmsmga001.fm.intel.com with ESMTP; 04 May 2015 01:56:11 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by PGSMSX106.gar.corp.intel.com (10.221.44.98) with Microsoft SMTP Server (TLS) id 14.3.224.2; Mon, 4 May 2015 16:55:51 +0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.162]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.69]) with mapi id 14.03.0224.002; Mon, 4 May 2015 16:55:49 +0800 From: "Zhang, Helin" To: Shelton Chia , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] kni: fix igb and ixgbe kni ethtool get_link op Thread-Index: AQHQbiGVRRj7ua0x3EmGiL8L6n9w4p1rsvnA Date: Mon, 4 May 2015 08:55:49 +0000 Message-ID: References: <1428074329-20469-1-git-send-email-jiaxt@sinogrid.com> In-Reply-To: <1428074329-20469-1-git-send-email-jiaxt@sinogrid.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] kni: fix igb and ixgbe kni ethtool get_link op X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 May 2015 08:56:13 -0000 Hi Chia > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shelton Chia > Sent: Friday, April 3, 2015 11:19 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] kni: fix igb and ixgbe kni ethtool get_link o= p >=20 > igb and ixgbe's link detected always return yes, fix get_link func refer = to > get_settings, it works correctly for my i350 and 82599es nic. Could you help to add more detailed description of why we need these code c= hanges? Thanks! >=20 > Signed-off-by: Shelton Chia > --- > .../linuxapp/kni/ethtool/igb/igb_ethtool.c | 18 ++++++--------- > .../linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c | 26 > +++++++++++++++++++++- > 2 files changed, 32 insertions(+), 12 deletions(-) >=20 > diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c > b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c > index f3c48b2..5457f48 100644 > --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c > +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c > @@ -383,19 +383,15 @@ static int igb_set_settings(struct net_device > *netdev, struct ethtool_cmd *ecmd) static u32 igb_get_link(struct > net_device *netdev) { > struct igb_adapter *adapter =3D netdev_priv(netdev); > - struct e1000_mac_info *mac =3D &adapter->hw.mac; > + struct e1000_hw *hw =3D &adapter->hw; > + u32 status; >=20 > - /* > - * If the link is not reported up to netdev, interrupts are disabled, > - * and so the physical link state may have changed since we last > - * looked. Set get_link_status to make sure that the true link > - * state is interrogated, rather than pulling a cached and possibly > - * stale link state from the driver. > - */ > - if (!netif_carrier_ok(netdev)) > - mac->get_link_status =3D 1; > + status =3D E1000_READ_REG(hw, E1000_STATUS); Can ' check_for_link ' be used for checking the link here? It needs to supp= ort all possible link types. >=20 > - return igb_has_link(adapter); > + if (status & E1000_STATUS_LU) > + return 1; > + else > + return 0; > } >=20 > static void igb_get_pauseparam(struct net_device *netdev, diff --git > a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c > b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c > index 11472bd..184b14f 100644 > --- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c > +++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c > @@ -801,6 +801,30 @@ static void ixgbe_get_regs(struct net_device *netdev= , > struct ethtool_regs *regs, > regs_buff[1128] =3D IXGBE_READ_REG(hw, IXGBE_MFLCN); } >=20 > +static u32 ixgbe_get_link(struct net_device *netdev) { > + struct ixgbe_adapter *adapter =3D netdev_priv(netdev); > + struct ixgbe_hw *hw =3D &adapter->hw; > + u32 link_speed =3D 0; > + bool link_up; > + > + if (!in_interrupt()) { > + hw->mac.ops.check_link(hw, &link_speed, &link_up, false); As done in kernel driver function ' ixgbe_watchdog_update_link ()', more ch= ecks may be needed. Regards, Helin > + } else { > + /* > + * this case is a special workaround for RHEL5 bonding > + * that calls this routine from interrupt context > + */ > + link_speed =3D adapter->link_speed; > + link_up =3D adapter->link_up; > + } > + > + if (link_up) > + return 1; > + else > + return 0; > +} > + > static int ixgbe_get_eeprom_len(struct net_device *netdev) { > struct ixgbe_adapter *adapter =3D netdev_priv(netdev); @@ -2838,7 > +2862,7 @@ struct ethtool_ops ixgbe_ethtool_ops =3D { > .get_wol =3D ixgbe_get_wol, > .set_wol =3D ixgbe_set_wol, > .nway_reset =3D ixgbe_nway_reset, > - .get_link =3D ethtool_op_get_link, > + .get_link =3D ixgbe_get_link, > .get_eeprom_len =3D ixgbe_get_eeprom_len, > .get_eeprom =3D ixgbe_get_eeprom, > .set_eeprom =3D ixgbe_set_eeprom, > -- > 2.3.5