From patchwork Wed Jul 25 08:37:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nir Dotan X-Patchwork-Id: 10543703 X-Patchwork-Delegate: jiri@resnulli.us Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C0810112E for ; Wed, 25 Jul 2018 08:38:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF4C429B86 for ; Wed, 25 Jul 2018 08:38:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3A4929B8A; Wed, 25 Jul 2018 08:38:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F25CD29B86 for ; Wed, 25 Jul 2018 08:38:36 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41b7t31zGMzDrS7 for ; Wed, 25 Jul 2018 18:38:35 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=193.47.165.129; helo=mellanox.co.il; envelope-from=nird@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by lists.ozlabs.org (Postfix) with ESMTP id 41b7sx0sgBzDrHF for ; Wed, 25 Jul 2018 18:38:28 +1000 (AEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from nird@mellanox.com) with ESMTPS (AES256-SHA encrypted); 25 Jul 2018 11:41:36 +0300 Received: from r-vnc13.mtr.labs.mlnx (r-vnc13.mtr.labs.mlnx [10.208.0.13]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w6P8cLMO006720; Wed, 25 Jul 2018 11:38:21 +0300 Received: from r-vnc13.mtr.labs.mlnx (r-vnc13.mtr.labs.mlnx [127.0.0.1]) by r-vnc13.mtr.labs.mlnx (8.14.4/8.14.4) with ESMTP id w6P8cLQj001285; Wed, 25 Jul 2018 11:38:21 +0300 Received: (from nird@localhost) by r-vnc13.mtr.labs.mlnx (8.14.4/8.14.4/Submit) id w6P8cLhM001284; Wed, 25 Jul 2018 11:38:21 +0300 From: Nir Dotan To: linux-internal@mellanox.com Subject: [PATCH net-next mlxsw 2/2] mlxsw: core_acl_flex_actions: Remove redundant resource destruction Date: Wed, 25 Jul 2018 11:37:44 +0300 Message-Id: <20180725083744.994-3-nird@mellanox.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20180725083744.994-1-nird@mellanox.com> References: <20180725083744.994-1-nird@mellanox.com> X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP Some ACL actions require the allocation of a separate resource prior to applying the action itself. When facing an error condition during the setup phase of the action, resource was destroyed. This was found to be redundant and also harmful for mirror actions, as error condition always leads to destruction of the rule and all of its resources. Signed-off-by: Nir Dotan --- .../ethernet/mellanox/mlxsw/core_acl_flex_actions.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c index 9c87363..c3401cf 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c @@ -962,14 +962,10 @@ mlxsw_afa_block_append_mirror(struct mlxsw_afa_block *block, u8 local_in_port, err = mlxsw_afa_block_append_allocated_mirror(block, mirror->span_id); if (err) { NL_SET_ERR_MSG_MOD(extack, "Cannot append mirror action"); - goto err_append_allocated_mirror; + return err; } return 0; - -err_append_allocated_mirror: - mlxsw_afa_mirror_destroy(block, mirror); - return err; } EXPORT_SYMBOL(mlxsw_afa_block_append_mirror); @@ -1019,7 +1015,6 @@ int mlxsw_afa_block_append_fwd(struct mlxsw_afa_block *block, struct mlxsw_afa_fwd_entry_ref *fwd_entry_ref; u32 kvdl_index; char *act; - int err; if (in_port) { NL_SET_ERR_MSG_MOD(extack, "Forwarding to ingress port is not supported"); @@ -1035,17 +1030,12 @@ int mlxsw_afa_block_append_fwd(struct mlxsw_afa_block *block, act = mlxsw_afa_block_append_action(block, MLXSW_AFA_FORWARD_CODE, MLXSW_AFA_FORWARD_SIZE); if (!act) { - err = -ENOBUFS; NL_SET_ERR_MSG_MOD(extack, "Cannot append forward action"); - goto err_append_action; + return -ENOBUFS; } mlxsw_afa_forward_pack(act, MLXSW_AFA_FORWARD_TYPE_PBS, kvdl_index, in_port); return 0; - -err_append_action: - mlxsw_afa_fwd_entry_ref_destroy(block, fwd_entry_ref); - return err; } EXPORT_SYMBOL(mlxsw_afa_block_append_fwd); @@ -1117,15 +1107,11 @@ int mlxsw_afa_block_append_counter(struct mlxsw_afa_block *block, err = mlxsw_afa_block_append_allocated_counter(block, counter_index); if (err) { NL_SET_ERR_MSG_MOD(extack, "Cannot append count action"); - goto err_append_allocated_counter; + return err; } if (p_counter_index) *p_counter_index = counter_index; return 0; - -err_append_allocated_counter: - mlxsw_afa_counter_destroy(block, counter); - return err; } EXPORT_SYMBOL(mlxsw_afa_block_append_counter);