Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4450938imw; Tue, 19 Jul 2022 06:54:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sisNjDFbRY+vYfhC1PK3r31j9Y2hhE7vS2w/Af23iXBBksQxnmrUZKuQXo0x8QC/rrvxRU X-Received: by 2002:a05:6402:358d:b0:43a:c600:a678 with SMTP id y13-20020a056402358d00b0043ac600a678mr44217092edc.219.1658238871172; Tue, 19 Jul 2022 06:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238871; cv=none; d=google.com; s=arc-20160816; b=REDp8i/e2wYWdzpGMzVjc7+TB8FhZi1coyha6+M+9dEe5s2BSLtileCMUKUWCeA5uV EqSlkjIyH6i1NwxlUohw6dJozFLchh1GSiRfoiaDUq2VhlywG2oXiZ7IdFmEYcYfSEWG RKIg/wH+vQO5b4m7otODVQqqvvcEo18XrUNqHVdy7FOAvaezJNweBcm2EnTVowWv9rzj GqRcUiQnbi4BivUDFKOryOjAk0AhzTgpHfdWPgvT9DeX1YQUvX2PcjPizBxHD3JQEssI aFoPzeTObFbQ1eJx/+93NKbPFqgtLLJM1O29UYYyP09aDaYAr0jZfH5c8IhhAzpi4pVx +BiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HRsKtoa9g1xv/c0KH8LlAJY8+5v8M+TsdKCEkeLmSuE=; b=QKyLKDEyTVrdCfjSvu5IlN/TxuoR+rcCON+HlHZVUOnhb9G2qFSmnm7w+RT3+RLOIw O1JrFeJFZ4vKbyq1rdprhmEPvgMt4KRgOmwJ6xoypvWkE+Sdg21UU6m36N3ojqZ8m8kJ wl3QvYMtyglJmbQ7Vq1hVNu6L0rMPKMIAMdqQC0L5CmxbeVWKWIBgx0qAqWTWpQcMbYN Vx9H6t+fAOn3nrPnM6JsOdqTZghItGBJjqXb1rPIzbINZh+8JxhEUQaq8ufvYc8quFAQ OyBi2vBelMYsdRBde7nfgDuNeb8NkscW3seWKPp+5PHxCqHrZLiG9k8zyF/ONAU11EQB ngwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l0wZdZ70; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t12-20020a056402524c00b0043a9a95d32fsi22543105edd.433.2022.07.19.06.54.06; Tue, 19 Jul 2022 06:54:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l0wZdZ70; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242027AbiGSMwY (ORCPT + 99 others); Tue, 19 Jul 2022 08:52:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241919AbiGSMu7 (ORCPT ); Tue, 19 Jul 2022 08:50:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8098AB86E; Tue, 19 Jul 2022 05:20:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 03F7B6177D; Tue, 19 Jul 2022 12:20:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1573C341C6; Tue, 19 Jul 2022 12:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233211; bh=JHvkOaikfq7lVP2FgXzAZJuffmnjOBt/h6hBSSmaQ9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l0wZdZ70LdKJ0eW2aKtBqfbHkmoGmoyYQh2Ic9gVvzGTbk9bMR/+GAPf5q3F2MQeZ lyb0NQ+hOxxvmd16slkbxj01tusbA7KAaAJSmUX0ju4eARvcPNKXqT/nW3Iz0pLwd0 BZeYi8TFyjdcsTcj6svG9rIjatFGoUg+QGFwLN+0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roi Dayan , Oz Shlomo , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 045/231] net/mlx5e: CT: Use own workqueue instead of mlx5e priv Date: Tue, 19 Jul 2022 13:52:10 +0200 Message-Id: <20220719114718.092751571@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roi Dayan [ Upstream commit 6c4e8fa03fde7e5b304594294e397a9ba92feaf6 ] Allocate a ct priv workqueue instead of using mlx5e priv one so flushing will only be of related CT entries. Also move flushing of the workqueue before rhashtable destroy otherwise entries won't be valid. Fixes: b069e14fff46 ("net/mlx5e: CT: Fix queued up restore put() executing after relevant ft release") Signed-off-by: Roi Dayan Reviewed-by: Oz Shlomo Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- .../ethernet/mellanox/mlx5/core/en/tc_ct.c | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c index 1ff7a07bcd06..fbcce63e5b80 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c @@ -66,6 +66,7 @@ struct mlx5_tc_ct_priv { struct mlx5_ct_fs *fs; struct mlx5_ct_fs_ops *fs_ops; spinlock_t ht_lock; /* protects ft entries */ + struct workqueue_struct *wq; }; struct mlx5_ct_flow { @@ -927,14 +928,11 @@ static void mlx5_tc_ct_entry_del_work(struct work_struct *work) static void __mlx5_tc_ct_entry_put(struct mlx5_ct_entry *entry) { - struct mlx5e_priv *priv; - if (!refcount_dec_and_test(&entry->refcnt)) return; - priv = netdev_priv(entry->ct_priv->netdev); INIT_WORK(&entry->work, mlx5_tc_ct_entry_del_work); - queue_work(priv->wq, &entry->work); + queue_work(entry->ct_priv->wq, &entry->work); } static struct mlx5_ct_counter * @@ -1744,19 +1742,16 @@ mlx5_tc_ct_flush_ft_entry(void *ptr, void *arg) static void mlx5_tc_ct_del_ft_cb(struct mlx5_tc_ct_priv *ct_priv, struct mlx5_ct_ft *ft) { - struct mlx5e_priv *priv; - if (!refcount_dec_and_test(&ft->refcount)) return; + flush_workqueue(ct_priv->wq); nf_flow_table_offload_del_cb(ft->nf_ft, mlx5_tc_ct_block_flow_offload, ft); rhashtable_remove_fast(&ct_priv->zone_ht, &ft->node, zone_params); rhashtable_free_and_destroy(&ft->ct_entries_ht, mlx5_tc_ct_flush_ft_entry, ct_priv); - priv = netdev_priv(ct_priv->netdev); - flush_workqueue(priv->wq); mlx5_tc_ct_free_pre_ct_tables(ft); mapping_remove(ct_priv->zone_mapping, ft->zone_restore_id); kfree(ft); @@ -2139,6 +2134,12 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains, if (rhashtable_init(&ct_priv->ct_tuples_nat_ht, &tuples_nat_ht_params)) goto err_ct_tuples_nat_ht; + ct_priv->wq = alloc_ordered_workqueue("mlx5e_ct_priv_wq", 0); + if (!ct_priv->wq) { + err = -ENOMEM; + goto err_wq; + } + err = mlx5_tc_ct_fs_init(ct_priv); if (err) goto err_init_fs; @@ -2146,6 +2147,8 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains, return ct_priv; err_init_fs: + destroy_workqueue(ct_priv->wq); +err_wq: rhashtable_destroy(&ct_priv->ct_tuples_nat_ht); err_ct_tuples_nat_ht: rhashtable_destroy(&ct_priv->ct_tuples_ht); @@ -2175,6 +2178,7 @@ mlx5_tc_ct_clean(struct mlx5_tc_ct_priv *ct_priv) if (!ct_priv) return; + destroy_workqueue(ct_priv->wq); chains = ct_priv->chains; ct_priv->fs_ops->destroy(ct_priv->fs); -- 2.35.1