From patchwork Tue May 4 18:22:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 12238507 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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28086C433ED for ; Tue, 4 May 2021 19:01:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 03FC161078 for ; Tue, 4 May 2021 19:01:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231995AbhEDTC0 (ORCPT ); Tue, 4 May 2021 15:02:26 -0400 Received: from mx0a-000eb902.pphosted.com ([205.220.165.212]:29282 "EHLO mx0a-000eb902.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231274AbhEDTCZ (ORCPT ); Tue, 4 May 2021 15:02:25 -0400 Received: from pps.filterd (m0220294.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 144I96dW023239; Tue, 4 May 2021 13:23:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pps1; bh=Dn1EcMNWZGsvJjV6KjhfFTdFjIc9V485NuIEyRCC98A=; b=0MYctD2v+C2H/CpmoxP+07w18h1DMWdSVCugHLRnkvI+WHhSRkJIDXX3aUhU9k0UaPoU RFaFpDOOMU612onaB54po7CgDjQ0t3oXcxryokwLkDPAe8Y/XG59rTXC4ndo97X3VAnC a7uBAcr4nXL0CEb6o+r5J3W86PYW0rZZeB3KHgcUBxnbivawMkqCW5YW9WcNR+KzDEhh dZXq+SiYGDemAMwSjcGFXL2dGpwydBgx6sYEkHiFKUJrDjD+jTW3Ls/3h++YSq1w3ac/ HMnnHSHrvrvYcaz6lTAJiDqw4CZx8DXBWjoDTG6QKXHCMWuOMg4Kjw91N/YMYEtWKpvC 5A== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2044.outbound.protection.outlook.com [104.47.66.44]) by mx0a-000eb902.pphosted.com with ESMTP id 38awtsha9t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 04 May 2021 13:23:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IMkDr6hc1yAtsYloeFmcCliyy9VkIgi9Kdc617vEg4oqHHeV2uGPz9/qAm7KCQnDBV+TI2S43dNsDkdfC5Q9XHLMMK3vfqFXu9WKww+u4vN2sZYgi+an7xmn0s77bCBchowHexbB3XOX0AV0SoL97V/CsusoQ/2+aOJhZZgrEaqhttzq49oGVpbcHrX55aAEVrJIUt/ZZt7JzYZVJl6bh0f+75TZbRmCLfEygN5ojV3p4OyD5P9sdtzGxUyFrOkbkHt2wDbbSyKeyk/iGzQ447x0CzsZ5TWOiI7Jdw46/Iyaqk8j3RvLwfTV2ifIpbNxSVIqI1V/Ci+W1Uy9i5StqA== 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-SenderADCheck; bh=Dn1EcMNWZGsvJjV6KjhfFTdFjIc9V485NuIEyRCC98A=; b=L2ymwoUwPxsOpCmuA6ejMtU+Ojcdqd4O6JF2DnDL2CXqF9erLE4YPZ0bzo0TDOGmaMiBPUkapoEbyDF8sMbUxpzbhcGU7XVQZi5Oga4uEPoqyd6YbhJ7N8ajvb0FjZkK70xFghyRHzZoDaL0jHGWsUizO+dMkvehmbj7nppmmnujxP2zbwTu78GQ5K+nHIeSDiCnITMBW6cgROSgixuXavqILozXuEUEwwbO9IPtPqRGIFJ9fIBY2YIsdWfklniG+OOChLRkrw5gMXVb3S1p2lzSFeodqfRch9mrxqdzChUKK3ZLRVMJlaNvvRGG4pEQODdSI7NsR3IrELjMGuHK5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=nvidia.com smtp.mailfrom=garmin.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=garmin.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.onmicrosoft.com; s=selector1-garmin-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Dn1EcMNWZGsvJjV6KjhfFTdFjIc9V485NuIEyRCC98A=; b=DnnkYM6WWDQ+Pcw+fOYu4ui1ru/5ctsUwnwJ4+QHgY8ZLIktY/xBK09PWBk1mhRQ2a8GZ4jr0wYznu9X472/ovTDx2n3gljqRQeaIqFS0K4kmQizcb/Y6kApyzGCnaGmJoVe/PmHqMhwXN+un4fz+0fOuBqUc20Gzby8y+1NVCHfJQg5nhJ1VH2eFef4TwWCpRpxs1f8sYz8+GucAOnwjLPtiIgZDhrjduA595GLvA7OeZXQptRWBLi3IWwqfVFF0HQ34rXkocEn0/Bfspx5EBOo6O2rVo73c49uia3Jt5ubFfNLj7mxbFde11YOt3yU05J3fQEvXe/RgnG4dfJnuQ== Received: from DM5PR07CA0072.namprd07.prod.outlook.com (2603:10b6:4:ad::37) by BY5PR04MB6309.namprd04.prod.outlook.com (2603:10b6:a03:1e8::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.41; Tue, 4 May 2021 18:23:24 +0000 Received: from DM6NAM10FT065.eop-nam10.prod.protection.outlook.com (2603:10b6:4:ad:cafe::66) by DM5PR07CA0072.outlook.office365.com (2603:10b6:4:ad::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Tue, 4 May 2021 18:23:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=pass action=none header.from=garmin.com; Received-SPF: Pass (protection.outlook.com: domain of garmin.com designates 204.77.163.244 as permitted sender) receiver=protection.outlook.com; client-ip=204.77.163.244; helo=edgetransport.garmin.com; Received: from edgetransport.garmin.com (204.77.163.244) by DM6NAM10FT065.mail.protection.outlook.com (10.13.152.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Tue, 4 May 2021 18:23:24 +0000 Received: from OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) by olawpa-edge1.garmin.com (10.60.4.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2106.2; Tue, 4 May 2021 13:21:40 -0500 Received: from huangjoseph-vm1.ad.garmin.com (10.5.84.15) by OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.4; Tue, 4 May 2021 13:23:23 -0500 From: Joseph Huang To: Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" , Jakub Kicinski , , , CC: Joseph Huang Subject: [PATCH 1/6] bridge: Refactor br_mdb_notify Date: Tue, 4 May 2021 14:22:54 -0400 Message-ID: <20210504182259.5042-2-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210504182259.5042-1-Joseph.Huang@garmin.com> References: <20210504182259.5042-1-Joseph.Huang@garmin.com> MIME-Version: 1.0 X-ClientProxiedBy: OLAWPA-EXMB2.ad.garmin.com (10.5.144.24) To OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 68cb105f-8c3c-454d-c80b-08d90f29b470 X-MS-TrafficTypeDiagnostic: BY5PR04MB6309: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W8r2wKhXuq1N/s3iMjBeXb6FrJmGjvxz/rbsjSoFE3YgExitmWUjHjPVo/2nAC0g9qyTBP0FVL4GYg50TFOglKPoms7NjxvzYwWMGyBOvwmzV8cBdVBnCRhrjV4fJOt1sg1fB/fw39oK+pw99iqM3PhpTDq/4GUIINetAywPLj4LdIiL9VSFjF8wxCgc9VNKjMfsJdc+p2JNcugGqUQRb8RWqYQvtqXNiezvlt9G5jn2pKhYgfi0HVONz0sv0rVIMBvDeR5oHSwSJ1lDWeCeo2ZWAg3KbFCBz5+VuUBOAcz9GKvP90XJjJFAp4mekyEsD6Bbt+CMrbvyIKyP3aqD8PKJLKCHSJbU9SEz7r4EGhRPR816IyxEmiQ12nAxAXpMpSeB5eTqIBojyU7zE7GJFddD/hm7C2SK5SGq9FNSNQ1ks5uDoYldFn2IvhrDLeAc4blDY2dxD1tf6iUy3/7GG9GAG+n+cPWDjhQiSJyOTLHOgueUz8jTPo1whv2vQ7nG+kmZA09UcuSxtfJcHuhzfz7WOgg2Mj2Q7s/bNzxgTDsmyM+/4LTP7lrkLGXpHsdtyGGK//zB/5+dxM27JQjm4Uwdn4lromSfecIjBMqHM0VmLHv86vV1bih9hP8tbcN9ZA7gHwkQU23SSctU8PItV7/ANWp3ybJIMiBUNd3I6As= X-Forefront-Antispam-Report: CIP:204.77.163.244;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:edgetransport.garmin.com;PTR:extedge.garmin.com;CAT:NONE;SFS:(39860400002)(396003)(376002)(346002)(136003)(36840700001)(46966006)(47076005)(70206006)(82740400003)(2616005)(82310400003)(107886003)(7696005)(8676002)(70586007)(6666004)(86362001)(8936002)(478600001)(26005)(356005)(83380400001)(4326008)(1076003)(36756003)(336012)(5660300002)(7636003)(426003)(186003)(36860700001)(316002)(110136005)(2906002);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2021 18:23:24.3792 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68cb105f-8c3c-454d-c80b-08d90f29b470 X-MS-Exchange-CrossTenant-Id: 38d0d425-ba52-4c0a-a03e-2a65c8e82e2d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38d0d425-ba52-4c0a-a03e-2a65c8e82e2d;Ip=[204.77.163.244];Helo=[edgetransport.garmin.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM10FT065.eop-nam10.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR04MB6309 X-Proofpoint-GUID: uUpYQPiGVCMDZjkhFKvzjiALfD_pik61 X-Proofpoint-ORIG-GUID: uUpYQPiGVCMDZjkhFKvzjiALfD_pik61 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-04_12:2021-05-04,2021-05-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 impostorscore=0 mlxlogscore=999 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2105040121 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Separate out switchdev notification to its own function in preparation for the patch "bridge: Offload mrouter port forwarding to switchdev". Signed-off-by: Joseph Huang --- net/bridge/br_mdb.c | 57 ++++++++++++++++++++++++----------------- net/bridge/br_private.h | 2 ++ 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 95fa4af0e8dd..e8684d798ec3 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -669,10 +669,9 @@ static void br_mdb_switchdev_host(struct net_device *dev, br_mdb_switchdev_host_port(dev, lower_dev, mp, type); } -void br_mdb_notify(struct net_device *dev, - struct net_bridge_mdb_entry *mp, - struct net_bridge_port_group *pg, - int type) +void br_mdb_switchdev_port(struct net_bridge_mdb_entry *mp, + struct net_bridge_port *p, + int type) { struct br_mdb_complete_info *complete_info; struct switchdev_obj_port_mdb mdb = { @@ -681,30 +680,42 @@ void br_mdb_notify(struct net_device *dev, .flags = SWITCHDEV_F_DEFER, }, }; + + if (!p) + return; + + br_switchdev_mdb_populate(&mdb, mp); + + mdb.obj.orig_dev = p->dev; + switch (type) { + case RTM_NEWMDB: + complete_info = kmalloc(sizeof(*complete_info), GFP_ATOMIC); + if (!complete_info) + break; + complete_info->port = p; + complete_info->ip = mp->addr; + mdb.obj.complete_priv = complete_info; + mdb.obj.complete = br_mdb_complete; + if (switchdev_port_obj_add(p->dev, &mdb.obj, NULL)) + kfree(complete_info); + break; + case RTM_DELMDB: + switchdev_port_obj_del(p->dev, &mdb.obj); + break; + } +} + +void br_mdb_notify(struct net_device *dev, + struct net_bridge_mdb_entry *mp, + struct net_bridge_port_group *pg, + int type) +{ struct net *net = dev_net(dev); struct sk_buff *skb; int err = -ENOBUFS; if (pg) { - br_switchdev_mdb_populate(&mdb, mp); - - mdb.obj.orig_dev = pg->key.port->dev; - switch (type) { - case RTM_NEWMDB: - complete_info = kmalloc(sizeof(*complete_info), GFP_ATOMIC); - if (!complete_info) - break; - complete_info->port = pg->key.port; - complete_info->ip = mp->addr; - mdb.obj.complete_priv = complete_info; - mdb.obj.complete = br_mdb_complete; - if (switchdev_port_obj_add(pg->key.port->dev, &mdb.obj, NULL)) - kfree(complete_info); - break; - case RTM_DELMDB: - switchdev_port_obj_del(pg->key.port->dev, &mdb.obj); - break; - } + br_mdb_switchdev_port(mp, pg->key.port, type); } else { br_mdb_switchdev_host(dev, mp, type); } diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 7ce8a77cc6b6..5cba9d228b9c 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -829,6 +829,8 @@ br_multicast_new_port_group(struct net_bridge_port *port, struct br_ip *group, u8 filter_mode, u8 rt_protocol); int br_mdb_hash_init(struct net_bridge *br); void br_mdb_hash_fini(struct net_bridge *br); +void br_mdb_switchdev_port(struct net_bridge_mdb_entry *mp, + struct net_bridge_port *p, int type); void br_mdb_notify(struct net_device *dev, struct net_bridge_mdb_entry *mp, struct net_bridge_port_group *pg, int type); void br_rtr_notify(struct net_device *dev, struct net_bridge_port *port, From patchwork Tue May 4 18:22:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 12238509 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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1828C433ED for ; Tue, 4 May 2021 19:03:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3292610E9 for ; Tue, 4 May 2021 19:03:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232080AbhEDTES (ORCPT ); Tue, 4 May 2021 15:04:18 -0400 Received: from mx0a-000eb902.pphosted.com ([205.220.165.212]:34018 "EHLO mx0a-000eb902.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231274AbhEDTER (ORCPT ); Tue, 4 May 2021 15:04:17 -0400 Received: from pps.filterd (m0220295.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 144IAPMQ028781; Tue, 4 May 2021 13:23:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pps1; bh=eGB4vdoqn/KudE2r/6GyvU8YVGKeGDDX+aBr9Ms9O88=; b=heWUE/Eyu7rg6O4+O5OyFfHOOi5Tb/Ggco6nuv+glqjaFk0F6jKGnVyhSsEnM0TI5Plk +7629hQ2/INPWo4LnVjizunq8/HcqliU4//DaCx0i93RFguJehjUw89gKjgMQvV0pOS4 9RfgPtFibhbskj2hYcup+tkyKjlfNqFsXgmZFDYMDQNB+c3T5/REBKMLykQnqw9oHHnl Hz+O3it9H2DPQuszdCsqXLe7m5YRvtE7c55DdAkAltp/G+zgDiwpAWMeGgigbAch2RvE 1MLLFU0+XCCB8nFmlfMzhDL7KAlR0+FUsGOy+xempYcRP1tVjmNOSkH6Lz/bRB3jgscs cQ== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2173.outbound.protection.outlook.com [104.47.55.173]) by mx0a-000eb902.pphosted.com with ESMTP id 38am0m231b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 04 May 2021 13:23:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pu5MWdsfs2qBHTF5VSyxB5vPSLjaJybrcyk0AmKw06ntK/sKAShoLjHXRm01hIsj4bx0awGF1ZBBCQiVecN6eIaXALpDZW5CAWF+Tvxr6+RhOwlbS+ywHyEoWD9TsDtkjfbM5DRwW2pEM+fjeTIRym2fGfv5K4j47PhGK71MRo3A9r3ZC2TqlfrG4O2Sv6/00pENRgbIe+jeBXvS4fwDOHhZJPBxYrx/jouK6tcgjo10nUFrvWLk9oe1iaMyNqyLipuAjaDd24vkN17gTOOhpkkD25zjz42pADwRv9tF8+vU8t/F0T87tzeooMR66jI6ik+pJ8UbpK6e110+jE39hA== 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-SenderADCheck; bh=eGB4vdoqn/KudE2r/6GyvU8YVGKeGDDX+aBr9Ms9O88=; b=hP5ygy7S3gagzeVlp2eYmqaGkNXgoIHKTYUQYPFDOylhW6dJ+PYODxqLM2ndO6GuVYYekoXB2hIuzWvV+XswR+d/vcaXFsaOJ7Uxul8djKlC4U24OpW+6zoTwPKFTsZdF2CbfBx0HhQUP15Hp7RZ3HGFknH57AKM7bTa3rLEBXXIlcpfC/byNYTfyEh7UhZRZtReeI18ydDbjPnEPpcWzjl22n1oD0ARMvGSADufKLBki9vb48R6qvuiovXhI60b0cneiKK3tPbZYUVwQpsUqDl3Ok/wKkXofy3QlZuqVGscoBLyOT398suH2YNpIuEMYQUaf/T/5RQwdrF78RvV6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=nvidia.com smtp.mailfrom=garmin.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=garmin.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.onmicrosoft.com; s=selector1-garmin-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eGB4vdoqn/KudE2r/6GyvU8YVGKeGDDX+aBr9Ms9O88=; b=Q7OLogtpLy9t6HYXi44dtp8fAht4NfP9+UKYNknUu09kHDVPnqavCVAMUVfJxDxGQK7Rzkga2iMXQI2NZvHauRHr+MwiQ3ab3wchoW83ifAIadBMtZpSgaFHZt2L0/Sh0Yy7/all0hvH4e9DRjqet4bk5WAQ1GO4ElbMBU4s3Fx02wZE9fp/Rdw//FqnpXrSo4WlNfGV/t9PysiFC2/LgzeWgVLSz+cYcXgzOEc9YG9pt+hnyy5f/i6Jtlo/6aqCskrQanO1Ms4Lk5FpyHOLB9dKNqIVB0Wkn7wjUHc5Dmw+VegMaVsAcp2McPtaJAeGJAAgQF8KJpSVZQNxfxyM5A== Received: from MW4PR04CA0171.namprd04.prod.outlook.com (2603:10b6:303:85::26) by MWHPR04MB3775.namprd04.prod.outlook.com (2603:10b6:300:fc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.44; Tue, 4 May 2021 18:23:25 +0000 Received: from MW2NAM10FT029.eop-nam10.prod.protection.outlook.com (2603:10b6:303:85:cafe::b1) by MW4PR04CA0171.outlook.office365.com (2603:10b6:303:85::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27 via Frontend Transport; Tue, 4 May 2021 18:23:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=pass action=none header.from=garmin.com; Received-SPF: Pass (protection.outlook.com: domain of garmin.com designates 204.77.163.244 as permitted sender) receiver=protection.outlook.com; client-ip=204.77.163.244; helo=edgetransport.garmin.com; Received: from edgetransport.garmin.com (204.77.163.244) by MW2NAM10FT029.mail.protection.outlook.com (10.13.154.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Tue, 4 May 2021 18:23:25 +0000 Received: from OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) by olawpa-edge5.garmin.com (10.60.4.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2106.2; Tue, 4 May 2021 13:23:19 -0500 Received: from huangjoseph-vm1.ad.garmin.com (10.5.84.15) by OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.4; Tue, 4 May 2021 13:23:23 -0500 From: Joseph Huang To: Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" , Jakub Kicinski , , , CC: Joseph Huang Subject: [PATCH 2/6] bridge: Offload mrouter port forwarding to switchdev Date: Tue, 4 May 2021 14:22:55 -0400 Message-ID: <20210504182259.5042-3-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210504182259.5042-1-Joseph.Huang@garmin.com> References: <20210504182259.5042-1-Joseph.Huang@garmin.com> MIME-Version: 1.0 X-ClientProxiedBy: OLAWPA-EXMB2.ad.garmin.com (10.5.144.24) To OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7ce3b0fb-0087-444e-0990-08d90f29b4e6 X-MS-TrafficTypeDiagnostic: MWHPR04MB3775: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2201; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3qm93Mcz6JuxpMnpRenZ7n3TP5kcloY3q/Pwe7oBytdGRnlvNMu1alorRT3Wjn89QY+Xraz4LcqC6Pz05bzkXzaClW598QeL7yXs2X7kx+hSqEQvLZPCWyle/+SdRKIDx/aYX2ZdhZSPfUe1HmkV2KBdSZWr810zanKHh/APTIF/ZelPDViwH1sa0TYqu+Wwj4Q+UW1FtNVfwZ4QNH5AccaxPP+taiLjyJgXFlKWM0qH5toi2Ho5laGBae446Z8d4Qsrcah8DQUcIShRH054mRFgLiVX60rzzDWO84OU1vDGskdg5uNdl2eOzoy0m+EGae4PAHQgR+Jed8C4JNBDZkcgVSe68Q12rXFXJNVtrCF5Tbl7IrzNuz2htK3ANAqKMRIRILuR/Vig6/PY92s4wMdRjUSI8SCfcyuFEspcoKqljaAJw5KpM+/U4a5U/stlTjlfykpoSkfWXLC/Mt3Vr0OBEYh1OiCp8W++1m4Qssmw7VMFSRkxf+wphqMVd69UHLRV7x5E12EXfBGSDjNDaYj5nYiiKI745KFOm1kS6GcYSU2pU1ReSPrURAzkMlrejXwEFx2jCtha445WzUiLWH0KmVPLvh0scQEABUiy+yhvNb/3mdOddlBmVyriIb/oOuFrDyjymqmjPd6anMltkbswCXFVljYzY/4LIE0R2Zg= X-Forefront-Antispam-Report: CIP:204.77.163.244;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:edgetransport.garmin.com;PTR:extedge.garmin.com;CAT:NONE;SFS:(346002)(39860400002)(396003)(376002)(136003)(36840700001)(46966006)(7696005)(4326008)(36756003)(82310400003)(316002)(70586007)(70206006)(107886003)(356005)(2906002)(86362001)(110136005)(8676002)(7636003)(1076003)(336012)(2616005)(66574015)(47076005)(36860700001)(186003)(478600001)(82740400003)(5660300002)(83380400001)(6666004)(426003)(8936002)(26005);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2021 18:23:25.1297 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ce3b0fb-0087-444e-0990-08d90f29b4e6 X-MS-Exchange-CrossTenant-Id: 38d0d425-ba52-4c0a-a03e-2a65c8e82e2d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38d0d425-ba52-4c0a-a03e-2a65c8e82e2d;Ip=[204.77.163.244];Helo=[edgetransport.garmin.com] X-MS-Exchange-CrossTenant-AuthSource: MW2NAM10FT029.eop-nam10.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB3775 X-Proofpoint-GUID: u3lN4rORjaBHU6kG3rvO2LwYXR-tSnkJ X-Proofpoint-ORIG-GUID: u3lN4rORjaBHU6kG3rvO2LwYXR-tSnkJ X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-04_12:2021-05-04,2021-05-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 suspectscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 priorityscore=1501 phishscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2105040121 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Offload the mrouter port forwarding to switchdev also. Currently multicast snooping fails to forward traffic in some cases where there're multiple hardware-offloading bridges involved. Consider the following scenario: +--------------------+ | | | Snooping +--| +------------+ | Bridge 1 |P1|----| Listener 1 | | (Querier) +--| +------------+ | | +--------------------+ | | +--------------------+ | | mrouter | | +-----------+ | +---------+ +--| +------------+ | MC Source |----| Snooping |P2|----| Listener 2 | +-----------| | Bridge 2 +--| +------------+ | (Non-Querier) | +--------------------+ In this scenario, Listener 2 is able to receive multicast traffic from MC Source while Listener 1 is not. The reason is that, on Snooping Bridge 2, when the (soft) bridge attempts to forward a packet to the mrouter port via br_multicast_flood, the effort is blocked by nbp_switchdev_allowed_egress, since offload_fwd_mark indicates that the packet should have been handled by the hardware already. Listener 2 would receive the packets without any problem since P2 is programmed into the hardware as a member of the group; however the mrouter port would not since the mrouter port would normally not be a member of any group, and thus will not be added to the address database on the hardware switch chip. This patch takes a simplistic approach: when an mrouter port is added/ deleted, it's added/deleted to all mdb groups; and similarly, when an mdb group is added/deleted, all mrouter ports are added/deleted to/from it. Before this patch, switchdev programming matches exactly with mdb: +-----+ | mdb | +-----+ | +----------------------------------------------+ | | +--------------------------------+ | | | | both in mdb and switchdev | | | | | +------+ +------+ +------+ | | | +--------|-| port |---| port |---| port | | | | | +------+ +------+ +------+ | | | switchdev +--------------------------------+ | +----------------------------------------------+ After this patch, some entries will only exist in switchdev and not in mdb: +-----+ | mdb | +-----+ | +---------------------------------------------------------------------+ | | +--------------------------------++---------------------+ | | | | both in mdb and switchdev || only in switchdev | | | | | +------+ +------+ +------+ || +------+ +------+ | | | +--------|-| port |---| port |---| port | || | mr |---| mr | | | | | +------+ +------+ +------+ || +------+ +------+ | | | switchdev +--------------------------------++---------------------+ | +---------------------------------------------------------------------+ Signed-off-by: Joseph Huang --- net/bridge/br_multicast.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 226bb05c3b42..5ed0d5efef09 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -522,10 +522,26 @@ static void br_multicast_destroy_mdb_entry(struct net_bridge_mcast_gc *gc) kfree_rcu(mp, rcu); } +/* Add/delete all mrouter ports to/from a group + * called while br->multicast_lock is held + */ +static void br_multicast_group_change(struct net_bridge_mdb_entry *mp, + bool is_group_added) +{ + struct net_bridge_port *p; + struct hlist_node *n; + + hlist_for_each_entry_safe(p, n, &mp->br->router_list, rlist) + br_mdb_switchdev_port(mp, p, is_group_added ? + RTM_NEWMDB : RTM_DELMDB); +} + static void br_multicast_del_mdb_entry(struct net_bridge_mdb_entry *mp) { struct net_bridge *br = mp->br; + br_multicast_group_change(mp, false); + rhashtable_remove_fast(&br->mdb_hash_tbl, &mp->rhnode, br_mdb_rht_params); hlist_del_init_rcu(&mp->mdb_node); @@ -1068,6 +1084,8 @@ struct net_bridge_mdb_entry *br_multicast_new_group(struct net_bridge *br, hlist_add_head_rcu(&mp->mdb_node, &br->mdb_list); } + br_multicast_group_change(mp, true); + return mp; } @@ -2651,8 +2669,18 @@ static void br_port_mc_router_state_change(struct net_bridge_port *p, .flags = SWITCHDEV_F_DEFER, .u.mrouter = is_mc_router, }; + struct net_bridge_mdb_entry *mp; + struct hlist_node *n; switchdev_port_attr_set(p->dev, &attr, NULL); + + /* Add/delete the router port to/from all multicast group + * called whle br->multicast_lock is held + */ + hlist_for_each_entry_safe(mp, n, &p->br->mdb_list, mdb_node) { + br_mdb_switchdev_port(mp, p, is_mc_router ? + RTM_NEWMDB : RTM_DELMDB); + } } /* From patchwork Tue May 4 18:22:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 12238477 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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F122DC433ED for ; Tue, 4 May 2021 18:56:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA61A613C0 for ; Tue, 4 May 2021 18:56:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231478AbhEDS5U (ORCPT ); Tue, 4 May 2021 14:57:20 -0400 Received: from mx0b-000eb902.pphosted.com ([205.220.177.212]:59526 "EHLO mx0b-000eb902.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230402AbhEDS5T (ORCPT ); Tue, 4 May 2021 14:57:19 -0400 Received: from pps.filterd (m0220297.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 144IBfwD032360; Tue, 4 May 2021 13:23:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pps1; bh=oWwVRod8b8WrHwDkrhClUSAxTighTRz6rsTbak1W1Pc=; b=VKO5sFkNqFEeWrkvCvAw+TQcRIet3UVfaGZMw1S+hbGaOnUpV1RVOG1dz+bW6s/8PkWu Hnd0DBxn+eKyb+jrJBEHVIdP5xfJZ2n0QcSef5ZAKZKgaNc506ZZjUPmem7267Tx4dkJ QqV33kgZY/qKlHueaQFomj9Agq6WZWnnS0Ud84R5p1YYE8Ae7GrAD0tOCwP+xOJOO/pr Yd8VEBfb6Ra0+u6kvE8DaiKyyu8OwCpWqPqHaUsMk3AuBCBiJrHWYoqF03cjzaMpMvwP inSsYS51gtz6LRHcp1kntQ5D/P2LkAQP3ZYOzn85iONP8V8VedpBNfJh0UQhtwoU9cfG Kw== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by mx0a-000eb902.pphosted.com with ESMTP id 38afvgah4t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 04 May 2021 13:23:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DuckEKxZO7OKT05d/FukZgM7xZx0XJTroG3PQIUJLE2aEJXiOka5/IWN31CzoO2689SwbRt4YsFvshQfUGJ7Ry9rAgqCKQTAig5TLd7dsoTVFZvWBlcTiIclgE0wVnTuCb48PVBeiaQvhXHA84KeYQ+hm4ZXUWs0twHtXcPq1zYmCLZXHKRRBA6Vuyha8bNwSusHH6f+IJ5wyU4MBnRAKHtzD9BThtB1bWU1YBjFLDaygoQAaxN5VIfT8rgRZTWkC1hPZ14GjSSzBDeopO7cn+9SW6/kmgiTvv3CzL6C5CEC9Z5sFsXl3F5nLkj1hNIpCqUwgz9eQH8ZCMg1r0JOUw== 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-SenderADCheck; bh=oWwVRod8b8WrHwDkrhClUSAxTighTRz6rsTbak1W1Pc=; b=FaWUq2qEEvrSG+MAW7uyQ/pYMI75VXSkNkZmBoTq4bRa1a11jrAlsYPEGyzESe0Ru7nQY7f/z+l8sfHa9hUSKUSoTnXU9OdtKeqTC/fWhF88HnyfNcYTpAW/LqEK126fiXFlO4azBA5HKBTxNO5pc7TAtAwQlgvAWzBTvWwMnuxWuSPcAsgYAz30SJmG5DzPQ5ofEUz7xZeTyYl/A+QN3IiF+C5wx39Odb/DJhwzAWyHXqTlA3/MCTK+JKJBQfyzUBUDv9Jocf4HsLku/mXQz7BJ3JFyuhFxguIOSOytEgvsOzTZ/eassOn70bIH8eB104Yb0LEPNo4Zlag7L5Z8/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=nvidia.com smtp.mailfrom=garmin.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=garmin.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.onmicrosoft.com; s=selector1-garmin-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oWwVRod8b8WrHwDkrhClUSAxTighTRz6rsTbak1W1Pc=; b=OO+gYD6qXmh/tLUDmgrLjU8InyFriy1rvlRqfvZ45EBYYHfZgf9zJSYu9LAHWVdilLLhBb8ajhe6m0rIpR48DDlXKmKfIRQ2rMCmmYEcpJT/Un5NeJqDI5IGRtNYeIJLSECoH5+2eGBOnhgToFyRHV7ULvYkybthgNCS+ZyUuvWisGlFEoSzZLXPkzCxh8hAKXDG8s8qsNlYPoBhhMBc7dYAE64y8TdrudMOe/vxgdiIsIdDVva03V2raWGm6pJ3+wS+eVPsrOmXkxNJPiH2sxIRHLHN1RNNnBHTTAXXmrEA2fDJ+gIVOhqfGnKloyl4hlVEScaj+K5XTquFPZNRhw== Received: from MW3PR06CA0012.namprd06.prod.outlook.com (2603:10b6:303:2a::17) by DM5PR04MB3771.namprd04.prod.outlook.com (2603:10b6:3:fa::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.26; Tue, 4 May 2021 18:23:26 +0000 Received: from MW2NAM10FT064.eop-nam10.prod.protection.outlook.com (2603:10b6:303:2a:cafe::f4) by MW3PR06CA0012.outlook.office365.com (2603:10b6:303:2a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24 via Frontend Transport; Tue, 4 May 2021 18:23:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=pass action=none header.from=garmin.com; Received-SPF: Pass (protection.outlook.com: domain of garmin.com designates 204.77.163.244 as permitted sender) receiver=protection.outlook.com; client-ip=204.77.163.244; helo=edgetransport.garmin.com; Received: from edgetransport.garmin.com (204.77.163.244) by MW2NAM10FT064.mail.protection.outlook.com (10.13.154.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Tue, 4 May 2021 18:23:25 +0000 Received: from OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) by olawpa-edge4.garmin.com (10.60.4.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2106.2; Tue, 4 May 2021 13:23:20 -0500 Received: from huangjoseph-vm1.ad.garmin.com (10.5.84.15) by OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.4; Tue, 4 May 2021 13:23:24 -0500 From: Joseph Huang To: Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" , Jakub Kicinski , , , CC: Joseph Huang Subject: [PATCH 3/6] bridge: Avoid traffic disruption when Querier state changes Date: Tue, 4 May 2021 14:22:56 -0400 Message-ID: <20210504182259.5042-4-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210504182259.5042-1-Joseph.Huang@garmin.com> References: <20210504182259.5042-1-Joseph.Huang@garmin.com> MIME-Version: 1.0 X-ClientProxiedBy: OLAWPA-EXMB2.ad.garmin.com (10.5.144.24) To OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a1c233cf-3d5a-4bcb-0b4e-08d90f29b535 X-MS-TrafficTypeDiagnostic: DM5PR04MB3771: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HDxspoqUt8zXe+c8ajWk5KNbwzWfOBVeII9IigpqImk1b9mQW313j8sLYyhfLmrPRdsl7Tm0XxWRKqArW3WsxCGUBx2PN77a6BJUs1nPK4Pfax2ZIEQ9d12pJo/1L6eASxyXJEgiiUc2ur9198Fr6oWRagiYZGPxH65FGNXSCEnXuULpwymrb87LpnMQnXfToS5hMwmUo85BYpla2qpZZwl0OA8DTBHSETPSbZG+1OEfwRMOrA7P3ua0DNbPcIV0dR1DTHMWinJAbh2eJvGduu5+H/V8OlYIb6UnkVNUe9ttJ80imEZ+aQipQJn0hB+px7NoxhVd6vTnKU55Zekc1r7REUeC3hqPEEDb8zoRZorABarsN8v6bmGAf8qJJW2BPHUBGCqwx7jzXzEd1kcKAKoWO+FvcQWlhAbCDEeUt9sVbLpF7eTbIVbLpGDGrNGtps4YAoi/dOcqKZr6dv8sugtIxedQBNv4L9poqODPE3wTAvhsfr3c6uCuaLTuEDNhhYeOOkKX3HVyieSPk1auDh+8NkAOBYkPbK14DMwfLsMeMHCheL5n/PbcZLPYp17LsRsOOd1AIjfdgGcHU68tn081y/RN0oznDRSIw2iUNHsDfj9pzvbv9Flpm54X3PvnvHv5ZSoEGXmZ6igjYfympw== X-Forefront-Antispam-Report: CIP:204.77.163.244;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:edgetransport.garmin.com;PTR:extedge.garmin.com;CAT:NONE;SFS:(136003)(39860400002)(346002)(396003)(376002)(46966006)(36840700001)(426003)(336012)(110136005)(36860700001)(316002)(82740400003)(86362001)(6666004)(8676002)(7636003)(356005)(82310400003)(186003)(2616005)(8936002)(70586007)(26005)(2906002)(83380400001)(4326008)(7696005)(70206006)(36756003)(1076003)(66574015)(5660300002)(478600001)(47076005)(107886003);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2021 18:23:25.6484 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a1c233cf-3d5a-4bcb-0b4e-08d90f29b535 X-MS-Exchange-CrossTenant-Id: 38d0d425-ba52-4c0a-a03e-2a65c8e82e2d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38d0d425-ba52-4c0a-a03e-2a65c8e82e2d;Ip=[204.77.163.244];Helo=[edgetransport.garmin.com] X-MS-Exchange-CrossTenant-AuthSource: MW2NAM10FT064.eop-nam10.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR04MB3771 X-Proofpoint-ORIG-GUID: IYnXQ2Sh7AxBWGPmTgcZMgHBIMbsG466 X-Proofpoint-GUID: IYnXQ2Sh7AxBWGPmTgcZMgHBIMbsG466 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-04_12:2021-05-04,2021-05-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 malwarescore=0 suspectscore=0 phishscore=0 mlxlogscore=999 priorityscore=1501 spamscore=0 clxscore=1015 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2105040121 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Modify br_mdb_notify so that switchdev mdb purge events are never sent for mrouter ports, and when a non-mrouter port turns into an mrouter port, all port groups associated with that port are deleted immediately. Consider the following scenario: +--------------------+ | | +-----------+ | Snooping +--| +------------+ | MC Source |----| Bridge 1 |P1|----| Listener 1 | +-----------| | +--+ +--| +------------+ | |P2| | +--------------------+ | | +--------------------+ | |P3| | | +--+ +--| +---------------+ | Snooping |P4|----| Listener 2 | | Bridge 2 +--| | Joins Group A | | | +---------------+ +--------------------+ Assuming initially Snooping Bridge 1 is the Querier, and Snooping Bridge 2 is a Non-Querier. After some Query/Report exchange, Snooping Bridge 1 would create an mdb group A and add P2 to the group, and starts a timer on the port group A/P2. Let's say Snooping Bridge 2 becomes the Querier for some reason (e.g., Snooping Bridge 2 rebooted) before the port group A/P2 expires. With the patch 'bridge: Offload mrouter port forwarding to switchdev', Snooping Bridge 1 detects that P2 has now become an mrouter port, and will add it to the address database on the hardware switch chip (even though it's already there when the port group A/P2 was added). This is all fine until the timer on port group A/P2 expires, and then Snooping Bridge 1 will purge P2 from the address database on the switch chip. Now Listener 2 will not be able to receive multicast traffic from MC Source anymore. With this patch, immediately after a bridge port turns into an mrouter port, the port's membership information is removed from the bridge' mdb, but remains programmed in the address database on the hardware chip, just to be consistent with the database/programming state as before the Querier role change. The hardware programming will be cleaned up when the group expires (via br_multicast_group_change). Signed-off-by: Joseph Huang --- net/bridge/br_mdb.c | 17 +++++---- net/bridge/br_multicast.c | 78 ++++++++++++++++++++++++++++++++------- net/bridge/br_private.h | 3 +- 3 files changed, 75 insertions(+), 23 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index e8684d798ec3..c121b780450b 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -708,16 +708,17 @@ void br_mdb_switchdev_port(struct net_bridge_mdb_entry *mp, void br_mdb_notify(struct net_device *dev, struct net_bridge_mdb_entry *mp, struct net_bridge_port_group *pg, - int type) + int type, bool swdev_notify) { struct net *net = dev_net(dev); struct sk_buff *skb; int err = -ENOBUFS; - if (pg) { - br_mdb_switchdev_port(mp, pg->key.port, type); - } else { - br_mdb_switchdev_host(dev, mp, type); + if (swdev_notify) { + if (pg) + br_mdb_switchdev_port(mp, pg->key.port, type); + else + br_mdb_switchdev_host(dev, mp, type); } skb = nlmsg_new(rtnl_mdb_nlmsg_size(pg), GFP_ATOMIC); @@ -1011,7 +1012,7 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, } br_multicast_host_join(mp, false); - br_mdb_notify(br->dev, mp, NULL, RTM_NEWMDB); + br_mdb_notify(br->dev, mp, NULL, RTM_NEWMDB, true); return 0; } @@ -1042,7 +1043,7 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, rcu_assign_pointer(*pp, p); if (entry->state == MDB_TEMPORARY) mod_timer(&p->timer, now + br->multicast_membership_interval); - br_mdb_notify(br->dev, mp, p, RTM_NEWMDB); + br_mdb_notify(br->dev, mp, p, RTM_NEWMDB, true); /* if we are adding a new EXCLUDE port group (*,G) it needs to be also * added to all S,G entries for proper replication, if we are adding * a new INCLUDE port (S,G) then all of *,G EXCLUDE ports need to be @@ -1176,7 +1177,7 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry, if (entry->ifindex == mp->br->dev->ifindex && mp->host_joined) { br_multicast_host_leave(mp, false); err = 0; - br_mdb_notify(br->dev, mp, NULL, RTM_DELMDB); + br_mdb_notify(br->dev, mp, NULL, RTM_DELMDB, true); if (!mp->ports && netif_running(br->dev)) mod_timer(&mp->timer, jiffies); goto unlock; diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 5ed0d5efef09..d7fbe1f3af18 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -506,7 +506,7 @@ static void br_multicast_fwd_src_handle(struct net_bridge_group_src *src) sg_mp = br_mdb_ip_get(src->br, &sg_key.addr); if (!sg_mp) return; - br_mdb_notify(src->br->dev, sg_mp, sg, RTM_NEWMDB); + br_mdb_notify(src->br->dev, sg_mp, sg, RTM_NEWMDB, true); } } @@ -617,7 +617,12 @@ void br_multicast_del_pg(struct net_bridge_mdb_entry *mp, br_multicast_eht_clean_sets(pg); hlist_for_each_entry_safe(ent, tmp, &pg->src_list, node) br_multicast_del_group_src(ent, false); - br_mdb_notify(br->dev, mp, pg, RTM_DELMDB); + /* don't notify switchdev if mrouter port + * switchdev will be notified when group expires via + * br_multicast_group_change + */ + br_mdb_notify(br->dev, mp, pg, RTM_DELMDB, + hlist_unhashed(&pg->key.port->rlist)); if (!br_multicast_is_star_g(&mp->addr)) { rhashtable_remove_fast(&br->sg_port_tbl, &pg->rhnode, br_sg_port_rht_params); @@ -688,7 +693,7 @@ static void br_multicast_port_group_expired(struct timer_list *t) if (WARN_ON(!mp)) goto out; - br_mdb_notify(br->dev, mp, pg, RTM_NEWMDB); + br_mdb_notify(br->dev, mp, pg, RTM_NEWMDB, true); } out: spin_unlock(&br->multicast_lock); @@ -1228,7 +1233,7 @@ void br_multicast_host_join(struct net_bridge_mdb_entry *mp, bool notify) if (br_multicast_is_star_g(&mp->addr)) br_multicast_star_g_host_state(mp); if (notify) - br_mdb_notify(mp->br->dev, mp, NULL, RTM_NEWMDB); + br_mdb_notify(mp->br->dev, mp, NULL, RTM_NEWMDB, true); } if (br_group_is_l2(&mp->addr)) @@ -1246,7 +1251,7 @@ void br_multicast_host_leave(struct net_bridge_mdb_entry *mp, bool notify) if (br_multicast_is_star_g(&mp->addr)) br_multicast_star_g_host_state(mp); if (notify) - br_mdb_notify(mp->br->dev, mp, NULL, RTM_DELMDB); + br_mdb_notify(mp->br->dev, mp, NULL, RTM_DELMDB, true); } static struct net_bridge_port_group * @@ -1294,7 +1299,7 @@ __br_multicast_add_group(struct net_bridge *br, rcu_assign_pointer(*pp, p); if (blocked) p->flags |= MDB_PG_FLAGS_BLOCKED; - br_mdb_notify(br->dev, mp, p, RTM_NEWMDB); + br_mdb_notify(br->dev, mp, p, RTM_NEWMDB, true); found: if (igmpv2_mldv1) @@ -2436,7 +2441,7 @@ static int br_ip4_multicast_igmp3_report(struct net_bridge *br, break; } if (changed) - br_mdb_notify(br->dev, mdst, pg, RTM_NEWMDB); + br_mdb_notify(br->dev, mdst, pg, RTM_NEWMDB, true); unlock_continue: spin_unlock_bh(&br->multicast_lock); } @@ -2575,7 +2580,7 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, break; } if (changed) - br_mdb_notify(br->dev, mdst, pg, RTM_NEWMDB); + br_mdb_notify(br->dev, mdst, pg, RTM_NEWMDB, true); unlock_continue: spin_unlock_bh(&br->multicast_lock); } @@ -2660,26 +2665,71 @@ br_multicast_update_query_timer(struct net_bridge *br, mod_timer(&query->timer, jiffies + br->multicast_querier_interval); } -static void br_port_mc_router_state_change(struct net_bridge_port *p, +static void br_port_mc_router_state_change(struct net_bridge_port *port, bool is_mc_router) { struct switchdev_attr attr = { - .orig_dev = p->dev, + .orig_dev = port->dev, .id = SWITCHDEV_ATTR_ID_PORT_MROUTER, .flags = SWITCHDEV_F_DEFER, .u.mrouter = is_mc_router, }; struct net_bridge_mdb_entry *mp; + struct net_bridge *br = port->br; struct hlist_node *n; - switchdev_port_attr_set(p->dev, &attr, NULL); + switchdev_port_attr_set(port->dev, &attr, NULL); /* Add/delete the router port to/from all multicast group * called whle br->multicast_lock is held */ - hlist_for_each_entry_safe(mp, n, &p->br->mdb_list, mdb_node) { - br_mdb_switchdev_port(mp, p, is_mc_router ? - RTM_NEWMDB : RTM_DELMDB); + hlist_for_each_entry_safe(mp, n, &br->mdb_list, mdb_node) { + struct net_bridge_port_group __rcu **pp; + struct net_bridge_port_group *p; + int port_group_exists = 0; + + if (is_mc_router) { + for (pp = &mp->ports; + (p = mlock_dereference(*pp, br)) != NULL; + pp = &p->next) { + if (p->key.port == port) { + port_group_exists = 1; + if (!(p->flags & MDB_PG_FLAGS_PERMANENT)) + br_multicast_del_pg(mp, p, pp); + } + + if ((unsigned long)p->key.port < (unsigned long)port) + break; + } + + if (port_group_exists) + continue; + + br_mdb_switchdev_port(mp, port, RTM_NEWMDB); + } else { + for (pp = &mp->ports; + (p = mlock_dereference(*pp, br)) != NULL; + pp = &p->next) { + if (p->key.port == port) { + port_group_exists = 1; + break; + } + + if ((unsigned long)p->key.port < (unsigned long)port) + break; + } + + if (port_group_exists) + continue; + + p = br_multicast_new_port_group(port, &mp->addr, *pp, 0, + NULL, MCAST_EXCLUDE, RTPROT_KERNEL); + if (unlikely(!p)) + continue; + rcu_assign_pointer(*pp, p); + br_mdb_notify(br->dev, mp, p, RTM_NEWMDB, false); + mod_timer(&p->timer, jiffies + br->multicast_membership_interval); + } } } diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 5cba9d228b9c..9aa51508ba83 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -832,7 +832,8 @@ void br_mdb_hash_fini(struct net_bridge *br); void br_mdb_switchdev_port(struct net_bridge_mdb_entry *mp, struct net_bridge_port *p, int type); void br_mdb_notify(struct net_device *dev, struct net_bridge_mdb_entry *mp, - struct net_bridge_port_group *pg, int type); + struct net_bridge_port_group *pg, int type, + bool swdev_notify); void br_rtr_notify(struct net_device *dev, struct net_bridge_port *port, int type); void br_multicast_del_pg(struct net_bridge_mdb_entry *mp, From patchwork Tue May 4 18:22:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 12238463 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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 128A5C433B4 for ; Tue, 4 May 2021 18:34:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4CAC6112D for ; Tue, 4 May 2021 18:34:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231215AbhEDSfG (ORCPT ); Tue, 4 May 2021 14:35:06 -0400 Received: from mx0a-000eb902.pphosted.com ([205.220.165.212]:59880 "EHLO mx0a-000eb902.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbhEDSfF (ORCPT ); Tue, 4 May 2021 14:35:05 -0400 Received: from pps.filterd (m0220294.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 144I9rmH024148; Tue, 4 May 2021 13:23:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pps1; bh=NevxT241im1sompXtnoojFuHhyOb8qL5q3yVwdaLpKw=; b=jt1UrfMrCaoiZYxrll0NBrtsXHQMCijieZi1/+1EH3UyPRAyBTpOrLL7X9KLBgidk3Jg pKHuKZrx6szm5UfyG2LflIbUxzZ9iAd858n1fI8hXr667ZWggQ6ZqEFDWPF9ydsUAVNr hu/1G9CP6/PQeR56W9OA553OJb6hJCK+c+2asdNOSDiSbvQfyAaJzCVYUZLDV4/rKvbl fqBCGtsV7w4yGh9hzxohjh8swQCcDboLM1bseaefbjDs6iyeYigLxAEToeUoyt3qwAhk aNN6aS4CRpSz5Nxk38HslWOqkE2ySNt4t6afIWYrK0eL94P0bzNBsFB9locarXGh8EbC nA== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2107.outbound.protection.outlook.com [104.47.55.107]) by mx0a-000eb902.pphosted.com with ESMTP id 38awtsha9u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 04 May 2021 13:23:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S/I08P8FX/ivmeoTl9OWlLOjgGk6hWZ6VGgOuws06Urt45FUVVfd+hL+xCNLUZtKAfcjHqgrNVzU1y8P2I329rfg+1gSQZafM8Q72YR+8OXSuj2NV8PkB7Kkgrfa7Z7LQLthE5C5v4ySxG8B2lt6Nuk72l0LUuaQJ8QRKii49f90HYIootM5mzbX3YpDrlhr9cL86Ugf5QPXZ501g3htcBosxChkneslhApALS2L2DIqlEFw3RW5+UnZp2jCEoz3jfA7xk+9kDPglhRlMXxibcjtVbsMFE3F6eIwigTOVqyEjgdycTEe5wcxW/tC97jK0cd+RKcRgVUTC2Mct8scug== 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-SenderADCheck; bh=NevxT241im1sompXtnoojFuHhyOb8qL5q3yVwdaLpKw=; b=BjYSkct6N5HJfvT53NAy31o77SMn6Z3cpcZJlTvYE3J4Dq6D4JsqvxIE2b1G5NdKGbxMKoYush9vPS6EIQ93lBkUIH/YXFRkDuhPfWBzfuSgpALiPyQyMBbWwSFSAFI4idTkuZUMQMMrQPhC8fADB9xp1tkQhSsLGBq7tD5Cx4I9VDBUBiU5R4ZdUOKysKPlhwnMVoi3u42fZq0g4O/LOV2Nho4mvcjtACGnWlsIiiCC3QOxEmWw7kqmpIvFIxEvkPwRK6KSp9gA4h/CGPSKAZlIVzxapeeX3e45GEZZyqtQBU1YengotO4h97BNy3blodyjbUC2qxna+b9tOpZqLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=nvidia.com smtp.mailfrom=garmin.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=garmin.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.onmicrosoft.com; s=selector1-garmin-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NevxT241im1sompXtnoojFuHhyOb8qL5q3yVwdaLpKw=; b=Aa9PF6ml7wwVuEi21SFpiybOtLwOeyI0q5XNF5QN1vJ9s7k7KTQEtK+HJn+StMd4uRIbWbZit/gQteNoPvFqVFAJHGn5LrTnRI+ojDItI6Rx2Z0YcVaWB22WEul+X6kMzwQbQvBUxsiFPcwwLzYdW+AuY+InkkrWJoFqYsv2DtvO80Iq6yR27+7h1vYM/9fAb1qDQz8DsNKVkr09cTE01nJXjzjJSPJTRzvVfLZ9MO//yhgHhcRTLj3mB62jYYw6R6FiqZsaOO0UIOOO+fHX3Pdny4S6eJnji/nKqQaoGkyRgDIvyVoDc5KwTALgQZNRw708oUvbOToAb4Dk0TK46Q== Received: from MW3PR06CA0012.namprd06.prod.outlook.com (2603:10b6:303:2a::17) by MW4PR04MB7396.namprd04.prod.outlook.com (2603:10b6:303:73::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24; Tue, 4 May 2021 18:23:26 +0000 Received: from MW2NAM10FT031.eop-nam10.prod.protection.outlook.com (2603:10b6:303:2a:cafe::2d) by MW3PR06CA0012.outlook.office365.com (2603:10b6:303:2a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24 via Frontend Transport; Tue, 4 May 2021 18:23:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=pass action=none header.from=garmin.com; Received-SPF: Pass (protection.outlook.com: domain of garmin.com designates 204.77.163.244 as permitted sender) receiver=protection.outlook.com; client-ip=204.77.163.244; helo=edgetransport.garmin.com; Received: from edgetransport.garmin.com (204.77.163.244) by MW2NAM10FT031.mail.protection.outlook.com (10.13.155.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Tue, 4 May 2021 18:23:26 +0000 Received: from OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) by olawpa-edge3.garmin.com (10.60.4.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2106.2; Tue, 4 May 2021 13:23:20 -0500 Received: from huangjoseph-vm1.ad.garmin.com (10.5.84.15) by OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.4; Tue, 4 May 2021 13:23:24 -0500 From: Joseph Huang To: Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" , Jakub Kicinski , , , CC: Joseph Huang Subject: [PATCH 4/6] bridge: Force mcast_flooding for mrouter ports Date: Tue, 4 May 2021 14:22:57 -0400 Message-ID: <20210504182259.5042-5-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210504182259.5042-1-Joseph.Huang@garmin.com> References: <20210504182259.5042-1-Joseph.Huang@garmin.com> MIME-Version: 1.0 X-ClientProxiedBy: OLAWPA-EXMB2.ad.garmin.com (10.5.144.24) To OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fc0e880f-b301-4d5f-da55-08d90f29b576 X-MS-TrafficTypeDiagnostic: MW4PR04MB7396: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3y9WVvgli4tX85BhpW2raQcZrjvvPJMXVcFjzxSqnMn7Gymnnkyw1YB6vsyxv+CAGtY9p9buKmDXLZ+0aIP5InEHfoEdtLqlsQmc2stfFRgw5h8P2vq5vmXSmWeQFNp+AGypKuokgvlqG7kqel8SGlUZAeEh66XRFvpHv59NCXqyhiV+jX/tDqqZ/2EHuoIkhHkNDgoYB9NJEjjyWyMYuRg/tnfHIF5h6jEmeSBvKkgoB1G32CcNh4Xaw1cjY11Kbp93Zu57NVFPRKqChUE1hSr6LdU0t+F79fSVqVHszEvo7hqkS1rcr6OvAs5E+sJ9NJjZpWJvcmYYEtlFwc71xri2u6rvWm/EWcINzALRsRrIFppAdfonUiy+Pd7UGaJR0asmkFUwFYGDvH73x2aYcYeHy3zyNaDPp3DRyX6ATBLS+KXk1Tr7lINKaa55+2QPLzuTj+hRZE9K19UCeJmDWxBmugftDohH2JOPTushaA5lfpjzIKgebt5lvedgoS5nQZSgUbmrr/iERBbOKVZTpqHlbRz5x1+L3ZG0MbHUXiJFORtcfBMG/msdsYmLa1yWKTrYGv6umbdy3AB8Yau5m1L3wC3FPsC7mfqd4WhEDegEvTl5uD/yyGkeu1rANwT/0ssDuiizdrgAGgKY/OzIvg== X-Forefront-Antispam-Report: CIP:204.77.163.244;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:edgetransport.garmin.com;PTR:extedge.garmin.com;CAT:NONE;SFS:(136003)(39860400002)(346002)(396003)(376002)(46966006)(36840700001)(110136005)(47076005)(8936002)(7696005)(2616005)(356005)(82740400003)(1076003)(7636003)(82310400003)(316002)(478600001)(107886003)(6666004)(36860700001)(5660300002)(26005)(70586007)(66574015)(36756003)(186003)(83380400001)(4326008)(2906002)(70206006)(426003)(86362001)(8676002)(336012);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2021 18:23:26.0787 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fc0e880f-b301-4d5f-da55-08d90f29b576 X-MS-Exchange-CrossTenant-Id: 38d0d425-ba52-4c0a-a03e-2a65c8e82e2d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38d0d425-ba52-4c0a-a03e-2a65c8e82e2d;Ip=[204.77.163.244];Helo=[edgetransport.garmin.com] X-MS-Exchange-CrossTenant-AuthSource: MW2NAM10FT031.eop-nam10.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR04MB7396 X-Proofpoint-GUID: IkUx2qSk45jIPxvdFIwvni-r5qIR79eb X-Proofpoint-ORIG-GUID: IkUx2qSk45jIPxvdFIwvni-r5qIR79eb X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-04_12:2021-05-04,2021-05-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 impostorscore=0 mlxlogscore=999 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2105040121 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When a port turns into an mrouter port, enable multicast flooding on that port even if mcast_flood is disabled by user config. This is necessary so that in a distributed system, the multicast packets can be fowarded to the Querier when the multicast source is attached to a Non-Querier bridge. Consider the following scenario: +--------------------+ | | | Snooping | +------------+ | Bridge 1 |----| Listener 1 | | (Querier) | +------------+ | | +--------------------+ | | +--------------------+ | | mrouter | | +-----------+ | +---------+ | | MC Source |----| Snooping | +-----------| | Bridge 2 | | (Non-Querier) | +--------------------+ In this scenario, Listener 1 will never receive multicast traffic from MC Source if mcast_flood is disabled on the mrouter port on Snooping Bridge 2. Signed-off-by: Joseph Huang --- net/bridge/br_multicast.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index d7fbe1f3af18..719ded3204a0 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -2680,6 +2680,21 @@ static void br_port_mc_router_state_change(struct net_bridge_port *port, switchdev_port_attr_set(port->dev, &attr, NULL); + /* Force mcast_flood if mrouter port + * this does not prevent netlink from changing it again + */ + if (is_mc_router && !(port->flags & BR_MCAST_FLOOD)) { + attr.id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS; + attr.u.brport_flags.val = BR_MCAST_FLOOD; + attr.u.brport_flags.mask = BR_MCAST_FLOOD; + switchdev_port_attr_set(port->dev, &attr, NULL); + } else if (!is_mc_router) { + attr.id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS; + attr.u.brport_flags.val = port->flags & BR_MCAST_FLOOD; + attr.u.brport_flags.mask = BR_MCAST_FLOOD; + switchdev_port_attr_set(port->dev, &attr, NULL); + } + /* Add/delete the router port to/from all multicast group * called whle br->multicast_lock is held */ From patchwork Tue May 4 18:22:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 12238511 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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D09AC433B4 for ; Tue, 4 May 2021 19:04:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DFB1E610E9 for ; Tue, 4 May 2021 19:04:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232064AbhEDTE4 (ORCPT ); Tue, 4 May 2021 15:04:56 -0400 Received: from mx0b-000eb902.pphosted.com ([205.220.177.212]:29104 "EHLO mx0b-000eb902.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231478AbhEDTEx (ORCPT ); Tue, 4 May 2021 15:04:53 -0400 Received: from pps.filterd (m0220299.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 144I8d7P025980; Tue, 4 May 2021 13:23:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pps1; bh=Fj46d+TFO6oS9m9H9NaMKRavcBycZmgywtCruQcLscg=; b=OJhdxKx6hEgp7j7TT6nzISmkxKLf7sQ/jhSNPZG1ZfoOMIhhw4bBUxVZLzF/ZrBnuRMQ /rSUiFaQ4nW5lrQXQ+6lXK0FYi88qGl9Gr4eUWkz16giinH+zu8ElL+aSgtI1BTpqI9c aoCZdN1UdT85iRxvDgtqZ1jx+QltAQoYbiBn90mfVLcLT8QITlijNAphZI1FeWHZXYcc +T/MBkqD3thxpq6ZA/7w/65QXt4I+rNZS60eS8iUVZnslw/Om8dy1LZH33Kp+tlJJ+4X WraZXZPdETnMaWj7bkXI/ueXR043GjMvSBWNr2NCfTIKBHd08dKHbQQCX9TNsGxC+zcQ TA== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by mx0a-000eb902.pphosted.com with ESMTP id 38ajpd2753-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 04 May 2021 13:23:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N8+rarTButp6VAgGtJUc8MruzwqjAStbrhredVgeGT0uO1wnsYTFvuH9E64WSQmUKOzDiCO7OV9BldeQafvuFwafTqDLsIwtXAG5/Ua7V9+1FTu5GTqHBb0cP+NIcvTO4gcROgAUPw7FhO4YjQQvNjc2mD4Kcy+FdYS5y/4lscvSzAdSX8Z4ptHxmxMZOc5VOeunVMD4WUaaTfDbNtiuCpIe2AgCn80vr0qCkXNfPaDhrxkV12AX20suOJ+DipWFkm8EKAiliYPhVAvppjSLxWmr6gGpD6iT2RoxZL22Jfggb/VEHYeno9zWmTAei6bv+rpwnAcYrzzyfJ3csOF1Sg== 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-SenderADCheck; bh=Fj46d+TFO6oS9m9H9NaMKRavcBycZmgywtCruQcLscg=; b=LUdn0hEi35e2gjpjY7rS55tdYlnam9Qlo/2akaG0QOr2GYp8sDbOAzZCKf1O80tI8fRZHeEPrORvwdoD+HHW7e5P/S5QQaDEkIarmdYHRs+li5crIBWmGwH+kME1lA+bvGVd2WFYYJF/ldAf8wI6JBwY3WLy6weR7ytT7+C/8LeDiJhcmQgJ4HrFZOS8JgDdEFS/02TSr+zgLcpoOJzVz1sVdkgX0AL9Q3LJaWBR/ff5irU1OVImCeq8tIXOy/GEFCbE7l4eZztaYfPKEGPMuqFCFQyOVqxcu5VeDntjnbJEu8D+M/VZcmJgeYOVYYdLUBIbNWFzYS3hFiMhdin7SQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=nvidia.com smtp.mailfrom=garmin.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=garmin.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.onmicrosoft.com; s=selector1-garmin-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Fj46d+TFO6oS9m9H9NaMKRavcBycZmgywtCruQcLscg=; b=GLYwZ3cgydMX0maQcdUxqt0CBhxPUSmMqOTP7mTOYDnoERjmHYFJ8GLmnVv3UHYR3oRiA5wu/aVG1uc78caRgNXm51Af3PSgpas7dVaT7lCjcThfxecR7xQfGWMXoO2IttmvukKISyZFYZGtnNCBmZ5s4jKW2nudHSFQW298utp9BfhfF2qeECeiAamItpewN3x1upfyjCwge3GfYvET/GrRgwSx63fUbrZJdM92aR3gaudb5PxXvgAL80yZxKAC+oKubly+0Knuqz4sJBBYSxD6Uq3EZtar32vHTedM0cN4uRrQRjzAy3XWiut3z5A2x/MGjCHm4zz7wEXd3ucs0A== Received: from BN9PR03CA0340.namprd03.prod.outlook.com (2603:10b6:408:f6::15) by DM5PR04MB0589.namprd04.prod.outlook.com (2603:10b6:3:9d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.27; Tue, 4 May 2021 18:23:26 +0000 Received: from BN7NAM10FT057.eop-nam10.prod.protection.outlook.com (2603:10b6:408:f6:cafe::55) by BN9PR03CA0340.outlook.office365.com (2603:10b6:408:f6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24 via Frontend Transport; Tue, 4 May 2021 18:23:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=pass action=none header.from=garmin.com; Received-SPF: Pass (protection.outlook.com: domain of garmin.com designates 204.77.163.244 as permitted sender) receiver=protection.outlook.com; client-ip=204.77.163.244; helo=edgetransport.garmin.com; Received: from edgetransport.garmin.com (204.77.163.244) by BN7NAM10FT057.mail.protection.outlook.com (10.13.157.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Tue, 4 May 2021 18:23:26 +0000 Received: from OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) by olawpa-edge2.garmin.com (10.60.4.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2106.2; Tue, 4 May 2021 13:23:21 -0500 Received: from huangjoseph-vm1.ad.garmin.com (10.5.84.15) by OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.4; Tue, 4 May 2021 13:23:25 -0500 From: Joseph Huang To: Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" , Jakub Kicinski , , , CC: Joseph Huang Subject: [PATCH 5/6] bridge: Flood Queries even when mcast_flood is disabled Date: Tue, 4 May 2021 14:22:58 -0400 Message-ID: <20210504182259.5042-6-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210504182259.5042-1-Joseph.Huang@garmin.com> References: <20210504182259.5042-1-Joseph.Huang@garmin.com> MIME-Version: 1.0 X-ClientProxiedBy: OLAWPA-EXMB2.ad.garmin.com (10.5.144.24) To OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e72eb858-ca08-400e-4b5e-08d90f29b5a2 X-MS-TrafficTypeDiagnostic: DM5PR04MB0589: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1417; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tOXjbgfvlUhzBTBSvi3pl1fo8JSI6ckSYQ0CgGnS5DyvRqaD8ygizSbqyovnGCOa82xgJbxz0sAslZOW2/A1sGNhC8lzIkknnSVdPC85JXB1sWfJ7d7AVzIX+8ZJs8At2GHH4khql2b2dEkcJyWJIo+pDipgwxBDKJbuD62ikGLAYM2iaj+zA4ldJIBR6kdjdnGnspG8xWP74gnrtna5JrJkx9zX16DsgRkKSJDTWZtqbTf2V0xBbU80QzLoqOzO0l/5WHe/ydPeUQitt3FoFdW4g/GVwTQA1L5+3Dk50ntXzkaqv3uxzkD4ZCgiiruP4x9gvYrKPFAFc+9T9UVf7/9ptAPYNPzxk2sgN36qQE77eiqyS5S+GVdLwkWaQjL7dZzhbbiuwy25dqnF5hv38GQXnYYxI4Qiz9WxCSemkjcLkRuumkEsR3ebN0MGpwZd36xckD8JgTgorRsG3wEWJ6fZmFLw13gGjb6Y2z26EeX5t+YnQnZdzHLGsQ2jcsMurqb7Zxt43sS8Gcn0YcWUzHSM7OG9ZUZUfrVFHUHX0ir9jaarroMqtdM0DRRM4QsoY0sd2lJBU6qZzJ6TECg7X71uk5VvsjrVZHBzLgrSP5Rizx5oj2sHEbJS55t6kFgtju5bpss+qXvCgpae1Kq5S1Kvb75nvHwGLqYiY5C+ldA= X-Forefront-Antispam-Report: CIP:204.77.163.244;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:edgetransport.garmin.com;PTR:extedge.garmin.com;CAT:NONE;SFS:(39860400002)(396003)(346002)(376002)(136003)(46966006)(36840700001)(107886003)(7636003)(316002)(1076003)(478600001)(2616005)(70586007)(5660300002)(6666004)(70206006)(186003)(83380400001)(8936002)(110136005)(86362001)(26005)(36756003)(82740400003)(4326008)(426003)(2906002)(7696005)(82310400003)(8676002)(36860700001)(47076005)(336012)(356005);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2021 18:23:26.3994 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e72eb858-ca08-400e-4b5e-08d90f29b5a2 X-MS-Exchange-CrossTenant-Id: 38d0d425-ba52-4c0a-a03e-2a65c8e82e2d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38d0d425-ba52-4c0a-a03e-2a65c8e82e2d;Ip=[204.77.163.244];Helo=[edgetransport.garmin.com] X-MS-Exchange-CrossTenant-AuthSource: BN7NAM10FT057.eop-nam10.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR04MB0589 X-Proofpoint-ORIG-GUID: MV7wwsIDto4SV8aemqFPnkHtS5spJa4M X-Proofpoint-GUID: MV7wwsIDto4SV8aemqFPnkHtS5spJa4M X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-04_12:2021-05-04,2021-05-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 clxscore=1015 mlxscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2105040121 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Modify the forwarding path so that received Queries are always flooded even when mcast_flood is disabled on a bridge port. In current implementation, when mcast_flood is disabled on a bridge port, Queries received from other Querier will not be forwarded out of that bridge port. This unfortunately broke multicast snooping. Signed-off-by: Joseph Huang --- net/bridge/br_forward.c | 3 ++- net/bridge/br_multicast.c | 3 +++ net/bridge/br_private.h | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 6e9b049ae521..2fb9b4a78881 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c @@ -203,7 +203,8 @@ void br_flood(struct net_bridge *br, struct sk_buff *skb, continue; break; case BR_PKT_MULTICAST: - if (!(p->flags & BR_MCAST_FLOOD) && skb->dev != br->dev) + if (!(p->flags & BR_MCAST_FLOOD) && skb->dev != br->dev && + !BR_INPUT_SKB_CB_FORCE_FLOOD(skb)) continue; break; case BR_PKT_BROADCAST: diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 719ded3204a0..b7d9c491abe0 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -3238,6 +3238,7 @@ static int br_multicast_ipv4_rcv(struct net_bridge *br, err = br_ip4_multicast_igmp3_report(br, port, skb, vid); break; case IGMP_HOST_MEMBERSHIP_QUERY: + BR_INPUT_SKB_CB(skb)->force_flood = 1; br_ip4_multicast_query(br, port, skb, vid); break; case IGMP_HOST_LEAVE_MESSAGE: @@ -3300,6 +3301,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, err = br_ip6_multicast_mld2_report(br, port, skb, vid); break; case ICMPV6_MGM_QUERY: + BR_INPUT_SKB_CB(skb)->force_flood = 1; err = br_ip6_multicast_query(br, port, skb, vid); break; case ICMPV6_MGM_REDUCTION: @@ -3322,6 +3324,7 @@ int br_multicast_rcv(struct net_bridge *br, struct net_bridge_port *port, BR_INPUT_SKB_CB(skb)->igmp = 0; BR_INPUT_SKB_CB(skb)->mrouters_only = 0; + BR_INPUT_SKB_CB(skb)->force_flood = 0; if (!br_opt_get(br, BROPT_MULTICAST_ENABLED)) return 0; diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 9aa51508ba83..59af599d48eb 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -491,6 +491,7 @@ struct br_input_skb_cb { #ifdef CONFIG_BRIDGE_IGMP_SNOOPING u8 igmp; u8 mrouters_only:1; + u8 force_flood:1; #endif u8 proxyarp_replied:1; u8 src_port_isolated:1; @@ -510,8 +511,10 @@ struct br_input_skb_cb { #ifdef CONFIG_BRIDGE_IGMP_SNOOPING # define BR_INPUT_SKB_CB_MROUTERS_ONLY(__skb) (BR_INPUT_SKB_CB(__skb)->mrouters_only) +# define BR_INPUT_SKB_CB_FORCE_FLOOD(__skb) (BR_INPUT_SKB_CB(__skb)->force_flood) #else # define BR_INPUT_SKB_CB_MROUTERS_ONLY(__skb) (0) +# define BR_INPUT_SKB_CB_FORCE_FLOOD(__skb) (0) #endif #define br_printk(level, br, format, args...) \ From patchwork Tue May 4 18:22:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 12238461 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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F586C433B4 for ; Tue, 4 May 2021 18:30:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55407613D7 for ; Tue, 4 May 2021 18:30:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232286AbhEDSbN (ORCPT ); Tue, 4 May 2021 14:31:13 -0400 Received: from mx0a-000eb902.pphosted.com ([205.220.165.212]:40272 "EHLO mx0a-000eb902.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232183AbhEDSbK (ORCPT ); Tue, 4 May 2021 14:31:10 -0400 X-Greylist: delayed 400 seconds by postgrey-1.27 at vger.kernel.org; Tue, 04 May 2021 14:31:10 EDT Received: from pps.filterd (m0220294.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 144I9h13023800; Tue, 4 May 2021 13:23:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pps1; bh=s+HR9JQYUp+nkFXI9Gvgl9YT5FYywAz7O3lXDrLaiW4=; b=YkOXwF5hEivWTNou1MWiJYjCLjERdMwVvsGE0GDe3g7ZrIqtpOS2ujLHsteNUKXoPmm8 QphcZ9+xRXBsqoJVhh/6GYh8eTj6En5ciZAnaoa9In9En8Sgi6gGbu6OQEsGvRh/svP7 oim/hWNbka6C4ZXmOU5zddhacH50hpPxDsktHZ7RfExgWt77DrXktB0RlE94FlPu5uLX 76PIB9qIPpjsXkN7of0/u+gRQ/VlvXPy//avdjTbzICLrnIwROEqofM8rUM+TjYx2L0q 0AGItmZLcn9VToUO+0zGULEpmyNbmgCCnnXOVMVGEvYm/QCVz3zj5vkfcrZYTZMrvXoJ Yw== Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2041.outbound.protection.outlook.com [104.47.73.41]) by mx0a-000eb902.pphosted.com with ESMTP id 38awtsha9v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 04 May 2021 13:23:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ibg76+Y18BtrvXFRUEDdzWD8SWhE1yb9TNJPOBAkKqKgGPCA6IMgXDp/M6L01FOnh4ACbKfqeeyIfnEtbApRXwPG+MOi6ltyoq5CuLkceHpwoFSieeVvKxcBEENDjdnqoeXj6+NHB8nod6VmmdLexm+0eL1wcYAcsnWxkn9e3BfBLENwVOnCaPQMcoCuOACgfwnnT49Dc3ySxn1WCzHmhwUJtA89APLSaNJGzHnavArgLoMFvLvvJVVDj0JtN6mnRZCi22xzLCJoYD6eBT/6jPxoiYo1uNCzdusbhFzAGBtPara8wxZN9OeNgt/AhxSxbKOimSTx/kAiqOXtF5k1mg== 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-SenderADCheck; bh=s+HR9JQYUp+nkFXI9Gvgl9YT5FYywAz7O3lXDrLaiW4=; b=N2XCsfkmv9wpB3wxDSEpIEGoXfSQrdalU1VaSVmRQLwU4tR76PiQGosOE5rD4WLeIs+b1uh2xto0pbxsJjbVN6it0CYIU3U4eRs3ETyjAFrNzxtVnl3VlAXjqiPxJ2WyDgpTUbW1R744fW+RWkNvhThbrC1kq8imOrWBAjLN8OSa6IP92LFPA1PoGRR9MZXJxzhNar3TEJiXdBZ/hUgZsddyWzG4G0D07yXLsgDwh/49Jdz3i0dtXE2uIBJKDu7iQUg+xDnxlKXeHZPeOnjljJCPXTo5OB+Rp47J+O8iOBbtcqGXCYifEZGq+UDA5WN+hUYMhz2xDKBBea03gqdUng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=nvidia.com smtp.mailfrom=garmin.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=garmin.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.onmicrosoft.com; s=selector1-garmin-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s+HR9JQYUp+nkFXI9Gvgl9YT5FYywAz7O3lXDrLaiW4=; b=g49CpVfLImxCyAS1317l0pX7EFpLEjsFQwJqZGvJ/DDLLngZ98HCRE9X6syHezoPBZ5i0HQReiMX+kJvSMcmUZ9jKJ+aUnO85/vF4NeZcE3f5z8qDbNmM/09M72MRcJEgdfF/te0MD4e2gQuKFY78A6NyLUvyynnftT65ldsTk5c7ZjY+Rbbwo3dyEgWEMunZQp/KEop8uOJU/0+cOh2cwTSkrGfGv7YFwexl0RUt1h6291iNGV8Ha7LNLvfERk+tC/GAwR88aueJVXlK0w99hsX654E5whKZFC30G4mPMUsfXTr9VL5VdrYDuwZKzt//OZBpz2UuytUi1iOe3TboQ== Received: from DM5PR12CA0072.namprd12.prod.outlook.com (2603:10b6:3:103::34) by CO6PR04MB7747.namprd04.prod.outlook.com (2603:10b6:5:35b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.43; Tue, 4 May 2021 18:23:27 +0000 Received: from DM6NAM10FT005.eop-nam10.prod.protection.outlook.com (2603:10b6:3:103:cafe::ea) by DM5PR12CA0072.outlook.office365.com (2603:10b6:3:103::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27 via Frontend Transport; Tue, 4 May 2021 18:23:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=pass action=none header.from=garmin.com; Received-SPF: Pass (protection.outlook.com: domain of garmin.com designates 204.77.163.244 as permitted sender) receiver=protection.outlook.com; client-ip=204.77.163.244; helo=edgetransport.garmin.com; Received: from edgetransport.garmin.com (204.77.163.244) by DM6NAM10FT005.mail.protection.outlook.com (10.13.152.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27 via Frontend Transport; Tue, 4 May 2021 18:23:26 +0000 Received: from OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) by olawpa-edge1.garmin.com (10.60.4.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2106.2; Tue, 4 May 2021 13:21:43 -0500 Received: from huangjoseph-vm1.ad.garmin.com (10.5.84.15) by OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.4; Tue, 4 May 2021 13:23:25 -0500 From: Joseph Huang To: Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" , Jakub Kicinski , , , CC: Joseph Huang Subject: [PATCH 6/6] bridge: Always multicast_flood Reports Date: Tue, 4 May 2021 14:22:59 -0400 Message-ID: <20210504182259.5042-7-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210504182259.5042-1-Joseph.Huang@garmin.com> References: <20210504182259.5042-1-Joseph.Huang@garmin.com> MIME-Version: 1.0 X-ClientProxiedBy: OLAWPA-EXMB2.ad.garmin.com (10.5.144.24) To OLAWPA-EXMB4.ad.garmin.com (10.5.144.25) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 55dd95ce-3845-4e18-4f60-08d90f29b5f6 X-MS-TrafficTypeDiagnostic: CO6PR04MB7747: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /J9bcrp1w7TI+xXe4b+VXEYX/i6pKdtqnRB83bQHHvdkNqW1Mskc3MstCZEZkbRc7RHvinlGmmUQwdENw2LRI3zApuczIUFqRYeBHwtszp9NiaLTsuN29eLFDiHPx5iIEDqXyDi4wY7gj0UI7h3qr2ioDugw7+86yTppLtEkZTNm8kGXJUMWJIUukCkL0jgeVqPJVjq10QBMNuBckg4RYx/a14p7vjPz9HzDaeb6YvKVvgHkJzgT2Aq1DLT9s68TnGT8jcDMe+WDpprSYvPl2fowwMoEKm9IOusRt6ahLgfAoUAJgih3CNTk+bmF2QolR/6IGTH5BFTDpN6jhZ6Ip3Q+tMJGlDiujrumQ6ErYYfz1lDab8zmldAhXMfI7TRuoX5gPr95+kT/4pO5XI/uSA9tqT6+PTBb4MlkrTro7msWnjRn+zW1NEizVjMd6uo7iGDRq8MFGfiRTCne53XfJ9WLJ2oyIjsdgcde0TndsvmjtKpJyr0NaZne5Eruz6kNS5KJPa8djLgOxvhCsYSltnTi2PIw+itcctHA6q+iA3Z1hrUcQrG1rbMHRkxQfg644nBEM0VDYk+LnCHrv8maN6Ema8r7jjG/I68/+qzVn+jhuoUgn15u9Ws/U9aH1mjuurkR8cd7fKhtnuDmQGsquVZPUzwNC8zheCXLwW3yxNY= X-Forefront-Antispam-Report: CIP:204.77.163.244;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:edgetransport.garmin.com;PTR:extedge.garmin.com;CAT:NONE;SFS:(396003)(136003)(39860400002)(346002)(376002)(46966006)(36840700001)(36756003)(8676002)(2906002)(7696005)(7636003)(110136005)(107886003)(47076005)(5660300002)(70206006)(8936002)(4326008)(86362001)(83380400001)(356005)(478600001)(66574015)(336012)(36860700001)(82310400003)(26005)(82740400003)(2616005)(70586007)(316002)(1076003)(426003)(6666004)(186003);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2021 18:23:26.9390 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 55dd95ce-3845-4e18-4f60-08d90f29b5f6 X-MS-Exchange-CrossTenant-Id: 38d0d425-ba52-4c0a-a03e-2a65c8e82e2d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38d0d425-ba52-4c0a-a03e-2a65c8e82e2d;Ip=[204.77.163.244];Helo=[edgetransport.garmin.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM10FT005.eop-nam10.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR04MB7747 X-Proofpoint-GUID: q5A2TvumHL--EkTtLClzzAkS-xBxjDEO X-Proofpoint-ORIG-GUID: q5A2TvumHL--EkTtLClzzAkS-xBxjDEO X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-04_12:2021-05-04,2021-05-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 impostorscore=0 mlxlogscore=999 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2105040121 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Modify the forwarding path so that IGMPv1/2/MLDv1 Reports are always flooded by br_multicast_flood, regardless of the check done by br_multicast_querier_exists. This patch fixes the problems where after a system boots up, the first couple of Reports are not handled properly in that: 1) the Report from the Host is being flooded (via br_flood) to all bridge ports, and 2) if the mrouter port's mcast_flood is disabled, the Reports received from other hosts will not be forwarded to the Querier. Signed-off-by: Joseph Huang --- net/bridge/br_device.c | 5 +++-- net/bridge/br_input.c | 5 +++-- net/bridge/br_multicast.c | 3 +++ net/bridge/br_private.h | 3 +++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index e8b626cc6bfd..ff75ba242f38 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -88,8 +88,9 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) } mdst = br_mdb_get(br, skb, vid); - if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && - br_multicast_querier_exists(br, eth_hdr(skb), mdst)) + if (((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && + br_multicast_querier_exists(br, eth_hdr(skb), mdst)) || + BR_INPUT_SKB_CB_FORCE_MC_FLOOD(skb)) br_multicast_flood(mdst, skb, false, true); else br_flood(br, skb, BR_PKT_MULTICAST, false, true); diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index 8875e953ac53..572d7f20477f 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c @@ -129,8 +129,9 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb switch (pkt_type) { case BR_PKT_MULTICAST: mdst = br_mdb_get(br, skb, vid); - if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && - br_multicast_querier_exists(br, eth_hdr(skb), mdst)) { + if (((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && + br_multicast_querier_exists(br, eth_hdr(skb), mdst)) || + BR_INPUT_SKB_CB_FORCE_MC_FLOOD(skb)) { if ((mdst && mdst->host_joined) || br_multicast_is_router(br)) { local_rcv = true; diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index b7d9c491abe0..dfdbe19f3e93 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -3231,6 +3231,7 @@ static int br_multicast_ipv4_rcv(struct net_bridge *br, case IGMP_HOST_MEMBERSHIP_REPORT: case IGMPV2_HOST_MEMBERSHIP_REPORT: BR_INPUT_SKB_CB(skb)->mrouters_only = 1; + BR_INPUT_SKB_CB(skb)->force_mc_flood = 1; err = br_ip4_multicast_add_group(br, port, ih->group, vid, src, true); break; @@ -3294,6 +3295,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, case ICMPV6_MGM_REPORT: src = eth_hdr(skb)->h_source; BR_INPUT_SKB_CB(skb)->mrouters_only = 1; + BR_INPUT_SKB_CB(skb)->force_mc_flood = 1; err = br_ip6_multicast_add_group(br, port, &mld->mld_mca, vid, src, true); break; @@ -3325,6 +3327,7 @@ int br_multicast_rcv(struct net_bridge *br, struct net_bridge_port *port, BR_INPUT_SKB_CB(skb)->igmp = 0; BR_INPUT_SKB_CB(skb)->mrouters_only = 0; BR_INPUT_SKB_CB(skb)->force_flood = 0; + BR_INPUT_SKB_CB(skb)->force_mc_flood = 0; if (!br_opt_get(br, BROPT_MULTICAST_ENABLED)) return 0; diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 59af599d48eb..6d4f20d7f482 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -492,6 +492,7 @@ struct br_input_skb_cb { u8 igmp; u8 mrouters_only:1; u8 force_flood:1; + u8 force_mc_flood:1; #endif u8 proxyarp_replied:1; u8 src_port_isolated:1; @@ -512,9 +513,11 @@ struct br_input_skb_cb { #ifdef CONFIG_BRIDGE_IGMP_SNOOPING # define BR_INPUT_SKB_CB_MROUTERS_ONLY(__skb) (BR_INPUT_SKB_CB(__skb)->mrouters_only) # define BR_INPUT_SKB_CB_FORCE_FLOOD(__skb) (BR_INPUT_SKB_CB(__skb)->force_flood) +# define BR_INPUT_SKB_CB_FORCE_MC_FLOOD(__skb) (BR_INPUT_SKB_CB(__skb)->force_mc_flood) #else # define BR_INPUT_SKB_CB_MROUTERS_ONLY(__skb) (0) # define BR_INPUT_SKB_CB_FORCE_FLOOD(__skb) (0) +# define BR_INPUT_SKB_CB_FORCE_MC_FLOOD(__skb) (0) #endif #define br_printk(level, br, format, args...) \