From patchwork Mon Apr 3 15:09:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cabaj X-Patchwork-Id: 1764491 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=vsc96sZR; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PqvSQ342xz1yZV for ; Tue, 4 Apr 2023 01:09:25 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pjLo4-0001Pa-Li; Mon, 03 Apr 2023 15:09:16 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pjLnx-0001Of-34 for kernel-team@lists.ubuntu.com; Mon, 03 Apr 2023 15:09:09 +0000 Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id CABA73F116 for ; Mon, 3 Apr 2023 15:09:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1680534548; bh=LFTWolFA+mmYxAVhZmh/fjIfOYMZibQ92VEahdHLtuk=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=vsc96sZRQl0NdU7dkLP1U0Pq1QV7yFWrRTq8/wNClhkWdl29bXi2PlQvqk6NLIGfs pG9veKR84SPPG5doD18Evrom+nTbjyEtWbdPis6KdMqdlQgv9lk/9m55EtO8X5scvD K40q+rBqh/X6/rPZCw3cvosE1VBkqXxWhzwDA4K0xHKzFweK/Q39hNsxK5EWtfKkqa E41a+n5nBS2caPY13liHhY2YWValaIo4pBdqcm62OVoH/bLSBwGFeWKkAhicBXQMzS VoSNGYlBLowApsPCo2/hy6H5pxQgyd70nArBmWUjWukfUJtPVklCttMkbhWTz+pOgF /izFBixD090rg== Received: by mail-yb1-f199.google.com with SMTP id y144-20020a253296000000b00b69ce0e6f2dso29047754yby.18 for ; Mon, 03 Apr 2023 08:09:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680534547; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LFTWolFA+mmYxAVhZmh/fjIfOYMZibQ92VEahdHLtuk=; b=nmDaBUjs13ckVaiBl9IQ+lF7g1qzLF2jctar4b2Fg+Ti+d8JOVmp7LF0IGKD9Jgzpz jlRggGtMMvKvqKHbNMdcRQVkmljku92uIbZ71IO68emAmLzNq4+Q6Yt61MLwm58gfWQK nlxxs9TjCsK7mxgPIK1YUCPLBBVahW4UaI1NcJquTiqshSsgsyuIANaYZQeHEOBjmr95 rta1zUDT6rQQ20fXEhqL0KUOkpdGz0zJ6z/pvb223z6JcZHmhIBaBsbCVhrkMAu/A3mG DFH+tp4Rs0/gHtgOEL6w8i532KUw7yz0AyaR+XlKM2xZpMjqX3pbcRA6sqgCY60irPw4 bdkw== X-Gm-Message-State: AAQBX9dO0LqzTub+DaiWox5dtzt/EQS/Fzgtoiflbj4yfLmbZOY4qXIx H/V8oBW9+GRBEuAO0YRowWcTam6fcuT7AWLWb0UiZiQRj9sBbIUHXKyNrsGy53D9BvI1n4BGLZd VziMNU5Ikozkn9TEK08sMiGYuivrSsfcDgCxQbvU7J6a5wW8jlA== X-Received: by 2002:a25:684a:0:b0:b40:1f75:ae63 with SMTP id d71-20020a25684a000000b00b401f75ae63mr33980288ybc.1.1680534547678; Mon, 03 Apr 2023 08:09:07 -0700 (PDT) X-Google-Smtp-Source: AKy350ayy8r5jvKWGit8kQaOr4TbxM3MBYhdf1Mmej0QEjiGJE7oQiXmKx4+hyDbEKTFjFDOn1EwkQ== X-Received: by 2002:a25:684a:0:b0:b40:1f75:ae63 with SMTP id d71-20020a25684a000000b00b401f75ae63mr33980266ybc.1.1680534547383; Mon, 03 Apr 2023 08:09:07 -0700 (PDT) Received: from smtp.gmail.com (h69-130-246-116.mdtnwi.broadband.dynamic.tds.net. [69.130.246.116]) by smtp.gmail.com with ESMTPSA id l12-20020a25bccc000000b00b7f8d94ce82sm2590046ybm.38.2023.04.03.08.09.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 08:09:06 -0700 (PDT) From: John Cabaj To: kernel-team@lists.ubuntu.com Subject: [SRU][jammy][PATCH 1/1] net/mlx5: fs, refactor software deletion rule Date: Mon, 3 Apr 2023 10:09:05 -0500 Message-Id: <20230403150905.2211962-2-john.cabaj@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230403150905.2211962-1-john.cabaj@canonical.com> References: <20230403150905.2211962-1-john.cabaj@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Mark Bloch BugLink: https://bugs.launchpad.net/bugs/2015097 When deleting a rule make sure that for every type dests_size is decreased only once and no other logic is executed. Without this dests_size might be decreased twice when dests_size == 1 so the if for that type won't be entered and if action has MLX5_FLOW_CONTEXT_ACTION_FWD_DEST set dests_size will be decreased again. Signed-off-by: Mark Bloch Reviewed-by: Maor Gottlieb Signed-off-by: Saeed Mahameed (cherry picked from commit d49d63075e0f56f7f05e3ddda59e0484d8a3aa7b) Signed-off-by: John Cabaj --- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index 65daa556dffa..ff757ce11eaa 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -526,8 +526,8 @@ static void del_sw_hw_rule(struct fs_node *node) mutex_unlock(&rule->dest_attr.ft->lock); } - if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_COUNTER && - --fte->dests_size) { + if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_COUNTER) { + --fte->dests_size; fte->modify_mask |= BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_ACTION) | BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_FLOW_COUNTERS); @@ -535,15 +535,15 @@ static void del_sw_hw_rule(struct fs_node *node) goto out; } - if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_PORT && - --fte->dests_size) { + if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_PORT) { + --fte->dests_size; fte->modify_mask |= BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_ACTION); fte->action.action &= ~MLX5_FLOW_CONTEXT_ACTION_ALLOW; goto out; } - if ((fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) && - --fte->dests_size) { + if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) { + --fte->dests_size; fte->modify_mask |= BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_DESTINATION_LIST); }