From patchwork Wed Apr 19 15:34:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13217046 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 58E86C6FD18 for ; Wed, 19 Apr 2023 15:35:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232898AbjDSPfz (ORCPT ); Wed, 19 Apr 2023 11:35:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230473AbjDSPfu (ORCPT ); Wed, 19 Apr 2023 11:35:50 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2047.outbound.protection.outlook.com [40.107.223.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE50C55B9 for ; Wed, 19 Apr 2023 08:35:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VLfHe6XgoYQctrNuWk6JBWIFlWx2Im4mPBKV21bjokNszanCt88mVn5buX1nvEVq99+tRbOgVv8dbwtMS3RXTDb6wkVf7/f76ZilahBRrA0nD3Oeg5BseWwzE5gYSOBR2nmpA1QDOf64Knu+RBM9RrINk9suZr/JGM5/8LIUNRfZQTqUyEVx/gfExVJDjuH8NXxWOz1lYmjRa4uV3RXDGctmeUhtYE361iKcrton7W3Zok6Dmy5/h27Hr4Xwu46EfLomVXoakMjoZOZRKzCV8tM6twkt9OwQwV7KIwByJc4qAFrvxr8a6UeIvTDCb/Oe8tC2crX+AHVaeQhg6oyFng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mUBz3SNGRtZLHFv2gMuTh4u3NUMpfV/b/lJ/ml+HcG8=; b=kt55NyTSHTLHeEENAzWpiLkin4PvTtHeYTBxA9E/5mNFS1uVJJ273BXLZTN1vayQRnlKdJrmP3mRbvH74Kp+9TwJyES8mAa5Wo3fWcsluCDTl4PYL3NwuNTgCaUPMhgZee05OrBD2gCN6saZzfy8O/Tpk/nKzy/+VM/Zc53JtcDLwXauzlA1nBqOawWqPjJEdBQs4mjYTetPwvBFFPE9P0Olls+kj03KqaRb15nwMr/NPAKiDDIf+pPDnjufGnrUDOBcePmfwJ6nvYU805ZVoDOD2mWQ1H4CxifhRx+Ek9Gc9bvx+bvkZnULhmxeNONUGOg0VnMIbjPvfOLLzFZptQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mUBz3SNGRtZLHFv2gMuTh4u3NUMpfV/b/lJ/ml+HcG8=; b=Il7Pih+MEdd06TGaaR6S3tMQuA/myOypRwu/9kEOXsSZzO8Hh7i2BspovX+15Rgh49KJlv/EUioDLhBQe98ASjp5LWHjj8ecBTiOYw6zGugY2V+b11dhAUv5mrEfX5UmmbpuuCvRRl+xMPqcjLc4v+Ofyg9I56Twj9NbB/w7L2ItfOgvGh/0X/uplaTA99vXg5zmuQ9TK/patVu/JDi8lcBNeTosv1VhtaC/eEkaedK/eihULQYfUZa351FU9h7IRZHgKzGxsQxz6C0up100n/7kIAlLisxyyKwGwwJEiBoAjlu3rngq9XZMyfN/k2IIykbM6MujGUBXh0HI4oXIaQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by DM4PR12MB5375.namprd12.prod.outlook.com (2603:10b6:5:389::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Wed, 19 Apr 2023 15:35:48 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697%5]) with mapi id 15.20.6319.022; Wed, 19 Apr 2023 15:35:48 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, razor@blackwall.org, roopa@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next v2 1/9] bridge: Reorder neighbor suppression check when flooding Date: Wed, 19 Apr 2023 18:34:52 +0300 Message-Id: <20230419153500.2655036-2-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230419153500.2655036-1-idosch@nvidia.com> References: <20230419153500.2655036-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR03CA0075.eurprd03.prod.outlook.com (2603:10a6:803:50::46) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|DM4PR12MB5375:EE_ X-MS-Office365-Filtering-Correlation-Id: 23b5f988-e397-44e6-d2ca-08db40ebbf74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9n+wG3K/ACc7gDWTnNBTKBHlCfA83KMdbtLdu9/CHj3lKzNUmLZ9frZ+4OV4h8jUXO+1+IRWV2VcADv2gdXbgi4TE3ky8eob/HEnB4TXOCzNj4b0Ewc7O5XVn0QDj8yxrO72eOxcyY4um1RjziYjliSxlzbliMLC46vaOdj26LktmTJSRpEoWsgytynbV/R8cadXu0aOvT/jEzhdSRYm0Z2+EMTCb6IUI5vJ6UmUA8J6SfEeS8y06O7OScaY92NQIaWa5f2cm+NGYdo1kvGHzvirtiu1B6feaGdrqZx4ZP/XSBfOanQddJLESABxTbMr4H3GoYkOgtjcvuQP10B++EJQiJLc+aFUTlRBxAwf3xwKt38f7P4ewppPAnkpqbQz7IOR9Fkn6FEgjaICPX6RhiXVy7cxgBjAx0KQwWw6Qz/JE1TwfiDhEaRH3VMYmLn4J6L+M61UxB0EoSPoNJRKCGJxVJNg/knQKr64mo5OhjfWVoVrduIednJCbN8Zd2L18ExRp6anJaWsdoU8awOCacILMu71mAdYkJJkBHlh14NWg99ZAs/jbPE/i/6vlMDm X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(396003)(346002)(39860400002)(376002)(366004)(451199021)(5660300002)(86362001)(2616005)(107886003)(83380400001)(6512007)(186003)(6506007)(1076003)(26005)(38100700002)(8676002)(8936002)(478600001)(6486002)(316002)(6666004)(41300700001)(36756003)(4326008)(66946007)(66556008)(66476007)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T4WrINrU/QPURUG/u02miRQApOOZXAyNOZmzsDvmwALvAEcSSIJOtS2ij/6hF3g/LuA6iS767AtvRik/F5DY5tFGJRW9/uRxrzfBYrv6kG4M3E6C0BmH4vvyrJmf08d0F8uXL3UM1YB/3mNqdmup1kwi/tVEpsOgZGDiu26HXeYPx7YE+kpy27ObY7EZDySmPOSwQLn4YJPdU1LCGjs+2P8jrKCuX6VFJ+U6nxCKfSEszK7y/QpGKoBDn+aQk25r0Qn7RRHBrqjio4SvtqmYFI72GD0hNALDURBbQsieD8hrCuJ7La9X+QqVZmiarh/j7dK8Ixg5b4hSKPdVfnPiJ8BO9UmeL/ORsJUPOPq6eHV8euuTO42gVYxojl6SxhHB+MYdiEL3M111WVJ5ETpGFoAjacDIEhFSeAXN4EIcCm8cZ0NrdWXVauwinquFardzGwSWFU2GrFsPBEgh3j4nbkRud9DkWqafodUgAABk4fNmYxVqfLp4EdO1ePU9yE+3PcpseuGiT9EgwY6+WVgBNrjGTQ1g9lTwvVPsXPVuv/eUatvVdblvEYxCqTy29hqDYDfypgH9JZ1rb+ipHv9Qv0c72msx5q+K4W4MHXaqq8927xwmC3gMaw/Em7rNWaSaWvs60uG4sBWn1mCkDjTNWbq0KpPFOTgDKO1iJeYcFAfZOD8/HmUJBiX+mjS0slD63+IzSvCYV7RDC5vwM6Z4MLWRIbErEnEqxKKdhnlCjkAO81WHoB6C5IYlE+3ZoBNO5UBaoLmNY01ntVw2syYB0dZblORoDpl/WH5DYFOU9WGDW6ycKZiQCPGzMklg1KdCSbP3klpyCpGSz6eJWMYXbbkRHDx1RnNQELEZAzKHeLBKzZ798PWq+zvoMhBtGDme0RcqqdX4HDJ26xPbKVQJM/vHC/Rvy4pWFLq+3x+HPX3nmWl+//mEjd9+lIAckykfH6Sh4r65qSpFiHC8HoXay5mFHk/o5C992CAMM8gfhElf9H2rVZjCKgM1fyA8v7NIYVsy8LxFNwJ7TucbZ6jFbBGzLavw9Ql88LDz+wx5txL69O9H2AVv/E4qPa5GNtqeRwJ+3xrxZ1xhUTzoPdUoI2tCMgzMGWG+la7+pNSte+Ued/eeSAVgJ5nVLJqusTbARqLY+62dOWycdQRkhy+7pxcvlm+uQHpirjfcDn1vCloZuA6OJQ1IapIZ4RUPIGcl8uQeXbtVOClQRNjH/e93rQK2Y1lNNUVErteZCK3s/h7eu4rafVd02S04XaqQeYWoerbcxwlSvYEb8xsZ2WgMYKCz5Rf5LuDhbZnZ1N0pZ+3OSn+UhX6Nn/9ceFB92pbfb3qKI9BHZ869Ud3yS65q91x2Tt+0TeKOvl/9JUXYbr0VKhdEQbniqr/Da5vjOQ1Q+x8C3nz5Njf02LD1nwwvMhYwM19f9HsmHuLcD9rV6peI8AAWL4oC5i4taixyXivpNPlX2eRUIcA2reqZJhTpiuuHqoRbMAAPm66QQslL8m0MCyQNmkt9p39w1tP9bzoIhyL0/ZhAthUQ2aYlsheL53W/YeTrNSWfy6GrNns46GyAmu14sujnOHmY+dVMLiRx X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23b5f988-e397-44e6-d2ca-08db40ebbf74 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2023 15:35:47.9400 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xiP9lqFya/9S/V1FeAzL0e/0RaAXCSCKx90gR5LcIKvEF12V0zr3TdSXGAJAW5cQ/GaDwIft4z6LiSWpoRJ+sA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5375 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The bridge does not flood ARP / NS packets for which a reply was sent to bridge ports that have neighbor suppression enabled. Subsequent patches are going to add per-{Port, VLAN} neighbor suppression, which is going to make it more expensive to check whether neighbor suppression is enabled since a VLAN lookup will be required. Therefore, instead of unnecessarily performing this lookup for every packet, only perform it for ARP / NS packets for which a reply was sent. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_forward.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 02bb620d3b8d..0fe133fa214c 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c @@ -224,8 +224,8 @@ void br_flood(struct net_bridge *br, struct sk_buff *skb, /* Do not flood to ports that enable proxy ARP */ if (p->flags & BR_PROXYARP) continue; - if ((p->flags & (BR_PROXYARP_WIFI | BR_NEIGH_SUPPRESS)) && - BR_INPUT_SKB_CB(skb)->proxyarp_replied) + if (BR_INPUT_SKB_CB(skb)->proxyarp_replied && + (p->flags & (BR_PROXYARP_WIFI | BR_NEIGH_SUPPRESS))) continue; prev = maybe_deliver(prev, p, skb, local_orig); From patchwork Wed Apr 19 15:34:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13217047 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 D675CC6FD18 for ; Wed, 19 Apr 2023 15:36:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232883AbjDSPf7 (ORCPT ); Wed, 19 Apr 2023 11:35:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232582AbjDSPf6 (ORCPT ); Wed, 19 Apr 2023 11:35:58 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2073.outbound.protection.outlook.com [40.107.223.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4851659F0 for ; Wed, 19 Apr 2023 08:35:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oV+LBdELSvRH79lrWS0bFcWDKSkWjPYvsSOsCHm5Iijfo9NcUH8bvx/jp9yS22bCO01kexNucZwMznc1rdr6776XZZSUbDnO7voR/RAoldDKlwne0oVB6H73iLr+Mdt2ZQW38+HZi0k2yzgo89JAuJp8VUBG6zxa7ZWKuxkW2v5ig9WUiAxhmpP/lEiTZOThyBqr5gBTyti+8lVDRlH57k5Lx/bJGGpCh9bSH6RiKJ//79x/fEYhJdzUCRECFCR9pN9wCV4r46gwcvaXNYT9iehdQRQ2NeN6wh9iWEpjjfGktpjnSVL883naxzhiS/q9yWQqYItap17+4g0K71VtxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I/+Iebnz0aBrOoxwW4/Y7AHieMxXgC/+ss85/Kp3RRE=; b=EJMmaVOxHf3sjAjzvCiAGDmNGNNtzS5BkL+fab5DY4/c3M9jo6SMowsEbtGBIZ6HpiuXrnWkos2hYwXEIFcvfZslQWZliiW8JKwKKP4PsspzGr3kUpSOL2MUnJXAXkSZSZMOjAGEPVkiFMEsSRIxnW3JG7BA1ns+VqUagZuNrFKl/fv870+fG0TETLjoAFZrQUZ+1zohMqddLhZICQjTgwEIOofvkvXP7bhHDd8MK5zj/yIRBEV5y67pN8260cmbGEuhUZyspCJouXaVCi6I59k4akTZILlYizimlNQYtiPdkwSY9HfR7xZlIlFEAuHmJLXCrgXeHtST4VCGTKoAQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I/+Iebnz0aBrOoxwW4/Y7AHieMxXgC/+ss85/Kp3RRE=; b=Hl7TIDkDhcSgjRxWezrTTNLDbbBzSWRKQAjsdIcsq0rfR0sI0WHH61yBZRT197F0Inh082C1I3nZ5jjYWKcoJzVAYctDcBWC6zu1ciSizjD8tt2wMbSERVZgdTTQJyTrXccBF+S1WRguXowMxki8GNxI5ar2WEhdy0M5xF9oGxpL+CjuPGfXA4+n6Huk8MbONKwPzfwjCUUfv3eyuizZSOqVSPG9R+6J6lxF/+19+rRzpFcAqIBdD3MEXFs8JSs0SR4skpRvuy4lc3MfiVy5OxPOmq2GHs7Obh1YG6dQQDLP1GrcbYuVc3GU9HZEt/cq0PiGQesnx8ng2V3NS2RU2g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by DM4PR12MB5375.namprd12.prod.outlook.com (2603:10b6:5:389::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Wed, 19 Apr 2023 15:35:55 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697%5]) with mapi id 15.20.6319.022; Wed, 19 Apr 2023 15:35:55 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, razor@blackwall.org, roopa@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next v2 2/9] bridge: Pass VLAN ID to br_flood() Date: Wed, 19 Apr 2023 18:34:53 +0300 Message-Id: <20230419153500.2655036-3-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230419153500.2655036-1-idosch@nvidia.com> References: <20230419153500.2655036-1-idosch@nvidia.com> X-ClientProxiedBy: MR1P264CA0205.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:56::6) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|DM4PR12MB5375:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c2afcde-fe96-4d1d-b2d5-08db40ebc3fd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kxOKCena5Jq6b4YOMn9X3N3wssEj5ZIXRVt0SMkt7k1qxAyM93SsWvGfMTEyunf2uMERtkSfs7PW07B/ILi4nP79Jyz1HvkLB+9Sp2w+LEfm+uBkdofqcUKZVw1mzu8xu7ibKZmCLYnV5uEVeVFskracq0Ks0gDzKOkNAIg5ebup5csf4fFhWvexGMN3bwpptBk3olPhxWd5yqCKXtGl2sYY3ERy4jYhJrubSnqoDxNxs3NlyBZ9oAb6DlRVkIjJgSi1X4EKBUCv8/CC+z3l/4GiPF9SfDo5AxXSSu2V8t0GTVuD2ObEf82xSvyxgpsDnhiYB0exTUjz6StWQ5lItPwajWXNMiwLAcSV/t8eHIMr6OEl32FEgyspbzIDQ2v7GA+rqH8zj9JXvzUonV2UJfDiA3QeE2PCVBnQ0/G2dG3t4jI+7iU/SXiF/WLLZykrn1s10WYT1nn9os4ds65Iq08lG1byxc2BSgJBDd4J5Z5DMJUPVb8alPcTVD3GqP3L4UHYwFnuYWfBNnY4Qevlb+vHaQgsqo+dZN7dliJHMahtjkgSYGM/ZJqcIzom/OJh X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(396003)(346002)(39860400002)(376002)(366004)(451199021)(5660300002)(86362001)(2616005)(107886003)(83380400001)(6512007)(186003)(6506007)(1076003)(26005)(38100700002)(8676002)(8936002)(478600001)(6486002)(316002)(41300700001)(36756003)(4326008)(66946007)(66556008)(66476007)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pvz+16ijzTCwx86ZnBtt4eG4I7he1za/AHa7vyC0Utok70HSCpA7sGYpj5zkG4ELxF8SDucczK6h71GGQX4LT9qRtcdy0wTNkrFiOfMRLtSPXBoy47BI5QW3bqOBLonIbRBFS0LI9NiiLBH0nNlAAzsTth4kL7QoO8LAeHory86e5x/76f5HOZe6MJJGFgKcAigmUNXxTGGCbuBOZekQfOHsluOUOszdhED8lR6hrp3PpibrWb5RGyE1utof4Jor/8q3//ghbkYyzrc3KhdQTkuObPnE35D5Vuczr7SmRFt8H2FlIG+/T+y1wiGPgxBQques9/T43QM076OW1fxdy2Ooa6PxA/XGGkszZIfCED51KcrA4Rp+BGkE2+/hj5R0WH1FyHLHvOLpr8ZF8Hbjo/919chNh7+B8+8ZWSgBVt8oMRPrSNaSYQG7NJZG6jVwrdBEWvIa9WjixSZOO84GI5y+ZM0fGnGC3mJiacQNZuiw3BkfLGnJyxamXv7VMrSUYinMraOFCdXJTLmjO4TaD2JrNbVg2K0VD76wi5O2kZdxom44ocEabwwW7mjKKBQsTSmckv8IhvtLzjJGuBbwmKnvkL3ikI+NPfaQORUi1pkRTS+jutMmlRsQJ2c/EHKdT+dW8F0D6oPti25iiPjqjKotL2buRFORQVwJLXdG9o7qggVNQFmFjcRvJVaBpizABNGCRl9gzR7kCg9a5ZyIX4QzvuEfUq0prWBWqluN4lyNDQTcjG6kO/JuCMPrniS3svGeBkxMqyJdc9q5xomSA80bEpIsfIWVBU+b8CYH7AI/Cebhj6xNuUUPYSx72CtneCKqOQa1sljHLlZV4D73pCETKE51x+VA2jdqLn81T4u6kljU7CWg7A4302813hbqC4CKePi4x+op1Vyo7e4SCgeqU38H1/fDcHqDPNTGxyYAuPC9cRIfVIs0OjF4Cz7DwCdsG7g9PdgnE2DD7BqG2+wZ+JJv3hwFRbNg4V8OCs/XVMtE1UP6pea1drCWfinlCkQySMfrYn3iT8oA0/GjROgxP/BBOJQeT8Ot4qhO6Yx/PAJ3XSiCIdvXI1aUkdghvQcAqLhfeNwls7pLoYsu8wQ5+K/zZTOs/+EPPcJoGpdpX7Bh5BcqLU5OPfKKLBuI175eTbi6eZ8lEfXP/DdnJxoTuAZmRnjIOBIb45JHiJTQnF4KxSOFkSGvtWyVyawDioKOzq3wfQ2i40dH20XbvS6gE0VOkfHFbhgDsjn8I3WlJNTCsXgEBWc6c3NgPuH7TbqS3IWNQSbVTpFigesTqZul+tla2+7ksYby5kM+YB9PCPDnPj17yvxwGcyChRNtagrDdhMOS1Dh2ZYzHrwL5PeuPKukevyVE8kJr5hfuFAsCMfb73Tfj7LqH9Eg5Gs+WJVFi7mahtrAouqwEE3Ae/LLhJBYXkERe9zHCc+WP0mnjwWgxJMPYeinOhyzsQHivXmlHAkmeKyQJYp5CmjINkAlTHh9ZvWLFzelZPWqDSy89GuVYV6AAFACJBvJteFYKK6bh5kwBInKiHu9/j1qj+gELLZjr8WjlTJ5yWGiPYhqgqVEMgauzdtlyds02Dqt X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c2afcde-fe96-4d1d-b2d5-08db40ebc3fd X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2023 15:35:55.4152 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aHo38Wvld2vCnritS9QHg71VElXX+UnNS3pEyYXXbiSzEXZNM7JBir9FVe0Izbg+XpYJ0CK2ncTyb/QQsH1mBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5375 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Subsequent patches are going to add per-{Port, VLAN} neighbor suppression, which will require br_flood() to potentially suppress ARP / NS packets on a per-{Port, VLAN} basis. As a preparation, pass the VLAN ID of the packet as another argument to br_flood(). Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_device.c | 8 ++++---- net/bridge/br_forward.c | 3 ++- net/bridge/br_input.c | 2 +- net/bridge/br_private.h | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index df47c876230e..8eca8a5c80c6 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -80,10 +80,10 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) dest = eth_hdr(skb)->h_dest; if (is_broadcast_ether_addr(dest)) { - br_flood(br, skb, BR_PKT_BROADCAST, false, true); + br_flood(br, skb, BR_PKT_BROADCAST, false, true, vid); } else if (is_multicast_ether_addr(dest)) { if (unlikely(netpoll_tx_running(dev))) { - br_flood(br, skb, BR_PKT_MULTICAST, false, true); + br_flood(br, skb, BR_PKT_MULTICAST, false, true, vid); goto out; } if (br_multicast_rcv(&brmctx, &pmctx_null, vlan, skb, vid)) { @@ -96,11 +96,11 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) br_multicast_querier_exists(brmctx, eth_hdr(skb), mdst)) br_multicast_flood(mdst, skb, brmctx, false, true); else - br_flood(br, skb, BR_PKT_MULTICAST, false, true); + br_flood(br, skb, BR_PKT_MULTICAST, false, true, vid); } else if ((dst = br_fdb_find_rcu(br, dest, vid)) != NULL) { br_forward(dst->dst, skb, false, true); } else { - br_flood(br, skb, BR_PKT_UNICAST, false, true); + br_flood(br, skb, BR_PKT_UNICAST, false, true, vid); } out: rcu_read_unlock(); diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 0fe133fa214c..94a8d757ae4e 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c @@ -197,7 +197,8 @@ static struct net_bridge_port *maybe_deliver( /* called under rcu_read_lock */ void br_flood(struct net_bridge *br, struct sk_buff *skb, - enum br_pkt_type pkt_type, bool local_rcv, bool local_orig) + enum br_pkt_type pkt_type, bool local_rcv, bool local_orig, + u16 vid) { struct net_bridge_port *prev = NULL; struct net_bridge_port *p; diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index 3027e8f6be15..fc17b9fd93e6 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c @@ -207,7 +207,7 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb br_forward(dst->dst, skb, local_rcv, false); } else { if (!mcast_hit) - br_flood(br, skb, pkt_type, local_rcv, false); + br_flood(br, skb, pkt_type, local_rcv, false, vid); else br_multicast_flood(mdst, skb, brmctx, local_rcv, false); } diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 7264fd40f82f..1ff4d64ab584 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -849,7 +849,8 @@ void br_forward(const struct net_bridge_port *to, struct sk_buff *skb, bool local_rcv, bool local_orig); int br_forward_finish(struct net *net, struct sock *sk, struct sk_buff *skb); void br_flood(struct net_bridge *br, struct sk_buff *skb, - enum br_pkt_type pkt_type, bool local_rcv, bool local_orig); + enum br_pkt_type pkt_type, bool local_rcv, bool local_orig, + u16 vid); /* return true if both source port and dest port are isolated */ static inline bool br_skb_isolated(const struct net_bridge_port *to, From patchwork Wed Apr 19 15:34:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13217048 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 CCB18C6FD18 for ; Wed, 19 Apr 2023 15:36:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232582AbjDSPgG (ORCPT ); Wed, 19 Apr 2023 11:36:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233034AbjDSPgF (ORCPT ); Wed, 19 Apr 2023 11:36:05 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2086.outbound.protection.outlook.com [40.107.223.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F9F9AF for ; Wed, 19 Apr 2023 08:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J0fvnMB0kv7+SpslAY2k14Apl5PS6T2BCeMjCWLgcAszjHzmIuQqRHb/tA3L9zvSKTLPMz+qJBw9LIRDRVbLyaxIGYGNGc8RAvBZ+nBjZWvmBUMNR3IocHsH+AB5wbPXHI9UsXv1b6rNz8yjLTl3IbfQo4Cq1ZebZciH1L3ibdzYC3NV+WVuIqkimTHKNq8sLMfDFyX8jO4Z4CyZ3l679flZZNrkdlwytqQGU5owLvMYzz/GBwP8idtcWueUMc3hhJ6/VUu73FTG0iU6x3BDBdzXois8ZI2AQ4YQD+DwKAT1Hp+6SRemy64V+QnCgWVNILZVJ5b42idUXaLKgw/mjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=06zjrbJ3kSp1VCxEQXzom3vWayo3NvLF0pBiTvOiepE=; b=HPaTFp/c9F1n3LBGcfKkyKcO4RXRdR9EoBXlfL96vXflrKychoxou5pq6PYxt9iiLXjJwT53iql9s4p5ig5jCBqIh34X0xyDVKosW56buI5nS904BviUaIsR8lAL+C6S4FTcZox9CaFmwg61GapszBVYHQN9f60odAb1huCaCDlejk9s+APfg8HhkWR7AgxIT3GmeBIbWiegjeje5fIopAcmaDND65njzzaoKk0qMUchV/ePmt0f84suoikYdu/Bs7PvsIjMnRG2zO2uMRpKybUjv8FSyj60X4DWa0Rnd1h4FvM8him+rmaWs4rSeahKL74CuGKShxUPPE7CngSTGg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=06zjrbJ3kSp1VCxEQXzom3vWayo3NvLF0pBiTvOiepE=; b=AAn7SjR0kyhxt2tUHMedlxWOXykYbj8TxtFs/vjCKtrs6D78UqBStGOnjSq3fiQtADSEQa3/zZhW7i/xFBYA6bmslzknf1v1lmE1RuKuzvtFZaHcywgTXtim2xTPyR+IZKlVX9njsaKgIIn4i5pgqAJsG244xNbdcU7jGYTLDqRF4iMRAvk8chtp6+NtXEs1YVQ4YCvcJ8YIV0f4VlMiDBjrvMiALDEFr/6zURvlwYHOA/sIqgzkyYp320EsnlQ4q5XutdhOKU0AsWpOWPsY98fCeWxTjxdTJbrI0pabNsgp5m9z//cV57WE4uJ6xoEjBqZMgcgvooUCINGgzloUxg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by DM4PR12MB5375.namprd12.prod.outlook.com (2603:10b6:5:389::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Wed, 19 Apr 2023 15:36:02 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697%5]) with mapi id 15.20.6319.022; Wed, 19 Apr 2023 15:36:02 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, razor@blackwall.org, roopa@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next v2 3/9] bridge: Add internal flags for per-{Port, VLAN} neighbor suppression Date: Wed, 19 Apr 2023 18:34:54 +0300 Message-Id: <20230419153500.2655036-4-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230419153500.2655036-1-idosch@nvidia.com> References: <20230419153500.2655036-1-idosch@nvidia.com> X-ClientProxiedBy: VI1P193CA0003.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:bd::13) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|DM4PR12MB5375:EE_ X-MS-Office365-Filtering-Correlation-Id: f957375f-2ad5-4a3b-9a59-08db40ebc848 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bEByzWldzMpaMo1Jdc5wqB8gBr8d71sky6PniiOWcVqe5Jjm2S47yp7rmFpBSbhoK8kWjmrJEO1TruWs7FxkUFe0wYrM7uWYx8tVxMLEQO/AqKm4zcxIK577uWYcLF5I3d8u3mmqGxGvy7/XpSl1RAUXz/52d22+V3MofUrGz+94jImvsXNz8LqJORwFjChGhzxJeJH87DyBnlgRPN2ZXWfdeHmrt3dHdU2TqM3UYNLmELTuEj/MA9wRPCr/frou0QpnA74/5EEmnzoaRTSJAgjtg2bVnp7GDV6/tzlWonkbaxBCaL3QBlko8amIpK6EMH6JqCuye+tW3F68mXNWZ5l6XZtbBW+W8h5hhX1B6TF34wx4R4bXLUWe/P6DnAPlmbn3rJcFUfkYDv4eSGomeT3W3yzPmNbiaOj9bC7bZ/HrCMSxSZSslZK4tNmhJBR3vZ0UmPFiqDBxbVKzV/efWxdJQU6UOIYvF/BwDKNp2KKcntGto3g3Z4tlgKop+qTPdy1v6p47kbnOLe/l7NNyeQPx2FBewQmR8u2MF9UZOeYi3QOWYhpqe5sBwGOxBQXe X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(396003)(346002)(39860400002)(376002)(366004)(451199021)(5660300002)(86362001)(2616005)(107886003)(83380400001)(6512007)(186003)(6506007)(1076003)(26005)(38100700002)(8676002)(8936002)(478600001)(6486002)(316002)(6666004)(41300700001)(36756003)(4326008)(66946007)(66556008)(66476007)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uB22lldNcVcxtcHC+0TjDZw6E09UBRnAtmIKhK/qjmAjY84MpmyXsveLeaTDMnxfGKcZ8ekeuRugKBqT3+aH963qRd8Bzcz5FMYzJdM2OFqOlpUlqH0iGdxIcWL9UBEoXtDXlnuplL5BjFkAwIFK70PZP2TN26weRSK1UOyCYYORIebXS7hjBgqdkYoD7yIJx5FTWfXJVHXCSGPsBNoZ+VgmBP4LjbO9U1aX90Y70uPrEiA/K0mvxRcD4wAU3CcBg67Ix+WQ9bm14JlJajgRKDq5SHMdIfk4Ra594UbZGFPImF8+iTC0wwBiS/1z8Q9DS8A/icEF0R6XKnWCSeEXJ924vCRQlt+HduidITblo/QQ8Cxlvts2IYWowVVLpKazYHuhKFlasV+JfQwM1Bkhq6eXc5QckqJARRJVmEurMZ/gkzUiXbuw04ESbGGEbB5JCSAEbyFMjeLfDfzkPbhq4BTX6R7PEm+8RsENjOT1oJ5srG2gRKGk0McGh9hDBRz7Ix/zb+gTJ8BwhgO2RbLmUTxz4utrxK0lpnzVbQOMxfIT7yeqFGMTIdK6NB4to6t9lPMsEGSwi/uA80RDGwB1ZQYpxwMMRfaDSmOCueiBQt88q6Teu35h1WX4VjabTqi+hV/zMUr0Cq9VB0GdNMCM2r8zmwPcctlbIGVLQ119vsg8obmlxtKvhWbnE/jHVK5MGWR1+63h8HNTHcL7ORyNfGCf3KaQ31JGc42FMVnXEdQxlyrJoNiT4PnuCBLUex9UzwBvoYppqOLaex8e8QeXtRoAFwTkNpKY8K2dPmBSYAHJPQ1EuQn+/QgnRLQNXuxwk66NWhxurN+xXiVUYpQ/5wkTsJmQ2x0tjUAOfbMqGJem1oqOWBDkUf1FgLpaeIzcAa9lj5AZo46HaOiG2KHXYVZ7rmlVQkHIWurOh85EaDRj5zC5PI6GvD+WFH+sDLQ9plB//r06ZUT2klx+gbRziFVxwFZkxtU8C2RQGjyXf0dqHk6ia+f9M0coGjMQdacinQuIG7QKo/XLCGo5FpHjbI0JU6JabRNDHg93M+AhzNT1ft25xlgnw/rsoSmetyWXg2ZPNg77Sac8smFUZTLijMj1opc5UClxVIu54HUDl8bUD9xoIvbBFs+kuZOx0LNIXKxTHGRVhotkZk1coQuLLXbqdseFpBT4As4HHh6XiT/O6MQVZ3IdLmy+pLY1zMyV9/5AInhVSRRGkgiedAw5y2NcHONFX/+vZsJUjOw2xCUgHVEvdPI1n/rDE3Y5ZadXUUrvN+K9ONrrB8jNxlhkdf89POspSvDu7ak8EvzRb63fBWWAXpuHO3MTo2LfjNli0uZ8oba5DUFHZ04vptAqjVlE3oaOgIYgN+PTck5rJbgW48MtGraj2228cI18iTva5dkc4i3SAfXJBIKgDvkPQREzz7hHsVbYZiuX8si7T6QKqwkcez4oigIAQ2L2aS/FexDINBiaqXm+g3NvYmzZ5ZZlg4IDc0nCDRmAAQ29Y4vVHW21j3RYG8tSHzJ8thrIXsqAfaBZzAWZ9txNXfbTB7kr25no4exQLPyaBfx4h7a4gJht9qoHqNDU7jaxgjTB X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f957375f-2ad5-4a3b-9a59-08db40ebc848 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2023 15:36:02.7507 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5PVKPNpSWV8iRyFENEc0e0KQlN8OnALmSanjkLNSkOjsIjnGuC2Cxm0SMPRlPa9I/3CVM5881TWg4qjqUk0Afw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5375 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add two internal flags that will be used to enable / disable per-{Port, VLAN} neighbor suppression: 1. 'BR_NEIGH_VLAN_SUPPRESS': A per-port flag used to indicate that per-{Port, VLAN} neighbor suppression is enabled on the bridge port. When set, 'BR_NEIGH_SUPPRESS' has no effect. 2. 'BR_VLFLAG_NEIGH_SUPPRESS_ENABLED': A per-VLAN flag used to indicate that neighbor suppression is enabled on the given VLAN. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- include/linux/if_bridge.h | 1 + net/bridge/br_private.h | 1 + 2 files changed, 2 insertions(+) diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index 1668ac4d7adc..3ff96ae31bf6 100644 --- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h @@ -60,6 +60,7 @@ struct br_ip_list { #define BR_TX_FWD_OFFLOAD BIT(20) #define BR_PORT_LOCKED BIT(21) #define BR_PORT_MAB BIT(22) +#define BR_NEIGH_VLAN_SUPPRESS BIT(23) #define BR_DEFAULT_AGEING_TIME (300 * HZ) diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 1ff4d64ab584..b17fc821ecc8 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -178,6 +178,7 @@ enum { BR_VLFLAG_ADDED_BY_SWITCHDEV = BIT(1), BR_VLFLAG_MCAST_ENABLED = BIT(2), BR_VLFLAG_GLOBAL_MCAST_ENABLED = BIT(3), + BR_VLFLAG_NEIGH_SUPPRESS_ENABLED = BIT(4), }; /** From patchwork Wed Apr 19 15:34:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13217049 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 8080BC77B73 for ; Wed, 19 Apr 2023 15:36:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233046AbjDSPgN (ORCPT ); Wed, 19 Apr 2023 11:36:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233027AbjDSPgM (ORCPT ); Wed, 19 Apr 2023 11:36:12 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2067.outbound.protection.outlook.com [40.107.223.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70AEDAF for ; Wed, 19 Apr 2023 08:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BGJlcCQjnWBhPMyVXL3LUXHPbNEjeIvq9gnJiQdoffL4fi+zHOC+PR3/qzGCp+sm9dMOpqrPKJJqc6i9QSMjaW2/wTl04mGkunQ80PKJe0H1lNilcvyEUkisNpL+E7C0+G/lZ2f3/1d7/5nnuaSQ9pI13MdFDJpVCMb7sEJMV0VVKkASdERqRFt1sP6Ng246VN5u1dgTjv5jmeag7jHKmsTPt69hyeh6oe/eHqGGa/B0IAmJF0Nhk0VqRinfqW7B5J2X4obDCU9Sv4mY1Dc7xkbzvY8sbpsXYLfttCKBae4BTI6VHGezsHxjgWPobCUX3L62i3hh8MMTX+g+xDgqzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7IpttaAn4DY0sV5dwPziEXk3W4FjjaFyPbq1SKIyX2Q=; b=fzfPk54TZq8qi1PGEi55UFaHhi0+kBy3h0LSOOFwSaDTl7ymwpqJ/miydwYe4/ymJnkA2SCPgGCBW4pQUsGSOSLSmWGO9yOUgzGZR+ClDxEmqGRJBIc4vnk/utu6PyzGXd9BiL4/4KbGC7p/lmdbIhKrxrbb50YVRuvVET+OaKihUuRa0ydFXioYq7WZ8WIAqVvhK69WhvrBWVvM41ZhyAAAYTQaORUFVDe8GNkEqNK9a8OK9bra7k6wcXmO/fV18U1l1XIyKP8FG4I2VMIzeMvGXy2wq/TqPZNVU+zkLdslOeCOZf5H8o/atCVaI/ne4pPUjBuNNwnnl3VaDDD8OA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7IpttaAn4DY0sV5dwPziEXk3W4FjjaFyPbq1SKIyX2Q=; b=G2af6AhoEOlyPk7DyDJlwP3Thv+UmpSQJ6la2Zng2AuTyRqDwjvcANbXTBB2Mvslo2NBP5RhAdvmyR+vP94T0X5IKhNpOsvTagaEJ3YAWt+L3deUJ4svCTO5RuiwgGjNzy919WqS/CIsMbGeujIyFSbW+JwTSeR6433T6Bmacrtdy9Eb1b7mkSowgHNWDDzNb9BgnAUPPPUP5jHYKhMZYdcl3nnozyUdWZEyihD2oIKqQO+XL1tozna1l8Q0ZTJq/oSOGaTxXItPywlsj+fs/aCLs8R+NlfZbdb7+GGI2q23BI67i48kL7r1M0/AWcxu5C4pEzHdAKH4LCg8deIHpA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by DM4PR12MB5375.namprd12.prod.outlook.com (2603:10b6:5:389::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Wed, 19 Apr 2023 15:36:09 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697%5]) with mapi id 15.20.6319.022; Wed, 19 Apr 2023 15:36:09 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, razor@blackwall.org, roopa@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next v2 4/9] bridge: Take per-{Port, VLAN} neighbor suppression into account Date: Wed, 19 Apr 2023 18:34:55 +0300 Message-Id: <20230419153500.2655036-5-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230419153500.2655036-1-idosch@nvidia.com> References: <20230419153500.2655036-1-idosch@nvidia.com> X-ClientProxiedBy: VI1P195CA0068.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::21) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|DM4PR12MB5375:EE_ X-MS-Office365-Filtering-Correlation-Id: 06f8e70d-4a4f-41e7-39fe-08db40ebcc47 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qmVpWy3O9TtjtmuxeZP+TIEXKW0HAD0Jazu30IcNcMc08DSzbOUsOSGRbcLPBzKJi0nwPCmKcyPGP0RjTH0YrZ/JTBAjqUCtxrkmTB/RvA6ldvYi588LroZtKV08ekU+I4O2yfjtQePhF6Rku0ddwYrvG9dmlMf5nX8et2RnLk7SOlrbwigIhhYTnT+EeF2cQ1n9suVdVl+dUXLVOIeewWqHx0n7elaFWsgNCuuxQ0ru4Bh2vh7BDKq6nOMSbRpgFHyjsKuXGd5f//9n6odlcx2GzJ1z4j2+e1NeWuqiOWPxONGh1/frQOOwayTGblmohh+j4EK90A5qxVg6MRQK7zM61pqB3P5eP4ywILd4kdHpLqpR6acnMjGUlC+7PGvOY13lcQJMj4BUDBMHRhlcx0wkFJwg1XGUccj40RhSDQ2NQQMiT7CWjjXMERR6xZkZ6WMI4q6+/ptiM6Rh6R8Tc5CCqXQoktGK0SXSV6nyohKlVQ0kToEgi37NfejBsr4/FuJAFcI4tu5NsDNNE+Jia3wRwXUgUCfZh90/nYRuw6Ac4EeLIJSBVaVE5U6b221x X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(396003)(346002)(39860400002)(376002)(366004)(451199021)(5660300002)(86362001)(2616005)(107886003)(83380400001)(6512007)(186003)(6506007)(1076003)(26005)(38100700002)(8676002)(8936002)(478600001)(6486002)(316002)(6666004)(41300700001)(36756003)(4326008)(66946007)(66556008)(66476007)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FFOFieptoZXQDH1A5woYyug3EMeZ0mfZ72k/dVzMLgufJPEYZRSvnpTKoW01UhWrItDIUmXtYgtGKBiKMaPseWDQz1bRwPkryGF13de+UgF0cBBhpPPRk4/qZJJitLhn5A+xkqaLMSbpfp4SlA7bkGyXkvbB/jS28GqXcOGPz6w/L2kD9utOcYCGUFTF2bsWusPHUa98HY73F33H0tt2xxIElbXe3m80x4Oef0sGdOdfw3QUqkhk2sBlFuz3wza6m7BJZ0CsDfctytiEmxGBYJHvO4mBBUoF/vZRbe5kThx/fzQm9WzjVcAsIgIEycAJOCeMiN5ybnCOFm5WRIzviQdcCYiK+lyEcn5YQAUIpD3ziYVxKx1p93QyLnsf3jPVZuKcUT4OSylX8kXUFqV9yYlg4CgDcCcPSwWelbTu4W0PtAjsKCYNwtMwIRDajqdjUpdhMHNJJQQBQpjDk6onoh7sUkcbsyuT4GcF9U5qB+F5iXtPbbv4EKu20EKmczQID/hRi2FRP8IsjqTKm8qsLZvJpfdPC5WNfmx9b7NyL6R8UnqmHhc19uIIWWdrw54rXtD0L3lNqsUeS7qewka/7+GViAXbbVw3GgcxF6jJdjvtd0Tp/yS1mwuwQ9eLvEPUOkc55nISKHqLz5BHJa5qGQBESaps2kATgxuhjQ6+eoz5EJSy7xrsnnFQV9rWNooO7oZCYbVjh2Yeh3awzLx4xRu+/xCbTFxql04ZEU4rjmEPgxV/01bo3MDupameON0JYqGNsaA2YgVvoc0D1OpFsnMsZ81xmic7b/Cf3dsZyCzPSixl1T7d+M/1QRgblNT7yvhvFxtGLnEqiQNyF7i42g+udmJySY12Jb+yQcr9Dxey+96+mcP2GaXZAt/sC2chX8Bhgi5+zQyzi2KjhHtMmBH3+72PYrcJH3jLnIlTl1RMTG5NQmUeI0acBFKeM9JYmylkazsHuPAJLPDzpYLkI4XMpCR7RDU3SirMP9cd9m0geL21LncNWjB+5G0PVjTAl5uxUWtRfAN39ROICpylTee+czLruNJuw1PfQuS5vSl71CosNwzGvuQElgAj8MCoZGBezP9dUZkB9F9HQFmZsPo38MQUlRcM904BpGdiqMuKhLMyvves/FdNSTGblkkzU6HBDCrf1b36aT4weu4vHBuTiFCT1PeNEZMqgkyVSrUzn/V2zkDGVmn+oOETY1MwicfruaUsPpHfE+sNwybjYwOMEQ1W+ync0vLqc+EI/ul+XcFxJfW/SqQ9zhk+ffWz/UfPcgEK1oWzcwo/Kd5RFTaVDVTCuwdLTVugigEYjp0ml5HltBnOo2GYFaeGbEaGlKeb6pnwh7CJ+jPnV/tygT7BEEasLK1o2bfq6X6dpCq8LAnbjOMyMKWMWWNaEdDvknu4U0IiH3fvBsZHh6V2Jr3plPZ+BR/dIjr0U9QhfJ63X/duB7Q63cYZOUUnxHzTFNRNagnt1gIf4c7tJhGV9nCjIfE/fslqL7lNMOHUpuDpP1ck4dWpa+wtJvriH7bYia+vNLkNAJJ2qJzd4mLNbtzJt95mXbXNKr5EpbBXYyy7qHVJa8lqyAodOYIU9Flc X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06f8e70d-4a4f-41e7-39fe-08db40ebcc47 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2023 15:36:09.4688 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CtuCO7hiDMWEntMjUpA0cZD25P45C+K/kScxVY5OdM2vKW2ubzIHj665RTP/o/+hOptSINWgf6aHvE2ACxdYWw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5375 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The bridge driver gates the neighbor suppression code behind an internal per-bridge flag called 'BROPT_NEIGH_SUPPRESS_ENABLED'. The flag is set when at least one bridge port has neighbor suppression enabled. As a preparation for per-{Port, VLAN} neighbor suppression, make sure the global flag is also set if per-{Port, VLAN} neighbor suppression is enabled. That is, when the 'BR_NEIGH_VLAN_SUPPRESS' flag is set on at least one bridge port. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_arp_nd_proxy.c | 2 +- net/bridge/br_if.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/bridge/br_arp_nd_proxy.c b/net/bridge/br_arp_nd_proxy.c index b45c00c01dea..016a25a9e444 100644 --- a/net/bridge/br_arp_nd_proxy.c +++ b/net/bridge/br_arp_nd_proxy.c @@ -30,7 +30,7 @@ void br_recalculate_neigh_suppress_enabled(struct net_bridge *br) bool neigh_suppress = false; list_for_each_entry(p, &br->port_list, list) { - if (p->flags & BR_NEIGH_SUPPRESS) { + if (p->flags & (BR_NEIGH_SUPPRESS | BR_NEIGH_VLAN_SUPPRESS)) { neigh_suppress = true; break; } diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 24f01ff113f0..3f04b40f6056 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -759,7 +759,7 @@ void br_port_flags_change(struct net_bridge_port *p, unsigned long mask) if (mask & BR_AUTO_MASK) nbp_update_port_count(br); - if (mask & BR_NEIGH_SUPPRESS) + if (mask & (BR_NEIGH_SUPPRESS | BR_NEIGH_VLAN_SUPPRESS)) br_recalculate_neigh_suppress_enabled(br); } From patchwork Wed Apr 19 15:34:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13217050 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 2A8FFC77B73 for ; Wed, 19 Apr 2023 15:36:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232870AbjDSPgX (ORCPT ); Wed, 19 Apr 2023 11:36:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233027AbjDSPgT (ORCPT ); Wed, 19 Apr 2023 11:36:19 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2058.outbound.protection.outlook.com [40.107.223.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8F6A2697 for ; Wed, 19 Apr 2023 08:36:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R7g8GczLCm71ZQ+4M4/2JTChHNoANcnIbPFsD4IH/+ZFSF8kkM8KW3wyiKyihMpqaA8thy6QJ9YhX0MJ7TpYrPGOwDzmyRcpSnEO3j8D/+QwJWCmRt93mgTzk7F0CE7fOFT8H1yGQxkJluxYDq0dDNrPmkMUymnHgbYPhGA/LN97T1yz9GqS4Rntks+S266s/4ZcqvZaqY0/LZK9XD1ayHD9Vs/+WMnzC7sQspc3z0Z6BkSc64HPG59WOIQOTBBlB8Pcn/XvmS16YuzsylOemzD1xTbZ9PkjsEwFH8WLA0buydqWMzPRszwENED2VB2JxMukoRbzayR0q/+EdBSPNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qCoPS6jRXIg8lmzwhDRB/kWn2MEZyeqs2DiwbhfYYRA=; b=RROOpg4lIA++XIPn95iLSd64M5y1HuNWZ+NV/2+tj5ueP3CoIicupTNTCFYLmtAL/ZifWO5bM8euwrc6ZufV8B8akkI69DdKp7g5v6Q3auVyJ/5GPVr3kN400QS0jvYK7dcS9b1BVzDD53e8W1DKdglkbJIxQAhsNdTQ7FUnuarOoQSCeKqWN2kAPl5OVOxIS/Bx7ND6QuSQTeza6hEvfHi0eCTLNRWm0rW+N02LseEsRn+NPA6ZcaNW6kVdghBuOCapSSbdra9lNjSgnExJ3EFrS0Lno3TO81HZsrk++UzwbN36EM1pof1tziWB7wgnkOw7AX/0uhpnFkzRqu+iPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qCoPS6jRXIg8lmzwhDRB/kWn2MEZyeqs2DiwbhfYYRA=; b=r6dYlgXqvzstB3vSTawl1a7c2OKjt2ANlmxSJWVzS9+1mOTfoMgTuuMw8L6H5doEgVG5DmE2z4re2vbZNZJ9tnP3tDJ5xYjxfReT+DnT8+4y53ZA5Qy7NnpN7kUWCcmGQNR+/WLkpj7UXCOZDEAxTTdveve87onxketycYzo/IVX2+IZR5C8y1WmxZY0k44c9EB+v6lfE+v1txQoanyb6ZW5s6Wl6AwPqA9+Z2FoBW+nY0E13njx1KVtTrUvS2YEcTH+0hg57izJFJSLphezasCe38tg2z13jRmK4Hx665rsFs7V10hZq4ZIsLV/NAxpXGs+Hnpstw43WthxLFuHhw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by DM4PR12MB5375.namprd12.prod.outlook.com (2603:10b6:5:389::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Wed, 19 Apr 2023 15:36:16 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697%5]) with mapi id 15.20.6319.022; Wed, 19 Apr 2023 15:36:16 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, razor@blackwall.org, roopa@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next v2 5/9] bridge: Encapsulate data path neighbor suppression logic Date: Wed, 19 Apr 2023 18:34:56 +0300 Message-Id: <20230419153500.2655036-6-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230419153500.2655036-1-idosch@nvidia.com> References: <20230419153500.2655036-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR0401CA0016.eurprd04.prod.outlook.com (2603:10a6:800:4a::26) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|DM4PR12MB5375:EE_ X-MS-Office365-Filtering-Correlation-Id: 593c52a2-4422-4415-0070-08db40ebd04d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4t195ykU/TFOR50SkC5lqIDN6XbzqaCAolvYi8h2scftDlFovMC9GymLXcLodixsHG9XExkUn0J+nzufGok0aoUgiNhtWNmLL4jHE7IJxjptP3H5eKPUbwErYBZOPFsgZF8hBP9cyAmPWA9eA5I9laL4DGpz/iiV1wDXrO8ZqKJlJHi2Xowhj2/TSpZMrpD5v2x/BSAzU/0QPrKs5RYcwcsiwLsP8NRer31pW6B2O/o3Gu79oTd4LmYiJzyqZsFRxdkozNkaumyfGntP/gM9hUk26zGl1OvpFKFSregVKZI8iYbBoxBlBewfWVv9c9chnd7wxKSr5UjL2wwFR18ZrswYRgA6JU7EOEVeTOFuwp6osAw8eqLxUx0IZCn6P+TlusweY9sDZrJJ4u9KKuvU60zR/5Ob2HND/7RcoJEjs5MOj4cArlwGVQS/WSLtc+u38/Y9/bta7gfAhQwfab5ZusArG0TdvT9LSz3hGH8c7Ur09KDq+gSdQig30P4n/ih8PR6wFOl13aDSnGcSR9sfhxMJqBGFFO3C+cJa8gMF1ZF2UGhd0fpVhCTw0GUT47ly X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(396003)(346002)(39860400002)(376002)(366004)(451199021)(5660300002)(86362001)(2616005)(107886003)(83380400001)(6512007)(186003)(6506007)(1076003)(26005)(38100700002)(8676002)(8936002)(478600001)(6486002)(316002)(6666004)(41300700001)(36756003)(4326008)(66946007)(66556008)(66476007)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PISyXGYPku7bkuZfHSq3tVtVtKkHhkM1lhTBBsexXjwuQ6jcQwqQT4cE/TmgHj0G4huwcdWof95YpK5pIOMBO2aD9l5fqbWzNWWMSi7qpW2npxfUpeDfUU7NJvHTpPL7XFe1UKG6e3e1SmuX5fPZepUTN1NTLTcWlKnrg8xJlU0kl2Uv3RUGnhpvQ9s4Goa3lwBIuqjPbH0ityuVlJUmNyrwfWJYfD6B8HYeu2/J8ANHBqrh5SxghgEHp/CwRR/BxqGZ10IoBolR4oAzTlyMB2xcfo817G3Hi1hHJFOhRrTAijkL2z3lNbhR1gKu55asQ4KRSIdSdGoxtdAdzMKotCNJlOW9Rh/RmZvCCJ/tM7Xniu0/RGIosrgZimMc4sP5T3J8K3Y4VLIuh/Odo8dN8z3us23zXdIWv6UvKwlR45EpCHHTPGxINx2GuN5someQMJgquQ47iC7j7coXb4J2OdU7hhZ0FDm2ieVeojUNbhyX9MwemtXTHxS216YKSlI6bZiT/5GhL20fSBhenu0i0QUiLU9aCDgIK8bSolLYCA1rM+hH+FnSpt6lKEjeQ25hl59pt2WJoJdqxUjjX+9HX/i91gxDYGTYlMi48AlwTMJE0IxWVHe/KMmwzHEd1uLavLfhPrjqNPLqNUPNY2PYmlY280wp1v1/SIzjuDu3BBrs8r+Ow9WoIbxWhKIs3QYUbzJzZ/7k2PxY2sBEbSb2tWkQUcLCmn3qcDQ4i8mvaCdRVqwdIz5OwQH7rZTWybVmK9z3kaChatm7myWOOQflfbgKAC8xKMArUra7HIvxdKJyjiZ8yxdEu2UPMowygqwrGQvuSFl+AsXoEtICdwQg3cFzp//Udx3bg/+qgsarDsNWRZ9hyBBX1/rhF7SsCHFxBpKMm3DxD7OuvpbU3d4Lu37c5Ueqk14vMzxHR0fBfiIDe4rNMlCsvsvqn6deAoCPXYejgBwWX+1z0Eff4vH605rFKyxcbO4QVtSEKbrM74c1xG1d9JuhcFfogZpTUBIf1f2Gv6jGSnNiBTSPjNlyD101iWjF7+OrmmDFNXM+YF2N+9r6oS9LnhZROu1qFPX4T9DY0TzKi456Er23/RpOaILuCgKRRIncfEfwASFjZ8JiFIknr2m521YRCZNn51AkafevFjXodO3pl1/FVzfU+T63f938PLnl0cUuuHG/oZhAsYf7bJKuqxgEiua9sQkVFbmo8k2nJLh8WkrWTBuJl0cojDgDG8t8T2H5Ryx1pUnxuN9uvhAf5bZNZ817hT3mJrzrxUffujnK+7xiFJFcC5oqgOF0a8vbIk6VHFn+1D7uksNVVRUqvcKFQDKR/RGIOi+RMa88ayliRU1RCcuI5vQD/aeOxhU6pnCp7MWBbt6opoQRu/QjqYk8X3Oy8xTaXK6ySmEjAkbqNkHHqMyymbcQ1og1fTpMJ8T4E2dXH3XI5UEII6ypI6UDQyTAyXF18qAFG+q98nHWoilJeHiSVaOVn6VKSSvuyz3lLF2ghkfcJ78/crZD+qDwyqwvjPy2xfyUMsA+y4cB6CoVa7dQNBbXEaM5P5wVAJYCS1o3COE5eVSvWgu5GBTZOx9XfGKJ X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 593c52a2-4422-4415-0070-08db40ebd04d X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2023 15:36:16.0758 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SmyDlaSXGTh7m6HkqFWkGx8zGBVdop3XlcVQk2f1qS+iv4JVtaNL4MmDEDcDFsdMEdJxeOYH9oq4BN2xsMQ7WA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5375 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Currently, there are various places in the bridge data path that check whether neighbor suppression is enabled on a given bridge port. As a preparation for per-{Port, VLAN} neighbor suppression, encapsulate this logic in a function and pass the VLAN ID of the packet as an argument. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_arp_nd_proxy.c | 15 ++++++++++----- net/bridge/br_forward.c | 3 ++- net/bridge/br_private.h | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/net/bridge/br_arp_nd_proxy.c b/net/bridge/br_arp_nd_proxy.c index 016a25a9e444..16c3a1c5d0ae 100644 --- a/net/bridge/br_arp_nd_proxy.c +++ b/net/bridge/br_arp_nd_proxy.c @@ -158,7 +158,7 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br, return; if (br_opt_get(br, BROPT_NEIGH_SUPPRESS_ENABLED)) { - if (p && (p->flags & BR_NEIGH_SUPPRESS)) + if (br_is_neigh_suppress_enabled(p, vid)) return; if (parp->ar_op != htons(ARPOP_RREQUEST) && parp->ar_op != htons(ARPOP_RREPLY) && @@ -202,8 +202,8 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br, bool replied = false; if ((p && (p->flags & BR_PROXYARP)) || - (f->dst && (f->dst->flags & (BR_PROXYARP_WIFI | - BR_NEIGH_SUPPRESS)))) { + (f->dst && (f->dst->flags & BR_PROXYARP_WIFI)) || + br_is_neigh_suppress_enabled(f->dst, vid)) { if (!vid) br_arp_send(br, p, skb->dev, sip, tip, sha, n->ha, sha, 0, 0); @@ -407,7 +407,7 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br, BR_INPUT_SKB_CB(skb)->proxyarp_replied = 0; - if (p && (p->flags & BR_NEIGH_SUPPRESS)) + if (br_is_neigh_suppress_enabled(p, vid)) return; if (msg->icmph.icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT && @@ -461,7 +461,7 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br, if (f) { bool replied = false; - if (f->dst && (f->dst->flags & BR_NEIGH_SUPPRESS)) { + if (br_is_neigh_suppress_enabled(f->dst, vid)) { if (vid != 0) br_nd_send(br, p, skb, n, skb->vlan_proto, @@ -483,3 +483,8 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br, } } #endif + +bool br_is_neigh_suppress_enabled(const struct net_bridge_port *p, u16 vid) +{ + return p && (p->flags & BR_NEIGH_SUPPRESS); +} diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 94a8d757ae4e..57744704ff69 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c @@ -226,7 +226,8 @@ void br_flood(struct net_bridge *br, struct sk_buff *skb, if (p->flags & BR_PROXYARP) continue; if (BR_INPUT_SKB_CB(skb)->proxyarp_replied && - (p->flags & (BR_PROXYARP_WIFI | BR_NEIGH_SUPPRESS))) + ((p->flags & BR_PROXYARP_WIFI) || + br_is_neigh_suppress_enabled(p, vid))) continue; prev = maybe_deliver(prev, p, skb, local_orig); diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index b17fc821ecc8..2119729ded2b 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -2220,4 +2220,5 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br, void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br, u16 vid, struct net_bridge_port *p, struct nd_msg *msg); struct nd_msg *br_is_nd_neigh_msg(struct sk_buff *skb, struct nd_msg *m); +bool br_is_neigh_suppress_enabled(const struct net_bridge_port *p, u16 vid); #endif From patchwork Wed Apr 19 15:34:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13217051 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 933E4C6FD18 for ; Wed, 19 Apr 2023 15:36:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233045AbjDSPgi (ORCPT ); Wed, 19 Apr 2023 11:36:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233140AbjDSPg1 (ORCPT ); Wed, 19 Apr 2023 11:36:27 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2073.outbound.protection.outlook.com [40.107.92.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9944249DB for ; Wed, 19 Apr 2023 08:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O+zCu37v8HNrZ+8RNE6CibtLNgduPQ9YpqzTLlh7F4upg9BjZxpZlsKhKXa+isQNzErBbevBBhm71DyXPzZMs0HC759tsdb/mNVmfcI6LlYc3GaNTsUQMd5muts3pbcV4Dc7tvi2yTjNHXixDSECKSJOkFVM4TgyfU8V/qEw0I9q3TQzbbvgzUR80llCnI1nt9OqF8+VF3xjd/VymwIvaQMVwzj7zg3igL8VB7Jd5Vh7Zg9bhSRPMWjvn6XyP6Sg1QN+jWvIH56DlHb9JCMYLDiS6sGMVg6QtezLYh7Bz3oOsuAD3O2h6spnGPsNZTvjkwd/OGyymvJeaT+d31bXdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wUmFijYCPgEX04cPjZN0kCpLZm8abO4duay48UU4ewc=; b=KkLUQtTZ+E3BAUrmQs+Op8/823UboEh0yzArE4RoZjmRJ6fAj1jF6BadxNohJJnZKfWH0hbZ4B3XaX6YrPhZYcbcJR7d+jApl+1IZbbz2CiBYgwdpIixL0e5bzS0b0nnqCUxZL5UFJaMolwHJLeEl5hCi0sFCG0Yi8vNvg58GD1bUj/VwZyd3SP7Cj67Mop6bfItt26kYR/Rpom3OIdObK1XsncnuJimBkdfZka2qS5lx0QAmyqLLt3qZ7fub/7XVlpItfc9KcURRVjJzSEN5nOV+x9SEf+g4nH72pYgHwHutebM4l6dUG66QohtQvDTGomWxnZ21GIRCJIX5NxGnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wUmFijYCPgEX04cPjZN0kCpLZm8abO4duay48UU4ewc=; b=hxAIK3wO9ESg8RSoyZ3XL9ggXJ8YR0H2US/ZviO6uJJD6GWcmZaj54avwzt6kvRLqWGvFQXiUe709CtHXX4jpq3sQy4ay9c+cVbvDVAtjyjcp1beCeOcSGThrPdfHfKBc6DAtOkvTBGpt88FswMP1KmAbErx++qaunem9zljp8t7PQDNpoDvrhBT6T9gXGmDgbmQSfIGAHPxPoiwDzEWqIiqYm+IdK53vqmRBYv8wLN3VTBqcrpaKch97sqRDh3sXeslizSSrwx7dC65VmwqA4p0kZolvBk6QWqnlx96E/vFCBjNRSWB/HOyxJlCjont4fMOIqenYaHGehRHPjXOAQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by SN7PR12MB7249.namprd12.prod.outlook.com (2603:10b6:806:2a9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Wed, 19 Apr 2023 15:36:23 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697%5]) with mapi id 15.20.6319.022; Wed, 19 Apr 2023 15:36:23 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, razor@blackwall.org, roopa@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next v2 6/9] bridge: Add per-{Port, VLAN} neighbor suppression data path support Date: Wed, 19 Apr 2023 18:34:57 +0300 Message-Id: <20230419153500.2655036-7-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230419153500.2655036-1-idosch@nvidia.com> References: <20230419153500.2655036-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR04CA0115.eurprd04.prod.outlook.com (2603:10a6:803:f0::13) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|SN7PR12MB7249:EE_ X-MS-Office365-Filtering-Correlation-Id: 135118f9-4159-42e7-7365-08db40ebd482 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 30zls8PqNSY/5qTzoRZaGzW6hs87c9f+bXuzFQYS+Pv/OA79vV7RDXfQPQfrWlGfwnF8WwXh1RiLSPUN518DXck4z40cwrm48ORSQp8xF7zHAuiT3MJat92RUcOMLl+JPCftP9HT+afNVstBtTJiMOZQbb5Z0tc5pPkJs5xEKDen0U9nMWr+V1+tJWpH6DlDKaeiCOmRrbJ2bAX24zx5IJEoRCFTjtnKqMMNoEbkm9HVnCtd0q13IZ6I6966MH+gbxSAaZcCyIBziU5bs/gr5b+HI5fsh39QqJs5qDqGw+CimXuHoTeNmJOv/7xAsmK3v2ajGeOZg8vBZfz/UIbYWrmxUXxUIzx9uPmeQ6sNYtAAqG9nAd+HkDHaIKF51t5/39ieWbvso5eJmfcD6E29GLG64yZSJZrbcDqamt8fRDMBvH0jE27TWPSyjcHWxO3smsYox8iAGAeTKleF5/3W13Qbt/ClpfLOps7y3vjv68rzhV/v3PrhNHh5LzZOrO5H7cxJ0GeVxXRXBbErV03UCCwYaWvAgFPDcGSRAic/h4808GtVSwVCbsSaqzgj9hTU X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(376002)(396003)(366004)(39860400002)(451199021)(5660300002)(6486002)(478600001)(66556008)(66476007)(2906002)(4326008)(66946007)(36756003)(86362001)(8936002)(41300700001)(6666004)(38100700002)(316002)(8676002)(1076003)(26005)(6506007)(6512007)(107886003)(2616005)(186003)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mFSYTAPtZUkgG5RBTlEW4ASUKN4t1yQZguIRv7awBkc9W1jjR5x2gXHl9rX9Dqn7cxI78SdlVt3Mrpo65AdytFGodrtFCkgLAqn6LUS3ug1ezPDHpTw6AUnfZU2hGNnkX46DaPC7WyADiBKXtPWPCBu1w8m6HHj1C0HNyo/Dx4CuVFQRoHtOx3N6fGCzeZCfbIPGmwnNQuM/kCfX/yPPVpIFLfuOgvZQXmHlc3COtMCSbXKKlu5/SaEsCH94QAkxNGK5YLQSwIWLnVRSX3rYxOLW6OUs9Sv9LyvOTfzCvZp+IV4L0I3FbkOY+bC78069y1IdRKAdLyfpL4F79jKxYuO4WXQSfpSMzNV6lDMVq34guTBhTn86dtQ1voF32kN3RhlxAktWyorwm5NyrcTWsqfJiFZ6dKcj2h21V9x8w7WcFyTA/7nkRAHIEt+YIqYnhFjPgLMGZ+Zqh2Dtp2XuSuAGRblOd2loX0R/25VazNYzb0qY9cAKIJJsj6VT2lSYb9usNk33hAtUvTBkudvz9OmiH70VXUHg3bT0u0XG22Z9XJkwjcbQRu4srcMSdXZrbdGMBcKMWO88cHTc8SImM2i/UO5w7oUedp3tXbM26GlT8qagrS3af8oO8ZHDF+BxmthhW5BGOS/jnb7aHwnd9Qkj8YV2VSplkt0QcAi5kBOtDs6DCDM0w0Nhw9gwa6KeBH6RSg+/PnEvAMn66+IlNmvNkqiu+17uxgeGixGR3yQDiQRL6PNi6pbIjHj8a2U/qivvGyPzWnJ/lOaD0uiCn5mD9hgd3C+nE070VbEUa0La0vLE466IH9pse19pKEH/MX5lRtw4AkcXnpnrTIZjisTBCBD6JlqWw08vZJu+HWh2trNQEQPMJlof6SSakFBZ9esoB/scHZfAbtc7ZlpGaYjGhN7s9i5avpXlDp6HMgzcd8+xccKgIg1XBdHio9tKm2/ICo13qYq4Xnvri3c97Zc38lON2j3BaLim48unRQpx0PJMRz/Z0/Yh4AtXSwPuxj3VknjlSJ+8lcTTSQgEZPX/8IxturyrZ7rv37LhVTC6UZfXeyHf0t37952XvAb39JoVMYGO/V8y5ALmlDmWzEiYNvsyBIVmNi/7IeTSlh0Wtb0JbsdJONqvsuPUK6P9PFd5L+2yoVYZDjQIwaHgfH/t+K36zWhUCDzMk2UJ6LKsmylrCZA7B1KM13UaG+PT7AwAgbCaiktEX9Zk8wVq1XMiqIiYGIxy3dKG1mjx4REIxJIpmxKV+UxuR/4rhFLsMvBW5jE5U7uWwsOIZxFnfIW43ltsrgCZkdzFg/ZwVvMV5ODCl7CuQYjq5NyM1qkwgCHswYPeuNc4Krso3jciaLxWUGR8ycbw50F/YHurw1dEMff8Cq+ISNq3fBm509tfbmfhLFwmJeEw5ExWB8U/3a1nP1iYLQ3hGQcByiC6tPyyouwdUkNCCUlZMQTfDH2nTOLNTP7TRfWflIElqmtiDzVyZE0NeQuI8HZK5dNE4dg9LBdDTvoea4BRANcbsYhbMrt06k/j0bvqabE1HSk8iXbXaga6W8rgwyakG0+QIk8ss+4TCS6hvjnxwcxtNndG X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 135118f9-4159-42e7-7365-08db40ebd482 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2023 15:36:23.1126 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JmQTKQuqiGOc5Dpk1l3xv1z6zt7kmhmBDPibTt7A0ocj2hOLuGW5X6wnFxE2rH8U4/XFK7q+AV/tgUo2fmagcA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7249 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When the bridge is not VLAN-aware (i.e., VLAN ID is 0), determine if neighbor suppression is enabled on a given bridge port solely based on the existing 'BR_NEIGH_SUPPRESS' flag. Otherwise, if the bridge is VLAN-aware, first check if per-{Port, VLAN} neighbor suppression is enabled on the given bridge port using the 'BR_NEIGH_VLAN_SUPPRESS' flag. If so, look up the VLAN and check whether it has neighbor suppression enabled based on the per-VLAN 'BR_VLFLAG_NEIGH_SUPPRESS_ENABLED' flag. If the bridge is VLAN-aware, but the bridge port does not have per-{Port, VLAN} neighbor suppression enabled, then fallback to determine neighbor suppression based on the 'BR_NEIGH_SUPPRESS' flag. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_arp_nd_proxy.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/net/bridge/br_arp_nd_proxy.c b/net/bridge/br_arp_nd_proxy.c index 16c3a1c5d0ae..c7869a286df4 100644 --- a/net/bridge/br_arp_nd_proxy.c +++ b/net/bridge/br_arp_nd_proxy.c @@ -486,5 +486,21 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br, bool br_is_neigh_suppress_enabled(const struct net_bridge_port *p, u16 vid) { - return p && (p->flags & BR_NEIGH_SUPPRESS); + if (!p) + return false; + + if (!vid) + return !!(p->flags & BR_NEIGH_SUPPRESS); + + if (p->flags & BR_NEIGH_VLAN_SUPPRESS) { + struct net_bridge_vlan_group *vg = nbp_vlan_group_rcu(p); + struct net_bridge_vlan *v; + + v = br_vlan_find(vg, vid); + if (!v) + return false; + return !!(v->priv_flags & BR_VLFLAG_NEIGH_SUPPRESS_ENABLED); + } else { + return !!(p->flags & BR_NEIGH_SUPPRESS); + } } From patchwork Wed Apr 19 15:34:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13217052 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 BD237C77B73 for ; Wed, 19 Apr 2023 15:36:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232355AbjDSPgk (ORCPT ); Wed, 19 Apr 2023 11:36:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233225AbjDSPgg (ORCPT ); Wed, 19 Apr 2023 11:36:36 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2068.outbound.protection.outlook.com [40.107.212.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61E5A5FD2 for ; Wed, 19 Apr 2023 08:36:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KEqvQsdH7wtjacT5hAWTYvn/NteS7GGVnuF/vyDHdI2J++JwfZOlqgt81ynR2I8LTtz7d/KyefPS7xg1WDjWf4puMS1ZWMdcSA3Xz2RV6irKIgPhuwggpxIb0dagraFKFI+gjABx47FLj2EpFbiK3xO7DqiMShHfQFLoAxC5rRM5+yd6CJ9d4PyTaTi/bf2mX3wXJRZN0E8/J9Df19621Ps5vgzIE6TKmddCBdB55kNOs7KyYggLPDanbdyGvmPcABiBlXOGuZjaP+/ILGGx9LR5oNf+7X7+TAvV4qvvADSKVqFX9b7fJxOE/xqrezNO5/Ij8GLpqUFe4jzyqFW9Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NmUQ6d6kxYpKJ4DxH+0kxjZ7sAECfUUkXSJAlzBBjXQ=; b=dxvUpkhSkOCyuEACYa5GqkGKg1UHWI4/58v4TSs44OYRwDZO33tLRByvzvPUyAycprPFA/IWMXLW/gT9AZ49E8MGucaOdMPki9O/BvmTcgGHgLkPi5mQ+pg0j8dlkjqb0oqajzKfE5O1Kuxlm+9NePrn3k9nMWu23pJpYisbupMI4JFU2gLpAtbZDu63L2mR6bQOSk1a1wi3/A9j64HRlRGK9KvX7cOkC/lfI/qdOn0gCC4FXUfn8MnYr2ucLng/JPdOCVHGUcTVa/YmKl5pN6rc4u7olNLf/NCHs3QdFsjrkvInQE23z5HYd/8KDHDWYyP7VtROU8Jj8dPxFMKDDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NmUQ6d6kxYpKJ4DxH+0kxjZ7sAECfUUkXSJAlzBBjXQ=; b=ppgFdrPEsMeCuIxNpQEQv406wZHIWnDhrsxxf6AgmQYz4Z1TOo5WGD1IYA12GgHb+DZChKkskdWLEIA4hBSFWCY07sFwn7Xqi5/KOhxWPxNymDpwkDf+SHBbtbZloNNTyk3jfsUm14NZZFG4DumIPQ+DJ2DaTAUAvWlkJPbtWmiCtwwqf5uaOr3F0FlMn6cp4nr2F8I418teCArY6I/jJAV45UBlLWXSa9puctsYeT0dcnXY0BwxjzWRihQ9f95fKy0P4E3o2L1QatDKCdKXwnTYkT0sP2NsFsuH7zXy7aEQHFfPpJSWUbVaO6+151/eG/GTyvohWEkhXbOP+96V7g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by DM4PR12MB7623.namprd12.prod.outlook.com (2603:10b6:8:108::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Wed, 19 Apr 2023 15:36:29 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697%5]) with mapi id 15.20.6319.022; Wed, 19 Apr 2023 15:36:29 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, razor@blackwall.org, roopa@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next v2 7/9] bridge: vlan: Allow setting VLAN neighbor suppression state Date: Wed, 19 Apr 2023 18:34:58 +0300 Message-Id: <20230419153500.2655036-8-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230419153500.2655036-1-idosch@nvidia.com> References: <20230419153500.2655036-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR06CA0182.eurprd06.prod.outlook.com (2603:10a6:803:c8::39) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|DM4PR12MB7623:EE_ X-MS-Office365-Filtering-Correlation-Id: 3bb433a5-b357-4642-9ebd-08db40ebd86b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /m0ap03qA83zkZVLtoRUC+bV0pSe+xUvM2w4ux7JloRB7G9kaKZj18m57L3IvQoItRkCr67NaQzgXNO4RFXn4y9AHQ8BB7tzxXQ9p8AoxoRQUiHIW6khpTxfGGChWdTL5b//j/z3DRG9kgwSkfnpvR9pIHPiIWGDZ3reMNmTq/vn0T/8PBj7cLiu9rRrRabU9qVwexWcC0CkcZp8qP3OAm2I7mV93cCLCdPJ6szMN5MG15VjicTcQGg98PFEVXQHQ1bnLvDCuKL3MpwG0Y2gG53yd97TegxRB/Yj+HYPoDoBcMU9p4vmRA8lq8MLc1tl9IlVWNGxyRhacHXUJFa/sRCY5OfNOJ8W50fry3OAXk3LRtFiRJsgIC7hh12G5KAlQIHmvE6/XjTZwX0YDZI5WWISAXq1fj0ES6jMv/1P+kszEDqRRqpcJF8AHtVlkPwFf7gF8rxR1KO4UsaL6NHTPchK7mE6GZKD1FjJMxclob0gbOEzLEvgpbnIM0mnwAZ+uKg0HFJvTv8ZlRVmiJtMjpsgl4U/9Uaxxg0D78AI3+ocoHKE6A8iK2A+NtJP+dA1 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(346002)(396003)(376002)(136003)(39860400002)(451199021)(2906002)(8936002)(38100700002)(8676002)(5660300002)(36756003)(41300700001)(86362001)(6486002)(6666004)(107886003)(6512007)(6506007)(1076003)(26005)(478600001)(2616005)(83380400001)(66574015)(186003)(316002)(66946007)(4326008)(66476007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sPH12w1MwgYH1rrxbHuL7aVmzgyuXA/xY6qzU/fP426Uf8EahN2gCdEt5tb7CLepSYKzwR0aOOe5nqnvGaYJ2gO/e8yQ5tS6n40amzxKZpMZVayRXn+d9KubCe4OTrlh4TihZZxkCnuAxDP1ORo22YwMcDIyoqpMH+B80NX3Bl0C3bhQuu2d5yem7pUNMhXzNXQb/JFzu1Zc/tC4RFkjq4LWUVw0xVtIu+umVoQuhv3GXsTUe6DHg2sA5lbRm6jBWyfc58WcqaY6ia5XrBjcd6IaPAfHe8WBdyJSk/bZt1vIUUEVRnthB+2d7OVP9ylACxwzZ6kBJAtFqGJQEpC0a769pJn182qIc/evrGAQUCDptS+ZkFJ1us9F3AWuvxB2xfTdk8DVxkWLCsRSZ7b61nMuPW/NcAHCCVq99YzdTSW8FrdoC69qOAUREpNu42A3U+itvqELrCXaqlm7exzigpkMaZsJim/B9K6QvaaQMo4HqbyBi6/n109xgvUuAIr3gAUPiznRcBt1ogEO3yWLSuTUNEtLq9rVzcX+nh+jD56wBLJfawFUutYui96x0a1Iegd9aX3G+pofoCDeKj2cvRIIC3XeVEY9ux+VrWvTrXL9KGhkN0CZVYD3719JWowYfk3VXjmRMoAnS2jDi5aWoOgxaCpejTy+KL2sODNgAzbEDQvqKa/Uq5hBgDPl0wTqYCVBdoXgAZHdQm9kA4RBwIRRN1vnw+JDUOE4B78xK65mvH3uoPOWxhhisNdzcykjLPKrjxmnVEKCdwDKyW856O2wVx+GgoG6tJ/KL5iIjQ8y6JirwpIxfjGKPLf2DDbYyveDLKAZhGaWAasAYjRtcJ0H2W8Y2yPw8ooTY+/aj2z3Fx8Jg/rvM1PYR8deAlf8DsPP7O/gG693MwfYLI+oa+qPhcvvEpQqgYV7J02DXZYJS8H5A0dg4ukiUDNxNP3pvhNigklmisTuPmGL4LkI+o0DxpEAZ7X9yGJyJDQgrvD4F2xomXib8xweHZVyqQ+MrVpg8ilL+Hw5L8ZsM9ORAbzm+FZ5iResoSAfOjTciv0M68pnayyN9SKIBrJavSYnKowbjrfin4M+XmRSi2bnnTvotU7sQtdCjqK3USdZFBNSRKc9hKjV6DucRhpuEBCk/PneIU7WomX/mZaFV5KzxuL1J5nv6gNkcm/Jr4rnf1HgL4ppEpwO08u3Jk5G58QJVQRqYE2JjLA7qp0DB9I0rzMtJxjdp37mxauALZJz2FE7yXII2hFpgrAb7XA9M13yozANqxmL64Z2vsmZAp/2nXEPfigRFaRziZnLUZXsBdqm8QykL8wf61ejT87vYQry2owfgU6YEi/U9T4a7MZ6PJ2fvI2rbmxWM32Ry/oRtsZlSZ4Jz0f8hG7FcaQe2VoS+GwMKcPVPvm1gZ5FsONuggY37/gIbaOBpuVHHb2LiNUNsWtGFMg2GYM8JXbhbyTpoHjy/2C5nXsgrHj6wu+GQQYRH3vs2wKh0oTnSp3MHzJTmpteTcd3VbVmVmCfABGFyelVZd2M1za/rPwt8e82JvMnaJAVCzx/hz68GuQNMZkkhZzg3D+y8UaJguConlad X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3bb433a5-b357-4642-9ebd-08db40ebd86b X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2023 15:36:29.6696 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Or3Vdp7EtNeuPMIhGI1v4SIQYIdybQ5YWyTpD/lXH4838/IZr8QrVOr4ZQzRINkycjgttxYK9ysOSvX5pxAdPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7623 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add a new VLAN attribute that allows user space to set the neighbor suppression state of the port VLAN. Example: # bridge -d -j -p vlan show dev swp1 vid 10 | jq '.[]["vlans"][]["neigh_suppress"]' false # bridge vlan set vid 10 dev swp1 neigh_suppress on # bridge -d -j -p vlan show dev swp1 vid 10 | jq '.[]["vlans"][]["neigh_suppress"]' true # bridge vlan set vid 10 dev swp1 neigh_suppress off # bridge -d -j -p vlan show dev swp1 vid 10 | jq '.[]["vlans"][]["neigh_suppress"]' false # bridge vlan set vid 10 dev br0 neigh_suppress on Error: bridge: Can't set neigh_suppress for non-port vlans. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- include/uapi/linux/if_bridge.h | 1 + net/bridge/br_vlan.c | 1 + net/bridge/br_vlan_options.c | 20 +++++++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h index c9d624f528c5..f95326fce6bb 100644 --- a/include/uapi/linux/if_bridge.h +++ b/include/uapi/linux/if_bridge.h @@ -525,6 +525,7 @@ enum { BRIDGE_VLANDB_ENTRY_MCAST_ROUTER, BRIDGE_VLANDB_ENTRY_MCAST_N_GROUPS, BRIDGE_VLANDB_ENTRY_MCAST_MAX_GROUPS, + BRIDGE_VLANDB_ENTRY_NEIGH_SUPPRESS, __BRIDGE_VLANDB_ENTRY_MAX, }; #define BRIDGE_VLANDB_ENTRY_MAX (__BRIDGE_VLANDB_ENTRY_MAX - 1) diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index 8a3dbc09ba38..15f44d026e75 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -2134,6 +2134,7 @@ static const struct nla_policy br_vlan_db_policy[BRIDGE_VLANDB_ENTRY_MAX + 1] = [BRIDGE_VLANDB_ENTRY_MCAST_ROUTER] = { .type = NLA_U8 }, [BRIDGE_VLANDB_ENTRY_MCAST_N_GROUPS] = { .type = NLA_REJECT }, [BRIDGE_VLANDB_ENTRY_MCAST_MAX_GROUPS] = { .type = NLA_U32 }, + [BRIDGE_VLANDB_ENTRY_NEIGH_SUPPRESS] = NLA_POLICY_MAX(NLA_U8, 1), }; static int br_vlan_rtm_process_one(struct net_device *dev, diff --git a/net/bridge/br_vlan_options.c b/net/bridge/br_vlan_options.c index e378c2f3a9e2..8fa89b04ee94 100644 --- a/net/bridge/br_vlan_options.c +++ b/net/bridge/br_vlan_options.c @@ -52,7 +52,9 @@ bool br_vlan_opts_fill(struct sk_buff *skb, const struct net_bridge_vlan *v, const struct net_bridge_port *p) { if (nla_put_u8(skb, BRIDGE_VLANDB_ENTRY_STATE, br_vlan_get_state(v)) || - !__vlan_tun_put(skb, v)) + !__vlan_tun_put(skb, v) || + nla_put_u8(skb, BRIDGE_VLANDB_ENTRY_NEIGH_SUPPRESS, + !!(v->priv_flags & BR_VLFLAG_NEIGH_SUPPRESS_ENABLED))) return false; #ifdef CONFIG_BRIDGE_IGMP_SNOOPING @@ -80,6 +82,7 @@ size_t br_vlan_opts_nl_size(void) + nla_total_size(sizeof(u32)) /* BRIDGE_VLANDB_ENTRY_MCAST_N_GROUPS */ + nla_total_size(sizeof(u32)) /* BRIDGE_VLANDB_ENTRY_MCAST_MAX_GROUPS */ #endif + + nla_total_size(sizeof(u8)) /* BRIDGE_VLANDB_ENTRY_NEIGH_SUPPRESS */ + 0; } @@ -239,6 +242,21 @@ static int br_vlan_process_one_opts(const struct net_bridge *br, } #endif + if (tb[BRIDGE_VLANDB_ENTRY_NEIGH_SUPPRESS]) { + bool enabled = v->priv_flags & BR_VLFLAG_NEIGH_SUPPRESS_ENABLED; + bool val = nla_get_u8(tb[BRIDGE_VLANDB_ENTRY_NEIGH_SUPPRESS]); + + if (!p) { + NL_SET_ERR_MSG_MOD(extack, "Can't set neigh_suppress for non-port vlans"); + return -EINVAL; + } + + if (val != enabled) { + v->priv_flags ^= BR_VLFLAG_NEIGH_SUPPRESS_ENABLED; + *changed = true; + } + } + return 0; } From patchwork Wed Apr 19 15:34:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13217053 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 C10D8C77B73 for ; Wed, 19 Apr 2023 15:36:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233140AbjDSPgs (ORCPT ); Wed, 19 Apr 2023 11:36:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232677AbjDSPgk (ORCPT ); Wed, 19 Apr 2023 11:36:40 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2070.outbound.protection.outlook.com [40.107.223.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 304434C1E for ; Wed, 19 Apr 2023 08:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZuoQwUdxH4ONsferpAUYjQMZM2UOpiO9bzL+qLWaD795bAauNpO5gUCwrEXToQ6dkJs5FI/FwAOndyiJigR0oDw4B3+Lt2PMEgmbQWrks3WvIpIVJX4Ox8+cfv4hFeE95FqGMdy5XzgPFjhU+HYbWULlUGlueA4wpJfbpWcwu6CvDuWpS8LMNlxqwyXdzj9LrmDWSucmwFPXKWr8LdD4/9AW6IEmxIk2dGcAvBQp6gkcdV8UpryU8Xis+JiwCx7tIBQeTQ28tXjwoHJH+ZwnBtCwJ/i155zJKQFywmHcwQhqwdGdvCE7/RvHtlCORWKOrr3XpPlPUYzoUzUT6xtEog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IGiHTPuD//V83hBeK/0kqBvdMWAAjILZAz+t5SR6Z5c=; b=GjWnGwui5DjJLc24FzLSB6fRjeQp865fYgv0VbKBO/f/siyxrNNRv5RQbs9mkl34zGm1nSjNavKm3opt5GYNiIbN/8LdWL6U1Fc3p2qScmDQRmm2VBDHufbk7fV7t6FESfKMKp7MKK8TaS3MCcFd2iNBeNwkPQqOibiVGe+0jlOYrfgXsw4vS/VYsiwx4sNH2um7PYzkPml2XkvYLjzSeB+YXsOfewJffBNxY7ql9DmgghQrEek+vj5zXKtFjOr6hfEze/Brwm9gFI2NRrB9tnCuVZ0vhqJMW5/f7/2puCFRBKHUcrTu4T8V15bZJPtyzL7VjcOtKZdzPSGhLDXU8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IGiHTPuD//V83hBeK/0kqBvdMWAAjILZAz+t5SR6Z5c=; b=FC8lcD1hudVaWVu1m6LzxtTcPiCGHJWji0wJfjtpJNe5xWSiGjXTlPkhe7oRHl9P9WSMVjzowpTd9Jx/pkW8FnuSlsr7uW3GBk9T1TY3BcuUZdqsGDS7bChNJnBI87sgRDIg1frwJ7fICeZUq85eIw4iyindRem6Leoj3IHo+SrAvk18U6GmUWhkQcXct+tGfJsGRx2mmQeWw9ykNcFpWwXA78+4qJ0YwGTyz90+OtcC2F/wJRHstCE2gjXTC+53Zj9Djjhmr45Vp1hXbXeRyjLsketnRUaJRV6kZx9cCK3Gd4ApIs90jcRaRnbWMqrI/KxY7u8jV8s68WHkpGgBAA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by DM4PR12MB7623.namprd12.prod.outlook.com (2603:10b6:8:108::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Wed, 19 Apr 2023 15:36:37 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697%5]) with mapi id 15.20.6319.022; Wed, 19 Apr 2023 15:36:37 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, razor@blackwall.org, roopa@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next v2 8/9] bridge: Allow setting per-{Port, VLAN} neighbor suppression state Date: Wed, 19 Apr 2023 18:34:59 +0300 Message-Id: <20230419153500.2655036-9-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230419153500.2655036-1-idosch@nvidia.com> References: <20230419153500.2655036-1-idosch@nvidia.com> X-ClientProxiedBy: VI1P195CA0009.EURP195.PROD.OUTLOOK.COM (2603:10a6:800:d0::19) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|DM4PR12MB7623:EE_ X-MS-Office365-Filtering-Correlation-Id: e5bd8e95-9776-478b-4a19-08db40ebdcbb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zUAl3Bq2N7CmW1wCHz1ZRgq8JZsZM39+D474JqPK4dXVl3QbMLDshSOGC5AcBT/m0Pj32FP4rNxYPZwD7JhSTzH+Va1JLBkpXR93hEaIHDeRlrk89bay9Dbcj3avjAdMrc7wfG/bjwpXwcy4fbEqEntLpPczI4hCTAufIC5mZFLTIaUKboI+iNkCUBoTdvOfjOU+57xH9Qgw3r21FBEc7+AU4rM3COgic2VkEeqkt7BDRPHRHBBEC5PPapDnhsAbUi9PuH1YACgqbIVWGVK9fkp0tq2XujTYrvPUrIFm/AIEWl0/rCyhLkmYbxmk4dP6JXn2/y2qzQpSDUNUY7Iaz6V2b8xNq8B/72EDutcFccnhBYHTUcT7z9Unvnj57CJGEdgzozvkWfUkuBhatYJvfSklj0WImEM0dTZfu3wW+9+OnOnEUGjIlN7EHI1O86EYBGhwnZHV9ioiUdtYhMFj2raBuAvCftjlzWt6D9wP3NXHEuiFENaMG1nNaKeDxDKuPljyGZf/ycW/MW5v+0tmLqrkF0TsNkEms0JH6h+ArM1ssBTRTlT3ktfPyW6mqbw2 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(346002)(396003)(376002)(136003)(39860400002)(451199021)(2906002)(8936002)(38100700002)(8676002)(5660300002)(36756003)(41300700001)(86362001)(6486002)(6666004)(107886003)(6512007)(6506007)(1076003)(26005)(478600001)(2616005)(83380400001)(186003)(316002)(66946007)(4326008)(66476007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m8EwoyNrDxJODDXiNv6+7zTzp3cxj6rWgwN6rTi7wCfQ8UO2RodLVa4Xwx7QSXdPByYPb+8cvYo3b7GI5W+Oe4MKUSCwldnWXn5K4iZ4OBlWrKxvR8dQAU3UEUWpbErrr+qkPPwZu2b0e1jBzUgu11oRWmxQ/ntkWYbJeK+rd2V8l8kpEGrGCdwGngEKJ9cJDkV7XiAckpcqGzc5ADw+0CW0EYcl8GOpeoiom6FxrkfVoP2UBRx5d4g3inFSY/vpONGrKt6xovHkPsKZvz7QCF6Ji3fFNRPB6CzqK25SGU7oIzEVGEQgDi4UNFlnF4vBGRuz1Qz/GTgHEpOoCABgsHAlbUhmogiOwlnpvGz2WXe77f+5JqUyHidSn4HL5bSkTYwU/egDTYggWX9kAClv8CNRvrcHQZBs7Mz+D+zkKC31lhDDNA5l/JeyhvbmXAVJNKTXIJsF2UcsIrMlay2EfIBqHCXNH9UIUBg9QQQdozIhrSw45QT0L1VUBeXv2keoomjYKEd7cHeUatOZUsapFgI3Igz5aylQ3tzK34GtSna0U8lYMYAgkybMppzJIe/veUlMD+oTbqMr8yR7Za0vI4qVQ36SL1IOTDCuzh6ibkibk6+eZY0QsyR0yqdFR9jUqKStdCHKCxTPhE4cfHJYOJdAbdqD7pl0IFxM91Q3nKNyU6YrFSFg7SFMRRw+riw09PJmf/quxiiAbqNHSxMAHn/AXBjCvD5skxB5Ijy1z9/ffwqgNefckBpqN8ewSwZJqez1T4+ndzdMrxp/sNkFcKbjO3eXM6dK+EFre6mcpHhlZm4LdK69hCCFQS0rfTfKTNPOUzGLfLtX7PvRXBB77mjjPkK5hIDpIgwY6vfVKiWPFsYlxawe3q8LFyuOjcM4jh0mWyB9zK1b28xV6nxIQvmiWQ4SpBaUNyAI6yQGJlA9eUvs989JEePEeK4P2TH0MYDYc4+Ccb2kZdLzjEhoMAFEqNcQB3W0qXAvkj8IyeWvoE0wQ9hXkDIPcuboBvsybK/ev69u703tGSi+a46guCpiivcYOQIdLyDehOGwgegfV1pWdKFT3lROrP65wT05AqaEpEdBXhymj6fAhdsFYo2NX1zJyJjKY1maghNyVyLjPhysLI19R2nwoSnmBVUbfOUn2bY2c1PJJBEI92wKO38EK2LeuZt7qive/AXBLX20yiIHSA5KvSRvlKribR3XaXORtZlk77JPm8wU/qEzCw0b05moaZSxa7Ue38NHfmDNvTSjXZKanANJgpPt8cC/emasc6EJhI+SzvQZxuJes43t0B3/xE8yiP/v/3QNlNJZQ8hnuumIhcRW83vm0iLPoLR7IXb30UJW/3/EmckBzX1liBEELqrqInSO0HwIZyYJjWGOiVkNQUIj8idB+qhrLt6XJG9Q/JBOizYCz75UPIEX3qOj9YYaWNvkzL+UaUfqdARqIMbQXkn4TAryBQdmhuopRnsvjF/MSAKTU5w96Ak2EhgEvCQ93znBc6jEyvc3RgN4kw5LpnvMnwH2Nf/RS3c3eTwkYNSGP7i6DPr2WLhH5GZe6U4QRFsVaDMlLpBDUm2CAoma2jQcva3ZTqz9 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5bd8e95-9776-478b-4a19-08db40ebdcbb X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2023 15:36:37.0331 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YprNUufC+i99dHxH3czz/7TXY2/KFzzWjz1ft/8sb9Sk+BUs4VsMIymN9nMt0UISizmR5coT9kTjYJ37l3QKwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7623 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add a new bridge port attribute that allows user space to enable per-{Port, VLAN} neighbor suppression. Example: # bridge -d -j -p link show dev swp1 | jq '.[]["neigh_vlan_suppress"]' false # bridge link set dev swp1 neigh_vlan_suppress on # bridge -d -j -p link show dev swp1 | jq '.[]["neigh_vlan_suppress"]' true # bridge link set dev swp1 neigh_vlan_suppress off # bridge -d -j -p link show dev swp1 | jq '.[]["neigh_vlan_suppress"]' false Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 8 +++++++- net/core/rtnetlink.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 8d679688efe0..4ac1000b0ef2 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h @@ -569,6 +569,7 @@ enum { IFLA_BRPORT_MAB, IFLA_BRPORT_MCAST_N_GROUPS, IFLA_BRPORT_MCAST_MAX_GROUPS, + IFLA_BRPORT_NEIGH_VLAN_SUPPRESS, __IFLA_BRPORT_MAX }; #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index fefb1c0e248b..05c5863d2e20 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c @@ -189,6 +189,7 @@ static inline size_t br_port_info_size(void) + nla_total_size(1) /* IFLA_BRPORT_ISOLATED */ + nla_total_size(1) /* IFLA_BRPORT_LOCKED */ + nla_total_size(1) /* IFLA_BRPORT_MAB */ + + nla_total_size(1) /* IFLA_BRPORT_NEIGH_VLAN_SUPPRESS */ + nla_total_size(sizeof(struct ifla_bridge_id)) /* IFLA_BRPORT_ROOT_ID */ + nla_total_size(sizeof(struct ifla_bridge_id)) /* IFLA_BRPORT_BRIDGE_ID */ + nla_total_size(sizeof(u16)) /* IFLA_BRPORT_DESIGNATED_PORT */ @@ -278,7 +279,9 @@ static int br_port_fill_attrs(struct sk_buff *skb, !!(p->flags & BR_MRP_LOST_IN_CONT)) || nla_put_u8(skb, IFLA_BRPORT_ISOLATED, !!(p->flags & BR_ISOLATED)) || nla_put_u8(skb, IFLA_BRPORT_LOCKED, !!(p->flags & BR_PORT_LOCKED)) || - nla_put_u8(skb, IFLA_BRPORT_MAB, !!(p->flags & BR_PORT_MAB))) + nla_put_u8(skb, IFLA_BRPORT_MAB, !!(p->flags & BR_PORT_MAB)) || + nla_put_u8(skb, IFLA_BRPORT_NEIGH_VLAN_SUPPRESS, + !!(p->flags & BR_NEIGH_VLAN_SUPPRESS))) return -EMSGSIZE; timerval = br_timer_value(&p->message_age_timer); @@ -891,6 +894,7 @@ static const struct nla_policy br_port_policy[IFLA_BRPORT_MAX + 1] = { [IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT] = { .type = NLA_U32 }, [IFLA_BRPORT_MCAST_N_GROUPS] = { .type = NLA_REJECT }, [IFLA_BRPORT_MCAST_MAX_GROUPS] = { .type = NLA_U32 }, + [IFLA_BRPORT_NEIGH_VLAN_SUPPRESS] = NLA_POLICY_MAX(NLA_U8, 1), }; /* Change the state of the port and notify spanning tree */ @@ -957,6 +961,8 @@ static int br_setport(struct net_bridge_port *p, struct nlattr *tb[], br_set_port_flag(p, tb, IFLA_BRPORT_ISOLATED, BR_ISOLATED); br_set_port_flag(p, tb, IFLA_BRPORT_LOCKED, BR_PORT_LOCKED); br_set_port_flag(p, tb, IFLA_BRPORT_MAB, BR_PORT_MAB); + br_set_port_flag(p, tb, IFLA_BRPORT_NEIGH_VLAN_SUPPRESS, + BR_NEIGH_VLAN_SUPPRESS); if ((p->flags & BR_PORT_MAB) && (!(p->flags & BR_PORT_LOCKED) || !(p->flags & BR_LEARNING))) { diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index e844d75220fb..653901a1bf75 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -61,7 +61,7 @@ #include "dev.h" #define RTNL_MAX_TYPE 50 -#define RTNL_SLAVE_MAX_TYPE 42 +#define RTNL_SLAVE_MAX_TYPE 43 struct rtnl_link { rtnl_doit_func doit; From patchwork Wed Apr 19 15:35:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13217054 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 0F441C6FD18 for ; Wed, 19 Apr 2023 15:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232651AbjDSPgx (ORCPT ); Wed, 19 Apr 2023 11:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231684AbjDSPgv (ORCPT ); Wed, 19 Apr 2023 11:36:51 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2079.outbound.protection.outlook.com [40.107.223.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D5F53C1D for ; Wed, 19 Apr 2023 08:36:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CtJUfXp/SaPex7C9GuYvY9iMocy50Z+gsJupUXDtljeisPfNjuMFkZPB0AlM+iHrqVgYmwPwD2ir8RUM2SEH49JpNcvCjpnc1C8Y8D+22C3zFkFXnEmK5nOh0e6q4Tq9mbc5OryaxEcYipA1rERJwdUZJEKgxYgbF1JyZANZJeS5poKKdT3IDu55RhEPBpZxmHYY5HLPCcwhZbn9UL8FE7mpvAhgz9TSi98CZ1DAc/7K/V3VlDHcf9F6zMMvyvwdLd58qjktK7HpjktiGtRLSdbzW5AH1pS002jq44VLPsk58NpHRc//FNRKqgWJ/FLNxIyHyDU83SSxSZuprs3vHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R7WsDBVi3wcfg1cPKMu98HDNcKoL3/KMofGBrWFlCI4=; b=I02vCpuNaLevKF66sfcHrU+tfVNjKDdTn/eRWodNWNAsZ6+3UNi6FteCpM/wqP2zuZz/M4OTtVJfGppDYC1CvJLMxiaLaCLcY3nGHqKye2ZvNh12zSClInlTmqhOCs7kX95ktyRXs7IF/EG9eUKq6uDedXkXadumrZ55J4vN+It+hUyo5R0MC/eUPY9skhPe3V0NUCEo3KdWtUccG9stZ+G174Dmxs6zpIndlmuud1adGAfq0YABj5arjH97wZXU92PRBoerN9djXpfYO6txFKyX4Yq4pqkrN+8srt1wmVm316dysmQoVLV3Yu1l1MEG+hrbJfRqRpILY+ebV//deg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R7WsDBVi3wcfg1cPKMu98HDNcKoL3/KMofGBrWFlCI4=; b=Eas1BK5OvNnPiSaVEA2z/+4GVgKhq5wKLkYNQD1Lv/L7/39J5augRDWJHCrA/5QMNYzw6uAnwoeycy4SE5Zpu4+wejNy/kJYvuYtqzaT76+IMTaFjT/gkfFEHelxMxSYvZuOk31n+3NKK5j9tv5o4DngEfKcj60q4AJmeqWzf7zdAhoQZIUmZdigTm4y//3yKxyVJDq1toGj49xOXEiezOoiNYHgY06c0i3GBCfn8i06HAToL44GR601Vgv3l9PBqaSiM/j0BpDSWSLwyriTbBKVF3vFtt3FVIWHHar+NHCkvAg7UnqoHJR3JUOixU2VNjO34I/rrK3fcAcqYADuFQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by DM4PR12MB7623.namprd12.prod.outlook.com (2603:10b6:8:108::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Wed, 19 Apr 2023 15:36:44 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::66d8:40d2:14ed:7697%5]) with mapi id 15.20.6319.022; Wed, 19 Apr 2023 15:36:44 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, razor@blackwall.org, roopa@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next v2 9/9] selftests: net: Add bridge neighbor suppression test Date: Wed, 19 Apr 2023 18:35:00 +0300 Message-Id: <20230419153500.2655036-10-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230419153500.2655036-1-idosch@nvidia.com> References: <20230419153500.2655036-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR09CA0058.eurprd09.prod.outlook.com (2603:10a6:802:28::26) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|DM4PR12MB7623:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b8e9a09-c91e-40b1-f849-08db40ebe0eb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GLaFjdIx6M6q4tdjc02DRT0JdQlVfyT9Sh1sIxfaNwcizhqO1I9f4M5BWw0VAOxpwRGdB74GiUM8pgNk85eFH98+vDPVmAMbzf7G3PinjByRwC0ohOVJ9/dxxxlkHNzmr78AdVGxfXfK0byItdFRHQLylomDeZqr9li/SIbR56i6YioRD3FN8vtW4BCO9/BzlO1H/fkfAnKLM1YIAtyELhTfm2xK/d9cj8PdbH9OcUmN440TpJuS1Jqv9k7h8JvVgGYOGl1FeiN6j+uIDtJqVkVctE6VcrRRzK/dh8sOif6g1fsVzYYikR23NlATGkgz8TSnOc2cUgB/HFGXJTdlqBBo+xZnsR2ILPdiwW6P9csRh1rrAq1ddeZHnsn97YtNiPvvOAw3BgTPRtp2gDri4CR/f2x8tNUJd0EB2Qm7oojVWLcJQqy1vjtawP9dNmlFvfPNSOd+kVkQrgqVJcBvkcQolAADbdSL5YClt+qnRCYXWV9tcyRlfurtfh7wOk1H3qITEA77IREUQwKye759V0EZX47h4/9rpNHGFQ4j0Z2V1oAq15wxNP3gcPsr8ycR X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(346002)(396003)(376002)(136003)(39860400002)(451199021)(30864003)(2906002)(8936002)(38100700002)(8676002)(5660300002)(36756003)(41300700001)(86362001)(6486002)(6666004)(107886003)(6512007)(6506007)(1076003)(26005)(478600001)(2616005)(83380400001)(186003)(316002)(66946007)(4326008)(66476007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1hVTV1vHpHIaQ0DpZsXsrwlksKjZgNVKJ3RgKRcbm8h4kOhThdZBCNsOqaJKi6CGha3Zi/Frng7bNlwt4lEaN//2r5ti4Lbc8rvJdbPDzZlzw0uxEGopjSy6AhWtp9UmJY0Q/4rmEZ7OnJW28v/Xi+E1bvZVTrElYCRUKEnCo7V9TKdmHTsQpXTs0Fl3Q3Lbi10BestjaGh3rUCkuc9F9X37HkBUwD1KjMinYFjUU0tJ9IewbqViAu5gjmW58Z7kaJbB6FcDQ3qskzJxjYw/fLOAXWDYe8YdqrL7GX0fVNSAiOoSU4eEb1ceAr+P4eC8RtgmcCEsAd5mRMqkTr/d0RUSm3gLeuETimByJ8kWgQ5eBHfwYOuNmVeyuiZAM0pRwDQ1WBc7yNIYbGjk70u0m8toS9gQhLHOB6hYplL6OvK/IPcTkstSllNvXUeaDWSd87TF0WmUX4eHYTKS2CUyyaDmW9pNltuJwkS0P5smPGQZf0i8zdf+zPoP2JCtEeZmo0Dun19Pl2xW7bIo0/IA5Bq0fgXYJb6MXTxZzOh0EYsSiZAkhwYKjBDi15nv0uQ47u+llXquEBHFyxfMPRQmovni1UDqEHLR7sx89kZ+ruKM35Rs3hG2a1s3A124S+6t8WyWIhUQQPcfxwoMr4e4AdwtcY0GZ5DeqKnd7iyfbRM7TlglYF14iEayYr8XiqwMuuINPSeL4Kg/mJQRpI+VW4IHG81a6DDxUj6yYdW+tH3xBeWnTvIdbxUa3JGgKpbWZANdJizO807NklB6tcFMODl3NgGySeDk9TFlde8ZqsY+bxbkMIi9vEW/HSBw74JY35pFJl/fcL07RryR6CngbLjXnPMe30ys5DrzHYzVKBYp40Co31b/kEubIKqxdIGxFfmbq2Ijrfl27nvTgKoQMf4BAFyeFOO65g5J2Xj9hKO5CQxSJC3bn3SHqJ1S+aE8wcwyEWtyEO/eo9PKFvAUgn6GolKFbilxQhfSr+3tXQ0FZnzunXMiAj8SylgZZfgC/uXxUolR+Gf5a+2Sp7RgwW3+akawwRKc7jRTDl2kkL8PTU/hjlwOnsnqy5n/ViZt6zYl1TYIvjISvY6O6qybVSF+mMRrR3g3sTqLFW4WMhnVuzwiv9gPjxCv9b5Fh3bFq8fCLixuZAeCLuvrb5O4IbH7zmejtpHAtxer+OCcjzXCHgXj5IkUpjFyVTqmtvQT4BIa/wWHlsbYdVESWgxW8A/aGSDLVfsP6gwWbd6ssqCw8IOYXc1UMlWRGYSqLWLYd7NZlDMLRtUXtsYRzYJZc0ZYEfvGzLUWKQjvkEElZaJqvbz8tdCbd+pRfLoDmO88r5qX02MGNRe/N96hY2TZtB/Dy4LwdqhZIbB+SqxJrsoASd+T7PYjqxOAxOLQm6LDT8iJ6IKa6sEWcQGP5fXzcMTCNH6562vcDIuaZlX8OgkZaXnMbnj25P+lK7ODdqh0/rks7olJFZJ15QrLvp7/00jNSdTE9nN+UQJfmiivHGPkKeKbljRBJVah0p15tFkPmvgpYftEmqXs+i2LJ8uyMLis+BxSLvBnnOWo4cJQi1bCMo2/BZ543SbBs1Kazuwn X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b8e9a09-c91e-40b1-f849-08db40ebe0eb X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2023 15:36:44.0652 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ycEvmX40nI7/Cc+EX49iJu2oDvJp7B0g1JGHR0NH9RzlrX/Cczz2+bmKe7YAS2VjZhhzRZAXFwSVqnwbm1SvEw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7623 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add test cases for bridge neighbor suppression, testing both per-port and per-{Port, VLAN} neighbor suppression with both ARP and NS packets. Example truncated output: # ./test_bridge_neigh_suppress.sh [...] Tests passed: 148 Tests failed: 0 Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- tools/testing/selftests/net/Makefile | 1 + .../net/test_bridge_neigh_suppress.sh | 862 ++++++++++++++++++ 2 files changed, 863 insertions(+) create mode 100755 tools/testing/selftests/net/test_bridge_neigh_suppress.sh diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index 1de34ec99290..c12df57d5539 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -83,6 +83,7 @@ TEST_GEN_FILES += nat6to4.o TEST_GEN_FILES += ip_local_port_range TEST_GEN_FILES += bind_wildcard TEST_PROGS += test_vxlan_mdb.sh +TEST_PROGS += test_bridge_neigh_suppress.sh TEST_FILES := settings diff --git a/tools/testing/selftests/net/test_bridge_neigh_suppress.sh b/tools/testing/selftests/net/test_bridge_neigh_suppress.sh new file mode 100755 index 000000000000..d80f2cd87614 --- /dev/null +++ b/tools/testing/selftests/net/test_bridge_neigh_suppress.sh @@ -0,0 +1,862 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# This test is for checking bridge neighbor suppression functionality. The +# topology consists of two bridges (VTEPs) connected using VXLAN. A single +# host is connected to each bridge over multiple VLANs. The test checks that +# ARP/NS messages from the first host are suppressed on the VXLAN port when +# should. +# +# +-----------------------+ +------------------------+ +# | h1 | | h2 | +# | | | | +# | + eth0.10 | | + eth0.10 | +# | | 192.0.2.1/28 | | | 192.0.2.2/28 | +# | | 2001:db8:1::1/64 | | | 2001:db8:1::2/64 | +# | | | | | | +# | | + eth0.20 | | | + eth0.20 | +# | \ | 192.0.2.17/28 | | \ | 192.0.2.18/28 | +# | \ | 2001:db8:2::1/64 | | \ | 2001:db8:2::2/64 | +# | \| | | \| | +# | + eth0 | | + eth0 | +# +----|------------------+ +----|-------------------+ +# | | +# | | +# +----|-------------------------------+ +----|-------------------------------+ +# | + swp1 + vx0 | | + swp1 + vx0 | +# | | | | | | | | +# | | br0 | | | | | | +# | +------------+-----------+ | | +------------+-----------+ | +# | | | | | | +# | | | | | | +# | +---+---+ | | +---+---+ | +# | | | | | | | | +# | | | | | | | | +# | + + | | + + | +# | br0.10 br0.20 | | br0.10 br0.20 | +# | | | | +# | 192.0.2.33 | | 192.0.2.34 | +# | + lo | | + lo | +# | | | | +# | | | | +# | 192.0.2.49/28 | | 192.0.2.50/28 | +# | veth0 +-------+ veth0 | +# | | | | +# | sw1 | | sw2 | +# +------------------------------------+ +------------------------------------+ + +ret=0 +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + +# All tests in this script. Can be overridden with -t option. +TESTS=" + neigh_suppress_arp + neigh_suppress_ns + neigh_vlan_suppress_arp + neigh_vlan_suppress_ns +" +VERBOSE=0 +PAUSE_ON_FAIL=no +PAUSE=no + +################################################################################ +# Utilities + +log_test() +{ + local rc=$1 + local expected=$2 + local msg="$3" + + if [ ${rc} -eq ${expected} ]; then + printf "TEST: %-60s [ OK ]\n" "${msg}" + nsuccess=$((nsuccess+1)) + else + ret=1 + nfail=$((nfail+1)) + printf "TEST: %-60s [FAIL]\n" "${msg}" + if [ "$VERBOSE" = "1" ]; then + echo " rc=$rc, expected $expected" + fi + + if [ "${PAUSE_ON_FAIL}" = "yes" ]; then + echo + echo "hit enter to continue, 'q' to quit" + read a + [ "$a" = "q" ] && exit 1 + fi + fi + + if [ "${PAUSE}" = "yes" ]; then + echo + echo "hit enter to continue, 'q' to quit" + read a + [ "$a" = "q" ] && exit 1 + fi + + [ "$VERBOSE" = "1" ] && echo +} + +run_cmd() +{ + local cmd="$1" + local out + local stderr="2>/dev/null" + + if [ "$VERBOSE" = "1" ]; then + printf "COMMAND: $cmd\n" + stderr= + fi + + out=$(eval $cmd $stderr) + rc=$? + if [ "$VERBOSE" = "1" -a -n "$out" ]; then + echo " $out" + fi + + return $rc +} + +tc_check_packets() +{ + local ns=$1; shift + local id=$1; shift + local handle=$1; shift + local count=$1; shift + local pkts + + sleep 0.1 + pkts=$(tc -n $ns -j -s filter show $id \ + | jq ".[] | select(.options.handle == $handle) | \ + .options.actions[0].stats.packets") + [[ $pkts == $count ]] +} + +################################################################################ +# Setup + +setup_topo_ns() +{ + local ns=$1; shift + + ip netns add $ns + ip -n $ns link set dev lo up + + ip netns exec $ns sysctl -qw net.ipv6.conf.all.keep_addr_on_down=1 + ip netns exec $ns sysctl -qw net.ipv6.conf.default.ignore_routes_with_linkdown=1 + ip netns exec $ns sysctl -qw net.ipv6.conf.all.accept_dad=0 + ip netns exec $ns sysctl -qw net.ipv6.conf.default.accept_dad=0 +} + +setup_topo() +{ + local ns + + for ns in h1 h2 sw1 sw2; do + setup_topo_ns $ns + done + + ip link add name veth0 type veth peer name veth1 + ip link set dev veth0 netns h1 name eth0 + ip link set dev veth1 netns sw1 name swp1 + + ip link add name veth0 type veth peer name veth1 + ip link set dev veth0 netns sw1 name veth0 + ip link set dev veth1 netns sw2 name veth0 + + ip link add name veth0 type veth peer name veth1 + ip link set dev veth0 netns h2 name eth0 + ip link set dev veth1 netns sw2 name swp1 +} + +setup_host_common() +{ + local ns=$1; shift + local v4addr1=$1; shift + local v4addr2=$1; shift + local v6addr1=$1; shift + local v6addr2=$1; shift + + ip -n $ns link set dev eth0 up + ip -n $ns link add link eth0 name eth0.10 up type vlan id 10 + ip -n $ns link add link eth0 name eth0.20 up type vlan id 20 + + ip -n $ns address add $v4addr1 dev eth0.10 + ip -n $ns address add $v4addr2 dev eth0.20 + ip -n $ns address add $v6addr1 dev eth0.10 + ip -n $ns address add $v6addr2 dev eth0.20 +} + +setup_h1() +{ + local ns=h1 + local v4addr1=192.0.2.1/28 + local v4addr2=192.0.2.17/28 + local v6addr1=2001:db8:1::1/64 + local v6addr2=2001:db8:2::1/64 + + setup_host_common $ns $v4addr1 $v4addr2 $v6addr1 $v6addr2 +} + +setup_h2() +{ + local ns=h2 + local v4addr1=192.0.2.2/28 + local v4addr2=192.0.2.18/28 + local v6addr1=2001:db8:1::2/64 + local v6addr2=2001:db8:2::2/64 + + setup_host_common $ns $v4addr1 $v4addr2 $v6addr1 $v6addr2 +} + +setup_sw_common() +{ + local ns=$1; shift + local local_addr=$1; shift + local remote_addr=$1; shift + local veth_addr=$1; shift + local gw_addr=$1; shift + + ip -n $ns address add $local_addr/32 dev lo + + ip -n $ns link set dev veth0 up + ip -n $ns address add $veth_addr/28 dev veth0 + ip -n $ns route add default via $gw_addr + + ip -n $ns link add name br0 up type bridge vlan_filtering 1 \ + vlan_default_pvid 0 mcast_snooping 0 + + ip -n $ns link add link br0 name br0.10 up type vlan id 10 + bridge -n $ns vlan add vid 10 dev br0 self + + ip -n $ns link add link br0 name br0.20 up type vlan id 20 + bridge -n $ns vlan add vid 20 dev br0 self + + ip -n $ns link set dev swp1 up master br0 + bridge -n $ns vlan add vid 10 dev swp1 + bridge -n $ns vlan add vid 20 dev swp1 + + ip -n $ns link add name vx0 up master br0 type vxlan \ + local $local_addr dstport 4789 nolearning external + bridge -n $ns fdb add 00:00:00:00:00:00 dev vx0 self static \ + dst $remote_addr src_vni 10010 + bridge -n $ns fdb add 00:00:00:00:00:00 dev vx0 self static \ + dst $remote_addr src_vni 10020 + bridge -n $ns link set dev vx0 vlan_tunnel on learning off + + bridge -n $ns vlan add vid 10 dev vx0 + bridge -n $ns vlan add vid 10 dev vx0 tunnel_info id 10010 + + bridge -n $ns vlan add vid 20 dev vx0 + bridge -n $ns vlan add vid 20 dev vx0 tunnel_info id 10020 +} + +setup_sw1() +{ + local ns=sw1 + local local_addr=192.0.2.33 + local remote_addr=192.0.2.34 + local veth_addr=192.0.2.49 + local gw_addr=192.0.2.50 + + setup_sw_common $ns $local_addr $remote_addr $veth_addr $gw_addr +} + +setup_sw2() +{ + local ns=sw2 + local local_addr=192.0.2.34 + local remote_addr=192.0.2.33 + local veth_addr=192.0.2.50 + local gw_addr=192.0.2.49 + + setup_sw_common $ns $local_addr $remote_addr $veth_addr $gw_addr +} + +setup() +{ + set -e + + setup_topo + setup_h1 + setup_h2 + setup_sw1 + setup_sw2 + + sleep 5 + + set +e +} + +cleanup() +{ + local ns + + for ns in h1 h2 sw1 sw2; do + ip netns del $ns &> /dev/null + done +} + +################################################################################ +# Tests + +neigh_suppress_arp_common() +{ + local vid=$1; shift + local sip=$1; shift + local tip=$1; shift + local h2_mac + + echo + echo "Per-port ARP suppression - VLAN $vid" + echo "----------------------------------" + + run_cmd "tc -n sw1 qdisc replace dev vx0 clsact" + run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 101 proto 0x0806 flower indev swp1 arp_tip $tip arp_sip $sip arp_op request action pass" + + # Initial state - check that ARP requests are not suppressed and that + # ARP replies are received. + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" + log_test $? 0 "arping" + tc_check_packets sw1 "dev vx0 egress" 101 1 + log_test $? 0 "ARP suppression" + + # Enable neighbor suppression and check that nothing changes compared + # to the initial state. + run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress on" + run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" + log_test $? 0 "\"neigh_suppress\" is on" + + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" + log_test $? 0 "arping" + tc_check_packets sw1 "dev vx0 egress" 101 2 + log_test $? 0 "ARP suppression" + + # Install an FDB entry for the remote host and check that nothing + # changes compared to the initial state. + h2_mac=$(ip -n h2 -j -p link show eth0.$vid | jq -r '.[]["address"]') + run_cmd "bridge -n sw1 fdb replace $h2_mac dev vx0 master static vlan $vid" + log_test $? 0 "FDB entry installation" + + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" + log_test $? 0 "arping" + tc_check_packets sw1 "dev vx0 egress" 101 3 + log_test $? 0 "ARP suppression" + + # Install a neighbor on the matching SVI interface and check that ARP + # requests are suppressed. + run_cmd "ip -n sw1 neigh replace $tip lladdr $h2_mac nud permanent dev br0.$vid" + log_test $? 0 "Neighbor entry installation" + + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" + log_test $? 0 "arping" + tc_check_packets sw1 "dev vx0 egress" 101 3 + log_test $? 0 "ARP suppression" + + # Take the second host down and check that ARP requests are suppressed + # and that ARP replies are received. + run_cmd "ip -n h2 link set dev eth0.$vid down" + log_test $? 0 "H2 down" + + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" + log_test $? 0 "arping" + tc_check_packets sw1 "dev vx0 egress" 101 3 + log_test $? 0 "ARP suppression" + + run_cmd "ip -n h2 link set dev eth0.$vid up" + log_test $? 0 "H2 up" + + # Disable neighbor suppression and check that ARP requests are no + # longer suppressed. + run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress off" + run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress off\"" + log_test $? 0 "\"neigh_suppress\" is off" + + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" + log_test $? 0 "arping" + tc_check_packets sw1 "dev vx0 egress" 101 4 + log_test $? 0 "ARP suppression" + + # Take the second host down and check that ARP requests are not + # suppressed and that ARP replies are not received. + run_cmd "ip -n h2 link set dev eth0.$vid down" + log_test $? 0 "H2 down" + + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip -I eth0.$vid $tip" + log_test $? 1 "arping" + tc_check_packets sw1 "dev vx0 egress" 101 5 + log_test $? 0 "ARP suppression" +} + +neigh_suppress_arp() +{ + local vid=10 + local sip=192.0.2.1 + local tip=192.0.2.2 + + neigh_suppress_arp_common $vid $sip $tip + + vid=20 + sip=192.0.2.17 + tip=192.0.2.18 + neigh_suppress_arp_common $vid $sip $tip +} + +neigh_suppress_ns_common() +{ + local vid=$1; shift + local saddr=$1; shift + local daddr=$1; shift + local maddr=$1; shift + local h2_mac + + echo + echo "Per-port NS suppression - VLAN $vid" + echo "---------------------------------" + + run_cmd "tc -n sw1 qdisc replace dev vx0 clsact" + run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 101 proto ipv6 flower indev swp1 ip_proto icmpv6 dst_ip $maddr src_ip $saddr type 135 code 0 action pass" + + # Initial state - check that NS messages are not suppressed and that ND + # messages are received. + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" + log_test $? 0 "ndisc6" + tc_check_packets sw1 "dev vx0 egress" 101 1 + log_test $? 0 "NS suppression" + + # Enable neighbor suppression and check that nothing changes compared + # to the initial state. + run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress on" + run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" + log_test $? 0 "\"neigh_suppress\" is on" + + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" + log_test $? 0 "ndisc6" + tc_check_packets sw1 "dev vx0 egress" 101 2 + log_test $? 0 "NS suppression" + + # Install an FDB entry for the remote host and check that nothing + # changes compared to the initial state. + h2_mac=$(ip -n h2 -j -p link show eth0.$vid | jq -r '.[]["address"]') + run_cmd "bridge -n sw1 fdb replace $h2_mac dev vx0 master static vlan $vid" + log_test $? 0 "FDB entry installation" + + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" + log_test $? 0 "ndisc6" + tc_check_packets sw1 "dev vx0 egress" 101 3 + log_test $? 0 "NS suppression" + + # Install a neighbor on the matching SVI interface and check that NS + # messages are suppressed. + run_cmd "ip -n sw1 neigh replace $daddr lladdr $h2_mac nud permanent dev br0.$vid" + log_test $? 0 "Neighbor entry installation" + + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" + log_test $? 0 "ndisc6" + tc_check_packets sw1 "dev vx0 egress" 101 3 + log_test $? 0 "NS suppression" + + # Take the second host down and check that NS messages are suppressed + # and that ND messages are received. + run_cmd "ip -n h2 link set dev eth0.$vid down" + log_test $? 0 "H2 down" + + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" + log_test $? 0 "ndisc6" + tc_check_packets sw1 "dev vx0 egress" 101 3 + log_test $? 0 "NS suppression" + + run_cmd "ip -n h2 link set dev eth0.$vid up" + log_test $? 0 "H2 up" + + # Disable neighbor suppression and check that NS messages are no longer + # suppressed. + run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress off" + run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress off\"" + log_test $? 0 "\"neigh_suppress\" is off" + + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" + log_test $? 0 "ndisc6" + tc_check_packets sw1 "dev vx0 egress" 101 4 + log_test $? 0 "NS suppression" + + # Take the second host down and check that NS messages are not + # suppressed and that ND messages are not received. + run_cmd "ip -n h2 link set dev eth0.$vid down" + log_test $? 0 "H2 down" + + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr -w 5000 $daddr eth0.$vid" + log_test $? 2 "ndisc6" + tc_check_packets sw1 "dev vx0 egress" 101 5 + log_test $? 0 "NS suppression" +} + +neigh_suppress_ns() +{ + local vid=10 + local saddr=2001:db8:1::1 + local daddr=2001:db8:1::2 + local maddr=ff02::1:ff00:2 + + neigh_suppress_ns_common $vid $saddr $daddr $maddr + + vid=20 + saddr=2001:db8:2::1 + daddr=2001:db8:2::2 + maddr=ff02::1:ff00:2 + + neigh_suppress_ns_common $vid $saddr $daddr $maddr +} + +neigh_vlan_suppress_arp() +{ + local vid1=10 + local vid2=20 + local sip1=192.0.2.1 + local sip2=192.0.2.17 + local tip1=192.0.2.2 + local tip2=192.0.2.18 + local h2_mac1 + local h2_mac2 + + echo + echo "Per-{Port, VLAN} ARP suppression" + echo "--------------------------------" + + run_cmd "tc -n sw1 qdisc replace dev vx0 clsact" + run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 101 proto 0x0806 flower indev swp1 arp_tip $tip1 arp_sip $sip1 arp_op request action pass" + run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 102 proto 0x0806 flower indev swp1 arp_tip $tip2 arp_sip $sip2 arp_op request action pass" + + h2_mac1=$(ip -n h2 -j -p link show eth0.$vid1 | jq -r '.[]["address"]') + h2_mac2=$(ip -n h2 -j -p link show eth0.$vid2 | jq -r '.[]["address"]') + run_cmd "bridge -n sw1 fdb replace $h2_mac1 dev vx0 master static vlan $vid1" + run_cmd "bridge -n sw1 fdb replace $h2_mac2 dev vx0 master static vlan $vid2" + run_cmd "ip -n sw1 neigh replace $tip1 lladdr $h2_mac1 nud permanent dev br0.$vid1" + run_cmd "ip -n sw1 neigh replace $tip2 lladdr $h2_mac2 nud permanent dev br0.$vid2" + + # Enable per-{Port, VLAN} neighbor suppression and check that ARP + # requests are not suppressed and that ARP replies are received. + run_cmd "bridge -n sw1 link set dev vx0 neigh_vlan_suppress on" + run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_vlan_suppress on\"" + log_test $? 0 "\"neigh_vlan_suppress\" is on" + + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" + log_test $? 0 "arping (VLAN $vid1)" + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" + log_test $? 0 "arping (VLAN $vid2)" + + tc_check_packets sw1 "dev vx0 egress" 101 1 + log_test $? 0 "ARP suppression (VLAN $vid1)" + tc_check_packets sw1 "dev vx0 egress" 102 1 + log_test $? 0 "ARP suppression (VLAN $vid2)" + + # Enable neighbor suppression on VLAN 10 and check that only on this + # VLAN ARP requests are suppressed. + run_cmd "bridge -n sw1 vlan set vid $vid1 dev vx0 neigh_suppress on" + run_cmd "bridge -n sw1 -d vlan show dev vx0 vid $vid1 | grep \"neigh_suppress on\"" + log_test $? 0 "\"neigh_suppress\" is on (VLAN $vid1)" + run_cmd "bridge -n sw1 -d vlan show dev vx0 vid $vid2 | grep \"neigh_suppress off\"" + log_test $? 0 "\"neigh_suppress\" is off (VLAN $vid2)" + + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" + log_test $? 0 "arping (VLAN $vid1)" + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" + log_test $? 0 "arping (VLAN $vid2)" + + tc_check_packets sw1 "dev vx0 egress" 101 1 + log_test $? 0 "ARP suppression (VLAN $vid1)" + tc_check_packets sw1 "dev vx0 egress" 102 2 + log_test $? 0 "ARP suppression (VLAN $vid2)" + + # Enable neighbor suppression on the port and check that it has no + # effect compared to previous state. + run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress on" + run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" + log_test $? 0 "\"neigh_suppress\" is on" + + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" + log_test $? 0 "arping (VLAN $vid1)" + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" + log_test $? 0 "arping (VLAN $vid2)" + + tc_check_packets sw1 "dev vx0 egress" 101 1 + log_test $? 0 "ARP suppression (VLAN $vid1)" + tc_check_packets sw1 "dev vx0 egress" 102 3 + log_test $? 0 "ARP suppression (VLAN $vid2)" + + # Disable neighbor suppression on the port and check that it has no + # effect compared to previous state. + run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress off" + run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress off\"" + log_test $? 0 "\"neigh_suppress\" is off" + + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" + log_test $? 0 "arping (VLAN $vid1)" + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" + log_test $? 0 "arping (VLAN $vid2)" + + tc_check_packets sw1 "dev vx0 egress" 101 1 + log_test $? 0 "ARP suppression (VLAN $vid1)" + tc_check_packets sw1 "dev vx0 egress" 102 4 + log_test $? 0 "ARP suppression (VLAN $vid2)" + + # Disable neighbor suppression on VLAN 10 and check that ARP requests + # are no longer suppressed on this VLAN. + run_cmd "bridge -n sw1 vlan set vid $vid1 dev vx0 neigh_suppress off" + run_cmd "bridge -n sw1 -d vlan show dev vx0 vid $vid1 | grep \"neigh_suppress off\"" + log_test $? 0 "\"neigh_suppress\" is off (VLAN $vid1)" + + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" + log_test $? 0 "arping (VLAN $vid1)" + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" + log_test $? 0 "arping (VLAN $vid2)" + + tc_check_packets sw1 "dev vx0 egress" 101 2 + log_test $? 0 "ARP suppression (VLAN $vid1)" + tc_check_packets sw1 "dev vx0 egress" 102 5 + log_test $? 0 "ARP suppression (VLAN $vid2)" + + # Disable per-{Port, VLAN} neighbor suppression, enable neighbor + # suppression on the port and check that on both VLANs ARP requests are + # suppressed. + run_cmd "bridge -n sw1 link set dev vx0 neigh_vlan_suppress off" + run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_vlan_suppress off\"" + log_test $? 0 "\"neigh_vlan_suppress\" is off" + + run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress on" + run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" + log_test $? 0 "\"neigh_suppress\" is on" + + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip1 -I eth0.$vid1 $tip1" + log_test $? 0 "arping (VLAN $vid1)" + run_cmd "ip netns exec h1 arping -q -b -c 1 -w 5 -s $sip2 -I eth0.$vid2 $tip2" + log_test $? 0 "arping (VLAN $vid2)" + + tc_check_packets sw1 "dev vx0 egress" 101 2 + log_test $? 0 "ARP suppression (VLAN $vid1)" + tc_check_packets sw1 "dev vx0 egress" 102 5 + log_test $? 0 "ARP suppression (VLAN $vid2)" +} + +neigh_vlan_suppress_ns() +{ + local vid1=10 + local vid2=20 + local saddr1=2001:db8:1::1 + local saddr2=2001:db8:2::1 + local daddr1=2001:db8:1::2 + local daddr2=2001:db8:2::2 + local maddr=ff02::1:ff00:2 + local h2_mac1 + local h2_mac2 + + echo + echo "Per-{Port, VLAN} NS suppression" + echo "-------------------------------" + + run_cmd "tc -n sw1 qdisc replace dev vx0 clsact" + run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 101 proto ipv6 flower indev swp1 ip_proto icmpv6 dst_ip $maddr src_ip $saddr1 type 135 code 0 action pass" + run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 102 proto ipv6 flower indev swp1 ip_proto icmpv6 dst_ip $maddr src_ip $saddr2 type 135 code 0 action pass" + + h2_mac1=$(ip -n h2 -j -p link show eth0.$vid1 | jq -r '.[]["address"]') + h2_mac2=$(ip -n h2 -j -p link show eth0.$vid2 | jq -r '.[]["address"]') + run_cmd "bridge -n sw1 fdb replace $h2_mac1 dev vx0 master static vlan $vid1" + run_cmd "bridge -n sw1 fdb replace $h2_mac2 dev vx0 master static vlan $vid2" + run_cmd "ip -n sw1 neigh replace $daddr1 lladdr $h2_mac1 nud permanent dev br0.$vid1" + run_cmd "ip -n sw1 neigh replace $daddr2 lladdr $h2_mac2 nud permanent dev br0.$vid2" + + # Enable per-{Port, VLAN} neighbor suppression and check that NS + # messages are not suppressed and that ND messages are received. + run_cmd "bridge -n sw1 link set dev vx0 neigh_vlan_suppress on" + run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_vlan_suppress on\"" + log_test $? 0 "\"neigh_vlan_suppress\" is on" + + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" + log_test $? 0 "ndisc6 (VLAN $vid1)" + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" + log_test $? 0 "ndisc6 (VLAN $vid2)" + + tc_check_packets sw1 "dev vx0 egress" 101 1 + log_test $? 0 "NS suppression (VLAN $vid1)" + tc_check_packets sw1 "dev vx0 egress" 102 1 + log_test $? 0 "NS suppression (VLAN $vid2)" + + # Enable neighbor suppression on VLAN 10 and check that only on this + # VLAN NS messages are suppressed. + run_cmd "bridge -n sw1 vlan set vid $vid1 dev vx0 neigh_suppress on" + run_cmd "bridge -n sw1 -d vlan show dev vx0 vid $vid1 | grep \"neigh_suppress on\"" + log_test $? 0 "\"neigh_suppress\" is on (VLAN $vid1)" + run_cmd "bridge -n sw1 -d vlan show dev vx0 vid $vid2 | grep \"neigh_suppress off\"" + log_test $? 0 "\"neigh_suppress\" is off (VLAN $vid2)" + + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" + log_test $? 0 "ndisc6 (VLAN $vid1)" + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" + log_test $? 0 "ndisc6 (VLAN $vid2)" + + tc_check_packets sw1 "dev vx0 egress" 101 1 + log_test $? 0 "NS suppression (VLAN $vid1)" + tc_check_packets sw1 "dev vx0 egress" 102 2 + log_test $? 0 "NS suppression (VLAN $vid2)" + + # Enable neighbor suppression on the port and check that it has no + # effect compared to previous state. + run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress on" + run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" + log_test $? 0 "\"neigh_suppress\" is on" + + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" + log_test $? 0 "ndisc6 (VLAN $vid1)" + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" + log_test $? 0 "ndisc6 (VLAN $vid2)" + + tc_check_packets sw1 "dev vx0 egress" 101 1 + log_test $? 0 "NS suppression (VLAN $vid1)" + tc_check_packets sw1 "dev vx0 egress" 102 3 + log_test $? 0 "NS suppression (VLAN $vid2)" + + # Disable neighbor suppression on the port and check that it has no + # effect compared to previous state. + run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress off" + run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress off\"" + log_test $? 0 "\"neigh_suppress\" is off" + + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" + log_test $? 0 "ndisc6 (VLAN $vid1)" + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" + log_test $? 0 "ndisc6 (VLAN $vid2)" + + tc_check_packets sw1 "dev vx0 egress" 101 1 + log_test $? 0 "NS suppression (VLAN $vid1)" + tc_check_packets sw1 "dev vx0 egress" 102 4 + log_test $? 0 "NS suppression (VLAN $vid2)" + + # Disable neighbor suppression on VLAN 10 and check that NS messages + # are no longer suppressed on this VLAN. + run_cmd "bridge -n sw1 vlan set vid $vid1 dev vx0 neigh_suppress off" + run_cmd "bridge -n sw1 -d vlan show dev vx0 vid $vid1 | grep \"neigh_suppress off\"" + log_test $? 0 "\"neigh_suppress\" is off (VLAN $vid1)" + + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" + log_test $? 0 "ndisc6 (VLAN $vid1)" + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" + log_test $? 0 "ndisc6 (VLAN $vid2)" + + tc_check_packets sw1 "dev vx0 egress" 101 2 + log_test $? 0 "NS suppression (VLAN $vid1)" + tc_check_packets sw1 "dev vx0 egress" 102 5 + log_test $? 0 "NS suppression (VLAN $vid2)" + + # Disable per-{Port, VLAN} neighbor suppression, enable neighbor + # suppression on the port and check that on both VLANs NS messages are + # suppressed. + run_cmd "bridge -n sw1 link set dev vx0 neigh_vlan_suppress off" + run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_vlan_suppress off\"" + log_test $? 0 "\"neigh_vlan_suppress\" is off" + + run_cmd "bridge -n sw1 link set dev vx0 neigh_suppress on" + run_cmd "bridge -n sw1 -d link show dev vx0 | grep \"neigh_suppress on\"" + log_test $? 0 "\"neigh_suppress\" is on" + + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr1 -w 5000 $daddr1 eth0.$vid1" + log_test $? 0 "ndisc6 (VLAN $vid1)" + run_cmd "ip netns exec h1 ndisc6 -q -r 1 -s $saddr2 -w 5000 $daddr2 eth0.$vid2" + log_test $? 0 "ndisc6 (VLAN $vid2)" + + tc_check_packets sw1 "dev vx0 egress" 101 2 + log_test $? 0 "NS suppression (VLAN $vid1)" + tc_check_packets sw1 "dev vx0 egress" 102 5 + log_test $? 0 "NS suppression (VLAN $vid2)" +} + +################################################################################ +# Usage + +usage() +{ + cat < Test(s) to run (default: all) + (options: $TESTS) + -p Pause on fail + -P Pause after each test before cleanup + -v Verbose mode (show commands and output) +EOF +} + +################################################################################ +# Main + +trap cleanup EXIT + +while getopts ":t:pPvh" opt; do + case $opt in + t) TESTS=$OPTARG;; + p) PAUSE_ON_FAIL=yes;; + P) PAUSE=yes;; + v) VERBOSE=$(($VERBOSE + 1));; + h) usage; exit 0;; + *) usage; exit 1;; + esac +done + +# Make sure we don't pause twice. +[ "${PAUSE}" = "yes" ] && PAUSE_ON_FAIL=no + +if [ "$(id -u)" -ne 0 ];then + echo "SKIP: Need root privileges" + exit $ksft_skip; +fi + +if [ ! -x "$(command -v ip)" ]; then + echo "SKIP: Could not run test without ip tool" + exit $ksft_skip +fi + +if [ ! -x "$(command -v bridge)" ]; then + echo "SKIP: Could not run test without bridge tool" + exit $ksft_skip +fi + +if [ ! -x "$(command -v tc)" ]; then + echo "SKIP: Could not run test without tc tool" + exit $ksft_skip +fi + +if [ ! -x "$(command -v arping)" ]; then + echo "SKIP: Could not run test without arping tool" + exit $ksft_skip +fi + +if [ ! -x "$(command -v ndisc6)" ]; then + echo "SKIP: Could not run test without ndisc6 tool" + exit $ksft_skip +fi + +if [ ! -x "$(command -v jq)" ]; then + echo "SKIP: Could not run test without jq tool" + exit $ksft_skip +fi + +bridge link help 2>&1 | grep -q "neigh_vlan_suppress" +if [ $? -ne 0 ]; then + echo "SKIP: iproute2 bridge too old, missing per-VLAN neighbor suppression support" + exit $ksft_skip +fi + +# Start clean. +cleanup + +for t in $TESTS +do + setup; $t; cleanup; +done + +if [ "$TESTS" != "none" ]; then + printf "\nTests passed: %3d\n" ${nsuccess} + printf "Tests failed: %3d\n" ${nfail} +fi + +exit $ret