From mboxrd@z Thu Jan 1 00:00:00 1970 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 D8C1DC32792 for ; Mon, 22 Aug 2022 20:00:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232605AbiHVUAP (ORCPT ); Mon, 22 Aug 2022 16:00:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232577AbiHVT7l (ORCPT ); Mon, 22 Aug 2022 15:59:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4521E4F1B7 for ; Mon, 22 Aug 2022 12:59: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 C781D61274 for ; Mon, 22 Aug 2022 19:59:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DF14C433D6; Mon, 22 Aug 2022 19:59:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661198377; bh=QxWggh2glKOf3N8D4zIt02VQ7APjnoXvrI0k+rmmpMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sMosyn8cARC0nk5M0bWeFkIYgENP9R6M53KQgB9Pm/XEhPz50QVDF/X8FYdpTb4oY qvgVVQdFZz1BRVpv+t8onWZpQzvzHnRVYydlzqhgdeylcAufDlaigzuhSLLZ0ONrlf n9x76oa9mNkAJOERtlkrpU0uyTfOQ3xzgLirw7pV2m80pLodSmu0jI6goITyPXAj1a cA/KReZ/lknZnn3l/CQRdx6BpNoTp/ePt/uKJm8AVNr2zxfsdAWlUlk/XAq8sHnqpl g1b1zboz/0pWIsvc1GX32VwYdHfPeUJ8ejdOnMzzVCPXQoHa0ObRS2feEDKOY5NIrN GLhiM/izxvQ+Q== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Maor Dickman Subject: [net 09/13] net/mlx5e: Fix wrong tc flag used when set hw-tc-offload off Date: Mon, 22 Aug 2022 12:59:13 -0700 Message-Id: <20220822195917.216025-10-saeed@kernel.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220822195917.216025-1-saeed@kernel.org> References: <20220822195917.216025-1-saeed@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Maor Dickman The cited commit reintroduced the ability to set hw-tc-offload in switchdev mode by reusing NIC mode calls without modifying it to support both modes, this can cause an illegal memory access when trying to turn hw-tc-offload off. Fix this by using the right TC_FLAG when checking if tc rules are installed while disabling hw-tc-offload. Fixes: d3cbd4254df8 ("net/mlx5e: Add ndo_set_feature for uplink representor") Signed-off-by: Maor Dickman Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 +++- 1 file changed, 3 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 c65b6a2883d3..02eb2f0fa2ae 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3682,7 +3682,9 @@ static int set_feature_hw_tc(struct net_device *netdev, bool enable) int err = 0; #if IS_ENABLED(CONFIG_MLX5_CLS_ACT) - if (!enable && mlx5e_tc_num_filters(priv, MLX5_TC_FLAG(NIC_OFFLOAD))) { + int tc_flag = mlx5e_is_uplink_rep(priv) ? MLX5_TC_FLAG(ESW_OFFLOAD) : + MLX5_TC_FLAG(NIC_OFFLOAD); + if (!enable && mlx5e_tc_num_filters(priv, tc_flag)) { netdev_err(netdev, "Active offloaded tc filters, can't turn hw_tc_offload off\n"); return -EINVAL; -- 2.37.1