From: Klaus Kudielka Subject: Re: [RFC] phylink: support for devices with MAC sharing SFP cage & PHY (e.g. Turris Omnia) Date: Fri, 4 Jan 2019 07:26:19 +0100 Message-ID: <90ce74ef-446c-9efd-7be4-43d180ceef85@gmail.com> References: <97244846-c507-113b-3353-dddc6a50d72b@gmail.com> <20181230095105.GA24825@lunn.ch> <62ef7a14-69ad-d517-b10b-dacabf9188d9@gmail.com> <20181231174306.GC3239@lunn.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, Florian Fainelli , Heiner Kallweit , Russell King , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Tomas Hlavacek To: Andrew Lunn Return-path: Received: from mail-ed1-f51.google.com ([209.85.208.51]:47075 "EHLO mail-ed1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726718AbfADG0W (ORCPT ); Fri, 4 Jan 2019 01:26:22 -0500 Received: by mail-ed1-f51.google.com with SMTP id o10so30837839edt.13 for ; Thu, 03 Jan 2019 22:26:21 -0800 (PST) In-Reply-To: <20181231174306.GC3239@lunn.ch> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 31.12.18 18:43, Andrew Lunn wrote: > > The Marvell documentation is not public. I would have to check, but > i think there is a bit which tells you. But as Florian pointed out, > this can be indirectly controlled from software, in that a PHY which > is configured down will never get link, in the same way an SFP with > its receiver disabled will never get link. So software to enable one > or the other would work. > >> Such a "generic" solution would be restricted (per MAC) to a >> maximum of one SFP (fiber or copper), and one separate PHY, right? >> The main difference between boards would be the switching logic. > > Yes, that seems a sensible restriction. > I might be able come up with a re-work of phylink.c, such that it can manage two independent link configurations, and reconfigure the MAC upon a switch. The actual switching would be modeled in the various existing callbacks, based on a board-specific recipe (for the moment sfp-module-present or first-link). ethtool will probably just see the "active" link (i.e. the PHY/SFP connected to the MAC). As far as I can see, this would make both the Omnia SFP and the Marvell switches work as they were designed, without any interface change. Additional userspace-driven control could be added at a later time, if it turns out to be necessary.