From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A529C4360C for ; Thu, 10 Oct 2019 18:17:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E574B218AC for ; Thu, 10 Oct 2019 18:17:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726742AbfJJSRu (ORCPT ); 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: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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