Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753893AbdFMUsI convert rfc822-to-8bit (ORCPT ); Tue, 13 Jun 2017 16:48:08 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:8278 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753311AbdFMUsG (ORCPT ); Tue, 13 Jun 2017 16:48:06 -0400 From: Salil Mehta To: Andrew Lunn , Florian Fainelli CC: "davem@davemloft.net" , "Zhuangyuzeng (Yisen)" , huangdaode , "lipeng (Y)" , "mehta.salil.lnk@gmail.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Linuxarm Subject: RE: [PATCH net-next 6/9] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Thread-Topic: [PATCH net-next 6/9] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Thread-Index: AQHS4ZxgU7WX1+yFm0OA+cc1rCELGqIeU/MAgACAPgCABHRdMA== Date: Tue, 13 Jun 2017 20:47:50 +0000 Message-ID: References: <20170610034630.493852-1-salil.mehta@huawei.com> <20170610034630.493852-7-salil.mehta@huawei.com> <20170611024314.GD26740@lunn.ch> In-Reply-To: <20170611024314.GD26740@lunn.ch> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.203.181.160] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090202.59404F82.000A,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=169.254.1.104, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 8906d6c919d986b79f07e113d02aa4f6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1673 Lines: 49 Hi Andrew, > -----Original Message----- > From: Andrew Lunn [mailto:andrew@lunn.ch] > Sent: Sunday, June 11, 2017 3:43 AM > To: Florian Fainelli > Cc: Salil Mehta; davem@davemloft.net; Zhuangyuzeng (Yisen); huangdaode; > lipeng (Y); mehta.salil.lnk@gmail.com; netdev@vger.kernel.org; linux- > kernel@vger.kernel.org; Linuxarm > Subject: Re: [PATCH net-next 6/9] net: hns3: Add MDIO support to HNS3 > Ethernet driver for hip08 SoC > > > > +int hclge_mac_mdio_config(struct hclge_dev *hdev) > > > +{ > > > + struct hclge_mac *mac = &hdev->hw.mac; > > > + struct mii_bus *mdio_bus; > > > + struct net_device *ndev = &mac->ndev; > > > + struct phy_device *phy; > > > + bool is_c45; > > > + int ret; > > > + > > > + if (hdev->hw.mac.phy_addr >= PHY_MAX_ADDR) > > > + return 0; > > > + > > > + if (hdev->hw.mac.phy_if == PHY_INTERFACE_MODE_NA) > > > + return 0; > > > + else if (mac->phy_if == PHY_INTERFACE_MODE_SGMII) > > > + is_c45 = 0; > > > + else if (mac->phy_if == PHY_INTERFACE_MODE_XGMII) > > > + is_c45 = 1; > > > + else > > > + return -ENODATA; > > > > Can you consider using a switch () case statement here? > > Does this concept even make sense? The Marvell 10G phy will use SGMII > for 10/100/1000Mbs and swap to XGMII for 10Gbps. It however stays a > c45 device all the time. > > In general, i don't think PHY mode is related to C22/C45. You are correct is_c45 should not be derived from the type of PHY like it is being done here. I have changed this code and now we are getting this information from the IMP(Integrated Management Processor) which handles the NIC commands and also maintains Ethernet specific configuration. Thanks Salil > > Andrew