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 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.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); -- 2.39.2