From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D4E9C43331 for ; Sun, 10 Nov 2019 18:50:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 47C8A20842 for ; Sun, 10 Nov 2019 18:50:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="gGLx3nLV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726950AbfKJSuy (ORCPT ); Sun, 10 Nov 2019 13:50:54 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:59358 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726778AbfKJSuy (ORCPT ); Sun, 10 Nov 2019 13:50:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=/y8k2c28+hL2dCV63JWWk4z9hfYxN2UUeOgQM9eFPkk=; b=gGLx3nLVOYgX2FC8XjiqaKjgeo iRZcutjpgDwD9pmcuf5fU9K42p5qHd9uNp82yXqfL8h0eT9k4cLRKAm0awPHZGxApyF4JNoijMM0N gmZl6kNccMzT5v69JcRl8VWZ1LMSCspi/vj3C1pHkREzJCMGh6A2OM54DJ+8wRISAk5U=; Received: from andrew by vps0.lunn.ch with local (Exim 4.92.2) (envelope-from ) id 1iTsIS-0007OE-JZ; Sun, 10 Nov 2019 19:50:48 +0100 Date: Sun, 10 Nov 2019 19:50:48 +0100 From: Andrew Lunn To: Nicholas Johnson Cc: Florian Fainelli , "netdev@vger.kernel.org" , Andy Gospodarek , "David S. Miller" Subject: Re: Possibility of me mainlining Tehuti Networks 10GbE driver Message-ID: <20191110185048.GV25889@lunn.ch> References: <6fc9c7ef-0f6c-01e0-132b-74a80711788e@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > Could I please have more information / reading resources on the PHY > business? My understanding is that the NIC firmware would be dealing > with the PHY (this is the MII, right?) and the OS would have nothing to > do with it (it just sees a NIC which processes packets). There are two different strategies boards can use: 1) The MAC firmware handles the PHY, and the firmware has all the PHY drivers needed. 2) Linux handles the PHY, and uses drivers from drivers/net/phy. The MAC driver then needs to export an MDIO bus, and use either phylink or phylib. > Above you mentioned mii_bus for PHYs, but a driver like Aquantia > Atlantic does not have references to PHYs or MII. Why do some not need > the feature when others do? The Aquantia MAC driver uses the firmware strategy. The PHY is completely hidden from Linux with the firmware running on the MAC handling the PHY. But say look at the Marvell MAC drivers. They expose an MDIO bus, and linux then drives the PHY. The MAC driver then uses the phylink_ API to interact with the PHY via the phylink core code. I also had a quick look at the code. It has the basic code you need to export an MDIO bus, and let Linux control the PHYs. bdx_mdio_read() and bdx_mdio_write() would become the two functions you need for struct mii_bus, and then pass it to mdiobus_register(). You would then need to add phylink calls in the write place in the MAC driver. If you think writing a new driver is too much work for you, then going via staging is probably the better idea. You can slowly working on improving the driver. One of the big chunks of work is going to be swapping to the kernel PHY drivers, using PHYLINK, etc. And to do that, you really do need to have hardware. You don't need all the different variants the driver supports, but you should at least have one. And i would suggest you get hardware which uses either the Marvell or Aquantia PHY. Andrew