Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp681651rwa; Sat, 20 Aug 2022 11:41:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR6szImqyAav9Recfj0k9K9H6nCeoRk7snrf3XOamnCKn0tBIrjJxXVnPbSpf5V1BiqwpdNr X-Received: by 2002:a17:902:c40a:b0:16e:cc02:b9ab with SMTP id k10-20020a170902c40a00b0016ecc02b9abmr12886451plk.81.1661020863901; Sat, 20 Aug 2022 11:41:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661020863; cv=none; d=google.com; s=arc-20160816; b=o3oMOOf2SRgkj43ajevYd/BT42uT3xo8UvP+phpplIenj321/YzkRZyUMBcVN+mIS1 DbEDnuDPGRuLiTozbPYWOmB7PGhcPC78GfV7+lc5N4bo8W1arrBN77z0SRkfZHk1seu3 4c13WSkHo2TIQZVPuFdvGCJtp8+jfueR1vpr1rvHoX+0b9PL/S6xJsjGPkdQP7zJJk+M yPIdyjkABQLcz12Me2MFk9kQnHBHQyjZ+UpMc1d8qL4OrLnTXbQ+w0MTsM95b1Y2N3Ux OCuEOd78z5sWfmS1mnRra0w4OAH1UspBVlfqD9h+HqSXhyYf45N2QXyUh95fAiPa9gpP Ueug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=t0pyLnK8OrpfhUWATUbAE+IWUhh8PnntBsAGRXSYTts=; b=gDPpWRksRuYkb4rejmoyg+ORFxyg4l/XSU4Ye7M9g5VhkXtCPQaRXozEvxCoKNkD04 d6SuFrRBh8IihRWYvaTIMBd7E+n81VHJteoeTOyIqEFL1JXa9LFQDv0D9IKcuEQ5o/9D CHQiuK/55Kmt6dpzEDNz5KNiHlJAXO+uJd7cBhb4eztWnAqY4rTpRMmQ6jpmqmQ+mswU awkEUUxlh6Lw0JG/aIQu0vr9yfHxTeEFG53JIWpIENH5X5ByKW+dSe9gIfSUbvCZWbgN 5Jw/bjY7lnOdfrucoYpri3Cf7IFr0gEmwsYma0zKB9qEqiF7/tN+JFMNWFr+ZPnVPi0R BJyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=IhbwOvYc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o8-20020a656148000000b0041cd5c02963si7803259pgv.334.2022.08.20.11.40.52; Sat, 20 Aug 2022 11:41:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=IhbwOvYc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232716AbiHTSRL (ORCPT + 99 others); Sat, 20 Aug 2022 14:17:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231671AbiHTSQm (ORCPT ); Sat, 20 Aug 2022 14:16:42 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69EF017071; Sat, 20 Aug 2022 11:16:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=t0pyLnK8OrpfhUWATUbAE+IWUhh8PnntBsAGRXSYTts=; b=IhbwOvYcpUK7EBUTNf020L0ywn KVC7WewJWw/Euj8lPlka2wIdLliFsuH3Qf3eMjYcLmYjSJvqacfqOV+4xulGbljEViFxivPWITHti i+2jVOYLuWoNriMiI32kVue9YpeQ4Vm2ptXTtuEHZwpXhwMGX6pMqSvKq4ScuGNXiF4c=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1oPT18-00E3jH-DP; Sat, 20 Aug 2022 20:16:18 +0200 Date: Sat, 20 Aug 2022 20:16:18 +0200 From: Andrew Lunn To: Oleksij Rempel Cc: Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, David Jander Subject: Re: [PATCH net-next v1 7/7] ethtool: add interface to interact with Ethernet Power Equipment Message-ID: References: <20220819120109.3857571-1-o.rempel@pengutronix.de> <20220819120109.3857571-8-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220819120109.3857571-8-o.rempel@pengutronix.de> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 19, 2022 at 02:01:09PM +0200, Oleksij Rempel wrote: > Add interface to support Power Sourcing Equipment. At current step it > provides generic way to address all variants of PSE devices as defined > in IEEE 802.3-2018 but support only objects specified for IEEE 802.3-2018 104.4 > PoDL Power Sourcing Equipment (PSE). > > Currently supported and mandatory objects are: > IEEE 802.3-2018 30.15.1.1.3 aPoDLPSEPowerDetectionStatus > IEEE 802.3-2018 30.15.1.1.2 aPoDLPSEAdminState > IEEE 802.3-2018 30.15.1.2.1 acPoDLPSEAdminControl > > This is minimal interface needed to control PSE on each separate > ethernet port but it provides not all mandatory objects specified in > IEEE 802.3-2018. > +static int pse_get_pse_attributs(struct net_device *dev, > + struct pse_reply_data *data) > +{ > + struct phy_device *phydev = dev->phydev; > + int ret; > + > + if (!phydev) > + return -EOPNOTSUPP; > + > + mutex_lock(&phydev->lock); > + if (!phydev->psec) { > + ret = -EOPNOTSUPP; > + goto error_unlock; > + } > + > + ret = pse_podl_get_admin_sate(phydev->psec); > + if (ret < 0) > + goto error_unlock; > + > + data->podl_pse_admin_state = ret; > + > + ret = pse_podl_get_pw_d_status(phydev->psec); > + if (ret < 0) > + goto error_unlock; > + > + data->podl_pse_pw_d_status = ret; I'm wondering how this is going to scale. At some point, i expect there will be an implementation that follows C45.2.9. I see 14 values which could be returned. I don't think 14 ops in the driver structure makes sense. Plus c30.15.1 defines other values. The nice thing about netlink is you can have as many or are little attributes in the message as you want. For cable testing, i made use of this. There is no standardisation, different PHYs offer different sorts of results. So i made the API flexible. The PHY puts whatever results it has into the message, and ethtool(1) just walks the message and prints what is in it. I'm wondering if we want a similar sort of API here? net/ethtool/pse-pd.c allocates the netlink messages, adds the header, and then passes it to the driver. The driver then uses helpers from ethtool to add whatever attributes it wants to the message. pse-pd then completes the message, and returns it to user space? This seems like it will scale better. Andrew