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=-9.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 AC2C6C41514 for ; Sat, 17 Aug 2019 13:30:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 822BC2173B for ; Sat, 17 Aug 2019 13:30:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="mRMyqZRC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726103AbfHQNa3 (ORCPT ); Sat, 17 Aug 2019 09:30:29 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:41573 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725929AbfHQNa3 (ORCPT ); Sat, 17 Aug 2019 09:30:29 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id E84A820D5; Sat, 17 Aug 2019 09:30:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 17 Aug 2019 09:30:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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=P1rm92h4dBKRE32uuSGa2030s95LDr78Wk1QK+5WDYo=; b=mRMyqZRC HKT4ii/c6nG3zQYoXn4VYbziDjR3sKbxYYRtnAAiwQZLObpuwJZYco+Ab2h3iVa1 HsmnAf7lIGx4f8NROS4TkZObEWxnnrszvdySXTxL/B8Tsl+yRMFgx0taHUu7nprU SRq9X/Drlifp6bykhgS/Kdh04yXqiyEuq2/O0cGUaVHBs0wZMMmtYU9XoX4DaU3p gvhZBgrsmwz/wO2uFTMXVVS1c2xbQ89/Ag13BNUn3d77QDChTLDP2h4kIvUwXVaV /VHjGFvV00qzrYLW7MOr48oqpbLL0lWADtwaYimOACNVXFoUUym37FOsmNirawt+ Xjx6HPKL19SNmQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudefhedgieeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepkfguohcuufgthhhimhhmvghluceoihguohhstghhsehiugho shgthhdrohhrgheqnecukfhppeejledrudejjedrvddurddukedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehiughoshgthhesihguohhstghhrdhorhhgnecuvehluhhsthgvrhfu ihiivgepvd X-ME-Proxy: Received: from splinter.mtl.com (unknown [79.177.21.180]) by mail.messagingengine.com (Postfix) with ESMTPA id 924FA80066; Sat, 17 Aug 2019 09:30:24 -0400 (EDT) From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, nhorman@tuxdriver.com, jiri@mellanox.com, toke@redhat.com, dsahern@gmail.com, roopa@cumulusnetworks.com, nikolay@cumulusnetworks.com, jakub.kicinski@netronome.com, andy@greyhouse.net, f.fainelli@gmail.com, andrew@lunn.ch, vivien.didelot@gmail.com, mlxsw@mellanox.com, Ido Schimmel Subject: [PATCH net-next v3 04/16] drop_monitor: Consider all monitoring states before performing configuration Date: Sat, 17 Aug 2019 16:28:13 +0300 Message-Id: <20190817132825.29790-5-idosch@idosch.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190817132825.29790-1-idosch@idosch.org> References: <20190817132825.29790-1-idosch@idosch.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ido Schimmel The drop monitor configuration (e.g., alert mode) is global, but user will be able to enable monitoring of only software or hardware drops. Therefore, ensure that monitoring of both software and hardware drops are disabled before allowing drop monitor configuration to take place. Signed-off-by: Ido Schimmel Acked-by: Jiri Pirko --- net/core/drop_monitor.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index 6020f34728af..a2c7f9162c9d 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c @@ -633,6 +633,11 @@ static int set_all_monitor_traces(int state, struct netlink_ext_ack *extack) return rc; } +static bool net_dm_is_monitoring(void) +{ + return trace_state == TRACE_ON || monitor_hw; +} + static int net_dm_alert_mode_get_from_info(struct genl_info *info, enum net_dm_alert_mode *p_alert_mode) { @@ -694,8 +699,8 @@ static int net_dm_cmd_config(struct sk_buff *skb, struct netlink_ext_ack *extack = info->extack; int rc; - if (trace_state == TRACE_ON) { - NL_SET_ERR_MSG_MOD(extack, "Cannot configure drop monitor while tracing is on"); + if (net_dm_is_monitoring()) { + NL_SET_ERR_MSG_MOD(extack, "Cannot configure drop monitor during monitoring"); return -EBUSY; } -- 2.21.0