From patchwork Thu Apr 13 09:58:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13210060 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 DD898C77B6C for ; Thu, 13 Apr 2023 09:59:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230110AbjDMJ7R (ORCPT ); Thu, 13 Apr 2023 05:59:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229773AbjDMJ7O (ORCPT ); Thu, 13 Apr 2023 05:59:14 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2040.outbound.protection.outlook.com [40.107.96.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 296B49027 for ; Thu, 13 Apr 2023 02:59:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L6Wee0VHtm8pUx5mVhb9kVGGY3iJFqbTNMBpaIyDI98Oed61TBQc1/MF8K8ZLgK4fr/yNvL8m2FXPEGvtKqWsyxOciobxzZw2t5hrYe2Gb3aiCQ1CJl9l7a3KRDmWgaQ4y7rbyNiQDs9ctMAh41FKvz/WSdO3ZvHVJwBpht3IoXJXxs4V9aE45jZlW8hh1u1jeuKXwB1Q2NnRFLxRGqYj2vbCK3r1KlIdQDxDjtMmFDbc7Q0OnIHARGKbBmOj0N8eHYGxSRVyXkb1mXRDM+AH0rXYv1NjJmJFMGi1Ur5tBBk17fFe+CFN9IzwttuMU/ZkhaQgXIwSaAMW5dNY9x96Q== 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=skXPRlKWkSk3ULoRmhja+VCV6ct38IRkmTkeVzeQtt8=; b=caYeC0bgbcD4sZ1UbdiJgB5SxYutlZBFjdRKmlLyp6nH2UeX6gZsY360xF3Yf0mcnbkeuH08kKHIP77EMOKG57P/d6hya3s8KSecRq8RoI8oHYTC0c3LQtio/PR7hrAw94BcFRLQuIFEQTNLozq+d1Fnv/QWS6wXWeRPIpQfOxKb1l+W6cXq1aAyR8nCm3zIktas4k5CQwoNP3kvh+Yj1VOcSu/dSkVAeg07RJqIP2jcRHWf0zkFYsU+gk43jQWEHUAK/ZxNTRgFbNCVqCpBvP4W3C2uFKNCaLE/Zvk26jLU5uDONze+SK7HivTFa2nSV8wM3Uld5YQchdraS1b2nQ== 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=skXPRlKWkSk3ULoRmhja+VCV6ct38IRkmTkeVzeQtt8=; b=R0yXcpkjnEReFt1dYor1NUAtw9ZLCs2ZgjoLqjAhpIPRCPoNje30yqY8MHLVdODnFJhjy6D+fhc+mQF70ZiH9sNFgi4LI2nK+X8ulfYEVU9soITkvLf7p8cqAq1C41ZdngPV6tOBILiC26VVPxBjXsBqcAoLfG8OJePcFxd/LaGB1ygVCyfamXXYBegy22/pjegjTrA+/acZYukX0KZMTtyf5nHyvRQtMogCxJ6q895NXEn56BTUir28OieZPxAKnTpFTQHDJCuaYC2tJK7HckjKemU8A22JjsR+MbLGnRDecWPJ2R02maYUuYgxw1Ol19eY4aAXMezisvXfd16+BA== 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 MW6PR12MB7070.namprd12.prod.outlook.com (2603:10b6:303:238::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Thu, 13 Apr 2023 09:59:11 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3%5]) with mapi id 15.20.6277.036; Thu, 13 Apr 2023 09:59:11 +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, petrm@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH net-next 1/9] bridge: Reorder neighbor suppression check when flooding Date: Thu, 13 Apr 2023 12:58:22 +0300 Message-Id: <20230413095830.2182382-2-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230413095830.2182382-1-idosch@nvidia.com> References: <20230413095830.2182382-1-idosch@nvidia.com> X-ClientProxiedBy: MR2P264CA0109.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:33::25) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|MW6PR12MB7070:EE_ X-MS-Office365-Filtering-Correlation-Id: d0439141-3f3b-4c40-946b-08db3c05bacd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gSj/wS5RE6lvz8AgQ5uiddfCCT5+Ry+ljNVJwFyeX/1Kcqk7o9ezMP47Rj4vENQSJ6g3gyRrhQMhXC9LC7segO5d1Lxba67m0JX8mLP71E6VulZAiCi45m+1fv5hAkKdnHr+n9QlpyWMqLxGn6nJiw+9mLMOidOU428bKf2IowBRnbKF/XBvye1U7s9tEhkNNXDffPkU9Ykl09OeViZJi1FjzxqA/SYOiZGl/PHxBq4S7+8gyA0TFdCB2HUYOmWl6XOxVHbOSTxkcsWg3JQJv4LsW7dS/jlxJTqpnh3wN8zFNM5E42Q94LrvZH7x5UEeTNPf4msvsdTecQv12SqGGTHYytcVtH2UQ4IJhPQcMe8TzWdl9c0LvS/W7pUOSpp6Uss6e0D7oM5oMy3Y7c1avhHp4Dnvuungvj+q6gR4Q5VvH2Nr2a6zO8797V26Hk/1eNsTosI9jkThjs8A1l7WVm4q+gRFFZFjN/OBM3mX+Pc5/3a3GPrm9YwW4/WymYKcO12EqW8sZHVSmfXmnIjbPPwQUVHYReGFcLUbU1W3RZtgdfwI+Omu1k32n1r8Co4N 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)(39860400002)(366004)(346002)(376002)(136003)(396003)(451199021)(36756003)(2906002)(26005)(478600001)(8936002)(38100700002)(2616005)(6486002)(1076003)(6512007)(6506007)(83380400001)(186003)(5660300002)(86362001)(66476007)(4326008)(66946007)(8676002)(66556008)(316002)(107886003)(6666004)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /ztmXzd65vfFQ1A5QmXx3/+PFpyJCTSHU+dT8YPzB8xwOfs0PwxeuXSqwEtGwUfWUQi4krLsYwEbIcX2BJ8eKQ0UPnquDSQoow1R75HY/F4HOvmgVWGPZ7kYTFux0BmafmnvKtEKhmFn1DzmBck3htnWgYQ4LWqOsJ67NHxAHLGBHeuxzL9OPJS3XmRh9hbo+HmKkIKzIjWgOqp2rRqmx9sVg13YR//yjlfkmC+qwOzN6d+F1mgTMwXNXghWG3cL89HWEeAceQsxU0WlbulzREZ4a8z78Ftoc4J7NoyVunCHvjBkbjVz39D9+heJjvZa+0LWr+GI3Qolylpj6X/vJ98PWBgR3c2uhYAiceQ+4tjWAy52WjhOsyGm9hsIw6tB/X++D9FEcPUqNkOv9uaRKuuoMmTUbHKy80zxW2TzayK+uJHuPAUU69AZJ8xP6E7eZUhKRuSQLmZNpNjP+S2GS3pXfX3I4H8cVrcfv0gs+SPV1Csx5MbnvvhPnDTUflY0JGmRgAWPKPQO8x2a9JQFCbUXyRyDnVqtdSKxyAFQpSKBYbfV6jf77iH8MUOB4IupnNzVv/9NX0y07v/Lptmpm5z2Uk/q9hLNyk3ycwdvlvZ1dCq8Y3eAcbuuRfQamYM1huyNeD2xJREM1NAbTVpv66/VDvNiNyHVs07AG1L2lWQG9ctGu6+DkZdz2NwUgRKmw6KhwZV1Ug4j9xEouFfPy5zxeZ6C+6stLyjo228wEjtp5LAtvci/883JnF7iHvtRCc6K53P/g8ya8uWfcVE1DokooPV02hLRvDtlqqsYOORPdidvG5pvcrOg6FaueIiL8TBVA4B82VhG4Zhg8tPTDvARTAolAY00zckcEqo07DtZ4iUR4aexkJIilj04GGUxA9nRAYtlZVT+WAwrSiXh8lQfHwpxZp0hn6aXGEoVF4hO5Fp2ktynMKrVU+bX5tiCtzVwH3+0kRU3Y618rW+XsRMFnvTtybJNHc4Mzp9numAPlkGV3YFxECaPGAv2dQJhTlkXQob1CU7WiqDfqEpcNROG/kFIpUzufdBFpHA/Qg0JGO3fQb3N1mwZeWpYj9NvfxVVbQSIzBTaWiIKH6dnFXupXBWNwl2hv001jmGZGgl7REw2rchWjXm+Fnj18UepM5TPiyMdfu5RMPoMr/Ie9NkYyL0AqPye0knmnsLJWZBBftbyb3pvIHCHKHg1k7+btFER2rrPMTR4mr9b93mbGPf89GxCF+OJZcCQckSkHby+EufBd8zULyqzg4M7lUc/WgBwJx/RcnTjjnBajVaUU0mOfDE+Pcfipz0Qv0jBCH2vplyLUvZuREvd5Hn5yYlb/cOgRMiOr155WJmUwLWoTRh8d0fd8CK3kHPyStuPFU9TEa1Fvd/3n9MD8AyM9n1mBYGJxbp3vqu2b3MGxnFeDUhNslfwCtUdt4lbKyfP0yLVOY16vpPlaOi9YXelQieLuHksFcxZ8kqgCcztL91zjF4TSWfkVwfMOoAaYtWBZXi+twnJjANyw5pvRSRNWKnHilXdMICBIiXH9m9N/bB75Yh/N9H5n15luHTOofkduYIxwhwL4AdSkm2h/x2HY+rD X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0439141-3f3b-4c40-946b-08db3c05bacd X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 09:59:11.0764 (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: +RsemPi9qeZSBlEyFa3HSXGh6snYQPAbUZn/HtsTuxZ6XquyJ0uHyrlLCYaeZ/Gw7xFA2Rx+qRBMn1jQhIPdcw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB7070 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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 Thu Apr 13 09:58:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13210061 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 ACA58C77B6E for ; Thu, 13 Apr 2023 09:59:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230031AbjDMJ70 (ORCPT ); Thu, 13 Apr 2023 05:59:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229977AbjDMJ7Z (ORCPT ); Thu, 13 Apr 2023 05:59:25 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C94708A6A for ; Thu, 13 Apr 2023 02:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l9gqerH4lJIqHXe4zJWkjssCpsQHrSZzVRV7HejFaj1lY2PDI+e0PIK9itCF4EY5gwoBgG5Qg2VkZrMNm4NiF/Gdb9nF/9BytC2SZ5yNqIeyQXIWmaVKU0w6k0idmMcfVFfkFvgzG3cRpBez5A6r/DOVUU+FoXYTqTjFFFUm67HKrn7fvClV2Yvo6ZraZHzKU+me0zq47JFt4Q+nN0xuvKA9+8fhljRzaUENnWtY/mPiWowkRDxMCdSTSg+oLtvzFCojuJjvG8LtrBuLWPFiBfkyYquJUgLQeK9RsuBkmJQddgPyP1aNbt/mR7M8MUDb6jhQJ/NA6fYTYGuTTk99og== 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=BvfuZz2RtcNsOMIxkmeqAAvj9pMe3FQETaJUeG4BNv4=; b=dxa7iXuM6Td/R1ktJfsJi7jL+tZkYOvsaYZad/7mq9c9Yxe10JwwN3pweO8tFIQarLoVC7VA0UZWFkEy9V2zKuHpSmVqpkRWlTcstzhAZGxYAVyvoHB8yoA5dwgUZtNJP5G2Lg91jT5j68329uH8dxrCASuG873jAbhkMI1K38VJ8jNo2T3j3o864AqKR027lTR1VyIAdcBkwTh1cpQe1znOLMc+8bEoT6/BJ89hdRFtYWW1tN//PyJ/pDYX/DmkAbkE33x6mZW6twOe2AuGhKWKxqsfzUWwmuORiudvilSOVYmRFSMveLkYn9vamWyIG9C3wiTrHxZIcEhaEzjekw== 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=BvfuZz2RtcNsOMIxkmeqAAvj9pMe3FQETaJUeG4BNv4=; b=TJPdct3OCrsuuE0aHPNa2+Zbo3xj0IGgxqTP+XnNTpKjz8XoEHoOq4IaiWDRxRguSN34pk2xHstoG0+2GBRRAiC84qcfcWhcLA+ZWkdLYtO3AEhH6hhkDEwqwz/vq3ftbOug15hYaMtix4nRLfWpTqC567nvxnXvIX8q0bM/xaFS6x9hAFtOqfAdMxE/3/qLidQhGvFV0zol2RdGY2YqgFn1N+KLCfrG/NDoLk7t7649ddNczF5iLa0T4zG77cIJqywV83hNyFGzNCham1ZjI6yxdSRVW9QM1ofPZk1/zNH+b377lhdwgWf+dy8fTg33Xyt/iBvLMn7yQ3OdtAnrgw== 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 MW6PR12MB7070.namprd12.prod.outlook.com (2603:10b6:303:238::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Thu, 13 Apr 2023 09:59:18 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3%5]) with mapi id 15.20.6277.036; Thu, 13 Apr 2023 09:59:18 +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, petrm@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH net-next 2/9] bridge: Pass VLAN ID to br_flood() Date: Thu, 13 Apr 2023 12:58:23 +0300 Message-Id: <20230413095830.2182382-3-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230413095830.2182382-1-idosch@nvidia.com> References: <20230413095830.2182382-1-idosch@nvidia.com> X-ClientProxiedBy: MR2P264CA0170.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501::9) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|MW6PR12MB7070:EE_ X-MS-Office365-Filtering-Correlation-Id: badd7c99-5be0-4b15-4838-08db3c05bf4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lGczfbI4r4AOC+tcwVXKmp/6aUe5mCnK8IfR+tnrm9sllkLHj3897chXwisL1vJi41KhP//0me4flDQtLviF0P8H0n+Hta16yb+MS50WV3p1B4nI/VjieR3tVUzwsDhed0KfLZQdopsb8OUw+Y/ZrNdbEbXn7etOG9WK2CCGGK9MMu6+q1N6yp0xnXGCSNFsplCrwq1qrYlCILYq0Oti1SsaoRpUmKxX7Fi/JcC71cecPgPwwvoNy6a1Tpf7jC1kMHDZmjI4XJMKRU+QzMy746iiBRWlpKaHmPUGWME0+ZzMQeqhbRZyzMpyPYDgbNYoUHs6v9geftz6DJ4RcXpAtl4qQ7CxQhp/F4LtinodIbF+Uvbge9EtY+bwlQPaGRegaVW2a95f8TcFy/ag11mq8K0Fk1QHNlJEH7D2BfOfsd9d4XtfTRv8VgiipgXNW+GuJpe3+qxVRhhUd8aVwsn+Oabpa5RxLPAJ3Sg60rdxi63wLzjsZ/C2TwZIIF7dvhE7RRSTQR8n7BzeqS60n7dXGiB5JIJ87jZJXQ7ubyExqUgJfkLzrHEifvOBUb0MPcOX 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)(39860400002)(366004)(346002)(376002)(136003)(396003)(451199021)(36756003)(2906002)(26005)(478600001)(8936002)(38100700002)(2616005)(6486002)(1076003)(6512007)(6506007)(83380400001)(186003)(5660300002)(86362001)(66476007)(4326008)(66946007)(8676002)(66556008)(316002)(107886003)(6666004)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: R59AqoyKWHfoMu9XH5OMwpBCmuXWPXwfztPxAhnFHUEkaUfSyZt/J4kuSNHcSylhD++k5OxBqUpTObdXeBDmA8x9PT5tQnk2u/8UWpgkvlSg6FoIHgYxg5Vqg5hu67LIGDB3cSb8LsQsLeswQ7CMd5xsNEkyCdHTQxqi/puPJuQAaO4oR4AfyAgHmSzgcWFoXYpyWxcJx9pWpcBJqempHB9RJBZm8C2m4OAe9M10IbhJ8BDmEqNEqMa1JJbhKYnvkvGGrxL/ImC1FBtiCFQYI4FB8Cdmk9SamwKZZGkBS2vm/EejQsn0QMMn3UFc+Mgm77H1lbVB1Zifc4LFP/B8K2ZVDi/4k4tE7ofXHDGftsVcpUgl2DlVG4umripQyAj5TRFum6D7fdC3QmR4kxdROfnHlj4RCb+UVlVI8Hu7nQdlPuRtqYyzgV1yqgpt5JfjC0Ffgi61ZX3CwLm3wquO/5nj7qlGw32ixD2KcJEkNstXWKPehSw4Ye0sKPrxjBdjDIimTrL+/TrfWhd35Nmjpr+7QmHtHdTPkE3WySHco/m0Yizkp7npSPe6Szb2GHFzP0ZwNQRzKRpGiQxj4J2w9jLFRz9WWzppwRbfjquW+iwetFU2DQv91uK4/ypKd5n+a3Bx+Av8I9Zd0a8Uc+ni2w9WuKu5PSqqlJh32KrcTjDyy2BhZnL2M8dFNvHKS85rty/uF5IwUJWEXMXsPky7rIIMJY1TSh1PpqI4cuCGdbVfQuQwprvDqes2rG4UwOTnHAassg9DlmuqzrEJ9Xbt1JztYgXma319+x2TKEBM94+vyKvYiuv4TEQmZUC6vC/fhdRVw/2919fR8W1aJ99luXQWYaroXPXmOUCZ7/zNREgV3GnJTtAAmhsjHqrgz/ISHurvIFtJpFrHJjPhB84OWmYL7fLIkEbTPHrFERn2LN4FiHqEdTIbTA8YZnMiKxPe4mdoNfCF7yRiKRBJKCiXpl8uNWbW6n66GUt5KUQ3cuetHqyc3PgHZ5+TD4HUpVyFYhj58WnlASckop1DKJxeVxA2e0cTdbeylH5Y4cgdxT3+0F3NkkKUtnU6cZVgJDrzXePk/K203KaDUJBSurXDz2rEVsUzH178VVofxoo4sxC27nXGlXA+REiM2aAWX8FFETBTKOC7aXDE3Oba59JFzlNwVtfOMJ/DP16fSmpuQqfw9Ibx1BpqcEnSHly2UAI09pO69jPYsMuFfZuJj4ECSnuyWKQEUPfmhrUYxuyy3XpY1uatzDyvhRyFVSFw4L3CoQ9In6OyBhBnuJPCzUg5mwsHO50/CnU7gZ5+JIybPOSB6OpQZvEUVLmzJIMtDbIPL93AX/QbefvyYJEbziH2xNQ7oUa4+SmBAIw4xfug3TeSowwjM1iizd3CXMjWisGaN1A/NswSGLSXhpmE+Ma/TyqKZv+MlE8Qxjl0DdRhfFE3UQaKhiY6HB2yxjHN8qmJ6nr7VvEO/Qqk8L7F2gRC7JnOqe8DvXo31h0YFPM90kZtt6QN1GsulYXp6Bicl7ffyJoVhDP4EfQXY6APklySmjQ52xIZBhnwhgfCJpGQrodjex2HO2lHUPE4IACGlCU4 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: badd7c99-5be0-4b15-4838-08db3c05bf4b X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 09:59:18.7337 (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: UU49rsAP/HIDuvy0YUp6LFUgLbq74qkgMvAFZo2soPW1rU/Znvsb/GJl26/B9gOIqdJ6Yeyj5+P2/ZV+Rxj8oQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB7070 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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 Thu Apr 13 09:58:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13210062 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 EF559C77B6C for ; Thu, 13 Apr 2023 09:59:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229773AbjDMJ7g (ORCPT ); Thu, 13 Apr 2023 05:59:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229977AbjDMJ7f (ORCPT ); Thu, 13 Apr 2023 05:59:35 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2040.outbound.protection.outlook.com [40.107.94.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3682A7AB6 for ; Thu, 13 Apr 2023 02:59:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FFnZxQff3uEPF0F+TeJyL0J6VEkFWkKyXeSSigPKVrTAO9YGT86S0lIFAvFY/Erzb6zPzf2AzEPMr86P9Ci/4c+slCDR4IRgVzZFCIaumvPnUqRc932S54zOO4Z6E34y3fd5Gs9duz4yjJrz6GGfPjUiQDWN+sWFlhvzrKHWGDJRI+8ldo1BTJSQDKoyC2pR2TQnoxDxBHjxJUaey0Jvw3mYu3xvCtRuVItaq7HB/x5MZhJI++BymF4OKYWGdiA9TpC0Vkmvf2/RU8tVveSkIjkU7ANw2aTQZ6JX7Cbp5K4CGS8RuRT9FCNNk0+wx6hIkiEmk0ksK2KOKdvPDlZr+A== 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=bwfQnYosgyTCzsOoJa7Ffb+0KyzF3LYxZylri88XmIw=; b=i9xprIryTitVpFIVcj2rc2AoVvXSZpNMg2wItoOWLjBY+FGyaVwpsOk8R8YPblpSgDmjvIyJKusS0JINDJQ0aGw/SaAi8kb5Y8cxOqc7PC9rx15RCxDFrMQOxbl1DO2a0rZowoL0Gg2zP3fYRvn0kM4/TgKwnYmW6BJQZdfwqY7weSzzN+I03WcTdQQtoJp4QPZUheSY6kzkOHEWYIqcZzavO5PGpNhRfKB8pSwb4xATFSvrtRVp+qbotDM4o5Zu5krkWK/NEpg9NH9DoZeorOQIFDG/qpcImCz13z67XWTYxUU4okyPKK+XYZrHX2W2t7xJYVcqgMuy1TVYDQafHw== 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=bwfQnYosgyTCzsOoJa7Ffb+0KyzF3LYxZylri88XmIw=; b=l1k7cJXO50PU/tL6BSDZ3UrfuyUiM6cnjtTNjZlJSOZgbyOuKQmv/+KtykcZ90LOtGWO+gl40iDs+y4iG5Q5UpUEuc9D6gLtFZ9mebRe12CIc222eQIkSQKChEAoGUpkwzXyo6D0ZAXgpLXLj8tdfMJgDjYTK93/wDmaUwn4ZjvHh2sVF8l6aTba4b0YCU2+bkubtMliDb43LsiFdbhPZ7ouCbEY0nQd2Bz6t+X8HTQSYgZsTiDiQxwGnxO9r1vwntEc0/nkX5fbGHRyL0TPOjb56p0/hzP4qWUm4S8jQ9yYDzr+Qgx5gGz8w2QDNdvS106YA2oJshJUcZglovO9rg== 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 BN9PR12MB5274.namprd12.prod.outlook.com (2603:10b6:408:11f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Thu, 13 Apr 2023 09:59:26 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3%5]) with mapi id 15.20.6277.036; Thu, 13 Apr 2023 09:59:25 +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, petrm@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH net-next 3/9] bridge: Add internal flags for per-{Port, VLAN} neighbor suppression Date: Thu, 13 Apr 2023 12:58:24 +0300 Message-Id: <20230413095830.2182382-4-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230413095830.2182382-1-idosch@nvidia.com> References: <20230413095830.2182382-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR09CA0107.eurprd09.prod.outlook.com (2603:10a6:803:78::30) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|BN9PR12MB5274:EE_ X-MS-Office365-Filtering-Correlation-Id: a6113915-9812-4c1b-f42e-08db3c05c3a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AdnWec5vdHKvzCxdoNhKgpQR/FceCoUvDP2SoWnQgJsmsUoeiCIluHnyfsSco+KmnW/s9EIR5VpciFxfQ1nTV+KyRw4nZ1Oe3h5/9sCsQ8odVzzsXM5vcAKTO4oiUCH0vkvzMYAEDz7BX3mWAF/Q2g3P1juAFYafS2UfKf8Y7wDwSrF7ZL37A+dyPbZMjGceG5jhKaI4zRPx7GD9Ydtx6gk8PNEeaZHtV2ZQ520Z2V0TlvUvneDsdBM+Ps9L1pwoGKzEXpJVZ60UeLQzo5rXd3muP7yEWq8DNsUdkpUlMH0LhKvMwiSrXzp9tX/g5eUQcEO1ZdR+ILYitz6oJ2abQrINK/xymzRRlVBbO23sPae6+WW3+UUawcNoaTRJHXWKTthVNt+707Rh7yyA2pXKDq8gjW0eItKCb5PpaUwTDWPe6y7/wvNGv+vYQepuVw9TbSvAwd6Y6Mex+4a7WIy4i9eupc1nsftpErmYTTrwPGnoeDg5GYuHM78X3CjPUYHID9Gk0rYUh4xtBFT+9niWeo8sUUYI17NnRx4MvylT+NDcMRGOnaY9nvzzLfQfEaQ/ 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)(396003)(39860400002)(136003)(376002)(366004)(451199021)(1076003)(4326008)(66946007)(66476007)(66556008)(6506007)(6512007)(36756003)(107886003)(26005)(2906002)(6486002)(2616005)(83380400001)(186003)(86362001)(5660300002)(8936002)(8676002)(38100700002)(478600001)(41300700001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pX/WmhWRvNq0KkUIByFD1sAKqmdYrbaWgNmeV1Bt8F7mDtYLbffO8hgWkQIiVdw2lQopNZj0iRVR7+nrBOpjzkpxd3833SiqVQboIjXIJWXEGIQjkNUu7gRoSYTllJmxpB7XHA5WY5AfdrXVQop9YD5m+MJcfIFw/JawKLAi+BkWxzxfL+c7sxj7aIKo7Sysjs9TQdiPtjP8jAJfbc8ukLrChQfbUjPInF1j5NNxBmpG0S5emokmJM3f7Jmv7iORSmXKqDH+F4DPE58j9b6eeeofkVnBb0qteNtQ9R7I1uQ19G4WAG00vpGt4YYJm9YjcCfhh9uF17jueieN9E6WdbpV0+vzKgmfYIpFamNHsoHeKRd8J/nTHngzvpq5MlCzntI2OWggklXPvXkfnIhEKFsjxsc/sm6Q5CLvtou7FA3XO4Zg9DcZT1+gqtu+U0u9I6YX/tFUd+ZfJ41RDFSmrypfXYjydHHhwba/KR8+HuC74oJj/yaQWWoO9m7/3G2XU91rL7xDVt0cGNATVBofOgv6AtX4wlgHIiMmvr1XmDB3JXcUB/a5Zk0yhCX1/z3wqcmY/ivh7reJu2TUfdS5dt0IZx9oaHlEbJUakBvuu6mQbt7ZEfc/I4bj6y66LrvylkMzhSthYhQFE1Cp7e2PgarmLeCFEJxO5QE0UFrtOXZ7VHHoPy6jIN5b/4cNd/a4MCYNFaHFOIQIDSaCS/Xmoezeg+if9V13zf0Mb+ssbjXzZ7SbUot26unvemMVCKMXZFgCF9Ys04V6TDoYK9e60/NtdXJ0535bSQmrvjYZpH28+2g10g1GBtNt4ChLt61zh4vrkN7WomexJzq/09FVfttsak+tqm/t7Tqn4zcxRFHiwyzRVyk9g49HXm5yrPl3winDf0JTzkv3Aa88GZuacAHG38XQKrhHY7icD0WcGUI4EsCB6hg5+X7L1c8+UffVF4djmDqDY1WBh93YHqilXP1/vIt8rcM5+BvbYvtiuPzRLPxFy8TUN6fl9mKii9KVaMUyBl6Shb9nKv35bgX/RB0Ef+U0u+WNBm4m0v11cp+vT7KdZECzZ7NEdNsWdzCajrQ9vrCqHicyG1mPBnuCunyi9VI3dkHapXtNBPDbs6GMXi2Y4umBXTG3l5YuGCGvJiPjPuEMTjKk8wepX5zk7RqMFs2fYrOx+3AjNdy0aH+2nCQO+aNGp7afGa7kaU+CiOqWTnPM3h8EOO7b2BSt7Ar1PvbPojy/EjXC9hbcYTm00i+O8GYUPKrYlD8mZqbr4xt3najncD/I8l2rP7nISjO5uqiAdoNzhv4nQsc6Dfc8rxBEEnTPQR4VMRoN/CwpB05lk+cCS7N18wQw6mbqoJEHBHXETmAojnmLKyGVWHAcvmO6Kyd039/ueKt9KoCWQ6WWAiqaN1JzN1s8odS3SKqKRh/Aghk+j9hH5JtPPfoFaIV8R2we8e44lpeue+oEoNZUkTSB9S3lSn3huYJNXBTlszGCFBdfn/FtrU0Rsevu5LbBeQsNiRd/dLiJcWHMZgzajeGu7A3pZ5twXF4x0n0iit8Gba25ZhNSPpyLFP2BcK9EQ2uGULAn91G+JJfg X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6113915-9812-4c1b-f42e-08db3c05c3a4 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 09:59:25.9296 (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: JaWrzhz2Er3mHGNJgRZ1Py8Vipz/sAUii2e08Vswa0KhTeuC26Yf7a86OEjtYGAT9Z+nHjnVTdDozB/STu73rg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5274 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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 Thu Apr 13 09:58:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13210063 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 93E70C77B6C for ; Thu, 13 Apr 2023 09:59:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229977AbjDMJ7o (ORCPT ); Thu, 13 Apr 2023 05:59:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229959AbjDMJ7l (ORCPT ); Thu, 13 Apr 2023 05:59:41 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2040.outbound.protection.outlook.com [40.107.94.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F6BF769F for ; Thu, 13 Apr 2023 02:59:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BG+ZfOoWIwPc1VAK4gnOGKVRVXQokLtzRhvWr6rVkpqvZi6jvqOsK4yh53iUPPvUzkHeAtoqS6jT4AerqFiT5dlupHJSRt4j27m9NNIQbTzaiIV9yzuwAoxENRPo/1boisKcIaT8N6DdmLu3FtU4cCky/ZFs8HHRFOvz5LoeKy8aSv37vNbF9Xx26g8JMz7GDy6FH6scessZMTIchENsWuI7LCW/ctT9swHaR6dTRVHAG63U0sV73EdKJn6DmoQuNsB/kV+ijagGPqgkspWAhcA6r7DSRmMPzex3jYtFudTS1H/yiBM/lvIQUlH+1DILcHm8qAOLIrFc+YL+R7KruA== 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=qcmW5XoYWRoEgZ0UlmwVtLC6KBdkA25Co/jTfaAJNF8=; b=J5pvn0sAQYOnC9+pKUzens5NzaDhDbbf07naMURh5izJz4nN9hAHe1sx2/D5PRRg/GUdZdVyYtGhZxpiuHgL126ganUNl2ijF7EGx5IyNPipBGy36o78eSE28/STGPf4loLzwd/NdVSIlVHUlL0u2tctO5d38NUkChMFCDyRv8RoJWE+bymgByWFc75sGkx9m9dNfmjt+zT3KFvrO1NfGeNjcWOmLlV5pzlwNoFbGoQVYYYCdyzUIJTtGnI7l7YPnpb0iR20nZlftMUUawQOZCFf8QTq0ZCL3FT2pqjy+pV+uOR1ZiX0CtnUDhz2JdXKboctjRrIByc8GRKaRHv+tA== 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=qcmW5XoYWRoEgZ0UlmwVtLC6KBdkA25Co/jTfaAJNF8=; b=cwn5t0TFEMpVF5+fsvnJV5TckWzlEAiv63t8PV8zJLVF7KuhbH/9h1BuBwaLHLCdV2HIO3fb+Kif8WwPEkFMTf9kV6qHadx+MOqDOe+7OCI7yEhh2Y8XJzdzYTpAg6/roNqRnUHMQDXyUiU6VNNN6KanXwNtXG3kyavZm/1GKZV3hApcsToQ94rXptQSASrudGf6JAm367MnH77VrF+AyMquVDozI5KYbDRAzJg9W7GdP6JS/RPjGXpbKx4vWKjSROVTNzdT9/T7kyuhIml3wtFXbzdW+7O24elDprkrD06XbgoSQtC1Kc3xTA5FTcLn1vtCiYwqUNrzEk9o3a+dCw== 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 BN9PR12MB5274.namprd12.prod.outlook.com (2603:10b6:408:11f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Thu, 13 Apr 2023 09:59:32 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3%5]) with mapi id 15.20.6277.036; Thu, 13 Apr 2023 09:59:32 +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, petrm@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH net-next 4/9] bridge: Take per-{Port, VLAN} neighbor suppression into account Date: Thu, 13 Apr 2023 12:58:25 +0300 Message-Id: <20230413095830.2182382-5-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230413095830.2182382-1-idosch@nvidia.com> References: <20230413095830.2182382-1-idosch@nvidia.com> X-ClientProxiedBy: MR2P264CA0086.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:32::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_|BN9PR12MB5274:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f2aa94a-0030-4506-99b4-08db3c05c787 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BNShkm/tfIwbcXVCcDQEutGPFmQQwhj4uadEpItrl3YVb2AcAqya4yOJ0ZP6tXsHuOAUW9HcDWFYeXExNmSFrhhLFuLHtqZ58iOwPRsItix2S1Keu3KruoLEfk+/k0eQ+xQ/nWkEh3l0PuNR+MmDvyeUW+b50F/EwLgsNWEncbe/6tjmZidkdv4+lZMKPW55KVlVvrnWlIAV/yvfdlRbD1Boz23LbnU7Q2L9AbvqsjLka/EIe41o5FuugUykh95u9qP3onBcm/JUHyp2ljwvnRMF3suxgEU29giXrV5xOu9/sap4Jt53hAMyT3ksrCirG/Y0w8SAIJ0HqfrWy9sFw/nZjJld4BW+B/AhYvr0kEtf9phbD5tic1aH7GGzssz3yxIPh2dk/f0Eaz9zfDAcbOF0FaJpZCrzJGNqhPoFL3gX+YGGzKG8BXYPG3f6ll+YcSQ9fzkqa6nqKlxnjO66f12ODc9ojocRwxIvtlEwSkAQS0eMGG7seeQ62dbykIIwCJLIAvYZGp8Jv/+gt/VbnyohPybvPqIhd6rjwer2uFxhgygCGDk8dRwLiN5sE5Vs 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)(396003)(39860400002)(136003)(376002)(366004)(451199021)(1076003)(4326008)(66946007)(66476007)(66556008)(6506007)(6512007)(36756003)(107886003)(26005)(2906002)(6666004)(6486002)(2616005)(83380400001)(186003)(86362001)(5660300002)(8936002)(8676002)(38100700002)(478600001)(41300700001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Y76anbzetgPCaLwyHDuCw9WzUli42i0Gz0m0SRSybms3pRT1FCwf7lKt2JC+J+vPz75B2fN6CHVWtyZ+wQPf+1YnoZHB/qDN3S2UPpaKkJfxhyD6hyUgBCZIrWLCUrzPK5KL19fFXhID5lHmmbkkJZk8msGMi6mhLszsCpsZJBjPG+g3tyd8FQiru1/FUiIAW3i4rciF9JELlcKO8Lm9VQ3GHy/1L8Oy1ZZLNDaPtWVzY0MsSt4kdG6YDTRITMgJexEGyzH/uEpZY2h/svnCuesmiBE5ohmBwdnkocfEYWD3+cCAJ/CwRJrWLAwX+F3FKxZe4yz4unTfoyq4tclhaFcPWVdQlt1hHlrG1J+MS6GQAk4nlIDURe08brHy9m451XvD5qRiIhaKJ7h+/1jw5FEBy5mOLFhEhYx8ZWTBe83E2AmGEykBcBDdeSd14NjCkhaopBZ56qirtw5C6ptVBeOqqNO4+ZUthgitMXAEdBagwZhkxE5kas/AVAa3Ij7rnVbWAiSirrtxX6wgqkieXwXqBrquPzaaOQYMNkJ94spe9a4QEPXnpAUYdzbEzppxxv0W8v12p6zRO1n/gqgz8Gb7R1uiPtIcDV7F+UfFk8bGxmdtzFTLaxDQyapEwbhIbgN74Rh83JF6Ew1ZKbKeaysvyHQIcwLbeNvmJKoE7r81wfjjsLTrYnzeoqgmSv/OPAcaioSI71/+AnXrebo57nlBoc48ne9C1k3dcaJhcJB/+Ea27zuY41MBnMfdzILa5rkO73dC8cliP/0c6ucgxFUbYiLiXRNMRbJSselMQUdP7anj+vz3BzUemwbqIcqNvdEN0n7s0Cmr0WNwSyfzSj1f/X7IvAQ79Trb9lcS0cOhLrh5xH8DLPp239/qFPtw40hMJRbOhTrf3u6c3PzpZrEYAcYiVKLoVeWmx3ldOqgb00uTHMG07VkqMpEsjlJBz/J2DyN5P5PRGnEY5UDE0iITLAAfGmC3P5rYekwxDXD9WCndtNaarVl7HlqOMTMYve0nn5dUvsywTG5xnDysmPPBsou3bSDYIJyqbkH3qhAmaKK4/YBKf3mPmR7dnAAVlHPmKuh8tZFw6Y7VTmZM9yA+Hk0FYr727GYdcVxqvLw6i2C4ZDqN2su74tPPbUaRhWYEl8UEupYZ6Z9zjkKwwTqtUDTVGsm22ZP6ytvQIytmWB0C1TS8ondVndiPmEi1z4/MMz0a/dJVpKp1o9JMN6crlpJ/+ihc8YDE3yWqnhJTGuJB7kc7GhqTfiKy4i1IhzIy9IkTGdiydAOGTzpQTwEZb5kW6SiHINdeZZRQw/LKcO+rlhr/sY2flv8asO0iAipiaXY5/xFGSLT1umOSkNsFMbZDISuh8anroYRpxN1X+oLflVjHp7TxLwo10vb4xoVNWVTeUFx+WHmejgMVrTwu7lCgCVgqJkwVN3b3QPd5xkfg4GRAb6zvHJu9yxiqArz5PpY0a0VDQ569E6WXcafiuJML5WKuNa26sy0CqZQSq+vLs3x3lw99BYXA8Ca+lbEJq6z0a8R1sbteBE9TRWoBWMBfLQLrI1j7afy09cKo+tyssOpQBg3sJ6x32h0L X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f2aa94a-0030-4506-99b4-08db3c05c787 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 09:59:32.5640 (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: YP8m9n+nszS/yTkiMo1o4AKTJAAbDmHj84zJ4y0yBSe9WtZx9ywSdqc88dQ86JpVX7WgZlnANkZL4+Iwhaf1uw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5274 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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 Thu Apr 13 09:58:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13210064 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 64907C77B61 for ; Thu, 13 Apr 2023 09:59:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230137AbjDMJ74 (ORCPT ); Thu, 13 Apr 2023 05:59:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230182AbjDMJ7r (ORCPT ); Thu, 13 Apr 2023 05:59:47 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2040.outbound.protection.outlook.com [40.107.94.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECF6E7D85 for ; Thu, 13 Apr 2023 02:59:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jH0bQHqujy2j0gXi54OFdTnUonoovA65TALoZehqreQYz3RbTd9Ru5KeML2WzdiZ4QKkpHEeCdBaJuWYMzNQ/5/wjU+tVPsMIE11FR4RFV1OERyzWl+MWx6xd0qiigcJNoCT4H11FBWDGbqnPIj4OUrtYp4lgt9jzlzWK7y92tUJ7R61wNJ3EsCj30dX4eTEqQTpYP4LZPFVDO+DVpD41nsBzyN3zy5QXVtjQ+cHXtwv7igECn1hIDyLAeJbM65Puh6T4S528l0jnRsbVPVbP1dkyXJJNPyet8oOKjmaQQANDodBpYfjgoHeTuDJP4kFDhfa0qkZyz7KAVzX3CaNXg== 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=Lj90Ut8XMA486m20mHdynKT2IGXrETfyB0ICpCEDQgs=; b=nraWY0fNtT3cdD5JkKOqGMta7mr7qr0cVx4PJPtoqi/lcIxzvD9alW4TW4dn0YcosK4BSIXz9rnFC5eEkbVQBCFaPSsfWF+0pibVAwdzLkcpalbO+pex8Tg72IjXTPX/1IjLnsRpmqLI4fuyOxSL7EBax7orTtx1JU7TtFYJuEDXOLLfLkm0H8MFs/hWUACP8ZOxjd7gfQy6pPiPU4ewTNiwNRRhBADyva6DQLEsRK9gUkdORW70UyVeC8/nt/Y4qBU0kb915SbQjeIFUOnZ52vtUP7NIYmzvx8k9mrX6+3uGcSoP3CNS2XGKWNJyRDlFv795hJ9Yv6oMSgS4ncINw== 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=Lj90Ut8XMA486m20mHdynKT2IGXrETfyB0ICpCEDQgs=; b=S+SbjFpFDAm/9468kA89irQBHOMWm3Ky9Gl+M+E0wdxI94r7iYKzzFGDYj/01xSodtzlwuWtS0aIj1oxdc31zH0fJTjRMnbyT5zdU1IK49409HrY/azsU/HrxgrUTFi0JsuUOqs1JD4cGLDCETjdhfN/VKmUX/Rq5NMaOcr3oCoXbvD419N2SeJE/F6kE5R+miQt/KYvNpsi6KJYPDMriXMhOS4m/2++opMG1LJuKmBAy3WTSjX9l/YW571kvo/mW31sXSQYs76JLE9492FvBclsfuUsFn+A7lGfuXy0/NYLL9rFgvm+X2BDPU0jb4SXXc7xlopxaME2M4TF+mDV6Q== 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 BN9PR12MB5274.namprd12.prod.outlook.com (2603:10b6:408:11f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Thu, 13 Apr 2023 09:59:40 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3%5]) with mapi id 15.20.6277.036; Thu, 13 Apr 2023 09:59:39 +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, petrm@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH net-next 5/9] bridge: Encapsulate data path neighbor suppression logic Date: Thu, 13 Apr 2023 12:58:26 +0300 Message-Id: <20230413095830.2182382-6-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230413095830.2182382-1-idosch@nvidia.com> References: <20230413095830.2182382-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR07CA0243.eurprd07.prod.outlook.com (2603:10a6:802:58::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_|BN9PR12MB5274:EE_ X-MS-Office365-Filtering-Correlation-Id: 53116161-8d04-4401-c04c-08db3c05cbf7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ePDOYFAkzwjwUoE+cKDB14W2+zM+fFik7jUmENkmEc3E5UrllaI+OWNCUQ0flzZWoIELETPNh/WH1vJgmj0r0nEr72ap95xV1r4WDM3UNquIvZZmMW/33UgiJ/aow0EemZ9zXp45fF1h1ULkqWBJU3j3NTBMR7U8NoleEPGJ0KC8iSEoG9s7WQ+HkNoPrSpVNLWzRPCZbSbsjKmbbxYrUcC6BTC57qenlPrwrk8NZckjJb40nwZnFTLn554sWhtK4krvb5N3lqjjgK0r0M//XI/HaR5JJUdcPnoz5Ibo8b+PR4jHK6jMG/eWDEEaWjKVvq1l5ewi6KgdD9EvQxZRXzF/RMz3zx7nj5+6qC9LIxCpA0u1WAt6PAmCZdtxQo3CVBddgYxfiIhCHO/2sKboHALHYfPMmizbRv/nQk6bGWgAKqQvYoJMiVAGxtzdJHctzfKpDFQGeA2lHQRSs2LHAUJ2p7PGbn60bdgQ0NovAVQlqeXVL586JPc11XPQMLyK+Mthi/l1ecDeejdHPDk5Uwz/0EWf7aTgTRPH0CdAvwUK5goBNLaNS9DBVdda7WDJ 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)(396003)(39860400002)(136003)(376002)(366004)(451199021)(1076003)(4326008)(66946007)(66476007)(66556008)(6506007)(6512007)(36756003)(107886003)(26005)(2906002)(6666004)(6486002)(2616005)(83380400001)(186003)(86362001)(5660300002)(8936002)(8676002)(38100700002)(478600001)(41300700001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0JNTbkOoJlC6w7GeHl2WR2wt5WAjnVPca4QyipwXl0xUlu3PvTSGGQnFBrlUMSyrobFZZarOWjbgV4pjjB6fhvWvwGhdraaxgmRfvxL+wAdRiQT0wf1RrP5dFGhmN5QmZgxyfk/TIS6ajr+iP5kM7qUsEYzqMpEMwP2AFRPpw4dkzx9xKebOug0zcaD/k2zzCS626YkXGFv045a24fcAR4AjSxAPMSdmF9ct7hDZegE46o0ldwvJ4x9q9S9jLuDpayY2sHkUqqLHWMDz/hhwnIKgy3oni23vn+4pWy8qcli356b+dLSN5ZI9hM4AZEH/FRbATm5zCERZz/fwCMiKjcQw+MvuXy1HMG7XxrYOky6QryHaVPxJPPU9PsSfd9EoFzOKZZdZvAD1EakLOcbQUGy9SSPUY7b4zr3C/ZV5cyls4+p3NcFJcH4Ysp5MzpQAGqNPZIz0fTvcwkcrKqvD5w4+a4atkqj6kbVb6l+Cy54M9Xkoh3TWueYMUwptuKeBravuNfG/WbfWSz+drmFzlf0G2s5GyfmztmXjdiv1E9/S1vsoWQWKrzhfaGS9okj+IsLHALu2dd5dWwMuGK9Q5rMs+d6yxDyXk1eQySobO4ABYEEuGh/NeQe3Tbx4lpeICz4p3Wnhq1o+/i6LknWQyS2ChY5nxAxWxxY5EEvbAXNtSF87trVsfaGEeS0W75Lnh08ZuvxIYVSSfHrOMoKHQlDk9MsXBM/1cfauWgbXKar8uwJV+gK60qi50GtCejYPnsfiF6cqNZ/aa5u2odnzdtfoThN3qMXGfqO4GMs+ujU8LAwfd7dWf3wwIdUxEm7MRPc8M9RUD4SR7DbRZiuix9K2VEaTrgUWAzeDiMHO/MKrcPRJsBKL4MIpWHhtEaq4LTJWYvzRDrNV5NK/HioaTTxDVK/NlqmdjACrf10bZvHZ4pJDB5xsoZNoEbNXHNnH3fZnXMBuXteS58BBUP5sJItM0vMkwcr91VmozU3mSnjqBueTWE3sziNcyf6RFPjX+27Y0AivbjpVGOOWUg4VwXxgPxqXrcGyxpMFDJtPmvKAIaASvBg8FPa0g3dJMG4EaWmLgkVu9BnJSd4p1K3NWuSiu/Sn6AP3RU33DSOUZUfgwc8hSpa6ZlBxkCRQkjGroZa3v9OKv3e+tiX4+ebTTfjMXOb6gA6VNENgj+KM8Blg7/bo4aVuqXlIkWQRkWJLTps5e4DOLw4+rORjERMkgF7t3NFkEl8u/M/yEKDbvfN/3eTfRCHmgq5PaaCJr6cQkiykky5eMUzW365dRi9FvQ0j+rPtoI/eZ1CpWwPaAnoDOjozX541wS15nNyZKYWfuYXMN9LzOVtClfMxuS+5mv0jVQssYTHsyS2gENHabvXzE1nIGD3tXbws1Yp8sxXhYundEXg4tDbYTqd/OHcI1ZepUzkxlRRV5Ta0WC0tzAEQ6D7ppMb1Nq43cVg5C73udZKUvBAz9YJji3tUXgr4LXmOsrAdZ5CRlOgARqkjPXlM3sfGnvAiAODKTInvdeDfPz3rJ2Pl0010sre3nh+bbcOpKAsFJ1Ee7ENAe15yX/chfywO4DM545T6WlITDLwf X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53116161-8d04-4401-c04c-08db3c05cbf7 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 09:59:39.8967 (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: v0HhlE0Z+DR8OkXgPAAvvPCkliKOX85Dai2YyewBL2mjvBwjN9uIadnZt3aRPGShMungWR4xKgIrbsL63H4zPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5274 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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 Thu Apr 13 09:58:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13210065 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 C6E89C77B6E for ; Thu, 13 Apr 2023 09:59:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230126AbjDMJ76 (ORCPT ); Thu, 13 Apr 2023 05:59:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbjDMJ7y (ORCPT ); Thu, 13 Apr 2023 05:59:54 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2070.outbound.protection.outlook.com [40.107.102.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 584946A4D for ; Thu, 13 Apr 2023 02:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j+LCWS3TdID0WWd93Npv0sVHojO4xog9LqiAX+k1pc9uRjm+Z1pdqNIordHiBYBzyeRFS6Aoc8bkluG6MCu2LfzNyNqLe3+t3rVQOX309CyPMuYnzinl7fOOo2hDX4n35JzKdm+FEHTHvUpcQKe7MPdxJTB0DBytIM3KRmz9/tHFQv0Etm24+JYGAJjiixfWqhQ5Eg9PbeX7r6BW4+K+1GF6sVg/Do24I8tkLvsUA5mfqvJWEg+7NjNsTHNeL47sRbqCcI+lFMG/qkHUub17YpFk+BIpNCP6pgkFzK74O9/RNhJCmypRsgevflJjdNwucrFYMpTVyUdrTrg705kz0Q== 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=EitCx+ml1dbx7pZX8cAfaMB6zKt4x68jbOWaxy+VYzA=; b=gGCACOU5Eb28mP8S/9g4AGVZp1Y+iva8T0h29FgvyjijAyMIaJz+oH9YQb5aYKBSxBLFOxFJJgvvFNf7uouMBUC6xFL9A+10d9e5Bql1XyRGWIQ9Ljzg9FOGm1OJqdPEjvWF2STtHEdUBaboneXQgkar3MtDlyWU+IaupbMeF/mwGoLiC6ZIIA3jvJThHZdopzT5Db16uANZJtkva/m2fRQAeRqdt3kXRu1UEofkkoLg0aY6rfGBcCoMlB6GJOMKJqI16pEYCYbBdMDMxmYju42PRL33IMCEKyqd/QSiAn/+QN7B5heY9F1miET+SEu+c37Z8sZ5YW/87orpAGpGJw== 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=EitCx+ml1dbx7pZX8cAfaMB6zKt4x68jbOWaxy+VYzA=; b=Eh7c0/QymzjR+fPh1TVOPQiz0q0m8+yOYPbOKNlY5vzgg9zHYqjWcKATpg3KkmQKCiy0duhL36HIlYOmG65uUsF2sE7ifrKo1derynyEkXcqJZFS4Xjv0bNycYY4OByaGhAXHgoYq69/zJKqZEjUj1MNopd8RJe+E3SlarGYPCUisITr6Y2VjKahmQ3jfAv0yfka2/UlqZZBaXIHoRM2vCHxNvkzEWfS/V6ivM6kKTelE8YkjsfNaZuR5O/MtQvCT+xI3+HjpwLiphzbhY4adIm8hyzM4DuLDvh+Y7n8QgwG2Gqtf8Q6Zf0+QNmZd8F+nfC72DFNwH0UNVaDjMdWWQ== 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 BN9PR12MB5274.namprd12.prod.outlook.com (2603:10b6:408:11f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Thu, 13 Apr 2023 09:59:46 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3%5]) with mapi id 15.20.6277.036; Thu, 13 Apr 2023 09:59:46 +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, petrm@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH net-next 6/9] bridge: Add per-{Port, VLAN} neighbor suppression data path support Date: Thu, 13 Apr 2023 12:58:27 +0300 Message-Id: <20230413095830.2182382-7-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230413095830.2182382-1-idosch@nvidia.com> References: <20230413095830.2182382-1-idosch@nvidia.com> X-ClientProxiedBy: MR2P264CA0101.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:33::17) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|BN9PR12MB5274:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d434eb7-5d93-4a58-adec-08db3c05cfc4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hk3ITNWy1NgR5T3GF+TmhBeWmmPq4RX4hN+s20cP9B4K2zcE+yF2RUKGEW6hR2MsPwQaPRmsfdLqXej8Wc9i4jRpGHijoloI6xU4qzr8kc5rVmHv3vol/Ugo4hC7vc09VdqVU9pCFb4/AnQtbP6kBsUXSsMVEwCB7D1UmAYEY3edSj6xx8vKt8KJDWYJNkKm7i+Ma5FuhkmMG0Di8fxj3ckxyZtvaM+hqDrFrTWDaad2ihpUI/1dH642boUUlTiSFTG8AfIyHKufyAk7JHP2l+E0BTfgbDgBassAw1I9a90vqBBQw0CT26I8ZoYvF/VatiREVIoUTyCZXsVdnUq8OFmH0Fnd5qv6kRvtpCyLp7BNwucB26446XqqiBCgysxyZirGtT0Ks0ZX8+vOfeNq+aDaXaCWobLI3XHwMHxgZEIawUpkIsZbcaZsoDbJ6nRL5vAQti0sjHBxVn58WksG4XEiFOBIn3Ubie/Ast0yaHKQ4MhYStMb+JxKVkn2o2cwstpv5ymufiXbNl9dZWPS9NPwFkLntjjGi0TQgQcmaha2idKmTOU4SWIdg14EUGtQ 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)(396003)(39860400002)(136003)(376002)(366004)(451199021)(1076003)(4326008)(66946007)(66476007)(66556008)(6506007)(6512007)(36756003)(107886003)(26005)(2906002)(6666004)(6486002)(2616005)(83380400001)(186003)(86362001)(5660300002)(8936002)(8676002)(38100700002)(478600001)(41300700001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UuGgnmfhNxFcZotaJNVHuHVBbMpDS857pbHLj4VLvuPGj2rST2EXwkvNLR7hG+gKrnfPO68TWTzgvAOsHNTVGbcbK4Pot2nbPRU/0v/5zopRtVaBCqU/GGuzIjwC9yFqlIrR3b0WLOoiD1p3uEnsOF5zumZKA+MNtnOqsx3BWNndLtjIvIF1OYHqPVSduXPyX1z/pmPNvWaZsTJs7Hh8jzR/i7MaJWYbL79Q0nyOtSTxm/W4071UIO6srtIpC1cIcFinKDz1XuJQKVxHVx6mlBjqkGSOURTTQDDyM5LvHcTi/LITRDsHslDA4V76fX8ve214v/yHOg1EU3njQ45LjtgueEHsJjlfPDrBI0vmx0p1xC8GqsOHRDjRSSvEK/KqBQgV1X+kCBf/R0ZqtmJWuTQV300h1O1Qv94222uoDtbu81qlJZ9OQHhVigbtP7FAobgElvg/XSXRe/g3ogL85ciDJQkhyXNArZf8W1+ndw7JgGpkS68e6QoTaEcM5Sup/5eYbEyartduFmd0iB/b0SmYliK6TVBHMGSPEOlEyp7u0rJMZotLAq5MEB147M/DpokO7QFe8zGKsquB0DTAPtxhmNYehNMC+DVj/rP/jlmaZsn05rgW6RULdfV2q1jDIbxXGPbdvbfy69+wi+pOCJOVx2grXXMUEPJOwui71v+dBH4c5sylKnAPHAFAFoTb+4f05vXn9cGqI5jKxl0SHOalZiLMnaL29QLMMxk0GIpLoLeMW4qby1npdtJ+hNL07lcZlDnReoK3k9qrHgOqtHuN/ESB4kYia//uUWQsB0FIuA9fgilEnn/KbpZj9qrqTCYnRcvyoHHNP6JDZp2Rm/kf8KLw/V2P3ZfanbEk8FiCwgee2yyoazznKjtXJese5VlqjEJzS/3Hc30rOX2d4/7MVziT3+DLEyFDUJSsM+oHln0cSeXPe8CUeqCovm9dc1NzmBg5d9RrMWbYTOilqx4iWl8yXapHMBRJVxJjk73rduwciIENauWvim2TGiuECHpqBHVtYTMpcxH+8M8Kw2tVdZboWdjJLeYrC0krOkiYMr+ntq1zRz4mrL1SBdTLFGqrMAmu+RcCvW05SPBj3G55uB7g9D4UbIrQQ2e8tjSzJqieV08zv+As+zpmXyw+1NJyBm57PGdQWE8/MLVcYg/UFYDjIsK9GlqvQtLwWuS19j+dkmgcbmkGA7IHLLQdqWG5cbqRb1nQj9CcCERT+vzNoJfIszldjDL8q7ItV12elfgCFeAzf4a0kz8CYXqkDSJ/KKoT9qWfUGOnwAlY/kfHFMJwJTAo6Yd3vlL7H4VoPQ0TcJqDStMvga5+zPSngpCl9IoEcaNvb1Lpqh/leGMwnirLs8svpw1LqHEAGwQ7aGS7DWuuz2KNGTEr+IEbzcgxGNseO0HCStPxjf3PwqqzTJra3U2roHU6QuOL7G7O1UCL3v7McqZ+Km5Jpc1Szlyc3wvHKTMvR173EXHjsdvkJvT2qG6IArBIhxRGT30zqifJVRWMXmlvTXZDvwteY2IPVjp4j4rAz6A4M9BSpUPwAc+YItxUE3ZMPKzxK6Pgyt/rJqz+VcVq0/9waKl+ X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d434eb7-5d93-4a58-adec-08db3c05cfc4 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 09:59:46.2507 (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: 0BsmNByYQ21EzEPvhIr7Rs/enUruPqrxA2SAJ2ldd9r0khwKD2ERnh7dEOmIPUmJro6Ojq1/KLslRMwrDS3LMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5274 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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 Thu Apr 13 09:58:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13210066 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 AB90DC77B6C for ; Thu, 13 Apr 2023 10:00:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230177AbjDMKAH (ORCPT ); Thu, 13 Apr 2023 06:00:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229959AbjDMJ74 (ORCPT ); Thu, 13 Apr 2023 05:59:56 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2050.outbound.protection.outlook.com [40.107.102.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30FA465BC for ; Thu, 13 Apr 2023 02:59:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NhYEzccgpFWMUL+mDSlY7cW2Jnx4+uA/o6Hm+yztR9yGpu6Yy9ZvBtS+u48B6Oth40r8BWwFtMUMZJOPBjUeLqP7gwyVNOyiC3bsUmCu1UnuDnxOy8msaHPyHsZdUkwcY0tVnxh3fKviXWCcjTUS3uWpNqkwgU3BVSlQ6yHZrM+3TKoF60CbS5+ktARZFSWLX4FgJSUnjn/CFCWclMKydZlf/dv0xyKgKgodg0opmN4smsqBTz+Y1rFSxjGHtHbq7G1tal9/BNG44UsSlqsncBHBX8xf0dRsZ7dQuTCcxWKNsJVlVsVc6ZgJQ1PDey9ap5ac2SBu0y1gPBbK+3tfdA== 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=OocpeD0UomI/FlyahJq/PTTUvQlSvlpAuA6QQ1oKXlo=; b=YIAst5eLo2sTjIdgBqDJKUUU4H+WSRvj/T80N6XxSTfB7DY7C6jw8dBmNmZQXDdoYxwnxzhNl/AwYdhyBCJ4Ok0faPAP5EjS5PYWkrbo7/NJnOLZnMXTfwommS1AjrlETc0jclX+OCiqDZGCxuMScsW40gcxZikjzODqEhYGQPFI6RPxstdbN8KjXDbiEzIqkLeIAghoNGQfzifa6dTVSpl2wWX+/hwRmzmnEZbgei6Hm8x+ZnxearhH9d3v4RNt3bum10X9+saFzE6hZe2uSOzIlAuPA/zMuuioVazWoqtNJTkFLgcc+3R2zd0gSowpzLZZlqc6rA25OHRx8A9V5w== 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=OocpeD0UomI/FlyahJq/PTTUvQlSvlpAuA6QQ1oKXlo=; b=hjfE86leb4fR2D/5++bDZF7lP5Qc7zGgjOjjabEYmhOJ4/PziQTTLBF0uf0twhZubKpXevO2rNMBtxkn/1W8ASvOKIqtk0AZhhn3X+MzOng8VAirKkcY0Xpdvzed5YC8m/EQZMEttehRPrGrE3M4wgXo/qskBicn/Ku5YZY3Xm+1rGjxka8tg49TTYBOshaKTe/EL61OhooOiJbS/oWSCAeDXRe5CRqc+adKEFwBq5h+Z2ap67MUUeeBou85QUOpI5gdY8cXtwk1VLQcCfyf45abhUz66iNtXkuMtQP6RhfMjRXxSYUtViqfgffpFHGFV8tSJkNp9ttsYHXCDSytvg== 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 BN9PR12MB5274.namprd12.prod.outlook.com (2603:10b6:408:11f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Thu, 13 Apr 2023 09:59:53 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3%5]) with mapi id 15.20.6277.036; Thu, 13 Apr 2023 09:59:53 +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, petrm@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH net-next 7/9] bridge: vlan: Allow setting VLAN neighbor suppression state Date: Thu, 13 Apr 2023 12:58:28 +0300 Message-Id: <20230413095830.2182382-8-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230413095830.2182382-1-idosch@nvidia.com> References: <20230413095830.2182382-1-idosch@nvidia.com> X-ClientProxiedBy: MRXP264CA0021.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:15::33) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|BN9PR12MB5274:EE_ X-MS-Office365-Filtering-Correlation-Id: b0d57c05-0f29-4973-a2ba-08db3c05d3e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t2tw9mzqT0k+edYeLBgb/Px5JYHpP6YWJZGXI1/FmDGDKkKVcwGZ/cjUlXIEEniqqBlqFoXVggzRO4YvHTu918lhUtBgBV5CjwBHzjpApolvSqPiGRlF2zGcJT+PQ6+Jks1fMBsL8XsnC8GDWkEenBn4wA8wqcSYKBBm/VTFflZeUyAQeelCi+Oc+AZrvF/slvIW/ToZRXKoNAMo0rB/xUv4m3+IrLqzGXAScQz+OZY6s2lQr2C5kmBNIAS6YaRSL3LbiTUrBOf4Kanpbsy1KtwC66ctCmSBN7e67BSdg/Yq9nCDK8c9/rmQkQkQB50C3IFAHZeJGMhYR3f/L2Cn9t1jd8cePbZ1+VIj569JcibFnetj5yYTia3RT3okjOA/SaXTIGfFXoZd9DAmhYgrYHJaYi15/euqhokLnFRHP3yCLFpmnim0B8w4sbx7igEliPUrEoFvILqBW/8tp9zwyW3mddnuEQoCFdFksr98KUVP1+WyCnw9GHuHQoTBD4pipz3u5w5d8MUiBARU4BJxYB67jzUfddKgfCKwgYW/y3vHPwFI4zIA4J5ydcn69ByI 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)(396003)(39860400002)(136003)(376002)(366004)(451199021)(1076003)(4326008)(66946007)(66476007)(66556008)(6506007)(6512007)(36756003)(107886003)(26005)(2906002)(6666004)(6486002)(2616005)(83380400001)(66574015)(186003)(86362001)(5660300002)(8936002)(8676002)(38100700002)(478600001)(41300700001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2IC2txsCkvcGSr2CzO4BrRtnWOaw+/2rcWHEyEfUsAcbx88Pd7WhepL6n//ppBx51fqNg70NBFNKZCVra6SglowHQuLYV+hGxYeluh3XN7Ee6pnQKM0dF4uMX+eLkHGn/QQlS6Z+3XW/TZdY9La8rHy2FDxbDa/lyvIUm7yFwCHY8JkQU9PC2Nz9lklmaAUtphisVyOXU194NwO8xoPHQPKIZKcAQ+SjJ30mZvB+5QfwJgfA5u1exAVqX7/EIebMtHQ11U0zVTp23iwgQMbbFzM2XP+lpPyGB+yoggNTzWivv5ZZBsnd0qaf2zr0W0mPdyP/8lHdWVCffufeK8ujgB/KsgwXEuweO2Ziy0/bhTa9mFWxNsOxgxjoq7VM1VzWCSQHG5KTWPgWSasD/CENjtbTC20s5BiAKpHXB1A5eaoda81yhytHTMbPqyfXNal11XfMJenN16za458T9lHMytXD8HC1BlUSv3gm1BYqIKEWs1oEmZ/8RQ5ZGitGGGYzS+b82C4pIPpTIOQz/ZsZRfZS7h6Df/mqY+lCk6x9BcU7i4ldE5sLzArb/wdwQ2CHIMDbXgLfAvj6q0WP7mrMHqTZAMnkml6LQoGK+rpZuZ9cWuq1uNBSVXg47tpkDZP1pr5PAWGQrjQjNRVY+VZsq8TUUV82mNY4T5jqFS4d1jN6HvPX+3l+KnEVFAQtWRHXXzMHT/gaQXY58hSyx3wpUbK8Kki3TKyWecvP/E4hwwwghD2z+HTphwPpnqxsjgVrT3BB5VnSY9YU+lS4AHUV9OmcKroX/SXNidExB/MpIMUS2aPVvSjNBAf6u0gyTCOHQSTlnDo5g/VlfbIhG3zbNEdFJcEXmGwt3zI8NaTMuGLhn+n+hicX8C+OTeAX2cDfbVZvckr8ij7jp/lnqvnNuumlWWNzdRUpHs4uf6uCnmbPC3ugrwKw+autKnlvGCAHLeTz7GmVVf/FO+rbeqIAppEhwePjfxQAGJlVES01fbJedvwfisB4Zf4/4TLGDBUx7D37e3TZ3cV9lCJIOa20uT3mjAmrERyB0MFQRILeT+OeCrJT30KPJL6hosOxRzl1FgEmY6L3qGxFX0ZSPnd439ojXczR1qmtQY7+MC/T8Kg3nebkQyU6+kyNZsWx4CsyVH6c+dcTi0D0KDhIBY8JTbHqjCeyB1ZSss+h3XadC7wEKsrWjeWwKQ7ChcYKdyHdiQLDbYGQBqPSJ1qoAaMn3+LkTW7V4OKVAb/2MO+F4WqeSNqjy9Q9yrTRp9MelA7VYEDEzApMq4vPwZJmxdpWn42e/cZk5e+Uc5GvBypcLz09ga18dvJSkpoyw2AGFz6G5BGJzIcthmDnvV9dXbUTQt2GbCBIohXlLOdXWNBp9m9iXBdNwBLZxJsBZ3/NJUzsSkLFNUlV0IK8X24F/2fu9XbroiKWO+ZRJXbK4y+q16yqwL5HAz9QpHpVe+/0DbwlixMz9nhRbCCQRqxoNmwLb/55AnTglnOrbyh00uIAaBWrpmlrIPuMcgF75Ki77REjivurMQkyWdmu4NHzDpNXm8DEMU5U1Sgl3bhQ8VzwwG9EsRZur2lH6K6nV2XAdcQb X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0d57c05-0f29-4973-a2ba-08db3c05d3e9 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 09:59:53.2293 (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: mqcbgn1NJ4qaJWDP3PKZGn6SRM8xnbobp9MHDwtN4/Kcb3Q/86Vkbu+q7y6Rsqf7LjXBv+bTLpLHmYBVvx23iQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5274 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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 Thu Apr 13 09:58:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13210067 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 A6CCEC77B6C for ; Thu, 13 Apr 2023 10:00:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229766AbjDMKAU (ORCPT ); Thu, 13 Apr 2023 06:00:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230192AbjDMKAI (ORCPT ); Thu, 13 Apr 2023 06:00:08 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2048.outbound.protection.outlook.com [40.107.94.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C47D39ED3 for ; Thu, 13 Apr 2023 03:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ex7Bga8R4BliK0NAFb8dFInRe20+74kH2jZB2Q8zrqGUKxgvsUvKdwMwmExx3VMiU+swTPIMRGX3ORnjICzFfkog8EvHqiRbblUzEd4SFcrq+yIi8U7ugWOuNXesjXNQvnbBM/Gv3TJ7WmowjVkc047drYxreUwAPPDiFf3fZIPCT5dT+cswB4HFn/HtUMMVbvl2MedSxBrYPzIj7JXaXGh1fcgVfptoHu4FAzO8Jn27WHO5n2MhTonplJTafEAjl2nMKSvgJ8qo8MGtjBQYB0n8mki416sNJYk5dho0NwxIncduL6BiBP98+LB5XSLQPAM7qnJ8t2+W1cnQw5QZDg== 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=tm/998fYJpyPV2aNcbC2a012YpIfmRWu/btH0Xyt/vU=; b=nPGkio4sl7BgnGeTsHCxwU8l7j8lsqZUjqXSFJRkG5bnWdGHwYTfvGd7jMawAh751RHAyAh+3wRZOKQgtO9FG3axWUa6YqsWf4FQcE26//7uQ7J3Pl6nSO51s9yZO6jGH7U1+8+BUrsWDj0lZ2kRcti8efMfh0Lzj50z/rLRogCEeZzZIJJGKuRhOwhIKmIPZSRI+y9t6eb9mML5vL6rxZAvtiwRLbF6Nd130njLgtWHXFESmek49gKpoXQYzjdulFpxqHhMwY6MW8g+zeQppdU/hLm8fyRKNjNEVDd3fqnZHrZGufnGb13IoPT3QiZdLiZvWcvQudZCAULNz85WgQ== 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=tm/998fYJpyPV2aNcbC2a012YpIfmRWu/btH0Xyt/vU=; b=uF+xBlYZggBiU0diFw7S3T7ICe2QXszFDaD/xZUwUA+QU01b5D+Pdys7QNQr8hng9z08CGaK753191DsuTvSAgegFuZ8Aep9RE5OGatqoJMaPLSWlYiMa27xsds2+2kN2zHGy0DaFGc1n6elRue2su/61szsOz5IVV+A5yaeXQOrO59OPSSmFMqnzo57t4ayexBUUCA4Y4ADr2fx5AOhOFCFjo43v5DGU9O8c6wDtnSO3/Qcz44qtOZ8zHSsaX3MYYhI/qvjjlX1oveGA0hZHEv2tI+UfPgxMUgc5jj2PlF/puZP/XSC/IpqIpeTHVtIzbzdHneg8w3M7PlL+JjqFg== 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 BN9PR12MB5274.namprd12.prod.outlook.com (2603:10b6:408:11f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Thu, 13 Apr 2023 10:00:00 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3%5]) with mapi id 15.20.6277.036; Thu, 13 Apr 2023 10:00:00 +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, petrm@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH net-next 8/9] bridge: Allow setting per-{Port, VLAN} neighbor suppression state Date: Thu, 13 Apr 2023 12:58:29 +0300 Message-Id: <20230413095830.2182382-9-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230413095830.2182382-1-idosch@nvidia.com> References: <20230413095830.2182382-1-idosch@nvidia.com> X-ClientProxiedBy: VI1P195CA0005.EURP195.PROD.OUTLOOK.COM (2603:10a6:800:d0::15) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|BN9PR12MB5274:EE_ X-MS-Office365-Filtering-Correlation-Id: c1f2fbab-126f-4d67-88d7-08db3c05d83c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BHlr53WONJnISxvdgPrvT03itDaTiawFNOu5X/YHTI9WvJVd52JEKfu66E36WRKyDklVfKqSHkJh2KdNXAmdfAYUcVPPZ12N1P4JEGioAUaKwLoDqavZ4brHht+Hdj1EdEn1W+86i42QcJYhNSEI87LTU5f6epCR4RjtiF2ua76fwBBYvPyhV2v1dGVGGWTEzWlcdPzUGUNVGa5+W4pB0wiw3PoUkxYlY3ZSSalPQAWFhOXabsfQqOjSynTBtqLx3Q7Nk+zKJI6hKyw6OzitNkrvRPzn7K7oquroGuslhFbCtH3afSsZR2wsw4JU7eVLHbr10Y4W9LdWN8s0mYUgl+JydJtiDAlKmSg/yySQRO0p9P+LFW8Rd9UCfkjoXC1q7IK+l0wcdk4QYxzwopWbBW+ZzGze6ZxUugzLBY73/xUoJi5LIeO/wiMgU66uu7Tmg8jx5vguEJyY8FTGy79DZpfWg0GVtvKpS22rk2n65KnVpfKW/4i6F3rEEYfCzZqDEqRb5J3OKfFPHhzE/7CocbMxp1vUPP7fsWAEIqeCrqaj5ib+jnuapbX/VcHR9YrX 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)(396003)(39860400002)(136003)(376002)(366004)(451199021)(1076003)(4326008)(66946007)(66476007)(66556008)(6506007)(6512007)(36756003)(107886003)(26005)(2906002)(6666004)(6486002)(2616005)(83380400001)(186003)(86362001)(5660300002)(8936002)(8676002)(38100700002)(478600001)(41300700001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: G+97Fa53es1k+nnv6SHAn80ZwKZRr5+GBzysOKBZrDPKkN+oFOMwLW/KjZtRFus9ftI1p0n0Ofv29Z2gHkenjjjAppHkN+yPCvwC9VM/u5a5BzUmcYjOX6rWk5JtG9NVqRbR0ulBcnQWznokte7Kps/yW5HgJMszYvGbHTwnlRY7+OJ+NQJaXEDamh5AfKnFa7kbXJyNLzr4+XBNXac4d9Bd4KP1RAvIWHHFjopp8/UNM1fjHnu68AIJHG5g4d2ufmEKYf0zD5zOJ+B0J34XkU0JGU6STMKraRcxBQQoSr+bperJ4WCGhasXVBoIl1XGHxcs/OnRji0JrIuAWY3VbMxjYlUm073ay3wPx2EF8fulTo7MbAJwPcLjw+ZY1Ty9AbiAAPp0a5VXblhEplFUuxB/96f8MW38RZknc2eOWzSTzbId0o2NIARlCAAmtuc8+fndX85WkXUsbLWexIXpa7NM5kSp7BXNTQUHgiu+Znm1wkSqpcTyUDJbzReo7bGP4uvQya+KPvEsRSKRRg+Nq2+r+blmH3ZiBt40h044R68kUio0yo6DN/5hlbR37lezpmC9Ux3ah6gcYE6HSEDrXxQBHcPskG+kqO+Hv2add52w32S8ml6n947BpSu2L6kR/nOPANBdiDVYbou29eF29ETPq0JaDNNkvK59ajjTaFr0jki5OLTGAWgXVq1kSW2mLnhG18LkUMmkztT9fzdaGJoRfqhGYYF0Bimqz9ZdX/rYfPgACuVlEOws/1Z18VIYmWeAnBbwXoeFffInKBDwe3b+KlATO5yPnIXoB8T2fo1JBNPvnJG5wfvJso3jV/w2D0djLvlKRo/msJYb5IEhTHmVpE3F4S4Z9bw322TiigWGRU5Woj4ne0dlax+6JVimBZPKlE7FAsB3IvYE1uNfTGyOzNdbL5wpyWCAbpHRvttNdw2+dbOO48aF8FRzsr36oTB3TjRSJO1wQegr0nakkRBp/FNEeHz9yLKQi2vvxnCugONR/OQvDOCO5vWeilNpCIw270O/qyG+I5yYkqXkck60K3as9rgnYEt7Cmd0D9m9wg8EFLW1L0Zgy+onrmIstgC4bLbUvppMpv/nvYHtUK+4wUFzGUPx9jPxzt/fIC7pYOIh9GQCERlgO+l0rrHdukLh9ev3LR0cwP/Wbcmt0b1a8PSaYJVW5xTIkBeB+uMQOQZVcGL2oIkH/MAcpWTk8AvHpcN8lK1diZkHDhKy6lJxa8oWkXz1YYd4VcgSa23bkqvPWsJXiPL0wMHggp8dEAiVK8I9f6wqNdGOguPMv3njFwJQ3AwE/JlOKLA7j8mtFqd6kErd7lrHmf0SA9+3cnheu/hi2ZOXkqqvBf2f3xxqiYBmlhi+STbYt2i0jiab8URvPMTlke6Fx7af2c6cDHivX9YNWexVkAWO/Vo0CbrVheJ7QnFe1dWNOshUGULu9L/VAwILAwHPfWAQCmx1C3YALY8XYVIC4IGLu9CLxY3p49rQRexXef5Ke/NQHIxkzle3PY5HcXd2UAQxk23KHtpEXJM4f35x1OGzBBHTn1MCxVe/fBmtjb2n6xCpqFWAO+ezRSWayLQ3UKM9U+SD X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1f2fbab-126f-4d67-88d7-08db3c05d83c X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 10:00:00.4826 (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: 7ePuDAhdrtL6HXOtNdUG6HxSa+iNwor5jCTSobx5g77f001lfDpTwPEsC9mjaj1WGqkaT0/hz1Ombs8Hop0XoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5274 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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 906aebdc566b..f522e8c4fcd5 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 Thu Apr 13 09:58:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13210068 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 ACF4DC77B6C for ; Thu, 13 Apr 2023 10:00:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230148AbjDMKA3 (ORCPT ); Thu, 13 Apr 2023 06:00:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230149AbjDMKAZ (ORCPT ); Thu, 13 Apr 2023 06:00:25 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2074.outbound.protection.outlook.com [40.107.94.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFA3E9EE3 for ; Thu, 13 Apr 2023 03:00:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LxUYpwV4IyKHxYvxPDmM1QYDEoAuMhPoFtS3ZDXYqoh6YvtYWUvLGMOXHmDQzxYBW3YX6jFHGNR9bspU3o514LKpO+l6AO2Ih9IXUAqHD0tXKDJ8U6Z2rftT3iQC2F6MUJ76jmLhKi+6xlw0NXBUth4ji+kYTxM7GY2jagV2/gPIBwtbU+nqb5MtaEPPkUAVuM0Bny6DfQQg9VW3ZtC7U2QRas5vANtYX95ICzBoyH01cZWZQVnU/oacQB2xj2x+Mvn0WKDAQW4TMyY5HfyBgFTaR1myMQgFWVqAKpewvXcS0dC1qu9FH7kiA3HKshSTvriSxbbUVyQpJ/oIpPrI3g== 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=rBjHjO64J8EabqPsbthfWfRZFlU3sUStdXPm4DpGfh4=; b=ne4HK7SQynfFxZ99Fq8E634Us04EDzPaLPIBVYbk55yA0a7ZdaGaw7CDeoNrjxZ0SB9zhDPJRGhhLCjXEKa22/Hw9S479IHCIT/G7RHo5OxpY1Nzwi+UmXStXiI8yEsigo7BhTNH0Jdbfjr711m6g7BBy29e6L3LXrt3R8DNC7pZa/9uVCcxvWcuBQYi5JCOSCF6xhkMsymvjZYZV9NpOMaKpAkWrgEH2ZfW+wvl1R/qwVKpKdtpetlrOJO13XYcn7hMRq/oX8IQ/QwAvuKIVw6M/yGa+Ap9L8uNWwBD+RDgypG2hbwBUxcdj7x5BmG66hSe8M/lHI5CLVHjH9V/+A== 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=rBjHjO64J8EabqPsbthfWfRZFlU3sUStdXPm4DpGfh4=; b=Y0wp9zCCemoAog6jBzrV4jQCGw6VfUtJ80zWLch/XdkjHcOnAmbHMABErgNLNVgw61Kebpwb7Am43otF8dgKz8P3O0MTKyCjUGftXdKk2gDiMIZ33KtdekQm1r2L7b9XXffvdXa3F0GCD/lRKVwc7FDaveghDklB5vh2UsZFS5mht0xRHnL7C3iJemVsq4ed2EO5+92nqGR0W9A60CBORzbQpiLPRwF7hwPUGHQKnTHS9ncLqRuw11cZk/vMoRv5KRmqnCgR+DYxt2HVyFme3TTxxLjswk2EAb0AjhFvMp7kM/NCKC1LRACHrNbAaVJwzWyWYdIAY/xpRlbfHuzL6Q== 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 BN9PR12MB5274.namprd12.prod.outlook.com (2603:10b6:408:11f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Thu, 13 Apr 2023 10:00:08 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::d228:dfe5:a8a8:28b3%5]) with mapi id 15.20.6277.036; Thu, 13 Apr 2023 10:00:08 +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, petrm@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH net-next 9/9] selftests: net: Add bridge neighbor suppression test Date: Thu, 13 Apr 2023 12:58:30 +0300 Message-Id: <20230413095830.2182382-10-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230413095830.2182382-1-idosch@nvidia.com> References: <20230413095830.2182382-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR0601CA0023.eurprd06.prod.outlook.com (2603:10a6:800:1e::33) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|BN9PR12MB5274:EE_ X-MS-Office365-Filtering-Correlation-Id: cff7bda4-699b-455b-161b-08db3c05dca4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l39X+cQ5aNeEdKSiiL10E+VJtnd8IZgK1A0YAUJ30FL9+k0FxWsKMO3n0/4QoIHAni1ON6uTJDQSLMXzQZJJiBkhAB3B3gjlgRWOTfP3puppwspulP0JReDJxDN6YgYMZxXPoeqxpfpqlgd6JRi+pI4c+PcSKUlJ3TJ/CXTuEVf09rEBVJ2prnMD0yrQlgZX7q4h9mnBog5uR/ZA1dx88YCsxJ6DDeLRmQ7ue8v0c2YrM20RrPOWyJHR4g0XUmtM0kC03oW49wwlvUmdxEdGwhhZbAoYgHX6AO32BfxwKLUxKmeedOcjFIdPSugkQ46bUHoeeURFWSG73O5YVGV1C/LnmV1G/Fpvr+Odvx7eABLuFNDi5GCxy+lQTKRbJ1zCwaG6FaziMzl9kOrwqf2mxvI8cmjKGi0HCNeXUgTaGzKvoMVEroIxtkYuf115I+8LaftGWPNIJpDddXDwnwGL/UCPeocWBNEip/wSie3uA9Wrk0AiFbl6A5hbWhGTLLCZGd9tY0Vf/4+UOV3OO7fZICs8pAGvRsSWsKsBLkR+PZ3YnAave8dMQhSTOz9OQzaa 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)(396003)(39860400002)(136003)(376002)(366004)(451199021)(1076003)(4326008)(66946007)(66476007)(66556008)(6506007)(6512007)(36756003)(107886003)(26005)(2906002)(30864003)(6666004)(6486002)(2616005)(83380400001)(186003)(86362001)(5660300002)(8936002)(8676002)(38100700002)(478600001)(41300700001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lLY/luEdrvCqbQ4FPmunOzYRuj/WAKxOOlG2WkwNv4hPoohKmFJTNPfGqPvXBL3UUlkvN9agySNCPudcDTYuip1ogQZxfqqck1V4snI3JoFZ1cyvtjzjrzrsYKgS9q+U2Po5iPyOjvjWkN7EYKz1RnxgVYGC9GXITDKbJy106m9dVVWx/472Tn3dPwBI//T/necgCOTllElA1Yy4bGSUXHqwh+8ZupGXDxWT1kXKX0LnYedJwWFMT2TfdvmAyCRrl+Yk6HCf0NmG89nP1YF5vXps/SNzNR33SOwqEV7s7pm4YI4dwItZh1PtSRuNpgdlI29j5Ek8Oe0s18eQ0OifYWlQtdST9pXEj+a5xqwQmx1cOHk/j2D/1MaJHCb1aHKY8URqrFRz43RQfvf7xG1T/t0VJa72Ce6zMVXng8j8dwOwX3lGG8d+tCntvOG1BEXM4WivTNrUmprhosrlCGSp/ZooUUpMGqlSQBE3SH6IKPHNxKYfvkSXGPPH6H8zseZWq1tgxF06Clcl+pSQsOP3jZxO8Pf+1pm6hKTDvH66jrIPe60waFI9xTcToeRyd/C+jOA/rDN2YWRnkC07BwOsL2OgSwFGQaVSUvWoET6TYr0sndAN4ntsL3Qgc5d+po1vr6lW+gREJslXPQLiHFmE9/Ox9GzhCiUcJ7bWFOerixrA875mBe+ert8F3Fql5Um+dkpdOQXD9Vo2mfDjMOrdYEb0FFntMINJBUIxdgw4Vok0bZlHnCya8JUm/Iy8y9eyj40EFoCD6dl+2N2PsosY0bW5GYn57OciuKZUofgq4nCS661JwDSBzb6xWblQ9K9gxxmhBN8cnJn56OXPv3JY4OeORC/9LbPcSU8LkmR0uksMhtt0cCO8GDwIGWTyKHcbt5JOSPH4dtMBW07qfj+tUcg1EjxJK31lL5hjrC35YHQOkWxdNMwj3sA79kzJ1CF23Xx+yVs3piGVG1hpmaYlcEvEa9r3uk8mC5H974evWDjyHcrItpfud4df0wTrXrSXtV68/ldT24SVIkr/QQoIXuYG8jSXj+dPpgMOEE34DbfKUMbW2eWXrTrFSDH4DPMf98DcFEcrajQTMzJl2I5Jxq2D0rA1p20RIxGf+SY9PjuUt2p/97m7qp1hvXrOGCYMDkTXFfYjrm6halVI++rPA/FONOh0N8rT060BECvoBuNMScw+OhpddVrvhOuLbIKifHJmzBS4PsX1JyQFflMNxcUfv8Jc0rvdILZVayBpS376OQqW3Am27k/xymEZd1gzT6lbaFXtFhTqIRA1dFlHrowj/OSCq2kB4NTzPbnlV2nBU34dlQfiGn0oGM7Q07jMS4Wzm8dQdPC0fAXQzOe0+wQLA9ZGEBGK5kfaIaG/EWT5Vutxy5kTf17bgl90p4VSLreOpEqQs0qU1po2B8Nn/V0pynfZG5Y6vYnrubljRKaC+Lxk/2jGVwm3er6g6dGTJZQd2A2JvRVbkRUoKwOnXTVgspYDk1I9HO7rQqkTKPPzcl43ViOomANwxNYbkuiqsjYtObW1xSd6p762savtSxHu+w0/JEn3DPcOI2CwW8GTkRRXCKasSOWCMslc5qAV X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: cff7bda4-699b-455b-161b-08db3c05dca4 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 10:00:08.0506 (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: InHiiZTysNlOxxXb7bgeJgs3YaVXhMRKOAFVsaGMP12dMqfxl1e8f6EvvCcU14g/uNiC478D0GHrYUSWagU3yQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5274 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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