From patchwork Tue Sep 7 21:24:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 12479369 X-Patchwork-Delegate: kuba@kernel.org 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=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 0344CC4332F for ; Tue, 7 Sep 2021 21:24:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D7A8B61090 for ; Tue, 7 Sep 2021 21:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348176AbhIGVZj (ORCPT ); Tue, 7 Sep 2021 17:25:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:37582 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348226AbhIGVZf (ORCPT ); Tue, 7 Sep 2021 17:25:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 376DD610C9; Tue, 7 Sep 2021 21:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631049868; bh=PAjkbyu15bkNT/69g6APeG9o5VRLRWREkwk28axDThI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KhAu1AlY9b79I/ieEJPOI/dvltwgfPEt/a3HJDMzROmikM/6NChZ4eqtWu3RtaCRY 4SZ+FXezxhBopTWVSaMciLeayPnk7Wy1MgC4xP55GFt2PC2Kdm+pXQjBhvwwuNybSq D2jwG4lfD9gwWTdGeK7znkLyvNY6WNDogdmSBrbA4HST9xia4FS8TYKvMlvP3T5cho KI80TxUatuI3Pty6VhW8P2O56xqr3xDd4EXlHNJN1hh8htMr0IJ5iKlie5mzyaScGf 5uvQ6IOkKeWBJ+IEOwKuPWyFuAJOnIpyDWgA4YW4Wv3nX8YQpKk+cqQstacaAjPjj0 4lKiaxOwTHeFA== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Vlad Buslov , Colin King , Tim Gardner , Naresh Kamboju , linux-kernel@vger.kernel.org, Saeed Mahameed Subject: [net 1/7] net/mlx5: Bridge, fix uninitialized variable usage Date: Tue, 7 Sep 2021 14:24:14 -0700 Message-Id: <20210907212420.28529-2-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210907212420.28529-1-saeed@kernel.org> References: <20210907212420.28529-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Vlad Buslov In some conditions variable 'err' is not assigned with value in mlx5_esw_bridge_port_obj_attr_set() and mlx5_esw_bridge_port_changeupper() functions after recent changes to support LAG. Initialize the variable with zero value in both cases. Reported-by: Colin King Reported-by: Tim Gardner Reported-by: Naresh Kamboju CC: linux-kernel@vger.kernel.org Fixes: ff9b7521468b ("net/mlx5: Bridge, support LAG") Signed-off-by: Vlad Buslov Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c index 0c38c2e319be..b5ddaa82755f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c @@ -137,7 +137,7 @@ static int mlx5_esw_bridge_port_changeupper(struct notifier_block *nb, void *ptr u16 vport_num, esw_owner_vhca_id; struct netlink_ext_ack *extack; int ifindex = upper->ifindex; - int err; + int err = 0; if (!netif_is_bridge_master(upper)) return 0; @@ -244,7 +244,7 @@ mlx5_esw_bridge_port_obj_attr_set(struct net_device *dev, struct netlink_ext_ack *extack = switchdev_notifier_info_to_extack(&port_attr_info->info); const struct switchdev_attr *attr = port_attr_info->attr; u16 vport_num, esw_owner_vhca_id; - int err; + int err = 0; if (!mlx5_esw_bridge_lower_rep_vport_num_vhca_id_get(dev, br_offloads->esw, &vport_num, &esw_owner_vhca_id)) From patchwork Tue Sep 7 21:24:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 12479367 X-Patchwork-Delegate: kuba@kernel.org 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=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 D6239C433F5 for ; Tue, 7 Sep 2021 21:24:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B764661090 for ; Tue, 7 Sep 2021 21:24:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348486AbhIGVZi (ORCPT ); Tue, 7 Sep 2021 17:25:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:37596 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348298AbhIGVZf (ORCPT ); Tue, 7 Sep 2021 17:25:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C59DD600D0; Tue, 7 Sep 2021 21:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631049869; bh=myKpKcNYGnXfNj/5egsbb6+3N8jw5BxNBdyS+Rup2T8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r35W435KeoUBg7HCV8jLU/686WK150Qti+CYYkrzJzQoh6jEPhi7ZtlmBbG8S6dLV BoY2bKgYQXdsVYu/9VVVDlCjmxUnQ9rRvLVndi2miCPB0jD5Dso2KalMoiw5bTGbb+ S6YTn5eX55MPS1lKef0TTgOpMdkHFx00HPiPzdBLwag8pX4k4kDN3QDxSGvTpm3d2i xF9ghHX7QddXzJ0QJXzC9VLYSgMAeq9BnFtqihnWfz8X9E5vkcJ0aZpfxBPisl9hqJ GkwQyECGVvsYGBMOG26JEnelulyof0WYpc1g4/rr0+W0oth6iDzTI+uECbGYdh9Byi Wt299xKfleWKA== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Parav Pandit , Shay Drory , Saeed Mahameed Subject: [net 2/7] net/mlx5: Fix rdma aux device on devlink reload Date: Tue, 7 Sep 2021 14:24:15 -0700 Message-Id: <20210907212420.28529-3-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210907212420.28529-1-saeed@kernel.org> References: <20210907212420.28529-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Parav Pandit RDMA auxdev parameter registration was skipped for eswitch manager PCI PF. Due to this when devlink parameter is read, it reads as false in below code flow. $ devlink dev reload pci/0000:06:00.0 devlink_reload() mlx5_load_one() mlx5_attach_device() is_ib_enabled() devlink_param_driverinit_value_get() Due to this, is_ib_enabled() returns false for the RDMA auxiliary device. This results into a skipping RDMA auxiliary device creation on reload. There is no need to check for eswitch manager capability to support RDMA auxiliary device. Hence, fix it by skipping eswitch manager capability. Fixes: 87158cedf00e ("net/mlx5: Support enable_rdma devlink dev param") Signed-off-by: Parav Pandit Reviewed-by: Shay Drory Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c index e84287ffc7ce..dcf9f27ba2ef 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c @@ -658,11 +658,10 @@ static const struct devlink_param enable_rdma_param = static int mlx5_devlink_rdma_param_register(struct devlink *devlink) { - struct mlx5_core_dev *dev = devlink_priv(devlink); union devlink_param_value value; int err; - if (!IS_ENABLED(CONFIG_MLX5_INFINIBAND) || MLX5_ESWITCH_MANAGER(dev)) + if (!IS_ENABLED(CONFIG_MLX5_INFINIBAND)) return 0; err = devlink_param_register(devlink, &enable_rdma_param); @@ -679,9 +678,7 @@ static int mlx5_devlink_rdma_param_register(struct devlink *devlink) static void mlx5_devlink_rdma_param_unregister(struct devlink *devlink) { - struct mlx5_core_dev *dev = devlink_priv(devlink); - - if (!IS_ENABLED(CONFIG_MLX5_INFINIBAND) || MLX5_ESWITCH_MANAGER(dev)) + if (!IS_ENABLED(CONFIG_MLX5_INFINIBAND)) return; devlink_param_unpublish(devlink, &enable_rdma_param); From patchwork Tue Sep 7 21:24:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 12479371 X-Patchwork-Delegate: kuba@kernel.org 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=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 2CC70C433F5 for ; Tue, 7 Sep 2021 21:24:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D4146109D for ; Tue, 7 Sep 2021 21:24:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348733AbhIGVZl (ORCPT ); Tue, 7 Sep 2021 17:25:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:37646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348325AbhIGVZg (ORCPT ); Tue, 7 Sep 2021 17:25:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4B54B61151; Tue, 7 Sep 2021 21:24:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631049869; bh=Hew74U7GpmfcRZXgkKrDNFf6XZrY2RoCliwDnX+TIvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RJhPGIXI4xRy4vqnHDCaM0eP73tInargL78OuH6jGwZgu8ZbG8DZuC8FrKA1+ZkKu sYgGzMCvQ17E++3IrL3ev8uAwrMWg7xTIJtN6yuVfKl3gkNE2zDvC+fZ1U9T4hp4/R 4E1ctNpmK7EfBASZ2P+1Ts2KFAKXwr34VwZ/OfD53ZpmIDp9Pi8J/gsfDrcvLGxtYx PruP/ZCjK27f/3/kZWkOXAUL7UIoJy05+NZMGYf/M8vb66y+jG2U99aBUecXEij1g3 C++lsaC3uwI2OcHjEM8w0E5hIfIZY0w6HIvBgOb51YscUHtt5EZbNdYKYwlO0HVYOC 4tphsDqQOXnCg== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Mark Bloch , Maor Gottlieb , Leon Romanovsky , Saeed Mahameed Subject: [net 3/7] net/mlx5: Lag, don't update lag if lag isn't supported Date: Tue, 7 Sep 2021 14:24:16 -0700 Message-Id: <20210907212420.28529-4-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210907212420.28529-1-saeed@kernel.org> References: <20210907212420.28529-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Mark Bloch In NICs that don't support LAG, the LAG control structure won't be allocated. If it wasn't allocated it means LAG doesn't exists and can be skipped. Fixes: cac1eb2cf2e3 ("net/mlx5: Lag, properly lock eswitch if needed") Signed-off-by: Mark Bloch Reviewed-by: Maor Gottlieb Reviewed-by: Leon Romanovsky Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/lag.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag.c index 49ca57c6d31d..ca5690b0a7ab 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag.c @@ -927,9 +927,12 @@ void mlx5_lag_disable_change(struct mlx5_core_dev *dev) struct mlx5_core_dev *dev1; struct mlx5_lag *ldev; + ldev = mlx5_lag_dev(dev); + if (!ldev) + return; + mlx5_dev_list_lock(); - ldev = mlx5_lag_dev(dev); dev0 = ldev->pf[MLX5_LAG_P1].dev; dev1 = ldev->pf[MLX5_LAG_P2].dev; @@ -946,8 +949,11 @@ void mlx5_lag_enable_change(struct mlx5_core_dev *dev) { struct mlx5_lag *ldev; - mlx5_dev_list_lock(); ldev = mlx5_lag_dev(dev); + if (!ldev) + return; + + mlx5_dev_list_lock(); ldev->mode_changes_in_progress--; mlx5_dev_list_unlock(); mlx5_queue_bond_work(ldev, 0); From patchwork Tue Sep 7 21:24:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 12479375 X-Patchwork-Delegate: kuba@kernel.org 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=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 52F46C433F5 for ; Tue, 7 Sep 2021 21:24:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3745461090 for ; Tue, 7 Sep 2021 21:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234972AbhIGVZs (ORCPT ); Tue, 7 Sep 2021 17:25:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:37668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347247AbhIGVZg (ORCPT ); Tue, 7 Sep 2021 17:25:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D738D61130; Tue, 7 Sep 2021 21:24:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631049870; bh=pFCQ+FRkZbr1qRhGa4oabcBHLAxXb/EWSj9Ty+3xSg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H1em3rVXXvAmVv+9zJShdVSa9ET++4Y+G2xE0S45keVxcMpB8NN37Nl2tciNqt2RB fZMutUD+/bRWogsoJmMLbK4GtzvVV/DUpeS6HuuEMktKmO+A5cxPmiH9YMZwGKwrxN E3ng9Ks4JIbPCFsGfjx632gxltrYvZ6FR7tKtCR9Uy86LDwnIHaLktBFfVNDurUwZJ mPul//079ntf9zwxSgVJl1CjmLVqqaO2S6eHLnoCzSRYZo2D90sssD7yBySJlzx3Qj CIo6WMjoFxHUHJMMfVqzYy0iA6YMY6VmvnuILb8FAIr33Q2qndNgc1Nqe4I1eHq84n 0rFqbMNmpFYig== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Saeed Mahameed , Pavel Machek , Aya Levin Subject: [net 4/7] net/mlx5: FWTrace, cancel work on alloc pd error flow Date: Tue, 7 Sep 2021 14:24:17 -0700 Message-Id: <20210907212420.28529-5-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210907212420.28529-1-saeed@kernel.org> References: <20210907212420.28529-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Saeed Mahameed Handle error flow on mlx5_core_alloc_pd() failure, read_fw_strings_work must be canceled. Fixes: c71ad41ccb0c ("net/mlx5: FW tracer, events handling") Reported-by: Pavel Machek (CIP) Suggested-by: Pavel Machek (CIP) Signed-off-by: Saeed Mahameed Reviewed-by: Aya Levin Reviewed-by: Pavel Machek (CIP) --- drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c index 3f8a98093f8c..f9cf9fb31547 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c @@ -1007,7 +1007,7 @@ int mlx5_fw_tracer_init(struct mlx5_fw_tracer *tracer) err = mlx5_core_alloc_pd(dev, &tracer->buff.pdn); if (err) { mlx5_core_warn(dev, "FWTracer: Failed to allocate PD %d\n", err); - return err; + goto err_cancel_work; } err = mlx5_fw_tracer_create_mkey(tracer); @@ -1031,6 +1031,7 @@ int mlx5_fw_tracer_init(struct mlx5_fw_tracer *tracer) mlx5_core_destroy_mkey(dev, &tracer->buff.mkey); err_dealloc_pd: mlx5_core_dealloc_pd(dev, tracer->buff.pdn); +err_cancel_work: cancel_work_sync(&tracer->read_fw_strings_work); return err; } From patchwork Tue Sep 7 21:24:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 12479373 X-Patchwork-Delegate: kuba@kernel.org 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=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 E6CCFC433EF for ; Tue, 7 Sep 2021 21:24:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D052C6109D for ; Tue, 7 Sep 2021 21:24:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348869AbhIGVZr (ORCPT ); Tue, 7 Sep 2021 17:25:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:37646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348373AbhIGVZh (ORCPT ); Tue, 7 Sep 2021 17:25:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 53CC761090; Tue, 7 Sep 2021 21:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631049870; bh=xfKb0TFSt7+jKKF/ohyaySpSk7pyyTIJ+oDaVr2ZNgo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ljj/lDL+RbRSwr3yGCI7SM+Ah5J6E1YaBKIkauxzUplMETWX1WMjHqzTJRqb62NsQ pccFCU+E5RhMCGXHWzaP0az+smR4BYXll2Mx76FH+So3QMG8cUfLchbbTwoCF8VIOd de5nSP1OW9ocQWOSIZ5T6N3KH3zwB7bwutoINqLeXipVJTJRPFGJukRl2RKExHoxP2 o6UKhJwxp9k58+1doIKQPFhgnS6VvYqfrNw6vFlMLHSPrVPWyLnP/fTGPpTric/vWi avLuGrGxrJrgZaGImvhvxhWi2CsmwasKBJ1geQKCWbWWsbyo/vhb2u8f8DQlnmHnFq TFJd75VVaOGPg== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Maor Gottlieb , Dan Carpenter , Saeed Mahameed Subject: [net 5/7] net/mlx5: Fix potential sleeping in atomic context Date: Tue, 7 Sep 2021 14:24:18 -0700 Message-Id: <20210907212420.28529-6-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210907212420.28529-1-saeed@kernel.org> References: <20210907212420.28529-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Maor Gottlieb Fixes the below flow of sleeping in atomic context by releasing the RCU lock before calling to free_match_list. build_match_list() <- disables preempt -> free_match_list() -> tree_put_node() -> down_write_ref_node() <- take write lock Fixes: 693c6883bbc4 ("net/mlx5: Add hash table for flow groups in flow table") Reported-by: Dan Carpenter Signed-off-by: Maor Gottlieb Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index 9fe8e3c204d6..fe501ba88bea 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -1682,14 +1682,13 @@ static int build_match_list(struct match_list *match_head, curr_match = kmalloc(sizeof(*curr_match), GFP_ATOMIC); if (!curr_match) { + rcu_read_unlock(); free_match_list(match_head, ft_locked); - err = -ENOMEM; - goto out; + return -ENOMEM; } curr_match->g = g; list_add_tail(&curr_match->list, &match_head->list); } -out: rcu_read_unlock(); return err; } From patchwork Tue Sep 7 21:24:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 12479377 X-Patchwork-Delegate: kuba@kernel.org 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=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 07EAFC433FE for ; Tue, 7 Sep 2021 21:24:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E41E7610C9 for ; Tue, 7 Sep 2021 21:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348375AbhIGVZt (ORCPT ); Tue, 7 Sep 2021 17:25:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:37696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347975AbhIGVZh (ORCPT ); Tue, 7 Sep 2021 17:25:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C302161102; Tue, 7 Sep 2021 21:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631049871; bh=Jwk1LNzAVlL/9CyoU3tfZPH2fIplD/6bGF2mPYtfIWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KEMeUjtwTuLJ6r6nf9p63fl0+Cvb2y8R4H9/a4ssbloHoUP6FZerUw8U8U6asAypp clVUM+Z7h1IeecYjdpmnf0JIlw/nxAnViu6SBOVnugZMv6XEpXa1GCDox9FD91MwHh R2PtzJSBQdIfvdnOMm6WhNefClSaF6SqKxDg+HfYsev/sTxpyVbX1Ltm/5m7vFI065 rvXAfCg6eQB4Po9h+cTshWkknYnyVyqHYQYmeFe920hR7tPl78lRov3Dzr+Aiqajz5 8saG4iIUb5CxLqsjCb+EXFr9tNhlHXUst01nUKMEcHBs5H0ZWnS6MgrHf3Fcc0eH4Q VBu0QvSXgvrYw== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Aya Levin , Moshe Shemesh , Saeed Mahameed Subject: [net 6/7] net/mlx5e: Fix mutual exclusion between CQE compression and HW TS Date: Tue, 7 Sep 2021 14:24:19 -0700 Message-Id: <20210907212420.28529-7-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210907212420.28529-1-saeed@kernel.org> References: <20210907212420.28529-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Aya Levin Some profiles of the driver don't support a dedicated PTP-RQ, hence can't support HW TS and CQE compression simultaneously. When HW TS is enabled the COE compression is disabled, and should be restored when the HW TS is turned off. Add rx_filter as an input to modifying CQE compression to enforce this restriction. Fixes: 256f79d13c1d ("net/mlx5e: Fix HW TS with CQE compression according to profile") Signed-off-by: Aya Levin Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 11 ++++++----- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 669a75f3537a..7b8c8187543a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -922,7 +922,7 @@ void mlx5e_set_rx_mode_work(struct work_struct *work); int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr); int mlx5e_hwstamp_get(struct mlx5e_priv *priv, struct ifreq *ifr); -int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool val); +int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool val, bool rx_filter); int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto, u16 vid); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 2cfd12953909..306fb5d6a36d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -1884,7 +1884,7 @@ static int set_pflag_rx_cqe_based_moder(struct net_device *netdev, bool enable) return set_pflag_cqe_based_moder(netdev, enable, true); } -int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val) +int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val, bool rx_filter) { bool curr_val = MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_COMPRESS); struct mlx5e_params new_params; @@ -1896,8 +1896,7 @@ int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val if (curr_val == new_val) return 0; - if (new_val && !priv->profile->rx_ptp_support && - priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE) { + if (new_val && !priv->profile->rx_ptp_support && rx_filter) { netdev_err(priv->netdev, "Profile doesn't support enabling of CQE compression while hardware time-stamping is enabled.\n"); return -EINVAL; @@ -1905,7 +1904,7 @@ int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val new_params = priv->channels.params; MLX5E_SET_PFLAG(&new_params, MLX5E_PFLAG_RX_CQE_COMPRESS, new_val); - if (priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE) + if (rx_filter) new_params.ptp_rx = new_val; if (new_params.ptp_rx == priv->channels.params.ptp_rx) @@ -1928,12 +1927,14 @@ static int set_pflag_rx_cqe_compress(struct net_device *netdev, { struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5_core_dev *mdev = priv->mdev; + bool rx_filter; int err; if (!MLX5_CAP_GEN(mdev, cqe_compression)) return -EOPNOTSUPP; - err = mlx5e_modify_rx_cqe_compression_locked(priv, enable); + rx_filter = priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE; + err = mlx5e_modify_rx_cqe_compression_locked(priv, enable, rx_filter); if (err) return err; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 47efd858964d..3fd515e7bf30 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3554,14 +3554,14 @@ static int mlx5e_hwstamp_config_no_ptp_rx(struct mlx5e_priv *priv, bool rx_filte if (!rx_filter) /* Reset CQE compression to Admin default */ - return mlx5e_modify_rx_cqe_compression_locked(priv, rx_cqe_compress_def); + return mlx5e_modify_rx_cqe_compression_locked(priv, rx_cqe_compress_def, false); if (!MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_COMPRESS)) return 0; /* Disable CQE compression */ netdev_warn(priv->netdev, "Disabling RX cqe compression\n"); - err = mlx5e_modify_rx_cqe_compression_locked(priv, false); + err = mlx5e_modify_rx_cqe_compression_locked(priv, false, true); if (err) netdev_err(priv->netdev, "Failed disabling cqe compression err=%d\n", err); From patchwork Tue Sep 7 21:24:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 12479379 X-Patchwork-Delegate: kuba@kernel.org 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=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 545F2C433EF for ; Tue, 7 Sep 2021 21:24:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3AA75610C9 for ; Tue, 7 Sep 2021 21:24:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345613AbhIGVZv (ORCPT ); Tue, 7 Sep 2021 17:25:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:37718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348393AbhIGVZi (ORCPT ); Tue, 7 Sep 2021 17:25:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 41C8461104; Tue, 7 Sep 2021 21:24:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631049871; bh=VfUqhtbPGXtwFIwhDWKRb7VjcBd409QOqHQzoGa6gMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zmn+toGdm1ZFk//hbG9rYeqHJ1T+Emnpmu6lfMi0yw/LEeujzvDZgIWy3t8oExB2K nSmYMW/OlqQ70chMmHR5nZVxiJ4nrCFmFKpfRKgvqTQXWhkGMz2hKh3DRJbxFB9RbA booCMoGozTnQIVghzRHSDXiFQvev8j9HtiwIh/c+KhM+kvF3hW3ShcZpu0rMk7qI5P VyYas3urM0JNCYm31tnAFPnLAw2m7yax2GNKkUvLJJYMapc9naMI/jeVtovz8sIzuW scbO5Rrcp6ZD8+8qCUFO8mNKqUDEtjUOgM88ql+4PkR0S182kUFnQ4+FbfbvrdZQ/K LnxqUXEGnjQ4g== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Aya Levin , Tariq Toukan , Saeed Mahameed Subject: [net 7/7] net/mlx5e: Fix condition when retrieving PTP-rqn Date: Tue, 7 Sep 2021 14:24:20 -0700 Message-Id: <20210907212420.28529-8-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210907212420.28529-1-saeed@kernel.org> References: <20210907212420.28529-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Aya Levin When activating the PTP-RQ, redirect the RQT from drop-RQ to PTP-RQ. Use mlx5e_channels_get_ptp_rqn to retrieve the rqn. This helper returns a boolean (not status), hence caller should consider return value 0 as a fail. Change the caller interpretation of the return value. Fixes: 43ec0f41fa73 ("net/mlx5e: Hide all implementation details of mlx5e_rx_res") Signed-off-by: Aya Levin Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c index bf0313e2682b..13056cb9757d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c @@ -572,7 +572,7 @@ void mlx5e_rx_res_channels_activate(struct mlx5e_rx_res *res, struct mlx5e_chann if (res->features & MLX5E_RX_RES_FEATURE_PTP) { u32 rqn; - if (mlx5e_channels_get_ptp_rqn(chs, &rqn)) + if (!mlx5e_channels_get_ptp_rqn(chs, &rqn)) rqn = res->drop_rqn; err = mlx5e_rqt_redirect_direct(&res->ptp.rqt, rqn);