Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp628732ybb; Wed, 1 Apr 2020 06:53:59 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv5kX5otgGDX4WLybI4273h2EcY2rfkMpOCYzh64bOZQV1aCjaDh/c0y/T7To/ZRFKvwipU X-Received: by 2002:a9d:6e8f:: with SMTP id a15mr13053468otr.188.1585749239544; Wed, 01 Apr 2020 06:53:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585749239; cv=none; d=google.com; s=arc-20160816; b=aG22BYGoyv13Tr1rxEvY0OA7IiQxxRdz44Jwx1A7vgKBYQc8tGbkm9XB4oTI7x6twX xM9RwpJMw3CIMxDr+noCyqdMYxZKJ/GILcLGd6fRNt1ch+5yF76sfeVBiBHV0WbXii7M YhsjaV/FkctLvovF0+CD68OQwRabwQWhU5tJNRVNokqqGsfmCRgp/zQZ6YgfGgAu0nsH psL7yDDjb7lFm98Q6yTToIU7HFPO66POzFMIKgp2y4uQHwBTW9FFCj/AvpK4F7qc6PC3 rrZf+gF7IoLz9n+rhMI8K9UQ2OCBSv/RoUN/W2NMJqVcBv9g7iBgBO6gr7tXKteVSyfs 6Igw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=BsnKKCm/0xhUX9Eh0r+sJcFsnyafS56/e7BV12MesKg=; b=NING/q/yGiQth4Ou0uzYRr6fJBXXsCCGfIfigvAgcAqwU3naUinTqozT8MhAApYBM/ aKKWS23XNVre4G7Ee1SKu4QLT6uiOIIk2l9AAJV8gGQpYl0ZcvX1yeRqvkn+vwamnsji eGK0R9CYxm67kCziurwS2CtshnrmA17p1DC1OryDXe0p68YHmvjeR5wK3gmVgvSt2lnP sBQIJSw0M3+/WglbT+ArgUh6Fns8XH6thLlz5BdomEv0E3/bhb0NXlQSGRuTDDu+vhMU kzvuATc4bvZk1RY8dLBx9TA6lbfuUQjYMzEnYOLHxuj1mFfrMkiTsxcQyvaB84pqlNn2 Nh3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b="qa/VcPdr"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4si907154ood.77.2020.04.01.06.53.46; Wed, 01 Apr 2020 06:53:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b="qa/VcPdr"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732784AbgDANvs (ORCPT + 99 others); Wed, 1 Apr 2020 09:51:48 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:43064 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732705AbgDANvs (ORCPT ); Wed, 1 Apr 2020 09:51:48 -0400 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=BsnKKCm/0xhUX9Eh0r+sJcFsnyafS56/e7BV12MesKg=; b=qa/VcPdrBtpGUMbaqANfWFh9+W TP8qKQ3TYfGL8IXRLr3FchAEU2Azq8RAv55NSYoN8MxvVE2aeVkcSYIL7z6FPBhfIfIqpImHfzGVk +LF2NCoRc3+cUPjGCRZul8yh3r+BWj2M5OtAMdghdk/XxmBjQPurVS8ts1uwGAGlbblc=; Received: from andrew by vps0.lunn.ch with local (Exim 4.93) (envelope-from ) id 1jJdmJ-000Qgk-52; Wed, 01 Apr 2020 15:51:35 +0200 Date: Wed, 1 Apr 2020 15:51:35 +0200 From: Andrew Lunn To: Florinel Iordache Cc: "davem@davemloft.net" , "netdev@vger.kernel.org" , "f.fainelli@gmail.com" , "hkallweit1@gmail.com" , "linux@armlinux.org.uk" , "devicetree@vger.kernel.org" , "linux-doc@vger.kernel.org" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "kuba@kernel.org" , "corbet@lwn.net" , "shawnguo@kernel.org" , Leo Li , "Madalin Bucur (OSS)" , Ioana Ciornei , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH net-next 6/9] net: phy: add backplane kr driver support Message-ID: <20200401135135.GA62290@lunn.ch> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 01, 2020 at 01:35:36PM +0000, Florinel Iordache wrote: > > On Thu, Mar 26, 2020 at 03:51:19PM +0200, Florinel Iordache wrote: > > > +static void setup_supported_linkmode(struct phy_device *bpphy) { > > > + struct backplane_phy_info *bp_phy = bpphy->priv; > > > > I'm not sure it is a good idea to completely take over phydev->priv like this, in > > what is just helper code. What if the PHY driver needs memory of its own? There > > are a few examples of this already in other PHY drivers. Could a KR PHY contain > > a temperature sensor? Could it contain statistics counters which need > > accumulating? > > > > Andrew > > Backplane KR driver allocates memory for structure backplane_phy_info > which is saved in phydev->priv. After all this is the purpose of priv > according to its description in phy.h: < by PHYs to maintain extra state>>. Here the priv is used to maintain > extra state needed for backplane. This way the backplane specific data > becomes available for all PHY callbacks (defined in struct phy_driver) > that receive a pointer to phy_device structure. This initial version > doesn't include accumulating statistics counters but we have in plan > to add these in future versions. The counters will be kept in specific > structures as members of the main backplane data mentioned above > and entire support will be integrated with ethtool. Hi Florinel And what about hwmon, or anything else which a driver needs memory for? As far as i see it, we have two bodies of code here. There is a set of helpers which implement most of the backplane functionality. And then there is an example driver for your hardware. In the future we expect other drivers to be added for other vendors hardware. phydev->priv is for the driver. helpers should not assume they have complete control over it. Anyway, this may be a mute point. Lets first solve the problem of how a PCS is represented. Andrew