Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2705418ybp; Thu, 10 Oct 2019 11:18:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbhbNO74B39I9RC6c4lEqlTKwdDXhT+trH1lLc6X875aMZ18udI2W/yzgbUrQZp8bMuNSl X-Received: by 2002:a05:6402:1a33:: with SMTP id be19mr9394771edb.197.1570731512462; Thu, 10 Oct 2019 11:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570731512; cv=none; d=google.com; s=arc-20160816; b=doDu/WP6+onTqH238DRONln0Dy3xK+SuovlzaKALCfVcd+XX+nwhqhQ7kZOOcbleN5 PoMU53Y2n7EU+l+Zgp+2V7tYeA42eF+cQXECSOTywfY/ZKrFxX4SlKxQHreVQGziVilT KlzzTpyVwwybSmnK/5d/swTjHlqdZRjdZgI9/xFrVJbzZX7s1WBs1SQkVuYVaua44ih3 rF1g20FT86K+4lXa+QviRVNPbmMBu21oZa27SrlF4DJsBCn889GXDmhcRw+wror6M1Sp /bgW00XToQo8kiT+dGATHfHgVp7lyR7NY15rjrQonYSwewYJX0h32WeRgneD8Ss64/8i jQoA== 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=jBilqDBjTswgAsR1gPdR668IsnhPfCE3/KqDK1HQX18=; b=mj9BGmMvBPOn7zx5k5SnC+qn0ndyG65kElquurNWDYNd6B6ZylTDvqdDdsoARFcfvj zwMXvs//pP7YXsSTq8iDH4YV24HSBN2DKaIvKYtzOhFVgjKV+p8w2MZgd6dv5l10xfUg CvC/aZFImHKHTPsSl8IwkRCxseibuA7FNGgv2NzJriyoA0xiZst8aY6VcIDUDUoIsltK 9/73ZKrnd2A682zUKWc56Gf4kQoPM96yg5bnRj0Duhp9Iz0geVWcs3kZLUqz+EaumqAb UyQGNRgJbC+V1t+FVZLUxt1udgXVnQSapKKykILzh2S9VCV61XtdoBp1OzJ8S6ZqnQJx t7oQ== 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 p16si3582357ejj.360.2019.10.10.11.18.00; Thu, 10 Oct 2019 11:18:32 -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 S1726783AbfJJSRu (ORCPT + 99 others); Thu, 10 Oct 2019 14:17:50 -0400 Received: from mx2.suse.de ([195.135.220.15]:40692 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726691AbfJJSRu (ORCPT ); Thu, 10 Oct 2019 14:17:50 -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 56503AC16; Thu, 10 Oct 2019 18:17:48 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 96806E378C; Thu, 10 Oct 2019 20:17:43 +0200 (CEST) Date: Thu, 10 Oct 2019 20:17:43 +0200 From: Michal Kubecek To: netdev@vger.kernel.org Cc: Jiri Pirko , David Miller , Jakub Kicinski , Andrew Lunn , Florian Fainelli , John Linville , Stephen Hemminger , Johannes Berg , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v7 13/17] ethtool: add standard notification handler Message-ID: <20191010181743.GF22163@unicorn.suse.cz> References: <20191010152559.GA2994@nanopsycho> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191010152559.GA2994@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, Oct 10, 2019 at 05:25:59PM +0200, Jiri Pirko wrote: > Wed, Oct 09, 2019 at 10:59:40PM CEST, mkubecek@suse.cz wrote: > >+static void *ethnl_bcastmsg_put(struct sk_buff *skb, u8 cmd) > >+{ > >+ return genlmsg_put(skb, 0, ++ethnl_bcast_seq, ðtool_genl_family, 0, > >+ cmd); > >+} > >+ > >+static int ethnl_multicast(struct sk_buff *skb, struct net_device *dev) > >+{ > >+ return genlmsg_multicast_netns(ðtool_genl_family, dev_net(dev), skb, > >+ 0, ETHNL_MCGRP_MONITOR, GFP_KERNEL); > >+} > > No need for these 2 helpers. Just put the code directly into > ethnl_std_notify() and make the code easier to read. In later patches (not submitted yet), these two will be also called by other notification handlers. > >+static const struct get_request_ops *ethnl_std_notify_to_ops(unsigned int cmd) > >+{ > >+ WARN_ONCE(1, "unexpected notification type %u\n", cmd); > >+ return NULL; > >+} > > Why this isn't a table similar to get_requests ? It's a relic of earlier version before splitting the complex message types when the table was rather sparse. I'll change it to a lookup table to make it consistent with the rest of the code. > >+ > >+/* generic notification handler */ > >+static void ethnl_std_notify(struct net_device *dev, unsigned int cmd, > > Better "common" comparing to "standard", I believe. That's similar to ethnl_std_parse(), the idea is that this is the standard handler for notifications which are triggered without additional data and the message is the same as reply to corresponding "GET" request (which is generated by the standard ethnl_get_doit() handler). Notifications for actions and notifications for SET commands which cannot be generated this standard way will have to use their own (nonstandard) handler. Michal