Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4270422img; Tue, 26 Mar 2019 06:25:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHXqwJcw2KpP0dfEYL1GcaGjl28l0pjZMs4esQBDhDM2czw5+sPPr3mCynChkjpo0w7ZMY X-Received: by 2002:a17:902:29ca:: with SMTP id h68mr6346392plb.297.1553606724676; Tue, 26 Mar 2019 06:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553606724; cv=none; d=google.com; s=arc-20160816; b=XpnjbWDZyDdisiPCIPzff1sbMfdDbvw84Hpe7IMj76CPzUjmMvE9PowN076PoBYWdW O6/BxbwfvCmk1nUBSMojVmMAqxH19x7wP3DOWJcUMqMYU8yLs8vWn/Z4P0k9xRN0bYwg TwVliLu6qFmhjL0ktVBb3bifUQ9C9n4LmfO6rYqQ6IOn05UFmtnReWGqQXpM4qg46uAQ KE66GoCtYZrzH8XfWmyPF5d1K/mqRUzFDgnEcLbyo59/ysFqtRZp2bR39Xw//ITQhxLc RouT810fQCCVK1V0HlFLxrxTz8gjUIn2mBH9YEzbFYhkto/V7ZZQ14OFRpWqiYRvIRiU KSVw== 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=TqVcrgvDrqv1Im6eAV9YH52GOzPtCqQ7e65nshbCfz0=; b=fdxnrTvTT6Dm++zAq5zUmUNzTMWVTEFKpycozmA85A2cLb4zOi4OAyr/sJW3O4jk2h RK1j1MxinMP83fFv3GgNz7NWJVZ28eHAkjenGB/F9JdSH6GL5bdIghmDhGmiZ4b8XeYq cyLReNsz71q56kOWVcbW5roXMcvRIZOD9UGYbbnEPQ3rTT385Eg3N8lHNLVafHJ/fTf9 T+azZ85uz0TYcweh4ce28DTvbSklFSO/51L/SeWRbHLOKx3mgNl78vu/sjJXE5wuelFK tKd8xB9JkUDcvxc5xKkDZi1XfIwkIGyob2GmcXCWl7KVGFYmv3vEfYSK9246E3j8bdQu +wmQ== 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 v34si16971341plg.176.2019.03.26.06.25.08; Tue, 26 Mar 2019 06:25:24 -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 S1730722AbfCZNYd (ORCPT + 99 others); Tue, 26 Mar 2019 09:24:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:58266 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726177AbfCZNYd (ORCPT ); Tue, 26 Mar 2019 09:24:33 -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 DEDB2AD0A; Tue, 26 Mar 2019 13:24:30 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 83A0DE1404; Tue, 26 Mar 2019 14:24:27 +0100 (CET) Date: Tue, 26 Mar 2019 14:24:27 +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 05/22] ethtool: introduce ethtool netlink interface Message-ID: <20190326132427.GK26076@unicorn.suse.cz> References: <8795d07d3315b232b4e7ebc7d109c9aa3185e555.1553532199.git.mkubecek@suse.cz> <20190326120909.GF2230@nanopsycho> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190326120909.GF2230@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 Tue, Mar 26, 2019 at 01:09:09PM +0100, Jiri Pirko wrote: > Mon, Mar 25, 2019 at 06:08:09PM CET, mkubecek@suse.cz wrote: > >+All "set" and "action" type requests require admin privileges (CAP_NET_ADMIN > >+in the namespace). Most "get" type request are allowed for anyone but there > > s/request/requests/ Will fix. > >+Device identification > >+--------------------- > >+ > >+When appropriate, network device is identified by a nested attribute named > >+ETHA_*_DEV. This attribute can contain > > Isn't it ETHA_DEV_*? I must admit I'm a bit confused. ETHA_*_DEV is the nesting attribute (e.g. ETHA_SETTINGS_DEV), ETHA_DEV_* (ETHA_DEV_INDEX and ETHA_DEV_NAME) are in the nest. > > > >+ > >+ ETHA_DEV_INDEX (u32) device ifindex > >+ ETHA_DEV_NAME (string) device name > >+ > >+In device related requests, one of these is sufficient; if both are used, they > >+must match (i.e. identify the same device). In device related replies both are > > You say this now for the second time. First time this was said in second > para. I'll drop one of them. > >+List of message types > >+--------------------- > >+ > >+All constants use ETHNL_CMD_ prefix, usually followed by "GET", "SET" or "ACT" > > Why "usually"? Why not "always"? Right, it's always. And if it changes one day, the sentence will have to be rewritten anyway. > >+Messages of type "get" are used by userspace to request information and > >+usually do not contain any attributes (that may be added later for dump > >+filtering). Kernel response is in the form of corresponding "set" message; > > Okay. Do we want reply to "*_cmd_something_get" command to be > "*_cmd_something_set". That sounds odd. Why reply has to be "cmd"? Why > not something like "reply" or "response"? > This should work for both "doit/dumpit" and notifications. As stated right below, the aim is to use the same format for replies to GET requests as userspace uses for related SET requests. We could use different id (genlmsghdr::cmd) but that seemed like a waste for no actual gain. > >+the same message can be also used to set (some of) the parameters, except for > >+messages marked as "response only" in the table above. "Get" messages with > >+NLM_F_DUMP flags and no device identification dump the information for all > >+devices supporting the request. > >+ > >+enum { > >+ ETHNL_CMD_NOOP, > >+ > > Usually headers have something like: > /* add new commands above here */ > here. OK > >diff --git a/net/ethtool/Makefile b/net/ethtool/Makefile > >index 3ebfab2bca66..f30e0da88be5 100644 > >--- a/net/ethtool/Makefile > >+++ b/net/ethtool/Makefile > >@@ -1,3 +1,7 @@ > > # SPDX-License-Identifier: GPL-2.0 > > > >-obj-y += ioctl.o > >+obj-y += ioctl.o > >+ > >+obj-$(CONFIG_ETHTOOL_NETLINK) += ethtool_nl.o > > Why? I believe this should be always build-in same as ioctl. I would like to make the ioctl interface optional as well, eventually. As someone noted in one of the earlier discussions, there may be some special minimalistic setups where ethtool interface may be of no use. > >+struct genl_family ethtool_genl_family = { > >+ .hdrsize = 0, > > No need to set 0. OK > >+ > >+extern struct genl_family ethtool_genl_family; > > Why? You need this just within "netlink.c", don't you? In the submitted part, yes. But one of the later patches adds specific notify handler (different from ethnl_std_notify()) which is not in netlink.c and needs to use pointer to ethtool_genl_family for a call to genlmsg_put() and genlmsg_multicast(). But I can make it static for now and change to extern when it's needed. Michal