From patchwork Tue Mar 21 21:11:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13183282 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53D1BC6FD20 for ; Tue, 21 Mar 2023 21:11:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229694AbjCUVLt (ORCPT ); Tue, 21 Mar 2023 17:11:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229995AbjCUVLn (ORCPT ); Tue, 21 Mar 2023 17:11:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 041D257D2A for ; Tue, 21 Mar 2023 14:11:38 -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 87CC161E66 for ; Tue, 21 Mar 2023 21:11:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4073C4339B; Tue, 21 Mar 2023 21:11:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679433098; bh=pIhC+wN//VpouPQGilyH5C1ONH0jjEIyD6jJQQyaz1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mf/HccwMV/Doa7hHUiEKGWC3PJh/vRKXwSYoLq9pJnnecmnkBv7uMVl2NHWuCX+qP sr1scZ+FagW7oTBemRC908270HCjogjVoIhVs42HCw9dTkWUAsVzy6qhMqlJuyx6KX AjXHrIFUiWHV6Ne0ZEe7nf252nT5Qs+HsbsEzBgGcI9x/RG0zFZOT0D2RTvveXG0E2 zohpPP/pzI44B5YjxBX9WXecnqWdHhHspfyxduFIXU6QLT2lMh9m2W0vjTp4EhXg/Y DRgGGq7haJEzti/JqMo4W3lGOybsxbsMkPYMEW8uYy9/XzUjCkutJPpeSRoUHGXE/Q aLR35za71YgXQ== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gavin Li , Gavi Teitz Subject: [net 1/7] net/mlx5e: Set uplink rep as NETNS_LOCAL Date: Tue, 21 Mar 2023 14:11:29 -0700 Message-Id: <20230321211135.47711-2-saeed@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321211135.47711-1-saeed@kernel.org> References: <20230321211135.47711-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: Gavin Li Previously, NETNS_LOCAL was not set for uplink representors, inconsistent with VF representors, and allowed the uplink representor to be moved between net namespaces and separated from the VF representors it shares the core device with. Such usage would break the isolation model of namespaces, as devices in different namespaces would have access to shared memory. To solve this issue, set NETNS_LOCAL for uplink representors if eswitch is in switchdev mode. Fixes: 7a9fb35e8c3a ("net/mlx5e: Do not reload ethernet ports when changing eswitch mode") Signed-off-by: Gavin Li Reviewed-by: Gavi Teitz Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index a7f2ab22cc40..7ca7e9b57607 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -4150,8 +4150,12 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev, } } - if (mlx5e_is_uplink_rep(priv)) + if (mlx5e_is_uplink_rep(priv)) { features = mlx5e_fix_uplink_rep_features(netdev, features); + features |= NETIF_F_NETNS_LOCAL; + } else { + features &= ~NETIF_F_NETNS_LOCAL; + } mutex_unlock(&priv->state_lock); From patchwork Tue Mar 21 21:11:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13183281 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0143C76195 for ; Tue, 21 Mar 2023 21:11:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229937AbjCUVLs (ORCPT ); Tue, 21 Mar 2023 17:11:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229984AbjCUVLn (ORCPT ); Tue, 21 Mar 2023 17:11:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF035580C0 for ; Tue, 21 Mar 2023 14:11:41 -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 ams.source.kernel.org (Postfix) with ESMTPS id F2144B81A37 for ; Tue, 21 Mar 2023 21:11:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A80E5C433D2; Tue, 21 Mar 2023 21:11:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679433098; bh=hdyQe9x7dF+xrU8LmN7+GAcqHMHdWV3iQayBwLQk93A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lRPfPrTW2nwI0q66YHR6JWt1jF8jBnm/Q3EUuSI8tok6TVPET9zRX7Fl3C7jtvwKK plKCSOfnlZC09rmvZeGCVVzSL/vDPzOquRzJzi6xlUAdEyB19phhgxuBj7aplNMFMs hYwzFKOdMxF4aptXIVNcf3iJtzc10UnHttU7t0UThM3XZrhyohPbB7kVTerx/iaiLj AL5JOtObpbeX3qEOVKgkSY/Pgj3wpvvE1anb4TndjQ85fiDQxzKRojLssuj8IZ9/Fb jrMd8XBokYV+Tba7NOFa+dtorlSI39kxVEdaLTtUQ3581PZf2uO3K29hQtrsTF6XQQ UafKJRve9z1iw== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gavin Li , Gavi Teitz Subject: [net 2/7] net/mlx5e: Block entering switchdev mode with ns inconsistency Date: Tue, 21 Mar 2023 14:11:30 -0700 Message-Id: <20230321211135.47711-3-saeed@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321211135.47711-1-saeed@kernel.org> References: <20230321211135.47711-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: Gavin Li Upon entering switchdev mode, VF/SF representors are spawned in the devlink instance's net namespace, whereas the PF net device transforms into the uplink representor, remaining in the net namespace the PF net device was in. Therefore, if a PF net device's namespace is different from its parent devlink net namespace, entering switchdev mode can create an illegal situation where all representors sharing the same core device are NOT in the same net namespace. To avoid this issue, block entering switchdev mode for devices whose child netdev net namespace has diverged from the parent devlink's. Fixes: 7768d1971de6 ("net/mlx5: E-Switch, Add control for encapsulation") Signed-off-by: Gavin Li Reviewed-by: Gavi Teitz Signed-off-by: Saeed Mahameed --- .../mellanox/mlx5/core/eswitch_offloads.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 22075943bb58..25a8076a77bf 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -3405,6 +3405,18 @@ static int esw_inline_mode_to_devlink(u8 mlx5_mode, u8 *mode) return 0; } +static bool esw_offloads_devlink_ns_eq_netdev_ns(struct devlink *devlink) +{ + struct net *devl_net, *netdev_net; + struct mlx5_eswitch *esw; + + esw = mlx5_devlink_eswitch_get(devlink); + netdev_net = dev_net(esw->dev->mlx5e_res.uplink_netdev); + devl_net = devlink_net(devlink); + + return net_eq(devl_net, netdev_net); +} + int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode, struct netlink_ext_ack *extack) { @@ -3419,6 +3431,13 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode, if (esw_mode_from_devlink(mode, &mlx5_mode)) return -EINVAL; + if (mode == DEVLINK_ESWITCH_MODE_SWITCHDEV && + !esw_offloads_devlink_ns_eq_netdev_ns(devlink)) { + NL_SET_ERR_MSG_MOD(extack, + "Can't change E-Switch mode to switchdev when netdev net namespace has diverged from the devlink's."); + return -EPERM; + } + mlx5_lag_disable_change(esw->dev); err = mlx5_esw_try_lock(esw); if (err < 0) { From patchwork Tue Mar 21 21:11:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13183283 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE68FC6FD1D for ; Tue, 21 Mar 2023 21:11:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbjCUVLv (ORCPT ); Tue, 21 Mar 2023 17:11:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbjCUVLn (ORCPT ); Tue, 21 Mar 2023 17:11:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B2EE580C9 for ; Tue, 21 Mar 2023 14:11:42 -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 ams.source.kernel.org (Postfix) with ESMTPS id B84D5B81A38 for ; Tue, 21 Mar 2023 21:11:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FD11C4339C; Tue, 21 Mar 2023 21:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679433099; bh=Twx5nMntdov5Sr5FRJHNDHqm4xHonNtpjb3YVJp2yWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qyLIxgCv2JOb/igWthzKRu6YA41NS7FlUdrknZLDROEXVn55l3HF17GU/aMNoWL1A PIxMoFWH6BeaBdtsnNe/Nwq0lcoHmhY25ramZw+sJ0yF8OJF1t8ZhEFLte+IQRMP6p vC59JT0wo6L2OBCQj1ak2iUtO0SPl2+gXZ7JZn0zKQgsAJIxj4YFJRwgniBKX68DUS Qk/pbCY8CZO/k6OGFvgxJ3toor3/dpWyMx9POSu2A6GnNVdY5fhX6ohD8/pItEVhMl gbq4/ORdRMZgj5zuj7i7Ld7RNfZcMxw+cwH0TQ3IFJio0tR5d/Goz0X4RocSEKdr0e g/SNyvFNsMOjA== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Lama Kayal , Huy Nguyen , Maor Dickman Subject: [net 3/7] net/mlx5: Fix steering rules cleanup Date: Tue, 21 Mar 2023 14:11:31 -0700 Message-Id: <20230321211135.47711-4-saeed@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321211135.47711-1-saeed@kernel.org> References: <20230321211135.47711-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: Lama Kayal vport's mc, uc and multicast rules are not deleted in teardown path when EEH happens. Since the vport's promisc settings(uc, mc and all) in firmware are reset after EEH, mlx5 driver will try to delete the above rules in the initialization path. This cause kernel crash because these software rules are no longer valid. Fix by nullifying these rules right after delete to avoid accessing any dangling pointers. Call Trace: __list_del_entry_valid+0xcc/0x100 (unreliable) tree_put_node+0xf4/0x1b0 [mlx5_core] tree_remove_node+0x30/0x70 [mlx5_core] mlx5_del_flow_rules+0x14c/0x1f0 [mlx5_core] esw_apply_vport_rx_mode+0x10c/0x200 [mlx5_core] esw_update_vport_rx_mode+0xb4/0x180 [mlx5_core] esw_vport_change_handle_locked+0x1ec/0x230 [mlx5_core] esw_enable_vport+0x130/0x260 [mlx5_core] mlx5_eswitch_enable_sriov+0x2a0/0x2f0 [mlx5_core] mlx5_device_enable_sriov+0x74/0x440 [mlx5_core] mlx5_load_one+0x114c/0x1550 [mlx5_core] mlx5_pci_resume+0x68/0xf0 [mlx5_core] eeh_report_resume+0x1a4/0x230 eeh_pe_dev_traverse+0x98/0x170 eeh_handle_normal_event+0x3e4/0x640 eeh_handle_event+0x4c/0x370 eeh_event_handler+0x14c/0x210 kthread+0x168/0x1b0 ret_from_kernel_thread+0x5c/0x84 Fixes: a35f71f27a61 ("net/mlx5: E-Switch, Implement promiscuous rx modes vf request handling") Signed-off-by: Huy Nguyen Signed-off-by: Lama Kayal Reviewed-by: Tariq Toukan Reviewed-by: Maor Dickman Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 0f052513fefa..8bdf28762f41 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -959,6 +959,7 @@ void mlx5_esw_vport_disable(struct mlx5_eswitch *esw, u16 vport_num) */ esw_vport_change_handle_locked(vport); vport->enabled_events = 0; + esw_apply_vport_rx_mode(esw, vport, false, false); esw_vport_cleanup(esw, vport); esw->enabled_vports--; From patchwork Tue Mar 21 21:11:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13183284 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7342DC76195 for ; Tue, 21 Mar 2023 21:11:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230185AbjCUVLw (ORCPT ); Tue, 21 Mar 2023 17:11:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230101AbjCUVLo (ORCPT ); Tue, 21 Mar 2023 17:11:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9F0157D35 for ; Tue, 21 Mar 2023 14:11:42 -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 ams.source.kernel.org (Postfix) with ESMTPS id 729B6B81A3E for ; Tue, 21 Mar 2023 21:11:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B154C433A0; Tue, 21 Mar 2023 21:11:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679433100; bh=p/p33At2klrA/IcrqTwWIbz3rg4gn0S5yPOQjgFIlJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uxc5zicvjNKHFmz7K0bdEYLdEK642ejTvGTDbR0ugqEmzCvYxVaGHx6fJQdxiQkBQ HyQQwrMpiMWfW6JDtTk9xAEMU27gDbkniZjwHeyH4nh31IgJ8evXeXS/3Rjrq/zhOv YmVirSfRvqIsf45n2ZSsS6PXXcqOBb15EVFByXEh/pUvV5hmUfTdvjmejlT3/J2cpH aqvvd/f/EIV0bMOWBt7uvn4u/LR79b1UZ2G3tRb6hnRovk5hOKodshgyCsLGBcX91h 0BC+ocXbBwjw3tTa/O67DaOq00RNisvoFQjk/pXUUY4p3QealKWi4+fFUx1QfterJE 0Ak0nuqeTTXiQ== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Roy Novich , Aya Levin Subject: [net 4/7] net/mlx5e: Initialize link speed to zero Date: Tue, 21 Mar 2023 14:11:32 -0700 Message-Id: <20230321211135.47711-5-saeed@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321211135.47711-1-saeed@kernel.org> References: <20230321211135.47711-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: Roy Novich mlx5e_port_max_linkspeed does not guarantee value assignment for speed. Avoid cases where link_speed might be used uninitialized. In case mlx5e_port_max_linkspeed fails, a default link speed of 50000 will be used for the calculations. Fixes: 3f6d08d196b2 ("net/mlx5e: Add RSS support for hairpin") Signed-off-by: Roy Novich Reviewed-by: Tariq Toukan Reviewed-by: Aya Levin Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index 6bfed633343a..87a2850b32d0 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -1103,8 +1103,8 @@ static void mlx5e_hairpin_params_init(struct mlx5e_hairpin_params *hairpin_params, struct mlx5_core_dev *mdev) { + u32 link_speed = 0; u64 link_speed64; - u32 link_speed; hairpin_params->mdev = mdev; /* set hairpin pair per each 50Gbs share of the link */ From patchwork Tue Mar 21 21:11:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13183279 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 842BFC6FD1D for ; Tue, 21 Mar 2023 21:11:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230146AbjCUVLp (ORCPT ); Tue, 21 Mar 2023 17:11:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229674AbjCUVLm (ORCPT ); Tue, 21 Mar 2023 17:11:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2C6F580C8 for ; Tue, 21 Mar 2023 14:11:41 -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 6D89361DDF for ; Tue, 21 Mar 2023 21:11:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C42FEC433EF; Tue, 21 Mar 2023 21:11:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679433100; bh=/MAKJVBeHEGyIp3pL4cofO3nKzxeTszy26JPUDZpeP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o4AlsKaY9qls/KvbI5fOcyyG4k7F0mKCGlHixOWHa1ywfvnXmrXQFr2VvYMBI5acN RGuzb1F+qcQ+/Osv0ekAbj1uV0Xu55bxpR09aH6p9f2DG9He9xTcdow+fCUs1OacEI Sv08+Omo7MJn3B3qaQkXAXshT+jk/CxY09ll8e3KpiBxRplgAtUL8ppLQ11vLr7zYw FCPvP4eJEEBLIWyTPthIvpy9I9GBI43Yt/soOhnFGqBbAAhT/sgLxzgYVXLIof8kpe oYDN6qhGtsXZp+F0MEoIz++nmNGBMa814/+MtPMbMu8N7jR3f+J3Vaa76Nq5Mw7aWY g4hTTjAfsiwTw== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Emeel Hakim , Leon Romanovsky , Raed Salem Subject: [net 5/7] net/mlx5e: Overcome slow response for first macsec ASO WQE Date: Tue, 21 Mar 2023 14:11:33 -0700 Message-Id: <20230321211135.47711-6-saeed@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321211135.47711-1-saeed@kernel.org> References: <20230321211135.47711-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: Emeel Hakim First ASO WQE poll causes a cache miss in hardware hence the resut is delayed. It causes to the situation where such WQE is polled earlier than it is needed. Add logic to retry ASO CQ polling operation. Fixes: 739cfa34518e ("net/mlx5: Make ASO poll CQ usable in atomic context")  Signed-off-by: Emeel Hakim Reviewed-by: Leon Romanovsky Reviewed-by: Raed Salem Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c index 8af53178e40d..33b3620ea45c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c @@ -1412,6 +1412,7 @@ static int macsec_aso_query(struct mlx5_core_dev *mdev, struct mlx5e_macsec *mac struct mlx5e_macsec_aso *aso; struct mlx5_aso_wqe *aso_wqe; struct mlx5_aso *maso; + unsigned long expires; int err; aso = &macsec->aso; @@ -1425,7 +1426,13 @@ static int macsec_aso_query(struct mlx5_core_dev *mdev, struct mlx5e_macsec *mac macsec_aso_build_wqe_ctrl_seg(aso, &aso_wqe->aso_ctrl, NULL); mlx5_aso_post_wqe(maso, false, &aso_wqe->ctrl); - err = mlx5_aso_poll_cq(maso, false); + expires = jiffies + msecs_to_jiffies(10); + do { + err = mlx5_aso_poll_cq(maso, false); + if (err) + usleep_range(2, 10); + } while (err && time_is_after_jiffies(expires)); + if (err) goto err_out; From patchwork Tue Mar 21 21:11:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13183280 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 756ADC6FD20 for ; Tue, 21 Mar 2023 21:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230157AbjCUVLq (ORCPT ); Tue, 21 Mar 2023 17:11:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230059AbjCUVLn (ORCPT ); Tue, 21 Mar 2023 17:11:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BC13580CA for ; Tue, 21 Mar 2023 14:11:42 -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 B75A261E67 for ; Tue, 21 Mar 2023 21:11:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F5CCC433A8; Tue, 21 Mar 2023 21:11:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679433101; bh=rXzO4vylVY3czvHRnLMeGVFWLV0kNkXJphhLQF9bjDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PV0o2H0SA7Qrye8P3RJSZhmnnMExcWh9Xr/FBu+znnPkAXO4v4apv4FyVCfdTt0eS LvIWDj5MJBFCFWZIzHg8UytP8AatYEaln038sqk9lLytGnqHlOmVeG7Fbo+JF8XKs0 1N/1zjUOqLolKYQ+/o+HpgX2ZPp/9Tct4Io2AzVD1NSd3GcZ0rWkL63n7df3mm0AyJ exWSCekYjo/buoziyYlhegDwUHhXdT/IIfa+phO3mrddJYRTyF86ff11OfPEhsjYyQ lU0UiijQtZ4KWwqTe1zPBk9YJ35FGMS/LDtkprGf3Ln0qXLIRzgh4A8ieEn5K3wKfs VH+xjnHpZSAJw== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Maher Sanalla , Moshe Shemesh Subject: [net 6/7] net/mlx5: Read the TC mapping of all priorities on ETS query Date: Tue, 21 Mar 2023 14:11:34 -0700 Message-Id: <20230321211135.47711-7-saeed@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321211135.47711-1-saeed@kernel.org> References: <20230321211135.47711-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: Maher Sanalla When ETS configurations are queried by the user to get the mapping assignment between packet priority and traffic class, only priorities up to maximum TCs are queried from QTCT register in FW to retrieve their assigned TC, leaving the rest of the priorities mapped to the default TC #0 which might be misleading. Fix by querying the TC mapping of all priorities on each ETS query, regardless of the maximum number of TCs configured in FW. Fixes: 820c2c5e773d ("net/mlx5e: Read ETS settings directly from firmware") Signed-off-by: Maher Sanalla Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c index 2449731b7d79..89de92d06483 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c @@ -117,12 +117,14 @@ static int mlx5e_dcbnl_ieee_getets(struct net_device *netdev, if (!MLX5_CAP_GEN(priv->mdev, ets)) return -EOPNOTSUPP; - ets->ets_cap = mlx5_max_tc(priv->mdev) + 1; - for (i = 0; i < ets->ets_cap; i++) { + for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { err = mlx5_query_port_prio_tc(mdev, i, &ets->prio_tc[i]); if (err) return err; + } + ets->ets_cap = mlx5_max_tc(priv->mdev) + 1; + for (i = 0; i < ets->ets_cap; i++) { err = mlx5_query_port_tc_group(mdev, i, &tc_group[i]); if (err) return err; From patchwork Tue Mar 21 21:11:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13183285 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4754BC761A6 for ; Tue, 21 Mar 2023 21:11:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230187AbjCUVLy (ORCPT ); Tue, 21 Mar 2023 17:11:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229666AbjCUVLq (ORCPT ); Tue, 21 Mar 2023 17:11:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E819C57D30 for ; Tue, 21 Mar 2023 14:11:44 -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 ams.source.kernel.org (Postfix) with ESMTPS id A2B75B81A3C for ; Tue, 21 Mar 2023 21:11:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B64EC433D2; Tue, 21 Mar 2023 21:11:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679433102; bh=T1gHgF/krt66bMl+FzD/Z1bqpe1pdkwXeh6elPfYFvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ST6HAVioK6/iQsCwupwlRvoqK6Qd6hMguGl/nhpG/RHyGRaypDeaxRMSr0ttQI3x8 E4VtNZdhqwY8z7aKupGrzeaZQH1QD24nT1dlClw3YHlML7yX7UQJVW3k+iprHWvBi0 3OxVa3HCIh/KIhfGt4wW/MLQWufPonZ1Dj3k6FAKLr1ML3iiuStB56wo6eHwRA7Jhe P7MPTzhM7t0z5pbXCPwZr74YpJNZsJnCPguXUYMBkPwt6CyCctubCUG+Cn8OpaiJga y67Q+02Jtwp/64UkPrC0cZfDdFYWIky+l4y6dZgwfSNf+Fsq7SIRqBrZfsczOXAP4R iiHzVrs9X5gnA== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Dan Carpenter , Roi Dayan Subject: [net 7/7] net/mlx5: E-Switch, Fix an Oops in error handling code Date: Tue, 21 Mar 2023 14:11:35 -0700 Message-Id: <20230321211135.47711-8-saeed@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321211135.47711-1-saeed@kernel.org> References: <20230321211135.47711-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: Dan Carpenter The error handling dereferences "vport". There is nothing we can do if it is an error pointer except returning the error code. Fixes: 133dcfc577ea ("net/mlx5: E-Switch, Alloc and free unique metadata for match") Signed-off-by: Dan Carpenter Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c index d55775627a47..50d2ea323979 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c @@ -364,8 +364,7 @@ int mlx5_esw_acl_ingress_vport_metadata_update(struct mlx5_eswitch *esw, u16 vpo if (WARN_ON_ONCE(IS_ERR(vport))) { esw_warn(esw->dev, "vport(%d) invalid!\n", vport_num); - err = PTR_ERR(vport); - goto out; + return PTR_ERR(vport); } esw_acl_ingress_ofld_rules_destroy(esw, vport);