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=DKIM_SIGNED,DKIM_VALID, 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 E4634C76186 for ; Wed, 24 Jul 2019 16:57:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B9BF121841 for ; Wed, 24 Jul 2019 16:57:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="12sBedEJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728279AbfGXQ5c (ORCPT ); Wed, 24 Jul 2019 12:57:32 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:56411 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726567AbfGXQ5c (ORCPT ); Wed, 24 Jul 2019 12:57:32 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id A5FC7125A; Wed, 24 Jul 2019 12:57:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 24 Jul 2019 12:57:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=FkEw4W 7ehtTm+q7kCmR6lO4anhI7KE1/g4HEN4AWYnc=; b=12sBedEJCcRgz7uXZHiFWH pky2OG6XqUC9GBr9uZVA6IK7saZCWG+Zavk5qor5ZqfhXic8NaukkzYCfI8nz5/a qdjjqlm31cvQ820yeMBcMmsK1xEu86pTvxKTkrpxdf1NbpRh52DgG3JqHmu/UDHP wkL2ciXf/MXXysOP1uWwXi0Pmqd6W1IxK2xWAA1IxACGxoBAXUnl1Kw2uLvvgf0h zT1pYjODgtTRMc6yUSy2vBjiuY9ExgJxxFSDP+8Uakm1Aa0KUPGkw5C2UhOr3T6t 9zBx3D7HiqRJrcRSxXsFFdAuiY+tk8WgPSBWiPxBe++Z2gIulSHv9yLlLfjk854Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrkedtgddutdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjfgesthdtredttdervdenucfhrhhomhepkfguohcu ufgthhhimhhmvghluceoihguohhstghhsehiughoshgthhdrohhrgheqnecukfhppedule efrdegjedrudeihedrvdehudenucfrrghrrghmpehmrghilhhfrhhomhepihguohhstghh sehiughoshgthhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (unknown [193.47.165.251]) by mail.messagingengine.com (Postfix) with ESMTPA id A17BA380074; Wed, 24 Jul 2019 12:57:27 -0400 (EDT) Date: Wed, 24 Jul 2019 19:57:25 +0300 From: Ido Schimmel To: Jiri Pirko Cc: netdev@vger.kernel.org, davem@davemloft.net, nhorman@tuxdriver.com, dsahern@gmail.com, roopa@cumulusnetworks.com, nikolay@cumulusnetworks.com, jakub.kicinski@netronome.com, toke@redhat.com, andy@greyhouse.net, f.fainelli@gmail.com, andrew@lunn.ch, vivien.didelot@gmail.com, mlxsw@mellanox.com, Ido Schimmel Subject: Re: [RFC PATCH net-next 10/12] drop_monitor: Add packet alert mode Message-ID: <20190724165725.GC20252@splinter> References: <20190722183134.14516-1-idosch@idosch.org> <20190722183134.14516-11-idosch@idosch.org> <20190724125341.GB2225@nanopsycho> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190724125341.GB2225@nanopsycho> User-Agent: Mutt/1.12.0 (2019-05-25) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Jul 24, 2019 at 02:53:41PM +0200, Jiri Pirko wrote: > Mon, Jul 22, 2019 at 08:31:32PM CEST, idosch@idosch.org wrote: > >+static const struct net_dm_alert_ops *net_dm_alert_ops_arr[] = { > >+ [NET_DM_ALERT_MODE_SUMMARY] = &net_dm_alert_summary_ops, > >+ [NET_DM_ALERT_MODE_PACKET] = &net_dm_alert_packet_ops, > >+}; > > Please split this patch into 2: > 1) introducing the ops and modes (only summary) > 2) introducing the packet mode Ack ... > >+static int net_dm_alert_mode_set(struct genl_info *info) > >+{ > >+ struct netlink_ext_ack *extack = info->extack; > >+ enum net_dm_alert_mode alert_mode; > >+ int rc; > >+ > >+ if (!info->attrs[NET_DM_ATTR_ALERT_MODE]) > >+ return 0; > >+ > >+ rc = net_dm_alert_mode_get_from_info(info, &alert_mode); > >+ if (rc) { > >+ NL_SET_ERR_MSG_MOD(extack, "Invalid alert mode"); > >+ return -EINVAL; > >+ } > >+ > >+ net_dm_alert_mode = alert_mode; > > 2 things: > 1) Shouldn't you check if the tracing is on and return -EBUSY in case it is? I'm doing it below in net_dm_cmd_config() :) But I'm returning '-EOPNOTSUPP'. I guess '-EBUSY' is more appropriate. Will change. > 2) You setup the mode globally. I guess it is fine and it does not make > sense to do it otherwise, right? Like per-net or something. Yes, it's global. I didn't change that aspect of drop monitor and I don't really see a use case for that. > > > >+ > >+ return 0; > >+} > >+ > > static int net_dm_cmd_config(struct sk_buff *skb, > > struct genl_info *info) > > { > >- NL_SET_ERR_MSG_MOD(info->extack, "Command not supported"); > >+ struct netlink_ext_ack *extack = info->extack; > >+ int rc; > > > >- return -EOPNOTSUPP; > >+ if (trace_state == TRACE_ON) { > >+ NL_SET_ERR_MSG_MOD(extack, "Cannot configure drop monitor while tracing is on"); > >+ return -EOPNOTSUPP; > >+ } > >+ > >+ rc = net_dm_alert_mode_set(info); > >+ if (rc) > >+ return rc; > >+ > >+ return 0; > > }