From patchwork Tue Aug 10 03:59:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 494829 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.7 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 CCE5DC432BE for ; Tue, 10 Aug 2021 03:59:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ACC2C60F8F for ; Tue, 10 Aug 2021 03:59:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229527AbhHJEAE (ORCPT ); Tue, 10 Aug 2021 00:00:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:39170 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236861AbhHJD76 (ORCPT ); Mon, 9 Aug 2021 23:59:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E40A6601FF; Tue, 10 Aug 2021 03:59:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628567977; bh=44PF6o63SCsrucW40/EdEgb/r/j/twEpfG8aT4uLmRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VSSNXVWzoZ39k2JaL3cED2NJhsp1ot8NAUyNwpH1kbDeHF4NFtzUPuCK3YpY8rU6P E/9xg44SrDJnwsJLs1+tuT0y2FdbeXGOpzW5o+IpbisiHYlJy9VYfPsPGU/PTqGCc3 8y+xanPAe49u9kp6INrg/RNHnj2lbZFP6T++jzzoHNHn3sKZU97KAZ05w7wANxOlkT LwtDO9Ey9Ci8hq2QoTOrNosMZ5H/lGKu88nw7KndaOy9Ostdya+tEXw1iTOQ7GuERt fHGv5VrPLR4/ttlTVW0HKwU/Nd8+4eYcEKRPR1iRLIZuFdhsfK9JsoNsaJc2fSKUBL wFhnU4TGrDN5w== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Leon Romanovsky , Tariq Toukan , Alex Vesker , Yevgeny Kliteynik , Saeed Mahameed Subject: [net 02/12] net/mlx5: DR, Add fail on error check on decap Date: Mon, 9 Aug 2021 20:59:13 -0700 Message-Id: <20210810035923.345745-3-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210810035923.345745-1-saeed@kernel.org> References: <20210810035923.345745-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Alex Vesker While processing encapsulated packet on RX, one of the fields that is checked is the inner packet length. If the length as specified in the header doesn't match the actual inner packet length, the packet is invalid and should be dropped. However, such packet caused the NIC to hang. This patch turns on a 'fail_on_error' HW bit which allows HW to drop such an invalid packet while processing RX packet and trying to decap it. Fixes: ad17dc8cf910 ("net/mlx5: DR, Move STEv0 action apply logic") Signed-off-by: Alex Vesker Signed-off-by: Yevgeny Kliteynik Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c index f1950e4968da..e4dd4eed5aee 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c @@ -352,6 +352,7 @@ static void dr_ste_v0_set_rx_decap(u8 *hw_ste_p) { MLX5_SET(ste_rx_steering_mult, hw_ste_p, tunneling_action, DR_STE_TUNL_ACTION_DECAP); + MLX5_SET(ste_rx_steering_mult, hw_ste_p, fail_on_error, 1); } static void dr_ste_v0_set_rx_pop_vlan(u8 *hw_ste_p) @@ -365,6 +366,7 @@ static void dr_ste_v0_set_rx_decap_l3(u8 *hw_ste_p, bool vlan) MLX5_SET(ste_rx_steering_mult, hw_ste_p, tunneling_action, DR_STE_TUNL_ACTION_L3_DECAP); MLX5_SET(ste_modify_packet, hw_ste_p, action_description, vlan ? 1 : 0); + MLX5_SET(ste_rx_steering_mult, hw_ste_p, fail_on_error, 1); } static void dr_ste_v0_set_rewrite_actions(u8 *hw_ste_p, u16 num_of_actions, From patchwork Tue Aug 10 03:59: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: 494828 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.7 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 D5956C4320E for ; Tue, 10 Aug 2021 03:59:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC31C60FC4 for ; Tue, 10 Aug 2021 03:59:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231221AbhHJEAH (ORCPT ); Tue, 10 Aug 2021 00:00:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:39180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236867AbhHJD77 (ORCPT ); Mon, 9 Aug 2021 23:59:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 47CC261052; Tue, 10 Aug 2021 03:59:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628567977; bh=naoM1dRyqsHsxDaqJipg4c6whkoshpjM8OQkOLXzP7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h//u729giIjfYmlRhvLg3NqpTVfVggafR2GRHkrFv3PTZuebE660v4+wI3hMD7Q9W 1kTCYVBg9ClP3RP9+S9xin9XKFPuaCbFXEG40inUu7VJ8X/RONW+7ciBqo+O3ZSnps l87ywZKMUjPT7sE6qNl8JXoOSwZi7LF8nPpekyWaAIKjcfB9ODq+0/lg+4o+RkgYv8 u6t0aZijSQa/zWeV9DrvWLkRFX5QvCLAJjipVbEEsyMAcgkKk9hLWw77TZMcvt8nv7 X90nVehY/x736jAVFLBIdTDxfY03riNVnSlWIdv25Fz5WQ6EXxu74cSnnwk28oWDeR qd9X4T4PtUAlw== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Leon Romanovsky , Tariq Toukan , Roi Dayan , Maor Dickman , Saeed Mahameed Subject: [net 03/12] net/mlx5e: Avoid creating tunnel headers for local route Date: Mon, 9 Aug 2021 20:59:14 -0700 Message-Id: <20210810035923.345745-4-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210810035923.345745-1-saeed@kernel.org> References: <20210810035923.345745-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Roi Dayan It could be local and remote are on the same machine and the route result will be a local route which will result in creating encap id with src/dst mac address of 0. Fixes: a54e20b4fcae ("net/mlx5e: Add basic TC tunnel set action for SRIOV offloads") Signed-off-by: Roi Dayan Reviewed-by: Maor Dickman Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c index 8f79f04eccd6..1e2d117082d4 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c @@ -124,6 +124,11 @@ static int mlx5e_route_lookup_ipv4_get(struct mlx5e_priv *priv, if (IS_ERR(rt)) return PTR_ERR(rt); + if (rt->rt_type != RTN_UNICAST) { + ret = -ENETUNREACH; + goto err_rt_release; + } + if (mlx5_lag_is_multipath(mdev) && rt->rt_gw_family != AF_INET) { ret = -ENETUNREACH; goto err_rt_release; From patchwork Tue Aug 10 03:59: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: 494827 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.7 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 EDB01C4338F for ; Tue, 10 Aug 2021 03:59:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C5358601FF for ; Tue, 10 Aug 2021 03:59:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231229AbhHJEAO (ORCPT ); Tue, 10 Aug 2021 00:00:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:39224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236937AbhHJEAC (ORCPT ); Tue, 10 Aug 2021 00:00:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A114060FDA; Tue, 10 Aug 2021 03:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628567980; bh=+wwuvY9UNTFkgFQJ6yxAY8w5RaAndG1QQZuWlHDAfNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lHE+4MvJYttnQmA+ZnPQEdLk8xNM+vXnD0kFnAhX/6gqRVs3RJJyl0zJGa2gTwaEg hFQiUxVe4Ic3bGPJ+H8eDgfUHL/mjjt9uyQ2aJH15cFcKBSpLX5h5igaYSoFWimjAI 5sLqvOZAGlVS4XPpOWVbf6KpPnmUWtxkSgtX9xnzPzUVjre6ZcX1X64ItBXeSUp9kr aHDOn9pkINV+KEdOaIDeotWpUExOjpDAZ3pJvXSpWFHbr7se8Tq1V8iJnMwcLUEZ3Q aWbadWmlRszMerzrqpEDhJxV5ZC1VJ75+aNssCCu+RONapDYJv/k4aBvjSp9yRuFLS PKtKXtL65fRRw== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Leon Romanovsky , Tariq Toukan , Aya Levin , Moshe Shemesh , Saeed Mahameed Subject: [net 06/12] net/mlx5: Block switchdev mode while devlink traps are active Date: Mon, 9 Aug 2021 20:59:17 -0700 Message-Id: <20210810035923.345745-7-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210810035923.345745-1-saeed@kernel.org> References: <20210810035923.345745-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Aya Levin Since switchdev mode can't support devlink traps, verify there are no active devlink traps before moving eswitch to switchdev mode. If there are active traps, prevent the switchdev mode configuration. Fixes: eb3862a0525d ("net/mlx5e: Enable traps according to link state") Signed-off-by: Aya Levin Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed --- .../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 011e766e4f67..3bb71a186004 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -48,6 +48,7 @@ #include "lib/fs_chains.h" #include "en_tc.h" #include "en/mapping.h" +#include "devlink.h" #define mlx5_esw_for_each_rep(esw, i, rep) \ xa_for_each(&((esw)->offloads.vport_reps), i, rep) @@ -3001,12 +3002,19 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode, if (cur_mlx5_mode == mlx5_mode) goto unlock; - if (mode == DEVLINK_ESWITCH_MODE_SWITCHDEV) + if (mode == DEVLINK_ESWITCH_MODE_SWITCHDEV) { + if (mlx5_devlink_trap_get_num_active(esw->dev)) { + NL_SET_ERR_MSG_MOD(extack, + "Can't change mode while devlink traps are active"); + err = -EOPNOTSUPP; + goto unlock; + } err = esw_offloads_start(esw, extack); - else if (mode == DEVLINK_ESWITCH_MODE_LEGACY) + } else if (mode == DEVLINK_ESWITCH_MODE_LEGACY) { err = esw_offloads_stop(esw, extack); - else + } else { err = -EINVAL; + } unlock: mlx5_esw_unlock(esw); From patchwork Tue Aug 10 03:59: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: 494826 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.7 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 1BB8BC4338F for ; Tue, 10 Aug 2021 03:59:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0427E60FC4 for ; Tue, 10 Aug 2021 03:59:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236890AbhHJEAS (ORCPT ); Tue, 10 Aug 2021 00:00:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:39224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbhHJEAE (ORCPT ); Tue, 10 Aug 2021 00:00:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 02D6361052; Tue, 10 Aug 2021 03:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628567983; bh=eT944fd4u2ysauXwgMIKLI72gj8On/Rn0sX/Rce8NdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSBtat7MQb90C/j5M0/3klcoWJZoRNpLr4YAxM0UnfvDzz1yRJeQfpY0BWj4cs55t imvEJujoW4zASJrxC5Nf/HEq4hPMS4z+apbQCfK38jkvETqbBko+hI00oFiNCtgE9w OdObNjw0uwJ2mKnunElwG8vij0D4+VtbZ6LujhQaiEI2GV4yslIKFztFRu+aRNPBZp 7Gv13MYXG6jNKIz9nTMRXembJHw4uoTgqIoVbY+lLhOXhbgja1RwGJZ+Lrofe/5OU5 yvW2o+Kzn7VlyAYRYbw8GHcRG4WO1hNciVX6Ssxy5+DwZfySaPl/clJq2QB00biskX FXRGyQedxKnFw== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Leon Romanovsky , Tariq Toukan , Shay Drory , Parav Pandit , Saeed Mahameed Subject: [net 08/12] net/mlx5: Set all field of mlx5_irq before inserting it to the xarray Date: Mon, 9 Aug 2021 20:59:19 -0700 Message-Id: <20210810035923.345745-9-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210810035923.345745-1-saeed@kernel.org> References: <20210810035923.345745-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Shay Drory Currently irq->pool is set after the irq is insert to the xarray. Set irq->pool before the irq is inserted to the xarray. Fixes: 71e084e26414 ("net/mlx5: Allocating a pool of MSI-X vectors for SFs") Signed-off-by: Shay Drory Reviewed-by: Parav Pandit Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c index 95e60da33f03..7b923f6b5462 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c @@ -214,6 +214,7 @@ static struct mlx5_irq *irq_request(struct mlx5_irq_pool *pool, int i) err = -ENOMEM; goto err_cpumask; } + irq->pool = pool; kref_init(&irq->kref); irq->index = i; err = xa_err(xa_store(&pool->irqs, irq->index, irq, GFP_KERNEL)); @@ -222,7 +223,6 @@ static struct mlx5_irq *irq_request(struct mlx5_irq_pool *pool, int i) irq->index, err); goto err_xa; } - irq->pool = pool; return irq; err_xa: free_cpumask_var(irq->mask); From patchwork Tue Aug 10 03:59:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 494825 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.7 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 826C8C4338F for ; Tue, 10 Aug 2021 04:00:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 590DE60FC4 for ; Tue, 10 Aug 2021 04:00:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229649AbhHJEAV (ORCPT ); Tue, 10 Aug 2021 00:00:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:39264 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230008AbhHJEAG (ORCPT ); Tue, 10 Aug 2021 00:00:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 97CC561051; Tue, 10 Aug 2021 03:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628567985; bh=nfsLYVKii38KA1BX1DoKYDnd+mnbX1oLvbkjiAb5AVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hsgk1txF2UDFhIfNHQ+Mvqd01XXZAxYtyGnjkc0f1gVP7YNNYTAy1LqA+Pc5cHoKP 9Z8DHerqrnAIfG4WliCn7AQVnauUBoZSm0QcLlwto20WYlp2ziIueVczOAq+Zld56Z d8zaMm7hFQyppn7Y8K9j6OHd6dLOXG6VZ5//WHLapTenSHiCTc/MZ1bAxcslvOigNI 5XM9lU2XJZAK1kAWolz4UQY2mVas/0t8p6l90N4ZQ55B8Ekx6o6f4wNBYfvYs/HQNi +TbSid9yx/uCdiTpKO0fYv/MTNXynYczu4Zf4POo6NJrlueJtituo1eObmgwXF7bQL wgVGuWz99VTrg== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Leon Romanovsky , Tariq Toukan , Chris Mi , Oz Shlomo , Saeed Mahameed Subject: [net 10/12] net/mlx5e: TC, Fix error handling memory leak Date: Mon, 9 Aug 2021 20:59:21 -0700 Message-Id: <20210810035923.345745-11-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210810035923.345745-1-saeed@kernel.org> References: <20210810035923.345745-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Chris Mi Free the offload sample action on error. Fixes: f94d6389f6a8 ("net/mlx5e: TC, Add support to offload sample action") Signed-off-by: Chris Mi Reviewed-by: Oz Shlomo Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c index 794012c5c476..d3ad78aa9d45 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c @@ -501,6 +501,7 @@ mlx5_esw_sample_offload(struct mlx5_esw_psample *esw_psample, err_offload_rule: mlx5_esw_vporttbl_put(esw, &per_vport_tbl_attr); err_default_tbl: + kfree(sample_flow); return ERR_PTR(err); } From patchwork Tue Aug 10 03:59:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 494824 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.7 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 9DBE2C4320A for ; Tue, 10 Aug 2021 04:00:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8109E60FC4 for ; Tue, 10 Aug 2021 04:00:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236986AbhHJEAk (ORCPT ); Tue, 10 Aug 2021 00:00:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:39212 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231381AbhHJEAH (ORCPT ); Tue, 10 Aug 2021 00:00:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 076236105A; Tue, 10 Aug 2021 03:59:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628567986; bh=nvec1VkwFajkVSAfo8vrhwi/e1N3ORPhIZ1KaqKuLkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MK/8ui+JbUqKYt7fXYu6M7POabhYy4D02wNZT8RUIR5WMfR/wrXE0QkhnZGR2Ja9P jBv9YlpV6av21WmKyn8wHuba27vaE4SdzVqggaeRswQECPEvYZ4Ovd/729xgrlriy8 Dz8SQWvjUby4eQJZKjNpnLQ8oqOOLwKrcNMhdSLuKBDA2drAduFRfnhxBXO1KPjQi8 ZZvNOACrf2SezqvhIBpVKOtH3x1op+yL6Gs6HPzuvyqUJ+HR6gV0yfg4kfU0Mynlte OInfYBntH83EHqVejil7e7I/kmNxXxn0jyC6QsyKQ8CosVAFKc9C6Fac0Fz6P9h7Jp mm3x10Cch7vQw== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Leon Romanovsky , Tariq Toukan , Aya Levin , Moshe Shemesh , Saeed Mahameed Subject: [net 12/12] net/mlx5: Fix return value from tracer initialization Date: Mon, 9 Aug 2021 20:59:23 -0700 Message-Id: <20210810035923.345745-13-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210810035923.345745-1-saeed@kernel.org> References: <20210810035923.345745-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Aya Levin Check return value of mlx5_fw_tracer_start(), set error path and fix return value of mlx5_fw_tracer_init() accordingly. Fixes: c71ad41ccb0c ("net/mlx5: FW tracer, events handling") Signed-off-by: Aya Levin Reviewed-by: Moshe Shemesh Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 01a1d02dcf15..3f8a98093f8c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c @@ -1019,12 +1019,19 @@ int mlx5_fw_tracer_init(struct mlx5_fw_tracer *tracer) MLX5_NB_INIT(&tracer->nb, fw_tracer_event, DEVICE_TRACER); mlx5_eq_notifier_register(dev, &tracer->nb); - mlx5_fw_tracer_start(tracer); - + err = mlx5_fw_tracer_start(tracer); + if (err) { + mlx5_core_warn(dev, "FWTracer: Failed to start tracer %d\n", err); + goto err_notifier_unregister; + } return 0; +err_notifier_unregister: + mlx5_eq_notifier_unregister(dev, &tracer->nb); + mlx5_core_destroy_mkey(dev, &tracer->buff.mkey); err_dealloc_pd: mlx5_core_dealloc_pd(dev, tracer->buff.pdn); + cancel_work_sync(&tracer->read_fw_strings_work); return err; }