Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1778930ybz; Thu, 30 Apr 2020 05:27:47 -0700 (PDT) X-Google-Smtp-Source: APiQypKyc4pD+EFx9mMs+eEeke8IKjkvTxrMzkCwZWuHgJrIh9N2jzjDnkvugfuOMohgWrkXUukh X-Received: by 2002:aa7:c0d1:: with SMTP id j17mr2445476edp.308.1588249667110; Thu, 30 Apr 2020 05:27:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588249667; cv=none; d=google.com; s=arc-20160816; b=u+1ieoGnVyiWmt2I8MMYt3vr40J28pdwWy3EsPZ6N7gMxmPCJI5sHH5IGujGv5Y9AZ JtC+/dFFnX8RT6xz5SEdYlrg0E3hPWlB4zCuVhR15VcByfhol9hfpYgQiv79Wp9ebUyS PRP9Nxyybo1hvBUlkDorpGzH17iUZwi0b3/PNLG/EKzbY6qaCTitIiRCz87hoHy9r/bQ I5h3jercc0nTZSdK/Ctyoan+1fNCCzgtjyUtBNLtAYA/rpsrtvzb6EojT/Ii27D1w2jm ydnYRoB+2wTAI9esyUdeNuuhCFChShZ8Of5zfYdXxPZTFzBsGlOaY8VB8aNKOBFMhszx QKkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=qPKGkl/uTm+iT3v4Y+w4rmEHIgsTI2gnJzCC/MQzTc4=; b=PnUPHVBG1NiS2hZ37LyzJSJdxuxldV3haOfwnQbDhd3V9YPR2bsuK/BmAmewYjxfCL cmRcdgVg9fkPAvNKGB0bcFgdYZF3oxL6X9mEonEqRsmgtDnL5zfh5E/nM02As/KTW+Pt 3w1IB7Yls3G/YedVLfZWEKuYyE4zbGQbhYD4Oz9m9aFNREssH6T2gWEXIOm5wvg/ptiE QL/z41NN1MShShXAbFxePj0kQQynvaoIc6pzRiiKSu5zuy0P+BOFHkJufZNGZliQtkRR oeq80sai/zPTmAjShOFWtd5HPar/NgGYaJiu2A6fuHgif61p3HL1WScf372kgkXLukhN hLVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o3si6455175edb.156.2020.04.30.05.27.22; Thu, 30 Apr 2020 05:27:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726684AbgD3MZz (ORCPT + 99 others); Thu, 30 Apr 2020 08:25:55 -0400 Received: from mx2.suse.de ([195.135.220.15]:33934 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725280AbgD3MZz (ORCPT ); Thu, 30 Apr 2020 08:25:55 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4ED94AB3D; Thu, 30 Apr 2020 12:25:52 +0000 (UTC) Received: by lion.mk-sys.cz (Postfix, from userid 1000) id B49F960341; Thu, 30 Apr 2020 14:25:51 +0200 (CEST) Date: Thu, 30 Apr 2020 14:25:51 +0200 From: Michal Kubecek To: Oleksij Rempel Cc: Marek Vasut , Andrew Lunn , Florian Fainelli , Jonathan Corbet , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Russell King , mkl@pengutronix.de, kernel@pengutronix.de, David Jander , Jakub Kicinski , Christian Herber , "David S. Miller" , Heiner Kallweit Subject: Re: [PATCH net-next v3 1/2] ethtool: provide UAPI for PHY master/slave configuration. Message-ID: <20200430122551.GB8934@lion.mk-sys.cz> References: <20200428075308.2938-1-o.rempel@pengutronix.de> <20200428075308.2938-2-o.rempel@pengutronix.de> <20200429195222.GA17581@lion.mk-sys.cz> <20200430050058.cetxv76pyboanbkz@pengutronix.de> <20200430082020.GC17581@lion.mk-sys.cz> <20200430120945.GA7370@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200430120945.GA7370@pengutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 30, 2020 at 02:09:45PM +0200, Oleksij Rempel wrote: > > > > > @@ -119,7 +123,12 @@ static int linkmodes_fill_reply(struct sk_buff *skb, > > > > > } > > > > > > > > > > if (nla_put_u32(skb, ETHTOOL_A_LINKMODES_SPEED, lsettings->speed) || > > > > > - nla_put_u8(skb, ETHTOOL_A_LINKMODES_DUPLEX, lsettings->duplex)) > > > > > + nla_put_u8(skb, ETHTOOL_A_LINKMODES_DUPLEX, lsettings->duplex) || > > > > > + nla_put_u8(skb, ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG, > > > > > + lsettings->master_slave_cfg) || > > > > > + nla_put_u8(skb, ETHTOOL_A_LINKMODES_MASTER_SLAVE_STATE, > > > > > + lsettings->master_slave_state)) > > > > > + > > > > > return -EMSGSIZE; > > > > > > > > From the two handlers you introduced, it seems we only get CFG_UNKNOWN > > > > or STATE_UNKNOWN if driver or device does not support the feature at all > > > > so it would be IMHO more appropriate to omit the attribute in such case. > > > > > > STATE_UNKNOWN is returned if link is not active. > > > > How about distinguishing the two cases then? Omitting both if CFG is > > CFG_UNKNOWN (i.e. driver does not support the feature) and sending > > STATE=STATE_UNKNOWN to userspace only if we know it's a meaningful value > > actually reported by the driver? > > Hm... after thinking about it, we should keep state and config > separately. The TJA1102 PHY do not provide actual state. Even no error > related to Master/Master conflict. I reworked the code to have > unsupported and unknown values. In case we know, that state or config > is not supported, it will not be exported to the user space. Sounds good to me, splitting "unsupported" and "unknown" states will be probably the best option. Michal