Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2090636ybp; Thu, 10 Oct 2019 02:01:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAimlFsp9T1uH6E/H1xoj/8Rf/2xiIgyKnzxxG8+6aA5fUjLOPgB23jQfWMNt8pR9uRC+V X-Received: by 2002:a05:6402:2d2:: with SMTP id b18mr7009825edx.264.1570698116761; Thu, 10 Oct 2019 02:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570698116; cv=none; d=google.com; s=arc-20160816; b=qlBx2GGTCKqCPJbv1yEGz3b47+6WGWfoHT40ejcSQhYj2stnDxR+bHkS/NUZiErJiX UaCjuv45raBWlQ42Ku9SbuMAV5H0ghlIsiQ8ZzKTGwGewTGYKXTXWWjfSG8OiUQ03rDK c/wysVwN8QYSBX4OxDVhuornrHDCU3q8eL5MHWl8b3PM82Qek80vb1v7hM9wEBV2I30C ClcBOerX5dAMgyXfTxGEp4vIG8j/oyLFjXMvDpnrZqfUHkitk598ATY+fYsEOMEZMUFx esG2eEzHluDpSPxchPSMrXPyNkKfRscfUngvDqIOiF+OynCxhgL758h1vtBmRY8VEnW9 i5SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4dImPnBaOxeeF5ARTnSA7P4dpK8GkXIs/dO8WMOM1wI=; b=o+5qnEgjJMACa+5wSx1uPEvQQVkc+9v9OsCfMumshqiW3GhNDelTUgYTi3LTJbH1bc 7lLnNSsoapO+HFRRz1NUQcv9JBxMFvPPVcnYIL6VFzzHggpDVDd9Q+gN8Ntx+MGp7/bt oHPxJFMX/8w/AP2i92l891oBIdeD2KJdlxiyeZ3YWaufrioOksZxnRDr0B9lOgnuhNDq SPyJ6cvSCfrc9bvlat2C/Kmy6w0YIIZ3hvnRtx6UHVLmDNa63ECJ7nrURUvT+dd5XnI2 NJplLwmPCnqY2y3q2EwvKT2s5YBCjEbVHbg4J0h62UIbVyfGRB2/+uELLgiL0rLkKcuK KsvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Xj+6+Btj; 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 cw11si2733068ejb.245.2019.10.10.02.01.33; Thu, 10 Oct 2019 02:01:56 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Xj+6+Btj; 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 S2388925AbfJJIoX (ORCPT + 99 others); Thu, 10 Oct 2019 04:44:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:49544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388914AbfJJIoW (ORCPT ); Thu, 10 Oct 2019 04:44:22 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6D7B5218AC; Thu, 10 Oct 2019 08:44:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570697061; bh=iZqvM8/ML7/3iO5oJRFmHz/GQMXiufVRTiQWFhISntU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xj+6+BtjPvD4U91VtTLl0VtZ3otYRaKtx4grZ2s3rXULg/3UkugAvyuGJ0PgWleOc BEx+vx8gEESSIGUUi5nMsJXLaKVxZ5dvxN47m3vlApA3PG4LYtJRXi2mbw0o/MB9Qs dXUhnxb+JNRamJS+2Qf4FAnMU7AOk6HUMwT5new0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Danielle Ratson , Jiri Pirko , Ido Schimmel , "David S. Miller" , Sasha Levin Subject: [PATCH 5.3 133/148] mlxsw: spectrum_flower: Fail in case user specifies multiple mirror actions Date: Thu, 10 Oct 2019 10:36:34 +0200 Message-Id: <20191010083620.441596408@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Danielle Ratson [ Upstream commit 52feb8b588f6d23673dd7cc2b44b203493b627f6 ] The ASIC can only mirror a packet to one port, but when user is trying to set more than one mirror action, it doesn't fail. Add a check if more than one mirror action was specified per rule and if so, fail for not being supported. Fixes: d0d13c1858a11 ("mlxsw: spectrum_acl: Add support for mirror action") Signed-off-by: Danielle Ratson Acked-by: Jiri Pirko Signed-off-by: Ido Schimmel Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c index 202e9a2460194..7c13656a83384 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c @@ -21,6 +21,7 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, struct netlink_ext_ack *extack) { const struct flow_action_entry *act; + int mirror_act_count = 0; int err, i; if (!flow_action_has_entries(flow_action)) @@ -95,6 +96,11 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, case FLOW_ACTION_MIRRED: { struct net_device *out_dev = act->dev; + if (mirror_act_count++) { + NL_SET_ERR_MSG_MOD(extack, "Multiple mirror actions per rule are not supported"); + return -EOPNOTSUPP; + } + err = mlxsw_sp_acl_rulei_act_mirror(mlxsw_sp, rulei, block, out_dev, extack); -- 2.20.1