Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp518455ybb; Thu, 28 Mar 2019 07:05:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLs6eeHhKZfx+6FMJs5w3bJpw8olZMPJ0fP4XOvg94cE4Q6GLvfhGZnRuOIBhQ8fJDU4cf X-Received: by 2002:aa7:9090:: with SMTP id i16mr40049552pfa.85.1553781942966; Thu, 28 Mar 2019 07:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553781942; cv=none; d=google.com; s=arc-20160816; b=o4qspjhMuQaUm8fLZ1BMHYnoqeKBNhs/zBDBOWrCHoZLI2cwQcda1LrmkRSvziCUt7 M2Q4J9xjNkRojlLCLJ6WHcYBAWL6y+nEhDMsvesqa5244t4ljFC/Orlf6kEnWl3/KbVn zvLWZ4bNQGDuRALisuLKAZ3/dWDsPNOu1EhVe9tbuzNWnjk7rNjFP+6wTcclkk4YnJtd AcgkLSHVPqPfyc7eXtqyn02EJN1vFkXSVlKiEEr7VBxe5pppZmz/H1kXtNDaQmUeBtER rDzPhNqmrmK9Ph2CT6d5MQx4cqWbMOJq04MNJmjheEhfqg9Hmzzii7P3XZPfEghV83Kg duag== 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=8AhNaFFfJqkutIVtZtbwVmp11Sd12UXihdIwaMDzLLM=; b=ya1n4+RPT4fQ8L6vsgkPY529aTIRfHicibGOMxCW/IMXFm3W+AToi2ad06Re0erG5I 8ybYTxFUWU06iP3d8XD8Awo292HJHSEA6zbTMpB/qJsbI6EpFYKuq1GtyQ0u9lWz2q03 nn46KCfPDIgpY22FAcBnsZBqr9URz4V08F7TWksB33AZc66d1xI7dtpieCD8WuBhXRnM 1vHHUTbMsloTjD/eWTSoztjvQ1hd2PiIB4wRNOwBstajZ7MRskOaA8mxfdstD2WFSe1C sYqnMHsVdnoTfOu3jTF9zpkgU2ayVDRVCsqv6CuPldk13YRHu1nta0dB6u5TtO8tljqq PK/g== ARC-Authentication-Results: i=1; mx.google.com; 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 t66si20993993pfb.178.2019.03.28.07.05.25; Thu, 28 Mar 2019 07:05:42 -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; 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 S1726439AbfC1OEd (ORCPT + 99 others); Thu, 28 Mar 2019 10:04:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:37044 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725875AbfC1OEc (ORCPT ); Thu, 28 Mar 2019 10:04:32 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 31793AFB8; Thu, 28 Mar 2019 14:04:31 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 0C9BDE1404; Thu, 28 Mar 2019 15:04:28 +0100 (CET) Date: Thu, 28 Mar 2019 15:04:28 +0100 From: Michal Kubecek To: Jiri Pirko Cc: Florian Fainelli , David Miller , netdev@vger.kernel.org, Jakub Kicinski , Andrew Lunn , John Linville , Stephen Hemminger , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v5 12/22] ethtool: provide string sets with GET_STRSET request Message-ID: <20190328140428.GG26076@unicorn.suse.cz> References: <2c29310b-a2a0-3867-a09f-51f2dc47ecd3@gmail.com> <20190328071853.GY26076@unicorn.suse.cz> <20190328134313.GO14297@nanopsycho> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190328134313.GO14297@nanopsycho> 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, Mar 28, 2019 at 02:43:13PM +0100, Jiri Pirko wrote: > > I don't like this. This should not be bitfield/set. This should be > simply nested array of enum values: > > enum ethtool_link_mode { > ETHTOOL_LINK_MODE_10baseT_Half, > ETHTOOL_LINK_MODE_10baseT_Full, > ETHTOOL_LINK_MODE_100baseT_Half, > ETHTOOL_LINK_MODE_100baseT_Full, > ETHTOOL_LINK_MODE_1000baseT_Full, > }; We already have such enum. The problem with your "no string" approach is that it requires all userspace applications to (1) keep this enum in sync with kernel and (2) maintain their our tables of names. Experience shows we are not very good and satisfying these conditions even for the one which should be best at keeping up. > and then there should be 2 attrs: > ETHTOOL_A_LINK_MODE_LIST_OUR /* nest */ > ETHTOOL_A_LINK_MODE_LIST_PEER /* nest */ > ETHTOOL_A_LINK_MODE /* u32 */ > > and then the message should look like: > > ETHTOOL_A_LINK_MODE_LIST_OUR start nest > ETHTOOL_A_LINK_MODE = ETHTOOL_LINK_MODE_10baseT_Half > ETHTOOL_A_LINK_MODE = ETHTOOL_LINK_MODE_10baseT_Full > ETHTOOL_A_LINK_MODE = ETHTOOL_LINK_MODE_100baseT_Half > ETHTOOL_A_LINK_MODE = ETHTOOL_LINK_MODE_100baseT_Full > ETHTOOL_A_LINK_MODE = ETHTOOL_LINK_MODE_1000baseT_Full > ETHTOOL_A_LINK_MODE_LIST_OUR end nest > ETHTOOL_A_LINK_MODE_LIST_PEER start nest > ETHTOOL_A_LINK_MODE = ETHTOOL_LINK_MODE_10baseT_Half > ETHTOOL_A_LINK_MODE = ETHTOOL_LINK_MODE_10baseT_Full > ETHTOOL_A_LINK_MODE = ETHTOOL_LINK_MODE_100baseT_Half > ETHTOOL_A_LINK_MODE = ETHTOOL_LINK_MODE_100baseT_Full > ETHTOOL_A_LINK_MODE = ETHTOOL_LINK_MODE_1000baseT_Full > ETHTOOL_A_LINK_MODE_LIST_PEER end nest > > Nice and simple. No bits, no strings. A bit too simple, actually. You would need third nest to distinguish supported and advertised modes. And for setting, you would also need two arrays if you want to set only some of the modes (unless you introduce something that would be similar to mine except for omitting the names). More important: you still didn't explain how is your "no strings" approach supposed to work for bit sets where userspace cannot possibly know the set of available flags (e.g. the private flags). Michal