Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp18938img; Wed, 27 Mar 2019 15:57:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvGd7xstiDetL6cFhq0fwP0DwJrngpcYAukY9zaPC+79ZULb6pkd8lUvqpy4PUgIOX3d5W X-Received: by 2002:a62:52c3:: with SMTP id g186mr22965824pfb.173.1553727429252; Wed, 27 Mar 2019 15:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553727429; cv=none; d=google.com; s=arc-20160816; b=RO8Mpl+3F5hq8ZynxLxpO5QBrI/JledRX1DaOOtBQGO0L7bmnmMAqsVy1S9wxRzLs+ 0+LXgRoKPZyEoy1kFMTTKyztygWWM0besPwDmKiuwzEmf4FMB/HCcBDmSDH8dZw4Zmpo T/z/WBRQKlt+aQ0DpMagV8rqJJszwUDT1M1cAKoZG4qELhL+wvAM933/JyVk3MN2Mi0m /7m8BdrkzM0AHFHPIptJluiBeXPtQ7VDxB1tlfKEeNmSjFBFhDufD91QYL3AqEUu3wb1 ug8vZVuDPkcER7sIjQ/EDG83a8SK8e4B//KAgvcs+lePSwrNMEvKGuJ+m5J9p9Q/W6c6 zxnQ== 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=36/CtzhfdFC8ADP5Kr4tyYa5zFZYk/ZoNuqT1JTV/Sg=; b=DDo4idij4vF4RNvPAvIuYDveHTLatmOYe9HGbfjDg9qTZ53mJZSN6ZPSKB98ePjM5S zE9bPy7UA4qmaAH5GFdVtPcog5Bhu9STF2ZhtevYBaQCXRfn+B93XP4sj0xWc3f8vuy8 RU5N/PVAPH2FngHSGfgmLmm7PQ0QfFM99U+GwwlJlpAeH7BTwmAsImqF8abp61YATrKs 4MwrEPEwLMOl0pdzF4SjMCI49jpOrwnqa3Wkdgdd4QZwMPB87f3/6ypHiYIm5uotRv4n moo79/detfXcoqqCBIsVXtN/HKnwKlZYXmpmGjq+EdM2ucMPPoY8n1+W2Tz5eziRilK3 ACLg== 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 l192si19671104pfc.147.2019.03.27.15.56.53; Wed, 27 Mar 2019 15:57:09 -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 S1728458AbfC0W4N (ORCPT + 99 others); Wed, 27 Mar 2019 18:56:13 -0400 Received: from mx2.suse.de ([195.135.220.15]:37702 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726059AbfC0W4M (ORCPT ); Wed, 27 Mar 2019 18:56:12 -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 9F2C3ACCD; Wed, 27 Mar 2019 22:56:10 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 06E96E1404; Wed, 27 Mar 2019 23:56:08 +0100 (CET) Date: Wed, 27 Mar 2019 23:56:08 +0100 From: Michal Kubecek To: Jiri Pirko Cc: David Miller , netdev@vger.kernel.org, Jakub Kicinski , Andrew Lunn , Florian Fainelli , 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: <20190327225607.GW26076@unicorn.suse.cz> References: <20190327201237.GG14297@nanopsycho> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190327201237.GG14297@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 Wed, Mar 27, 2019 at 09:12:37PM +0100, Jiri Pirko wrote: > Mon, Mar 25, 2019 at 06:08:30PM CET, mkubecek@suse.cz wrote: > >Requests a contents of one or more string sets, i.e. indexed arrays of > >strings; this information is provided by ETHTOOL_GSSET_INFO and > >ETHTOOL_GSTRINGS commands of ioctl interface. There are three types of > >requests: > > > > - no NLM_F_DUMP, no device: get "global" stringsets > > - no NLM_F_DUMP, with device: get string sets related to the device > > - NLM_F_DUMP, no device: get device related string sets for all devices > > > >It's possible to request all string sets of given type or only specific > >sets. With ETHA_STRSET_COUNTS flag, only set sizes (number of strings) are > >returned. > > > >Signed-off-by: Michal Kubecek > >--- > > Documentation/networking/ethtool-netlink.txt | 46 +- > > include/uapi/linux/ethtool.h | 2 + > > include/uapi/linux/ethtool_netlink.h | 43 ++ > > net/ethtool/Makefile | 2 +- > > net/ethtool/netlink.c | 8 + > > net/ethtool/netlink.h | 4 + > > net/ethtool/strset.c | 447 +++++++++++++++++++ > > 7 files changed, 549 insertions(+), 3 deletions(-) > > create mode 100644 net/ethtool/strset.c > > First of all, the code is hard to follow. For reasons I mentioned in > other replies (lack of prefixes, wrappers, etc). > > More importantly, why do we need this? This concept of having strings in > kernel for various things and features and sending them to userspace is > weird. Certainly not common for Netlink interface. I believe these > strings should be avoided and all should be communicated to userspace > and back in form of well-defined Netlink attributes. We are introducing > new Netlink API, lets do it properly and don't bring baggage from past. For some of the global string sets where the values have fixed meaning and new values are only appended to, it would be possible. But even for those, keeping the list in sync between kernel and ethtool is often less than perfect. And ethtool is only one of the tools using the interface. So even in this case, I don't see string identifiers (or tags or names or whatever we call them) as a baggage from past, rather as a solution to a problem some of the existing interfaces have. Then e.g. netdev features are not fixed in this sense: the same bit index represents different feature in different kernels. I guess we could introduce some fixed numeric identifiers for them and map between those and actual indices but I don't see an advantage of such approach. But the really important question is how would you handle what is currently described by "per device" string sets, i.e. private flags, (ethtool) statistics, tests, ...? For these, the list depends on the driver or even device. Michal