From patchwork Tue Apr 2 00:11:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 13613175 X-Patchwork-Delegate: kuba@kernel.org Received: from mx0b-000eb902.pphosted.com (mx0b-000eb902.pphosted.com [205.220.177.212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9119B81E; Tue, 2 Apr 2024 00:12:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.212 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016774; cv=fail; b=qyWSrw294oyUCEEfOOc8wl4koYRBvkyZC9B0z/8zvh63NEzKuGqkzhDb8ew0AP9oIhJ6RQCEA4MYkxAXSfWc/GP5XC4IH4M+cp61UD8c5A/ozGa6b1UkY+w4/B2umvL4hoAtCCFBNq6mp5ekip6+6M3QrpU+5dXQNopNEiFxgs0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016774; c=relaxed/simple; bh=wsXF30yh9ge3GMsxMDm/SY7ZXK3PyAMck3oGLU2/8tg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=B0FD9g+MG4nBdVSQQXM3JghTOubq7qe13Lea1BgqFkxjIpwa0h/wmhlpYVQRCFjsThUj325mXN6o/kzbzNWyUFO5RA8YggXdxEqIS0G1u8eGfZ4jNe0TRjFWYKb2rI81X7A3KGsczbBdhfbY+mqPQ2Xn2M8msjt/AmhEnQowCbk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com; spf=pass smtp.mailfrom=garmin.com; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=GiRi0L68; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=TJTg5Ngo; arc=fail smtp.client-ip=205.220.177.212 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=garmin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="GiRi0L68"; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="TJTg5Ngo" Received: from pps.filterd (m0220299.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 431IxhiT023940; Mon, 1 Apr 2024 19:12:24 -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=CTJNy+dHkorgc388simu6OXyJa6YT69jpJ/6JvKUu7g=; b=GiRi0L68mpkb QubHzCaHQyyJCZexKrGiEjuaR1kpTYjmJEhH/lCObjWwE2SUmeboUrmNR4S5stmD VMqapao1IJ6rKmtFyPrpSz3n2ehDJOFioH0IFnZfd2hWIdsyHW6isIoGi9egGPBD 37a8yjGNVXF0DtgXieXJtoRburmS+8KVwOou0iKuaeCDuMu2CIQcPSkHY9u5SE3F /apswMitd6/kMpD04jFi1QvrfyZ0GBniTpxyh6dUFN4OQrYV7Hp+bOc1t3O5omq7 zipOIaYfIQKpK/xdWBqXJ5ZIHgWjU9eMjcDfe0sVLtl52/d+Tz0VWhWibfRofvEc 59tZIUOy5Q== Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by mx0a-000eb902.pphosted.com (PPS) with ESMTPS id 3x80hys4mk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Apr 2024 19:12:23 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dhDe46TwvIRxf7hSW6eE+m5r9K2bvNTK1ue+xeDGOGSjU7Hih5WKNIMF9FEQTyHvjMrg7SkOH3GhGm9S59yY07BnNuEsL+dyswhtesf3BYApEYds2wRyDqMA7ZjRKo/9Wy+GFYSE3PsKyV7Pz91tkfqqu3ZKvI2Q9uur5YdV2Ufar+C62bsN0jxKFXaHRx87EodVah5gKYc/4GuDD7vUZZ4B09QN+aidKiILqrEagX1Add0qbeIKT4yW+mo2FjbvbEtu8r/y+4y2g2H6UxIGk2Udu78lLCGGoA47TTe7QqqS9yTKkbmqV5ZezSrUeMoabzPsZTT+r/KNCTJDJC1jyA== 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=CTJNy+dHkorgc388simu6OXyJa6YT69jpJ/6JvKUu7g=; b=bxfF7v1ROp5Zb+i9bqljh0J2gYzb3Gr7QJlEYNwn/HjlsyidhvBS/ozF6RpunnxTrssQ0T84s3dBkG2PSna+lnUJwpZnOMOtLNGLq5Z/AzXI/t3DmvVMnDGtbITydqtJixHp7NsXFgLEyG9zNvlHi9pTph6SIptrEnG7TQIw8qrPYe4TwXVuL2xOvdHmWGeHjMGazDqLtIQx6wYU0acUHrDYQDywF20O7fgjGqx/9PcPCl4BEIzIsgOcj09UAooUa0AYyvZyZm2wSdxafW1oYvuRRmlgOolz+gWOel8Zt4wGVeeTScoM2T4ONyKiVGXbMcF9kYXbXoBvUdL5FS9GGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=vger.kernel.org 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 (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CTJNy+dHkorgc388simu6OXyJa6YT69jpJ/6JvKUu7g=; b=TJTg5NgonX/VTg4v79Vx+RoVF4eUrNRfZBac3QtXA2XJFcpcH7XBILxKubqHan/6+9bFcwi2Yz3Qn/a3xVPXS6F0ulNvV50De4DTUBH64jTXhoDVgyBKtVbNbtbjEW7Fuwm4Rzy4b3xn91AjiOtILQHzQoc60mJGyqGZKG66k/CqCYOy6ezuRxwwtDp1GmPVIpvVWMiG8FeQdHVHDYrTxZcxBgB8HnZwEo21Avz2ZlQO82nuhYWcqNilSPlF68lCmVjc5KBoybAmBMDv87NMPhM8gsh/nGo7ooaEM+aoSxQrPlQbQK9Gbofbg4SglX4/WJQxTN4HfmM6H24qyofxjA== Received: from SJ0PR13CA0149.namprd13.prod.outlook.com (2603:10b6:a03:2c6::34) by SJ0PR04MB8247.namprd04.prod.outlook.com (2603:10b6:a03:3fa::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 00:12:18 +0000 Received: from SJ5PEPF000001CE.namprd05.prod.outlook.com (2603:10b6:a03:2c6:cafe::ab) by SJ0PR13CA0149.outlook.office365.com (2603:10b6:a03:2c6::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.25 via Frontend Transport; Tue, 2 Apr 2024 00:12:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from edgetransport.garmin.com (204.77.163.244) by SJ5PEPF000001CE.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Tue, 2 Apr 2024 00:12:18 +0000 Received: from cv1wpa-exmb1.ad.garmin.com (10.5.144.71) by olawpa-edge5.garmin.com (10.60.4.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Mon, 1 Apr 2024 19:12:07 -0500 Received: from cv1wpa-exmb5.ad.garmin.com (10.5.144.75) by CV1WPA-EXMB1.ad.garmin.com (10.5.144.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.37; Mon, 1 Apr 2024 19:12:15 -0500 Received: from kc3wpa-exmb3.ad.garmin.com (10.65.32.83) by cv1wpa-exmb5.ad.garmin.com (10.5.144.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.32; Mon, 1 Apr 2024 19:12:14 -0500 Received: from CAR-4RCMR33.ad.garmin.com (10.5.209.17) by mail.garmin.com (10.65.32.83) with Microsoft SMTP Server id 15.2.1258.32 via Frontend Transport; Mon, 1 Apr 2024 19:12:13 -0500 From: Joseph Huang To: CC: Joseph Huang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Roopa Prabhu" , Nikolay Aleksandrov , =?utf-8?q?Linus_L=C3=BCssing?= , , Subject: [PATCH RFC net-next 01/10] net: bridge: Flood Queries even when mc flood is disabled Date: Mon, 1 Apr 2024 20:11:00 -0400 Message-ID: <20240402001137.2980589-2-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240402001137.2980589-1-Joseph.Huang@garmin.com> References: <20240402001137.2980589-1-Joseph.Huang@garmin.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001CE:EE_|SJ0PR04MB8247:EE_ X-MS-Office365-Filtering-Correlation-Id: 15f43726-0cc8-46f8-dd14-08dc52a98f3a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LuSOw911TyxWvc6Gd/B04uGPz/HtEaiHZxeXmEkQy464MrSPwBuPvIWCJY9u6RwOxc5Lr4duozGy+/i/etvVAUZDGSAe89JJAT0sNfj2uPdFHT/j8lVW3rPUWnjQ2pFQYyMj2bRiJiKClZ05xPX6TuO6JGxQp3hIKneFH5UQZbhAaau61LvoUug3yB7Js64zmiL0EYzjQbEdUmGsfQqFvTl/taJZmmGOufowwPjms+CC/l65wj3pe+O8vOeeZdeMuVxcymvEFS9POJt2x/eM1ClvKcCtFmPtGtlPqOV/RTrWxMxp1YbTpoGVS3RMQ0XyUXnufbcDe8yheb578jB3B+yj70kq+LJHjRgbwLVW/enmaB5h+b8q8cE3tH/wYGvTcKujs/4BwrgrmKwg+ZuyNjAfCTekh7s3gTeAoKcKEr+1sL7sIRDJHoi2E1DfwKxeNyxnxF8t6Ia0zEBS5h5N2K5JwbKslDAI1YVc7d4+gXDcMWHVnv6hMUDIaZZF7IdLW0YPtwoxEbutX6Klpf84VqE/lKaKGb/61+z8Ij81XrI/EACiHEtLRMWRxBXPhO3t6Te7CPIi5XXOc4Of5WTwJKt14dNUt3QoQKhmA5AZI2zMViBngx7v7qHbVgdEmYLQBMBgGhoY7iAxRuOE8GWeyaLQBScoJBv7MEFB502ImfSMYbx/LnNoZVd/nVZcbcgG4/1mPGByCEuuu2U5BWgxrFzASO3G/5y5mlcQZgUcmfuVhct7ZGMDMkzBOhw1lTBx 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:(13230031)(1800799015)(36860700004)(82310400014)(376005)(7416005);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 00:12:18.4468 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15f43726-0cc8-46f8-dd14-08dc52a98f3a 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: SJ5PEPF000001CE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR04MB8247 X-Proofpoint-GUID: 2BKmK7QelfwEkQmFLCBEaLd8Q-ZE9o4C X-Proofpoint-ORIG-GUID: 2BKmK7QelfwEkQmFLCBEaLd8Q-ZE9o4C X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-01_16,2024-04-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 suspectscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2404010168 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Modify the forwarding path so that received Queries are always flooded even when multicast flooding is disabled on a bridge port. In current implementation, when multicast flooding is disabled on a bridge port, Queries received from other Querier will not be forwarded out of that bridge port. This unfortunately breaks 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 7431f89e897b..6c18ea37b5f5 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c @@ -216,7 +216,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 9a1cb5079a7a..42d900549227 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -3851,6 +3851,7 @@ static int br_multicast_ipv4_rcv(struct net_bridge_mcast *brmctx, err = br_ip4_multicast_igmp3_report(brmctx, pmctx, skb, vid); break; case IGMP_HOST_MEMBERSHIP_QUERY: + BR_INPUT_SKB_CB(skb)->force_flood = 1; br_ip4_multicast_query(brmctx, pmctx, skb, vid); break; case IGMP_HOST_LEAVE_MESSAGE: @@ -3916,6 +3917,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge_mcast *brmctx, err = br_ip6_multicast_mld2_report(brmctx, pmctx, skb, vid); break; case ICMPV6_MGM_QUERY: + BR_INPUT_SKB_CB(skb)->force_flood = 1; err = br_ip6_multicast_query(brmctx, pmctx, skb, vid); break; case ICMPV6_MGM_REDUCTION: @@ -3941,6 +3943,7 @@ int br_multicast_rcv(struct net_bridge_mcast **brmctx, 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((*brmctx)->br, BROPT_MULTICAST_ENABLED)) return 0; diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 86ea5e6689b5..c28e0cd0855c 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -586,6 +586,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; @@ -620,8 +621,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 Apr 2 00:11:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 13613179 X-Patchwork-Delegate: kuba@kernel.org Received: from mx0a-000eb902.pphosted.com (mx0a-000eb902.pphosted.com [205.220.165.212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3F4929AB; Tue, 2 Apr 2024 00:12:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.212 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016778; cv=fail; b=MfUDWBCUmomP3SvvqVRBdcpEQP53PjHkJ4FEyFq836i4OAups7jUS3X6yxcKhdwUKtvqy4tdzfQXT+ZN2pSz2kVTup9lpScop9Sst3eurLOPudrIFaSFrkzRoXvPAx74eou2fwituSdljGJEezd4CO0YhORI41quP+juKkr75z8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016778; c=relaxed/simple; bh=MNNI14WvZxnxVDzMezADwis2ZV539eOg4RYEB0AMbf4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GceXZU7yG53wotleUSWMR5D8WpYQZrmiyVSl97h2ezME/+tDiQihplHsBXTSFLD8GeN5KyaYd2jCGrrgFK5BftSDN0KnpUtT9em+e6nEYgEFPaBO/Qg8bJuUNjyqzrhqMiVK208UzrhaEZGarFCIZjtgCQALPQI12Vrv49PeOtE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com; spf=pass smtp.mailfrom=garmin.com; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=KCYlgI37; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=irf8Xo/X; arc=fail smtp.client-ip=205.220.165.212 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=garmin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="KCYlgI37"; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="irf8Xo/X" Received: from pps.filterd (m0220296.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 431Ixg2M023096; Mon, 1 Apr 2024 19:12:21 -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=a4U0GDF9RFbSPVoEgm/DDUa/de3VmMWRfFdDUCamaCc=; b=KCYlgI375FLi GzDRuddTsS0k8pbHMkkdqYXDhFDQJ9sCZ49Ek7nlZJyCD3CL7GNO6Pud7SozLACg NHYX9yxvBExwn/hR4YV9IZL088yJHeggpTJVL6atYgfBfnKkRJr5ppZreLDyivnH nW+LAwTUlHO/yKhxrWsmAqgsNa//M36LsojNTdageWu7ndgBefcFa1DGi3VuuKzr PcZrhehePOZUF0qRiqSMQiMFTkaN1iJIQiFB7G6Qv5m7TgraIBvIs9WB5WnYW9Vn 4vPu2MfExHOFe6svw72HCyWM8rulcuUFkiIRZBkzy4F7x0K+ptmf/P2jLNxNV6Xm sb0LQmSnjQ== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by mx0a-000eb902.pphosted.com (PPS) with ESMTPS id 3x6g44qfbt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Apr 2024 19:12:20 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OPR0kVDZpobk8UH4PKOX5k3jAEh30lI5hKtrYNgqQJMn6C5mcZSHHFxuu/+6aPP2+oz9XgXdLdk2FxlnnzR5ANDxeTtka8jSG0BQtFOWsfJg62hw8nOwBy9euHVeC94FLXOSCixYKH8A0winw3ZGUymkOlgisgimCUXXtCpELz9zVvt8ed2OMGn+zA+MPsosl/fQaVND5ZnkhaoSqV34+0MeE33CfAAOmYSH45IXEFjGVzSHs+26tcJe+4TXPpsVoR6Q+TNua1wN/+9O0sp14dUnCNl/AOt28njQxuE/zA3J2xPJJ7GXqO4wn8qvObCiY2sNaeHlWA8ProKmzabXrw== 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=a4U0GDF9RFbSPVoEgm/DDUa/de3VmMWRfFdDUCamaCc=; b=H9MjewJIV4XcHIndYec0uYghuvqO/vCHD/vyo644OsVaFjjgKBxIe1EigGw4n2wtJ1At5lHIMrafUNdGP51ccyL4UJI82oqaLxTBCj+BE9WV/vZI9d3OO7vd6UL5LH0PF4y8cWxQyJ3a6vE4ydeRkTc2lNcxv0+08bODwbYyzVHGvvlA/S0gta8NhFDtZ6TGEXntq2dUqJpZVF6Jb9KvA5Ts6R9ppezHQBuo1DM760GoqsK46vqvwApkSzlC3Of8PXw7JJbDg1/p/hj+YqguYWtF4dCP4fLerKFlV+rLVq1PwPF8pkftASJO9XIEvCM1iFoK2FJNeHoX8SfgJXo31w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=vger.kernel.org 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 (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a4U0GDF9RFbSPVoEgm/DDUa/de3VmMWRfFdDUCamaCc=; b=irf8Xo/XfCWdg5tAntkoCrD+c+jMtPOkohCk/fGuPuX1q0riGTl1Z8v9eoOu0MZUz91PCqy5wGbguu13Ew513mxjCKu/od+DUMGx799gsPSlFAGEFy6haGmuOMVAc2b9i2vyN7fFxj/zDN7LPcFEu0yj20I8FJ+Gw9KFt12I4G5A+mh6HNw3eXCv4ws9a+jfWKNWALNnc5c4TTpmIs9UuQJ8cCUesvfidw6h8leNfAw3Is484DvQSlP50p9jShDkyzZnEw4k/vILcXn80rahb5eBt0y8rJWsIbddX92FBLtJEKutIy1jwbtk28+09CRhBWryouDsAuKNjaoxPqHDRA== Received: from BN9PR03CA0176.namprd03.prod.outlook.com (2603:10b6:408:f4::31) by SA0PR04MB7340.namprd04.prod.outlook.com (2603:10b6:806:e1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 00:12:19 +0000 Received: from BN1PEPF0000467F.namprd03.prod.outlook.com (2603:10b6:408:f4:cafe::b0) by BN9PR03CA0176.outlook.office365.com (2603:10b6:408:f4::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.40 via Frontend Transport; Tue, 2 Apr 2024 00:12:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from edgetransport.garmin.com (204.77.163.244) by BN1PEPF0000467F.mail.protection.outlook.com (10.167.243.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Tue, 2 Apr 2024 00:12:18 +0000 Received: from cv1wpa-exmb2.ad.garmin.com (10.5.144.72) by olawpa-edge3.garmin.com (10.60.4.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Mon, 1 Apr 2024 19:12:09 -0500 Received: from cv1wpa-exmb5.ad.garmin.com (10.5.144.75) by CV1WPA-EXMB2.ad.garmin.com (10.5.144.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Mon, 1 Apr 2024 19:12:18 -0500 Received: from kc3wpa-exmb3.ad.garmin.com (10.65.32.83) by cv1wpa-exmb5.ad.garmin.com (10.5.144.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.32; Mon, 1 Apr 2024 19:12:17 -0500 Received: from CAR-4RCMR33.ad.garmin.com (10.5.209.17) by mail.garmin.com (10.65.32.83) with Microsoft SMTP Server id 15.2.1258.32 via Frontend Transport; Mon, 1 Apr 2024 19:12:16 -0500 From: Joseph Huang To: CC: Joseph Huang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Roopa Prabhu" , Nikolay Aleksandrov , =?utf-8?q?Linus_L=C3=BCssing?= , , Subject: [PATCH RFC net-next 02/10] net: bridge: Always multicast_flood Reports Date: Mon, 1 Apr 2024 20:11:01 -0400 Message-ID: <20240402001137.2980589-3-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240402001137.2980589-1-Joseph.Huang@garmin.com> References: <20240402001137.2980589-1-Joseph.Huang@garmin.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF0000467F:EE_|SA0PR04MB7340:EE_ X-MS-Office365-Filtering-Correlation-Id: e0e20870-cc33-473c-a311-08dc52a98f4d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ptQacw1M4Xa5vLnfuJEiGRsOAM7vXFXcqvAQevmP9QFS28aVScx5soRFD0r+l3t1angIEZeF9o5Ijo9UO0o1zgNOjA+IYSsvQlsan/Pmd6xXNGfaAGdMvumfkOLPJkhnBP1d7byWHbxGJ0lCPg6AdfgG9hzB+CuTB4azvLJ8N9zS3SSSQ1KpG/UKQws4jYXFezdgDnEBpxCqK6koLuvuPEbFoSF0a9t0WbisuSpJmvzsq70qfwDmvlMvejPJG2zQI4br9l0ZNCEY75RL+yZN5edMepkEu+hvVnBZ7nA4oucniGjmQdzbkSQSkxpRRiBoFWEQ/v3fq8l5uFzQcJKZHqEZLBrUpcUwfCdJhihXtC73EmoGGaciFIbZBMgOzewJEkQ2PkRyfNOwwlFAp30EFYGmyLWkt6wq3No7UTAN2E+jnhuB9p2VwOQOTwTQ8oGWlhXku7uGKvAbncz0bPWiGcBXJwQBZ7ZVP/EMBfjqZn8/qW+Xjbw2Ee9ltDUZ2QRkv+5ofLLTifIIivamyUyQBx4gF1yZ+NDngMSm9wTmTTcYCA7K7zuBZYkPBL4jvrIIKkQ3fh1v+jDKFlS1+Nw0YpZro92Q7POQ/Z0cN1PfGkOV6UxNM5800KIchFnQtIthJ72xif3BZeB4QQR4HdabMHNXSba/M6KML9zet/XFhtZ+qLUHEfzXeHdtjObkc4ZSXxdxhVcg0yT4a5p/E8GZPij8XcH7mKDUWb6moiqkj67oe/BgaZgnpXhOMkdcUXH4 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:(13230031)(82310400014)(36860700004)(7416005)(1800799015)(376005);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 00:12:18.5854 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0e20870-cc33-473c-a311-08dc52a98f4d 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: BN1PEPF0000467F.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR04MB7340 X-Proofpoint-GUID: tJJADjvwhknu33qI0j1gLH_r78aXxl_J X-Proofpoint-ORIG-GUID: tJJADjvwhknu33qI0j1gLH_r78aXxl_J X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-01_17,2024-04-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 priorityscore=1501 phishscore=0 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2404020000 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Modify the forwarding path so that IGMPv1/v2/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 shortly 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 multicast flooding is disabled, the Reports received from other hosts will not be forwarded to the Querier. Fixes: b00589af3b04 ("bridge: disable snooping if there is no querier") Signed-off-by: Joseph Huang --- net/bridge/br_device.c | 5 +++-- net/bridge/br_input.c | 5 +++-- net/bridge/br_multicast.c | 5 +++++ net/bridge/br_private.h | 3 +++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index c366ccc8b3db..5c09b9dd61dc 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -93,8 +93,9 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) } mdst = br_mdb_entry_skb_get(brmctx, skb, vid); - if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && - br_multicast_querier_exists(brmctx, eth_hdr(skb), mdst)) + if (((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && + br_multicast_querier_exists(brmctx, eth_hdr(skb), mdst)) || + BR_INPUT_SKB_CB_FORCE_MC_FLOOD(skb)) br_multicast_flood(mdst, skb, brmctx, false, true); else br_flood(br, skb, BR_PKT_MULTICAST, false, true, vid); diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index f21097e73482..8e614ab20966 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c @@ -176,8 +176,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_entry_skb_get(brmctx, skb, vid); - if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && - br_multicast_querier_exists(brmctx, eth_hdr(skb), mdst)) { + if (((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && + br_multicast_querier_exists(brmctx, eth_hdr(skb), mdst)) || + BR_INPUT_SKB_CB_FORCE_MC_FLOOD(skb)) { if ((mdst && mdst->host_joined) || br_multicast_is_router(brmctx, skb)) { local_rcv = true; diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 42d900549227..8531f0e03f41 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -3844,6 +3844,7 @@ static int br_multicast_ipv4_rcv(struct net_bridge_mcast *brmctx, 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(brmctx, pmctx, ih->group, vid, src, true); break; @@ -3855,6 +3856,7 @@ static int br_multicast_ipv4_rcv(struct net_bridge_mcast *brmctx, br_ip4_multicast_query(brmctx, pmctx, skb, vid); break; case IGMP_HOST_LEAVE_MESSAGE: + BR_INPUT_SKB_CB(skb)->force_mc_flood = 1; br_ip4_multicast_leave_group(brmctx, pmctx, ih->group, vid, src); break; } @@ -3910,6 +3912,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge_mcast *brmctx, 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(brmctx, pmctx, &mld->mld_mca, vid, src, true); break; @@ -3922,6 +3925,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge_mcast *brmctx, break; case ICMPV6_MGM_REDUCTION: src = eth_hdr(skb)->h_source; + BR_INPUT_SKB_CB(skb)->force_mc_flood = 1; br_ip6_multicast_leave_group(brmctx, pmctx, &mld->mld_mca, vid, src); break; @@ -3944,6 +3948,7 @@ int br_multicast_rcv(struct net_bridge_mcast **brmctx, 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((*brmctx)->br, BROPT_MULTICAST_ENABLED)) return 0; diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index c28e0cd0855c..d72a632a1ad2 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -587,6 +587,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; @@ -622,9 +623,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...) \ From patchwork Tue Apr 2 00:11:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 13613174 X-Patchwork-Delegate: kuba@kernel.org Received: from mx0b-000eb902.pphosted.com (mx0b-000eb902.pphosted.com [205.220.177.212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12D2563B; Tue, 2 Apr 2024 00:12:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.212 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016774; cv=fail; b=puaLI9Bi5AIwXVPwdTxKzBN+Sa9GNDFU1MC7ORkm0kpmbgRR+hoHlFel8UK715WydPLl6CubH1rdBytWghoa+Al3b+m0kMaVSL6CvApXxuOcsiCEqpLjZk9MpzoF9DxpRjFgnAjEQFR7vbNgYHNwEuQF2sttxvytSgbSyiYeHug= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016774; c=relaxed/simple; bh=UWcYZ7EZF7J4vACET6uCIAKTx3l3xJWs4KzJxoQfBr8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nrgSMNwM//RZ9wU7PL/6KYfbAq2laWfBktxLvsFd5EdaFCSRdkfru2HPtOOHdd4ooUM7e4RHAT0VWACXgCkbCaDnFwRyqsQrLhO4Ll2gA8v6TCVfvmYWyt80uOyt0FfBRQzGjrRS/Wnp9VsapWLdKlYVwyUBZB+2Vk7PwudZdck= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com; spf=pass smtp.mailfrom=garmin.com; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=NfLZ5eiM; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=YfIbR4W7; arc=fail smtp.client-ip=205.220.177.212 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=garmin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="NfLZ5eiM"; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="YfIbR4W7" Received: from pps.filterd (m0220299.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 431IxhYb023933; Mon, 1 Apr 2024 19:12:25 -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=a60koyl3sK4k07hzMsJ3jYPnKyNmnt4o3FXJ1NJZAr8=; b=NfLZ5eiMcNAx KoIOhvLli8wQafyv5Wax8yMAepbT6vyI3OC9ua3myYWSQ4ltWZwlFG9bILykJfZD 6HdgTMGJ/iYGI/q+tqS+cZTRir9povY4W96LWH4q0rLrAE41e+OXsMC0q4IaxiTg TRn6g8PtsifdXMAxPGVQLcp0Hm2N75zg9TV0tRo8upjrz29f5seJZNeq1kpVYtzq 9p45iHnUK4xG+IwPwdAnGR+FndlEg3abUSGH3XPdrhCEnBCfMbxUuE3Pm27pBKJR PUUvrevrQMvX2WIWb1Phagn/aisPQaQ01X+DPBGKJ4+0uLgjH5hhqJhrLdg6USRs lQtZx/4bvg== Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by mx0a-000eb902.pphosted.com (PPS) with ESMTPS id 3x80hys4mm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Apr 2024 19:12:25 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GxeBsqzUF8M7cFLEx8CEVwfdtEJdueOuWYcuN8xmhY2PfFANeuanxfHb2M5eeYcBD9ma3R8eOjazvbUEpWDD/GVlL2OV8hXMI2pUwLL66Vu1k2odIfDPAqFpQWVP6Bk1r47FI9KxIOEiVwTw4NjITc6EWSGRmslntQj8HY522dKqnMIsJEgC2HKExTy7SsNm9IncaQn0jYoy9nHxDGPVeOpzLPSxn7uNEWuiw40pWNd7f6SiN63dEfgig+ULMv+mHa26L8cdpFxmvNSfswsxoFaWsGcx9+J/5FduMc09j9Z7pDwqP5JqAJe7DOdOHvCYbpDoSg/CIFYHflGRsSa3yA== 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=a60koyl3sK4k07hzMsJ3jYPnKyNmnt4o3FXJ1NJZAr8=; b=TepycmsMSU02lZ72bRKFXEW1klnmWttvw1wZHY60bJ4kkkpGm/vOVJmR+0UTqSE1tyioPKMJOpXtY0Zv4RgjpUmzEMJa4Wd4QQxfEJpOou+pZjzIkH/OBSx1ro6QW3XkycbomMC5DR84/QxLC8vjwJCfZlGnJV6pSAdMNJnq0Hg9mKmWmNFkIMhjUhh+l/Jmc8Hx7O3Q+nd7Rdk1RxRcROqrySFQfGxsesu6CJmz0hRWPZIamdumPiyf11I2wo6engeWfr89XP4nnT8QqY9LDqtEGhyZzeXBywPQhlwl8z/SZfsRggmxk18on8j0u4oFS2xkRqwg5DGfV4XUhXg15A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=vger.kernel.org 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 (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a60koyl3sK4k07hzMsJ3jYPnKyNmnt4o3FXJ1NJZAr8=; b=YfIbR4W7EN8vhEF74liNtyirQsNo0EPiWm90fXIibdBhWtmFanIK6oPtzjD9pekfA++P7bPYk6XXCkIciDzbDNtkeasz6ewltLlxm6rv10v1QsXhoEvTsOcCGfAMRFrSktlsWqO+4/zlJ4lHfevLkyF96tGzYNaBJsmmEtcbMHUGJXDnkHxiPoL8ZgSa4yTB7cWgC4Bub858Uy/x1PGtliv2h876dLfgRF6octlD9ejxpAYZILg780ztmr6JVGYRmnnXUKXHTA5AFxxVj+BV7MctY7gzZd8+nK3TeJlLQ9udyTP5f0L5LUnxSrpOrZIR1uSkGDqk2iiEHb1MLbvdoQ== Received: from BN9PR03CA0164.namprd03.prod.outlook.com (2603:10b6:408:f4::19) by BN0PR04MB8207.namprd04.prod.outlook.com (2603:10b6:408:15f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 00:12:22 +0000 Received: from BN1PEPF0000467F.namprd03.prod.outlook.com (2603:10b6:408:f4:cafe::c1) by BN9PR03CA0164.outlook.office365.com (2603:10b6:408:f4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.40 via Frontend Transport; Tue, 2 Apr 2024 00:12:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from edgetransport.garmin.com (204.77.163.244) by BN1PEPF0000467F.mail.protection.outlook.com (10.167.243.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Tue, 2 Apr 2024 00:12:22 +0000 Received: from cv1wpa-exmb4.ad.garmin.com (10.5.144.74) by olawpa-edge3.garmin.com (10.60.4.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Mon, 1 Apr 2024 19:12:12 -0500 Received: from cv1wpa-exmb5.ad.garmin.com (10.5.144.75) by CV1WPA-EXMB4.ad.garmin.com (10.5.144.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Mon, 1 Apr 2024 19:12:21 -0500 Received: from kc3wpa-exmb3.ad.garmin.com (10.65.32.83) by cv1wpa-exmb5.ad.garmin.com (10.5.144.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.32; Mon, 1 Apr 2024 19:12:20 -0500 Received: from CAR-4RCMR33.ad.garmin.com (10.5.209.17) by mail.garmin.com (10.65.32.83) with Microsoft SMTP Server id 15.2.1258.32 via Frontend Transport; Mon, 1 Apr 2024 19:12:19 -0500 From: Joseph Huang To: CC: Joseph Huang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Roopa Prabhu" , Nikolay Aleksandrov , =?utf-8?q?Linus_L=C3=BCssing?= , , Subject: [PATCH RFC net-next 03/10] net: bridge: Always flood local subnet mc packets Date: Mon, 1 Apr 2024 20:11:02 -0400 Message-ID: <20240402001137.2980589-4-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240402001137.2980589-1-Joseph.Huang@garmin.com> References: <20240402001137.2980589-1-Joseph.Huang@garmin.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF0000467F:EE_|BN0PR04MB8207:EE_ X-MS-Office365-Filtering-Correlation-Id: 77ecdf74-bb9f-48e4-3be4-08dc52a9916d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LkNi8qY+O+AVaHsrvad4rhPYoVtrbkH+Utc6WGlTDf/iWgpSZK8dey2sszCP/8yZZxLy8QmiSU6dQ7Bpg7/v17kqGydUBynFLphudCCIdsK1emC0sAOPzauvUFfsWcof4t2PTefnyOG6v4agXm02COL2PwtBzklrWery4XWdfDZjK2aWXo/W7bBRhm9nTu0uy+CURtErahjVfwJzDqCSuR1PtXrSpnRljH03EvGaBdxcnND49TQWmx3xpeGCntgH62Nv/cHzlwtccIMv3p84NqsC5nAn3B/sviIyw/zCAF1GiIv96nKq9y95pJ+alIzTHca+RXlKkjeDt2jdW0zJDGFIyT7wjmbs81WRjXoxxAlni/aL8YbAcPYSqLKbwx8qlpCcAvVIDWUISF7Lk1bNinVy85aD07+sguqtSDTA5pEFwbMwq3G5Mu2zTX5l2Xsf8k75g52SczJG8+Uq/hZTU1xNNs9BUJm5JzoH8OxxORATgi7T+y3oenE7+egJFivasqCbiVugNTfGPi0kt0Nb0NiGi7zrs9JKUSCs4YQVNU2PeXAN5DFdjmfXeURfsHgTTcW9tjHJNtHUEWF6Kl3wMfRpVC7AhuvrfrqXsgr9alQM3/1bQvuC8jQAABE2imn+hNAqvQ6JL2E4+0MjUjnM8U3RvKUfSQIOv9ifSHmpvoNcYGOBcxm5TirhHvSREPb5mvtXlPdt5ZsUJJEFx0aPKYkyDG3Vl9C9MJojMg5DV0m5prQqKDVnLNHzInJOVvdX 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:(13230031)(1800799015)(36860700004)(82310400014)(376005)(7416005);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 00:12:22.1479 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 77ecdf74-bb9f-48e4-3be4-08dc52a9916d 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: BN1PEPF0000467F.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR04MB8207 X-Proofpoint-GUID: sypMPbQwKW79TZKzwiZepSFDuOAaez-C X-Proofpoint-ORIG-GUID: sypMPbQwKW79TZKzwiZepSFDuOAaez-C X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-01_16,2024-04-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 suspectscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2404010168 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Always flood packets with local multicast destination address. If multicast flooding is disabled on a bridge port, local subnet multicast packets from the bridge will not be forwarded out of that port, even if IGMP snooping is running and the hosts beyond the bridge port are sending Reports to join these groups (e.g., 224.0.0.251). This is because the bridge blocks the creation of an mdb entry if the group is a local subnet multicast address, which will cause these packets to be flooded via br_flood(), but blocked by the mcast_flood flag check. Signed-off-by: Joseph Huang --- net/bridge/br_multicast.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 8531f0e03f41..02a5209afab8 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -3823,11 +3823,14 @@ static int br_multicast_ipv4_rcv(struct net_bridge_mcast *brmctx, if (err == -ENOMSG) { if (!ipv4_is_local_multicast(ip_hdr(skb)->daddr)) { BR_INPUT_SKB_CB(skb)->mrouters_only = 1; - } else if (pim_ipv4_all_pim_routers(ip_hdr(skb)->daddr)) { - if (ip_hdr(skb)->protocol == IPPROTO_PIM) - br_multicast_pim(brmctx, pmctx, skb); - } else if (ipv4_is_all_snoopers(ip_hdr(skb)->daddr)) { - br_ip4_multicast_mrd_rcv(brmctx, pmctx, skb); + } else { + BR_INPUT_SKB_CB(skb)->force_flood = 1; + if (pim_ipv4_all_pim_routers(ip_hdr(skb)->daddr)) { + if (ip_hdr(skb)->protocol == IPPROTO_PIM) + br_multicast_pim(brmctx, pmctx, skb); + } else if (ipv4_is_all_snoopers(ip_hdr(skb)->daddr)) { + br_ip4_multicast_mrd_rcv(brmctx, pmctx, skb); + } } return 0; From patchwork Tue Apr 2 00:11:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 13613177 X-Patchwork-Delegate: kuba@kernel.org Received: from mx0a-000eb902.pphosted.com (mx0a-000eb902.pphosted.com [205.220.165.212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B28F42107; Tue, 2 Apr 2024 00:12:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.212 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016776; cv=fail; b=ce9QlVruWoMYUiBKu6cwyW2il96KwKKaUMo47bv7BDWpIv4MCk2krhxkWK/Ogg4uMvwX5tJr3vCv9gIBVM7NwXuiQSTeMfp5pEPORnRjXJ6mL484j++16KIhybAJ0yxcoQUjSb+wZs0wSIxFTIH2dvMUoyeojNBxVzwzWzm+1eY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016776; c=relaxed/simple; bh=8wZf9G7hTWyo09J/RapitcvH7k6Akgj24a2GxCDygSs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fOwcSEko6A/MkviVV0Oo9e1KFU7Fz9+XeJ4Wq4SuX7ofgmQJp2kq143gK6k+npTTov1JAOm8G8GpjJ18clkkp5iT0x7eOMFNngGLq0h1xajfjzEWFPS1nqAVKpOR/NAQXniQ95IDMV0+Eo02T76sj34PsjrBJw1Q1p9fz6N4bQU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com; spf=pass smtp.mailfrom=garmin.com; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=AapHN/x7; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=i9I4QpkD; arc=fail smtp.client-ip=205.220.165.212 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=garmin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="AapHN/x7"; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="i9I4QpkD" Received: from pps.filterd (m0220295.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 431J00Zq011380; Mon, 1 Apr 2024 19:12:31 -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=2FrUqD7C17W4jEYKn/TxgYjSvbgMFjeqVFsoOdy5czs=; b=AapHN/x7cGf9 IfGx1reezWmBBzXBW+RSJci3cD6aJf4HhzT7HYpv/QMQpWyVrf3Bz+HfnykVnqcZ v7aj7fiMIw6dg9eWYhQTh3e9id0/Z5/p4z3FdWxV/1DMG8G9dYC99euQm54SwMFv g0MBYEeadjaWto2Cp0i8Sb71IZKTM2J6rsKmG9gKPO/I3MmhE7qdh5I/4j1jQu9B oO9RMyALZt6GLZ+8iOCZWL/lmNbZqD/40HiBoNLfghYLuQEPpU3efQZx41DGIq+L 7QhtKdiG3yS5lAez1HknmNsGq95Bu933O5rNhOJtP2rSjk9XvPjXa/oUmhooK6bg d8KtJwAd/A== Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by mx0a-000eb902.pphosted.com (PPS) with ESMTPS id 3x6d6tfyj4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Apr 2024 19:12:31 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S6+P/GvoaLALMMEnb5wvxGpYpcLV92zKhYe6DyQWefmFbDabSpKdHFRpPNrFBfn4QUh74zyBPXtSOgOUf3IJCW/NUtFvLHcBaP28McJp6tXkQ9U0r7EYDSgwZVCa/N+/HhJO8qp+h3OoY4MzhH2YTdMJZdy6/MyeepBmKSo796SGNnbl5eDEzwQrr14jh2/S1BusXM1WT3Iwh7RJ21mPUaWodf9BqVQq//x2Y6PuaNkJ4nDpBTAl9c8NrAcE0c/7aTy1WaeFTEHnoaTeZGqzRzWNhCMNqpNazEhx0BFhqqYsKPVeADAg3rX/WAr3lQUDsi3wnYBolCC1HnmPIfHk3Q== 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=2FrUqD7C17W4jEYKn/TxgYjSvbgMFjeqVFsoOdy5czs=; b=jcPdgOSYm2MKk9H6hGKNl56YGetTSm9SGuNDnja2lTZenhYc5wTfLSgg5uLfPcTvIAkIu/1md3XTs/HvqOmlwv3dNhA9NQeMb1gzHU+EIfFvRER6xY0Nm1mmifQZfsjWESSj53ryskSLLyUHR35VGRI4JammKMYWgbsknUjFtL5QXqar1BJMM1caMg7qZCEMBpcUxVY0DRFUg4UbZgjVAKPGh7IWCtT28VgkK+qELdjmr64fj3Uz29d4pxzoak1ehk5Pua0HjvtCwB4RfzfDunlIxGcIZSsncCrk68keYHQ5+R/1X01E7JA19feQgJEPr853yXiYv6C0TlEhJ/mgqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=vger.kernel.org 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 (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2FrUqD7C17W4jEYKn/TxgYjSvbgMFjeqVFsoOdy5czs=; b=i9I4QpkD05oXuLgR0qFIV14iowCrTwJ7AhcZiEFw5uPkIM+KR6AqTOtrptvwQvbvHCUeYglmVNAiyu3CDE7IOL1dBJ77ciS4uOiu9L588v+Vry4MimL8LPdBNKGjcgySRy1uQJDxd7H8pWBS8erw6qcXyzMjZNXrW2ep0g3q41uBzj3nVvKgtGgqZvNEeYjeRUvOjA/Xf7LLBTCpZGXrktRGn6vjW3nB+tgFWlxHmrfEteg3n6LOKe8ikIIu6O5pyMeVYwhGyeNeLDCLK8YHAfybCpX72lT/MYeXLdMXVt+pEFnE3jQ1klScO5hNOxzrWEJspvuuBPei1mXU7CKf8w== Received: from CH0P223CA0014.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::18) by BY5PR04MB7042.namprd04.prod.outlook.com (2603:10b6:a03:22f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 00:12:25 +0000 Received: from CH3PEPF00000014.namprd21.prod.outlook.com (2603:10b6:610:116:cafe::b2) by CH0P223CA0014.outlook.office365.com (2603:10b6:610:116::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46 via Frontend Transport; Tue, 2 Apr 2024 00:12:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from edgetransport.garmin.com (204.77.163.244) by CH3PEPF00000014.mail.protection.outlook.com (10.167.244.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.0 via Frontend Transport; Tue, 2 Apr 2024 00:12:24 +0000 Received: from cv1wpa-exmb3.ad.garmin.com (10.5.144.73) by olawpa-edge1.garmin.com (10.60.4.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Mon, 1 Apr 2024 19:12:16 -0500 Received: from cv1wpa-exmb5.ad.garmin.com (10.5.144.75) by cv1wpa-exmb3.ad.garmin.com (10.5.144.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.37; Mon, 1 Apr 2024 19:12:24 -0500 Received: from kc3wpa-exmb3.ad.garmin.com (10.65.32.83) by cv1wpa-exmb5.ad.garmin.com (10.5.144.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.32; Mon, 1 Apr 2024 19:12:23 -0500 Received: from CAR-4RCMR33.ad.garmin.com (10.5.209.17) by mail.garmin.com (10.65.32.83) with Microsoft SMTP Server id 15.2.1258.32 via Frontend Transport; Mon, 1 Apr 2024 19:12:23 -0500 From: Joseph Huang To: CC: Joseph Huang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Roopa Prabhu" , Nikolay Aleksandrov , =?utf-8?q?Linus_L=C3=BCssing?= , , Subject: [PATCH RFC net-next 04/10] net: dsa: mv88e6xxx: Add all hosts mc addr to ATU Date: Mon, 1 Apr 2024 20:11:03 -0400 Message-ID: <20240402001137.2980589-5-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240402001137.2980589-1-Joseph.Huang@garmin.com> References: <20240402001137.2980589-1-Joseph.Huang@garmin.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000014:EE_|BY5PR04MB7042:EE_ X-MS-Office365-Filtering-Correlation-Id: 7baa287e-6dc6-482a-b1fd-08dc52a9931f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ADWkrYeCe9/4zQwZToNkSqgwgNvnmldDfQx+FoVaFQLLD4mllbg2u2n/xHP552nJF6/p96goDqUZFkpBsdeQSlGVgUSapimwy8FH/SeqsyKivbgTdkAMzQXGW+caWrywY3Eiiw6V1EnALB+gfDVxf897HTjCzkP20obV8cc2Mm8PFUKIGD91jVVVZ5l/KoDQYyY2tc7KhVR7HM137te+ZLQpbI6EDNUeCVf/O6Rl7gpZeUwUJKPOMyG8xPWpMxU+jQT8sfjn1yvJn+4T2wwgd2RAYdPP42XgkHDShbn0UxajY/bPmcrjxEwgZuQMpQyJvGUeYIEodu1SLsbtNMECLWGOtjOKCNjEvOJPK/aBdfYF4Ux2FbeLS6FRYrqA4T8c+7gSC2NFcd0fAix46LiTeAY/f6VD0N7ZtzLL5wDd9jDLsvmvwEMb0ZzXros/A+hyxXPgTInuv6XBQZGIj5uFn/NSRHcnHPfDj93ztC056zhCP3Gp57KcOiugwxaDITu8LzjflIZOlQ4u/ZAaGSByrcexi3+RjDAlY7FbODw7bSQqCK6OguQW8wTEgzfTx+wLUJwODcpRqglKIKJy96mbu2wwvrNVLCq7GSgC4dNfA102xbRNi5nMGfmFhT/N3rGsR+2x5EaH6MM7LaILAuRpyUezimdEmMwtsyquEXp1OLnKIkxc+GLi4ACE+OpPSGhvNpePERmIHg9E9mUL6iBACzmyS8FTKNo6zycxwS+uXG9TIwRwvhEmBjWMf43/jKo9 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:(13230031)(36860700004)(82310400014)(7416005)(376005)(1800799015);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 00:12:24.9952 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7baa287e-6dc6-482a-b1fd-08dc52a9931f 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: CH3PEPF00000014.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR04MB7042 X-Proofpoint-GUID: H7cVO4xao41MGbyUzl2U-wa9jR3bG28Y X-Proofpoint-ORIG-GUID: H7cVO4xao41MGbyUzl2U-wa9jR3bG28Y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-01_17,2024-04-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 impostorscore=0 spamscore=0 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2404020000 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Add local network all hosts multicast address (224.0.0.1) and link-local all nodes multicast address (ff02::1) to the ATU so that IGMP/MLD Queries can be forwarded even when multicast flooding is disabled on a port. Signed-off-by: Joseph Huang --- drivers/net/dsa/mv88e6xxx/Kconfig | 12 ++++++++ drivers/net/dsa/mv88e6xxx/chip.c | 47 +++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/drivers/net/dsa/mv88e6xxx/Kconfig b/drivers/net/dsa/mv88e6xxx/Kconfig index e3181d5471df..ef7798bf50d7 100644 --- a/drivers/net/dsa/mv88e6xxx/Kconfig +++ b/drivers/net/dsa/mv88e6xxx/Kconfig @@ -17,3 +17,15 @@ config NET_DSA_MV88E6XXX_PTP help Say Y to enable PTP hardware timestamping on Marvell 88E6xxx switch chips that support it. + +config NET_DSA_MV88E6XXX_ALWAYS_FLOOD_LOCAL_ALL_HOSTS_ADDRESS + bool "Always flood local all hosts multicast packets" + depends on NET_DSA_MV88E6XXX + help + When set to Y, always flood multicast packets destined for + 224.0.0.1 (Local Network All Hosts multicast address) and + ff02::1 (Link-Local All Nodes multicast address), even when + multicast flooding is disabled for a port. This is so that + multicast snooping can continue to function even when + multicast flooding is disabled. + If in doubt, say N. diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 9ed1821184ec..fddcb596c421 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -2488,6 +2488,41 @@ static int mv88e6xxx_broadcast_setup(struct mv88e6xxx_chip *chip, u16 vid) return 0; } +#if IS_ENABLED(CONFIG_NET_DSA_MV88E6XXX_ALWAYS_FLOOD_LOCAL_ALL_HOSTS_ADDRESS) +static int mv88e6xxx_port_add_multicast(struct mv88e6xxx_chip *chip, int port, + u16 vid) +{ + u8 state = MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC; + const char multicast[][ETH_ALEN] = { + { 0x01, 0x00, 0x5e, 0x00, 0x00, 0x01 }, + { 0x33, 0x33, 0x00, 0x00, 0x00, 0x01 } + }; + int i, err; + + for (i = 0; i < ARRAY_SIZE(multicast); i++) { + err = mv88e6xxx_port_db_load_purge(chip, port, multicast[i], vid, state); + if (err) + return err; + } + + return 0; +} + +static int mv88e6xxx_multicast_setup(struct mv88e6xxx_chip *chip, u16 vid) +{ + int port; + int err; + + for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { + err = mv88e6xxx_port_add_multicast(chip, port, vid); + if (err) + return err; + } + + return 0; +} +#endif + struct mv88e6xxx_port_broadcast_sync_ctx { int port; bool flood; @@ -2572,6 +2607,12 @@ static int mv88e6xxx_port_vlan_join(struct mv88e6xxx_chip *chip, int port, err = mv88e6xxx_broadcast_setup(chip, vlan.vid); if (err) return err; + +#if IS_ENABLED(CONFIG_NET_DSA_MV88E6XXX_ALWAYS_FLOOD_LOCAL_ALL_HOSTS_ADDRESS) + err = mv88e6xxx_multicast_setup(chip, vlan.vid); + if (err) + return err; +#endif } else if (vlan.member[port] != member) { vlan.member[port] = member; @@ -3930,6 +3971,12 @@ static int mv88e6xxx_setup(struct dsa_switch *ds) if (err) goto unlock; +#if IS_ENABLED(CONFIG_NET_DSA_MV88E6XXX_ALWAYS_FLOOD_LOCAL_ALL_HOSTS_ADDRESS) + err = mv88e6xxx_multicast_setup(chip, 0); + if (err) + goto unlock; +#endif + err = mv88e6xxx_pot_setup(chip); if (err) goto unlock; From patchwork Tue Apr 2 00:11:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 13613178 X-Patchwork-Delegate: kuba@kernel.org Received: from mx0a-000eb902.pphosted.com (mx0a-000eb902.pphosted.com [205.220.165.212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B550A2C9E; Tue, 2 Apr 2024 00:12:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.212 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016776; cv=fail; b=URlDpgb8Zrr8TXJmjG/bZFCjwevJg02oHma7MWo/vHulJQ9CTfKE23RbG6lVx1J9DNj1AgcsDxz+1fUkEumliVxwt96NedpGIzGTinxsuX4KCew1YGipZVI0wbw+p+dzaevBWduC1FH2N/Ydpg7VID1QuupkAd5Q5hj/dFzTJ4I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016776; c=relaxed/simple; bh=0l5hsdHDLVVnywoch5SQrIbuIghnUX5nqsuzUE76m88=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Kl2h6j/y3TJXlC0ZMJbxijAfVzLbTcYVkPFY18jMsU/fOitAG74V9TlNqsWtgutRULXi+KwG0gtajYqIhsqXEmR50p0SXciiwdm3UH/daVCT8zTX8qwZqXKPrGym1HQArzntSOjglq7e6272ViytSF8uCjbzGZmpD9XI5tjeKUE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com; spf=pass smtp.mailfrom=garmin.com; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=GVlhvV0M; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=aIgnKhUD; arc=fail smtp.client-ip=205.220.165.212 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=garmin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="GVlhvV0M"; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="aIgnKhUD" Received: from pps.filterd (m0220295.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 431Ixexg010408; Mon, 1 Apr 2024 19:12:31 -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=Rg2UydNof9shahdUvJueK7G9agfcFnQPz3zx5dpxrzs=; b=GVlhvV0MD/62 lXqXi9A6/BApV+7aopQZFr8c0UheK1FXXHfSpCK1XdUlF2jtJVWXPBARCi59FnzP cAVQfMmMZIjM7K6Tv4Mz4cTLIR1udi3h57mhWtDDHEXlWhm3wH+ubIbIdvCzJn5S 6khIYC809Ueoo4RRjLw0SiAQ5voFAv5++r9thOmeV9wsptKtV4dAcshmcu6NQHa0 1xNvxLYhgAvwNrFCM/RZNhFJ2afolpggW4egTjA50ZmMJLqEdLB4N8UdcH6ApH2Q esF3w0GG8RlQFfIQ5dSLKLi55OsTjWUbJlGJjAQhnzLwKHo9MTPaGzyyrFCKnckD dE1H55pFxg== Received: from bl0pr05cu006.outbound.protection.outlook.com (mail-eastusazlp17013025.outbound.protection.outlook.com [40.93.11.25]) by mx0a-000eb902.pphosted.com (PPS) with ESMTPS id 3x6d6tfyj5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Apr 2024 19:12:31 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IwiA6G23P+yZ54MBIYjgbr0Ku9+OUE99msQrWssEQlUGiwF0W6akzyE1In1kOyDTiziaoel06yseitleQrdQrFMVf3wDR1Buubvv+eLQJvFYzZCakXje8uK0koL1x6x82MoyhRtdm3kUEvvdUuzSRDxH26DLNUgDJ3sd4odcWY3CAusW9YqNYzp4OLfTo5wIHcdkGN+U7bZ3pI7S7eE2JFFOWbNpfo7V0ilO59Y1JpwYMJ/9y48F6j7X44QtJA/b7ZW4mYSgvLmTXgzpz74P1vLeWg0//jr4EOzuavw0sEjCVBmM+GFVVLJ5cBAc9b/Hu2pSWy0r940F4VFuWX5lsg== 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=Rg2UydNof9shahdUvJueK7G9agfcFnQPz3zx5dpxrzs=; b=M4vNb2GND4j4k0R+jGPPBUDMAkTkEjY0rmjhEhRE2SjaMS//DVEEucI9J3uWH918sseayUZ+liKRXSoTt2yZi9hHsPGaKAR+h7qJ5s5z7I4zr1097tLS+oW7qC48IjwfP5MA+ZTJ9VaVYFsQJDPf9YcM0krQeJ3YUqrgjH6bURGvu6yAf17mpRWut6s6Gji+NftgDcXV7J43MMHANkh7iryVp/4nbNiweP9Vw2psXysBk+M9nGt3JI9HPyMEjotsRXStFdsM/M9d5EstPhdI0Xh2ImXPxbJDnnwK1CeJXbJoyLZYcmhYph2BkaHolXkbn6U7YA9vvn4TC0xD/q1UgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=vger.kernel.org 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 (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Rg2UydNof9shahdUvJueK7G9agfcFnQPz3zx5dpxrzs=; b=aIgnKhUDH4lNgWn4kDE19quhI5ylf2UsubuPFEhpa9AN816rsjVG6wGs1k8vM1GAxjsKvKJ7MYoxUDczk6X+0e5UPWBaN6GK0q2yrL2hqpzgB2iL0tdRfERdDLNItg35h9BzH8PeSMj+tr/rJAqFnxqNPVL7QtKOj/pQ31rOFNUkA0wY3UBlC3L/RJzm5wlQ+CbamJLQ9Pjna9y7sjIbzyuzkOEzlsUoqKFggBkS1e/0fKV7NRngyeca/B/koCcx7TpwBacpQ74o+AuOIeqGzgHa2A4EkH5BT69OVR9HSvfPLRYrop7OTLhTQm9UgqVBJn/pFfICleeixviyFh6CPw== Received: from BYAPR06CA0018.namprd06.prod.outlook.com (2603:10b6:a03:d4::31) by SJ0PR04MB7773.namprd04.prod.outlook.com (2603:10b6:a03:302::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 00:12:29 +0000 Received: from SJ5PEPF000001C8.namprd05.prod.outlook.com (2603:10b6:a03:d4:cafe::5a) by BYAPR06CA0018.outlook.office365.com (2603:10b6:a03:d4::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46 via Frontend Transport; Tue, 2 Apr 2024 00:12:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from edgetransport.garmin.com (204.77.163.244) by SJ5PEPF000001C8.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Tue, 2 Apr 2024 00:12:28 +0000 Received: from cv1wpa-exmb1.ad.garmin.com (10.5.144.71) by olawpa-edge5.garmin.com (10.60.4.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Mon, 1 Apr 2024 19:12:19 -0500 Received: from cv1wpa-exmb5.ad.garmin.com (10.5.144.75) by CV1WPA-EXMB1.ad.garmin.com (10.5.144.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.37; Mon, 1 Apr 2024 19:12:27 -0500 Received: from kc3wpa-exmb3.ad.garmin.com (10.65.32.83) by cv1wpa-exmb5.ad.garmin.com (10.5.144.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.32; Mon, 1 Apr 2024 19:12:27 -0500 Received: from CAR-4RCMR33.ad.garmin.com (10.5.209.17) by mail.garmin.com (10.65.32.83) with Microsoft SMTP Server id 15.2.1258.32 via Frontend Transport; Mon, 1 Apr 2024 19:12:26 -0500 From: Joseph Huang To: CC: Joseph Huang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Roopa Prabhu" , Nikolay Aleksandrov , =?utf-8?q?Linus_L=C3=BCssing?= , , Subject: [PATCH RFC net-next 05/10] net: dsa: Add support for PORT_MROUTER attribute Date: Mon, 1 Apr 2024 20:11:04 -0400 Message-ID: <20240402001137.2980589-6-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240402001137.2980589-1-Joseph.Huang@garmin.com> References: <20240402001137.2980589-1-Joseph.Huang@garmin.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001C8:EE_|SJ0PR04MB7773:EE_ X-MS-Office365-Filtering-Correlation-Id: 8791e8b4-c6ff-4bf5-ff7e-08dc52a9955e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9MQQonZ8w14KBM6bqLbTpfFOdLDhPt8cYjoKxmGkmCkXZr5FerpzMKsUQrI5Wll26Zir4eK06W5O/44TVQo1iJltPByRWA8wP5pV/gSsMFdOgRXGzxbTSKloKmQWhbVsuZlog11rxd27QFYmkmLT9KKE0BkwVOvOoNYxyMGzgw6jXNRXu3meG8RTKRlGMbKDXi67Oqvdyy03TuX8DBXV8MJI8zC9ePIv/+EhIoQ5YIMUuoOtjx6gTNW8gKD9TB3buVuAGV+wdG5KKSm/XxQ5uupvzhg+Vx2kEXZRRSMz+GaD93ZNWBjBg4J9OM0/jg5J7AduPKkp9ldLR7BIbOdmQvq9FD3Jj18eyB8YiujcY7RB+CsX41DkgKxFgzIuHrI+r/qbvSbQyS36TwSwhIwmGWTI81rI73dyEwfEBg+qkgQ2nVFFe5j8obx6jBZvO7xqL7QSzQxkY9le2gEIqOklxVDVtRMDjfXuMTRp8TY0Ae4zpb42bk1C43fzn56qK4+mxCu8bC2DAT3sBKZ7iY0PBJrUZC3Yl6KypEvGD9+WLqHFunMzMyjZe8W4t/xweum/Scr9uDgbYII4afOk0TzPPCBmuuig7gcgPaQonfrXP+XhPLNSOrnboOd89ij2D6fSjfbsh1thsVGryhCZ2UWmx9ni8IYijG24KmWezgIKFpiZIIAo7b0V9fD1PsJDUL1SYmlnFThLqhD37/DFMhnjGMcQDa6j8JdnRRe0+8oQ2BG/WZBK8goZWYbVBR2IEZlQ 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:(13230031)(36860700004)(82310400014)(7416005)(376005)(1800799015);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 00:12:28.7499 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8791e8b4-c6ff-4bf5-ff7e-08dc52a9955e 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: SJ5PEPF000001C8.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR04MB7773 X-Proofpoint-GUID: NShXKpIRB4-u1fUT1aplDxZ93JsQY3pZ X-Proofpoint-ORIG-GUID: NShXKpIRB4-u1fUT1aplDxZ93JsQY3pZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-01_17,2024-04-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 impostorscore=0 spamscore=0 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2404020000 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Add support for delivering SWITCHDEV_ATTR_ID_PORT_MROUTER event to DSA subsystem. This is essentially 08cc83c ("net: dsa: add support for BRIDGE_MROUTER attribute") repurposed for PORT_MROUTER. Signed-off-by: Joseph Huang --- include/net/dsa.h | 2 ++ net/dsa/port.c | 11 +++++++++++ net/dsa/port.h | 2 ++ net/dsa/user.c | 6 ++++++ 4 files changed, 21 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 7c0da9effe4e..5dc5838caa9c 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -1037,6 +1037,8 @@ struct dsa_switch_ops { int (*port_bridge_flags)(struct dsa_switch *ds, int port, struct switchdev_brport_flags flags, struct netlink_ext_ack *extack); + int (*port_mrouter)(struct dsa_switch *ds, int port, bool mrouter, + struct netlink_ext_ack *extack); void (*port_set_host_flood)(struct dsa_switch *ds, int port, bool uc, bool mc); diff --git a/net/dsa/port.c b/net/dsa/port.c index c42dac87671b..3f689cb713aa 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -948,6 +948,17 @@ int dsa_port_bridge_flags(struct dsa_port *dp, return 0; } +int dsa_port_mrouter(struct dsa_port *dp, bool mrouter, + struct netlink_ext_ack *extack) +{ + struct dsa_switch *ds = dp->ds; + + if (!ds->ops->port_mrouter) + return -EOPNOTSUPP; + + return ds->ops->port_mrouter(ds, dp->index, mrouter, extack); +} + void dsa_port_set_host_flood(struct dsa_port *dp, bool uc, bool mc) { struct dsa_switch *ds = dp->ds; diff --git a/net/dsa/port.h b/net/dsa/port.h index 6bc3291573c0..85102e1659ae 100644 --- a/net/dsa/port.h +++ b/net/dsa/port.h @@ -81,6 +81,8 @@ int dsa_port_pre_bridge_flags(const struct dsa_port *dp, int dsa_port_bridge_flags(struct dsa_port *dp, struct switchdev_brport_flags flags, struct netlink_ext_ack *extack); +int dsa_port_mrouter(struct dsa_port *dp, bool mrouter, + struct netlink_ext_ack *extack); int dsa_port_vlan_add(struct dsa_port *dp, const struct switchdev_obj_port_vlan *vlan, struct netlink_ext_ack *extack); diff --git a/net/dsa/user.c b/net/dsa/user.c index 16d395bb1a1f..f69c4df143f7 100644 --- a/net/dsa/user.c +++ b/net/dsa/user.c @@ -647,6 +647,12 @@ static int dsa_user_port_attr_set(struct net_device *dev, const void *ctx, ret = dsa_port_bridge_flags(dp, attr->u.brport_flags, extack); break; + case SWITCHDEV_ATTR_ID_PORT_MROUTER: + if (!dsa_port_offloads_bridge_port(dp, attr->orig_dev)) + return -EOPNOTSUPP; + + ret = dsa_port_mrouter(dp, attr->u.mrouter, extack); + break; case SWITCHDEV_ATTR_ID_VLAN_MSTI: if (!dsa_port_offloads_bridge_dev(dp, attr->orig_dev)) return -EOPNOTSUPP; From patchwork Tue Apr 2 00:11:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 13613182 X-Patchwork-Delegate: kuba@kernel.org Received: from mx0a-000eb902.pphosted.com (mx0a-000eb902.pphosted.com [205.220.165.212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6951DF71; Tue, 2 Apr 2024 00:12:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.212 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016779; cv=fail; b=DZ31LtbChjpKPaZUT/c9tMKO2uf6+TYjoaXlvPN/Gu+6VTQk8KcQB34tfh2pLG2j5By2QAZXFMFcZ0mZALJhbVMgoeXT+Ck7tOI7eZwqcMaezCAgudNJ7ID6GbNMsgHaWtRl0DwFw6bFx1dVK2IauBi9u83oz5Xn8bxXLVCYwk8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016779; c=relaxed/simple; bh=10LvToiNoXWxfAgBnRbz/Edl1JUEJ/r79jkSYD2FVwk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sYYmFUyQIihXu5OHXCLNpUTfOyO00peHZnX2HgjApYNSyLip11jVr7RvafkBCCx1Xh1B7T8VWt8EO6GFSa6engoq8+LGZBvKXUK6M5txCyxWU2LG3F4br5VGjYkywPyOROtHXbELPeYuOfcNH7NszilNJG4ULou3P7H8LqPSN/A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com; spf=pass smtp.mailfrom=garmin.com; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=aqjyypMt; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=YYYCRpde; arc=fail smtp.client-ip=205.220.165.212 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=garmin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="aqjyypMt"; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="YYYCRpde" Received: from pps.filterd (m0220295.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 431Ixexh010408; Mon, 1 Apr 2024 19:12:34 -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=gNCJ8QpPM6O7VAMSMFT9c/qqYIMZ719xiz/u8QFWKw0=; b=aqjyypMtuKRL cj+E6i7z0pBVKwKxR/jTfnwmJEvebn5nMxRZmy/4TRMlLJfEnOx/ywZemCbm0AO7 NgCp6+uzd6l4VxQ7MQdy5ebrbR4i60malpiOqRv7UT+gtvfhUKve85rB5aoWKuFT ijPGnrasxqgPKt4EwppRM0BgSsLVGWPQSaFbl1FLn+8bKcnTwjrc/XwDEEKcmhYJ 0pGRJVXQaJ0U9+171qYYglx5osl1YDVZ2J+U1gY1eSXnYniJ8p87hGu3SW2z6odh rYul/OdsdkIBrR2aey/LmLVZzd3vk0UKJ0oWWhX1DUGrE/6DIjiXFUKGeQLnae9s W898Bf4sHg== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by mx0a-000eb902.pphosted.com (PPS) with ESMTPS id 3x6d6tfyja-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Apr 2024 19:12:34 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ikImYDA6ZoFnmeBJiX1bQfYozQNYHZuHEYYTMNUV4ZokfcpfbF/RUC/VmokYX+A2cE4RZ29YzEHO2CbubJgBrzgcMf2CvP49liROR90Q8/xPGyFaFjgK3zVYwOfaIxcqaoE9lFnyl9iVY3pA1kiMby/SGPaVf3b9/xSZDp69EUgrG7KHrSUMQoIa6hoeDsibWgRPMmRXXurz/KkZ4JN5k1Y0jWeATx5Nthfwf7nYFTTwo/i2WzDfbeWiyaJLdveeIxPFSAHALHs0XjhXAcUbxt5JyZQNbZeb9Yu2fA8X31bLPtrTOfxSeJt44e1WRydmTzH/6VobSdlUq4MGqOuCdQ== 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=gNCJ8QpPM6O7VAMSMFT9c/qqYIMZ719xiz/u8QFWKw0=; b=iCELJA9UAS/20yY4M5L3KRVnKaXu99guG7mYEkSzurC47mlVMErqZ3P0COBEFmhkz0tRKnvntx3bUgO79R29PYE8lZqWC2k/3/dNQyS+Mqv4GZZThQa+ICE6IqxZpuobHt5n3RKEUzNMWspTDzbv1vDtfuiyNxxbOUX7ZuS+GJ5lJ7uW0FZpbRgf1zb0sjgAsvUU2I/rdqRzFYIqGIkTYERnuns/NFwTSUu5230cN7SXfcoR6gYfFTA1slm2z5Kn2hqcte2BrNlEl5yb3X4YKdjqflUrdC2zV4wquHdVQ/ukMlJorOG4FEsFf1V3fpxCcl+KAuv6wXQPVzBBqT3zTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=vger.kernel.org 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 (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gNCJ8QpPM6O7VAMSMFT9c/qqYIMZ719xiz/u8QFWKw0=; b=YYYCRpdexR9BJUg0ma9jDED9WwNdxWQhWKBn6HzW3yrKHuSHayrUqBWH2zTZtV9MBpRUaMs4omzf4Pt+SEMCP65zQp2tbj+ts0XSlZWQzoenCJaXoVj8iAP2MkgCqV5IZkgR4Ou4Pt57UHAupcAQhneA38IdxobjdZp4d/0MsYgmVYcQCjigmoxpbO1k5T2ku/mAUN3m5lIMJzzNsdaM85a1f0eKcKOwRkeP9CoaqviZ7ybycPdZlV0NcTR4Ml5UrWbh6REXhuadjww8nkhhLaGOdSj04X3lo43yRYz2zGUJS3lDSR0vrb9l+Q6E2jjSnv7zJ2GO+BeHm+v0cCLzdQ== Received: from PH7PR10CA0023.namprd10.prod.outlook.com (2603:10b6:510:23d::21) by BY5PR04MB6755.namprd04.prod.outlook.com (2603:10b6:a03:22d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 00:12:32 +0000 Received: from CY4PEPF0000E9D7.namprd05.prod.outlook.com (2603:10b6:510:23d:cafe::1c) by PH7PR10CA0023.outlook.office365.com (2603:10b6:510:23d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46 via Frontend Transport; Tue, 2 Apr 2024 00:12:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from edgetransport.garmin.com (204.77.163.244) by CY4PEPF0000E9D7.mail.protection.outlook.com (10.167.241.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Tue, 2 Apr 2024 00:12:31 +0000 Received: from cv1wpa-exmb2.ad.garmin.com (10.5.144.72) by olawpa-edge4.garmin.com (10.60.4.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Mon, 1 Apr 2024 19:12:24 -0500 Received: from cv1wpa-exmb5.ad.garmin.com (10.5.144.75) by CV1WPA-EXMB2.ad.garmin.com (10.5.144.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Mon, 1 Apr 2024 19:12:31 -0500 Received: from kc3wpa-exmb3.ad.garmin.com (10.65.32.83) by cv1wpa-exmb5.ad.garmin.com (10.5.144.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.32; Mon, 1 Apr 2024 19:12:30 -0500 Received: from CAR-4RCMR33.ad.garmin.com (10.5.209.17) by mail.garmin.com (10.65.32.83) with Microsoft SMTP Server id 15.2.1258.32 via Frontend Transport; Mon, 1 Apr 2024 19:12:29 -0500 From: Joseph Huang To: CC: Joseph Huang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Roopa Prabhu" , Nikolay Aleksandrov , =?utf-8?q?Linus_L=C3=BCssing?= , , Subject: [PATCH RFC net-next 06/10] net: dsa: mv88e6xxx: Track soft bridge objects Date: Mon, 1 Apr 2024 20:11:05 -0400 Message-ID: <20240402001137.2980589-7-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240402001137.2980589-1-Joseph.Huang@garmin.com> References: <20240402001137.2980589-1-Joseph.Huang@garmin.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D7:EE_|BY5PR04MB6755:EE_ X-MS-Office365-Filtering-Correlation-Id: d54443a5-4cee-4677-ee5f-08dc52a99734 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4A7A7ODQP1WO/BWu+GAMf0m9zXKbYJkivs3lYeOvREu6Z5HKHiO5Xi/frpz6dV8Zk1F8ZCLsg1MACl4QJGunBENAZ011UlFsTN7k0cWhMWaTLcptXr6BKJWjiaIYzJIruY6pVWpdMzAjpAIttrKfpKOC+dOJV77h9+Md6NhnT61/ED+myWxLdhCdX6AiTD4/z94WRwA6nqd0KLflX2xFsQERlt/o1PZ26YDpaMoAECIXV6q+NpHIAUzpqp2br7MVnaGu6F/HR8cYif3SXglDMZNJFEc70a1D6V+wjl4VbkRr2Q98k/AJENbKVjIogvNgV7ZW9VdMUZDCF9Vccgz80t5+1wBZIQG8HGTx1oMqOz8RbIGqtpjfWaHL/4IDx7uqHLJK2H2N/Sh/qz2fp5qDm3UL1sHF55nMkKKcOOliPpSQCSNLk3bnNw7FybHk+5ctPKqvp4DbcIgt49sNwVBATtzedz2Mo2H7692RDv+N5rpO2B8yjCft9AJB0s2TrWi1315edFpwVK63LJZqzSeLy9/BMONnx39+aGbqjZ7dRc2yRg3oOfCpKSv3s9BPA53ewt2323YCnz7Ozlyhfsf9CKQxcxfESoOP1rNv9eLH08H38acR4rwN6Na9J8Nqvc5FvyW2XVgLU+jgxHZPp+G+hHCHGlqDCwFbrhbPwop9Q3OgfMg88++2nm/0CN/9veBaQYk4l/O/kaO/pnS7umemof8Bdc5KDMCq8BB/vReBqqXURbnyOMYLTFD5Gvor2UGj 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:(13230031)(36860700004)(7416005)(82310400014)(376005)(1800799015);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 00:12:31.8609 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d54443a5-4cee-4677-ee5f-08dc52a99734 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: CY4PEPF0000E9D7.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR04MB6755 X-Proofpoint-GUID: RBxjUKhp5xGS4ZG-fExvbXtiTt-qu37U X-Proofpoint-ORIG-GUID: RBxjUKhp5xGS4ZG-fExvbXtiTt-qu37U X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-01_17,2024-04-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 mlxlogscore=945 impostorscore=0 spamscore=0 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2404020000 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Keep track of soft bridge objects in the driver. Since the driver doesn't get explicit notifications about bridge creation or destruction, just create the bridge data structure when the first port joins the bridge via mv88e6xxx_port_bridge_join(). Similarly, destroy the bridge after the last port left the bridge via mv88e6xxx_port_bridge_leave(). Use the bridge's net_device pointer as the key to the list. Port information is stored in a bitmask. Signed-off-by: Joseph Huang --- drivers/net/dsa/mv88e6xxx/chip.c | 85 ++++++++++++++++++++++++++++++++ drivers/net/dsa/mv88e6xxx/chip.h | 3 ++ 2 files changed, 88 insertions(+) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index fddcb596c421..f66ddde484dc 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -43,6 +43,12 @@ #include "serdes.h" #include "smi.h" +struct mv88e6xxx_bridge { + struct list_head head; + struct net_device *br_dev; + u16 ports; +}; + static void assert_reg_lock(struct mv88e6xxx_chip *chip) { if (unlikely(!mutex_is_locked(&chip->reg_lock))) { @@ -2958,6 +2964,60 @@ static int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port, return err; } +static struct mv88e6xxx_bridge * +mv88e6xxx_bridge_create(struct mv88e6xxx_chip *chip, struct net_device *br_dev) +{ + struct mv88e6xxx_bridge *mv_bridge; + + mv_bridge = kzalloc(sizeof(*mv_bridge), GFP_KERNEL); + if (!mv_bridge) + return ERR_PTR(-ENOMEM); + + mv_bridge->br_dev = br_dev; + list_add(&mv_bridge->head, &chip->bridge_list); + + return mv_bridge; +} + +static void mv88e6xxx_bridge_destroy(struct mv88e6xxx_bridge *mv_bridge) +{ + list_del(&mv_bridge->head); + + WARN_ON(mv_bridge->ports); + kfree(mv_bridge); +} + +static +struct mv88e6xxx_bridge *mv88e6xxx_bridge_by_dev(struct mv88e6xxx_chip *chip, + const struct net_device *br_dev) +{ + struct mv88e6xxx_bridge *mv_bridge; + + list_for_each_entry(mv_bridge, &chip->bridge_list, head) + if (mv_bridge->br_dev == br_dev) + return mv_bridge; + + return NULL; +} + +static struct mv88e6xxx_bridge * +mv88e6xxx_bridge_get(struct mv88e6xxx_chip *chip, struct net_device *br_dev) +{ + struct mv88e6xxx_bridge *mv_bridge; + + mv_bridge = mv88e6xxx_bridge_by_dev(chip, br_dev); + if (!mv_bridge) + mv_bridge = mv88e6xxx_bridge_create(chip, br_dev); + + return mv_bridge; +} + +static void mv88e6xxx_bridge_put(struct mv88e6xxx_bridge *mv_bridge) +{ + if (!mv_bridge->ports) + mv88e6xxx_bridge_destroy(mv_bridge); +} + static int mv88e6xxx_bridge_map(struct mv88e6xxx_chip *chip, struct dsa_bridge bridge) { @@ -3009,8 +3069,16 @@ static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, struct netlink_ext_ack *extack) { struct mv88e6xxx_chip *chip = ds->priv; + struct mv88e6xxx_bridge *mv_bridge; int err; + mv_bridge = mv88e6xxx_bridge_get(chip, bridge.dev); + if (IS_ERR(mv_bridge)) + return PTR_ERR(mv_bridge); + + if (mv_bridge->ports & BIT(port)) + return -EEXIST; + mv88e6xxx_reg_lock(chip); err = mv88e6xxx_bridge_map(chip, bridge); @@ -3033,6 +3101,8 @@ static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, *tx_fwd_offload = true; } + mv_bridge->ports |= BIT(port); + unlock: mv88e6xxx_reg_unlock(chip); @@ -3043,8 +3113,19 @@ static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port, struct dsa_bridge bridge) { struct mv88e6xxx_chip *chip = ds->priv; + struct mv88e6xxx_bridge *mv_bridge; int err; + mv_bridge = mv88e6xxx_bridge_by_dev(chip, bridge.dev); + if (!mv_bridge) + return; + + if (!(mv_bridge->ports & BIT(port))) + return; + + mv_bridge->ports &= ~BIT(port); + mv88e6xxx_bridge_put(mv_bridge); + mv88e6xxx_reg_lock(chip); if (bridge.tx_fwd_offload && @@ -6436,6 +6517,7 @@ static struct mv88e6xxx_chip *mv88e6xxx_alloc_chip(struct device *dev) INIT_LIST_HEAD(&chip->mdios); idr_init(&chip->policies); INIT_LIST_HEAD(&chip->msts); + INIT_LIST_HEAD(&chip->bridge_list); return chip; } @@ -7272,6 +7354,9 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev) mv88e6xxx_g1_irq_free(chip); else mv88e6xxx_irq_poll_free(chip); + + WARN_ON(!list_empty(&chip->bridge_list)); + } static void mv88e6xxx_shutdown(struct mdio_device *mdiodev) diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index 85eb293381a7..a32e4564eb3d 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -432,6 +432,9 @@ struct mv88e6xxx_chip { /* Bridge MST to SID mappings */ struct list_head msts; + + /* software bridges */ + struct list_head bridge_list; }; struct mv88e6xxx_bus_ops { From patchwork Tue Apr 2 00:11:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 13613181 X-Patchwork-Delegate: kuba@kernel.org Received: from mx0b-000eb902.pphosted.com (mx0b-000eb902.pphosted.com [205.220.177.212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CFC08BE5; Tue, 2 Apr 2024 00:12:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.212 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016779; cv=fail; b=VL5O7R7eqZQrudpD8GTjmwN8h3rsv8kOQE8nTVS2ujR5OecpRcNPH59uKzoqcykraFrIouhr01bNfqz4zRiUOZlEpc6bQrx7VXLexXzmfKLNQNbR53jC4M5VSF7681fdQw/0UIR/V8bPtO382kfINx6Vay4e2IGTx8+QdG5wivo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016779; c=relaxed/simple; bh=TQJufkiN6+FwmkxY8Kc9C6WhsreIiFsobupB1QMJ8Xg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tmOTBtz0Yodri2zXVlziAOdzSZAt+S/OF4AnzJxaNNoe/6iil5o42/ZlIcUbg1wX60TqEEIlge6mGLNvi0UQjBbqTv9RSIqCKYGNQy6EqhFP/FylFOYBnBhHbCvqePxDkaqYSHLBY8Fc4Qy5IV75Pz4qd5v0mFCNVS4B84WN83E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com; spf=pass smtp.mailfrom=garmin.com; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=eWIGWjzH; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=EspMfqjt; arc=fail smtp.client-ip=205.220.177.212 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=garmin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="eWIGWjzH"; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="EspMfqjt" Received: from pps.filterd (m0220297.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 431J0Gf0003286; Mon, 1 Apr 2024 19:12:37 -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=hl9b1s+/NgfLZDUBljKqbssQp7LoQo+naDmi0MKelYk=; b=eWIGWjzHtQmL cFar6bxeRW8zxdjRkgN15td/HRkHgZUPzYyAGlP6UUygX+QzqZRQf+6CrT+zlm5X 9Cifel910yUeCMr4fNzXz4cQAK+h82PLMbb6dppOMJNZEdpzR12c6ZwzJ/zQFVMu wk+pih4PykC9greRr9HBLeIT39asf5B/23imyMlMZ17kL/uZjZb2lD1uofa0oBXO DzzL5Qlmy1EIPdy1l+1vym90/DiJzDhZpMSRo+1V8sNSAI6vP+y3yxvqNbo4Y2ti luApv/SjAHHR12RLf46r2SaFRcS6Br4TQ5X/vtM/fmys9DwzKbS32zyclwOE6EAb mcKfIfM8Zg== Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by mx0a-000eb902.pphosted.com (PPS) with ESMTPS id 3x808696h3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Apr 2024 19:12:37 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BVWlbziF7wBdm57bymx/EU88idFIonUmMyDehskJA2N2PpI0X4EEYcM3L8BDrBPcRTK7EtL99+anPlTl/6TwHXrjHt4g4ITv4jmn0zGB92RXCedm1mi5tWh41xuBhbVNSODpUP/j2um5v9QMdyPAhLxoyLEOU0cvhAXJ5CqWIY1Pzyjb4VLA27S/4CKke/o47FAf1FrwLvJD3c0blHA5X3ElG8oO6SIxUj8mCmph/ZmQ9WZcnMpKLhDID7DBcr56ktn6kO6P7ngxhA3GInYn4ez52JC4ju5ZKAJ71r78epdRbmEaD8GMOEmDE6RF3l+ADEL1xGDJhJ9JqoyxNuWcRA== 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=hl9b1s+/NgfLZDUBljKqbssQp7LoQo+naDmi0MKelYk=; b=RlmmPRsinliGR+K1AbJZHLnJjvJEvRFb3GPJE+PWc9evYqbJbuFAeZFZk8IrQyAGKxrkvovQvbzf1i6K+UhFPkQdYo4CbFXOYgEYMgsBaxmStY65ehpQT9tWgW5yyRF9R0fH9/Wx8qC8OJCQX5lRwFx5AOCjZRmqKiAGJqS07LU4QVcoxWzSsWbwLb+qXgQ61+3TSQUHZGK4AWJyiUg+VB2nl7mxrP80Lr+vGFrUzh5cqhCRP1qhSEjnN1EFBZQRg2X7s1zbNI7zDaY37QoGUd+54CRI8zSkYIE+d6EXLCe3rmdWTG/IJzL741LnIm2kBtd518vv0B4gLHjhMhb2xQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=vger.kernel.org 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 (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hl9b1s+/NgfLZDUBljKqbssQp7LoQo+naDmi0MKelYk=; b=EspMfqjtCAcTHpW7LiRlmWKhU5PJMh3mMlk7XB8iTy/ycmP43HFOoxwr86NHCX9Qmn7ZU/H+OriD0VC+CRzix12kG7cAuulAWfDdgdcOgIuyBKyP6W+lzREsfOjGRT9rijou6xdKqvsIYZcky2dYYnnR5xh823tGXsOag//kuqplUDh/EJyFuwfrISWcE/u19dCLJkYNs9lCx9eFJalVUVu3ep7xhkcArUUDaKGln7M6cKryifalZE+gRqe0N2/XYdCqs3KyXq/sbUHFL46Q+tkMD8UmwnddmsdF0ylerQrWRkbmL6vrNGwgdAZdxZ3dUIoe4L8yKfutkmg9WpMINQ== Received: from DM6PR08CA0057.namprd08.prod.outlook.com (2603:10b6:5:1e0::31) by CH0PR04MB8097.namprd04.prod.outlook.com (2603:10b6:610:f5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 00:12:35 +0000 Received: from CY4PEPF0000E9DB.namprd05.prod.outlook.com (2603:10b6:5:1e0:cafe::3b) by DM6PR08CA0057.outlook.office365.com (2603:10b6:5:1e0::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46 via Frontend Transport; Tue, 2 Apr 2024 00:12:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from edgetransport.garmin.com (204.77.163.244) by CY4PEPF0000E9DB.mail.protection.outlook.com (10.167.241.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Tue, 2 Apr 2024 00:12:35 +0000 Received: from cv1wpa-exmb3.ad.garmin.com (10.5.144.73) by olawpa-edge4.garmin.com (10.60.4.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Mon, 1 Apr 2024 19:12:27 -0500 Received: from cv1wpa-exmb5.ad.garmin.com (10.5.144.75) by cv1wpa-exmb3.ad.garmin.com (10.5.144.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.37; Mon, 1 Apr 2024 19:12:34 -0500 Received: from kc3wpa-exmb3.ad.garmin.com (10.65.32.83) by cv1wpa-exmb5.ad.garmin.com (10.5.144.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.32; Mon, 1 Apr 2024 19:12:33 -0500 Received: from CAR-4RCMR33.ad.garmin.com (10.5.209.17) by mail.garmin.com (10.65.32.83) with Microsoft SMTP Server id 15.2.1258.32 via Frontend Transport; Mon, 1 Apr 2024 19:12:33 -0500 From: Joseph Huang To: CC: Joseph Huang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Roopa Prabhu" , Nikolay Aleksandrov , =?utf-8?q?Linus_L=C3=BCssing?= , , Subject: [PATCH RFC net-next 07/10] net: dsa: mv88e6xxx: Track bridge mdb objects Date: Mon, 1 Apr 2024 20:11:06 -0400 Message-ID: <20240402001137.2980589-8-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240402001137.2980589-1-Joseph.Huang@garmin.com> References: <20240402001137.2980589-1-Joseph.Huang@garmin.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9DB:EE_|CH0PR04MB8097:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f99e027-0c30-4414-40a3-08dc52a99922 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XrFxhwE7FssqrLjnrBO/JoatIlbvZdqyXy8xR7zDKCpo76Witkn/pYlv+jIXYlPVRrnLuLk5GsbrRQVyNU4xCR44O1TGOp9fDzcYf+yKzKAlAgke2udMq8ykHug+DGed1priQ51w0Tw2qsxPNPZUvMjNnGD/B4ysqtr7+IswbNSKOcPV7OlBynflW4DSjUJc+iAsi0FwVT8/EXfNXzD5grCOCxLSCXxMIL+lpdGE5oP/Df8EjgoVTIr8l8TYxSkRu8aodh1yJ0Mp86+PU8yJgyrtAnjE+kLEdevMtIy2rO7KY4k7jUZqbwJ668g4ePWlf3I+Ta1qPVopnjANH7fgF/WmJ0wqvyYQOHn3/uqok3siBztyGW09KbDvFTyYfjyZL2qxMy8U2pUpJU0bNY4DTgAoR1wN4LRR69Z/8L1GqngoqKIDG0HbGUIXVDcNNoYtEmfgNm8XygpNkYm52prz/0UL7q3jNOWqPfUvDLxuImnXOZUmyyCLhs5eeoZoFqKgdlM/FYLeN56Ocmpdwpi638txID+Qkx169aVhWsYjl5l9gpIB5el1vmTWHmbZ9Y/zJvwnDzuu3+cVjNlycx/rH00ehlPIMiYnjvFzuDVEktu7LL8Gi51b6XM7H6pcosyUNkfCBFAg7tOzHDyAKF4vpGivOs5vqPYUbqCXas0Rfg3vZQEazG7jq7IJaDBT66T0eSxhRRtRP+hVHNzmctXLjdUMLpRaG6PXz93NcudaHbxWLCR+SRHKY4HBgAfS+Je0 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:(13230031)(7416005)(376005)(82310400014)(36860700004)(1800799015);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 00:12:35.0939 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f99e027-0c30-4414-40a3-08dc52a99922 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: CY4PEPF0000E9DB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR04MB8097 X-Proofpoint-ORIG-GUID: nHpMqpoJ1mrr7prrOOz8KxzvLv56tl-q X-Proofpoint-GUID: nHpMqpoJ1mrr7prrOOz8KxzvLv56tl-q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-01_16,2024-04-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 impostorscore=0 malwarescore=0 mlxscore=0 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2404010168 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Keep track of bridge mdb objects in the driver. Similar to the previous patch, since the driver doesn't get explicit notifications about mdb group creation or destruction, just create the mdb group when the first port joins the group via mv88e6xxx_port_mdb_add(), and destroys the group when the last port left the group via mv88e6xxx_port_mdb_del(). Use the group's L2 address together with the VLAN ID as the key to the list. Port membership is again stored in a bitmask. Signed-off-by: Joseph Huang --- drivers/net/dsa/mv88e6xxx/chip.c | 117 +++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index f66ddde484dc..32a613c965b1 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -47,6 +47,14 @@ struct mv88e6xxx_bridge { struct list_head head; struct net_device *br_dev; u16 ports; + struct list_head br_mdb_list; +}; + +struct mv88e6xxx_br_mdb { + struct list_head head; + unsigned char addr[ETH_ALEN]; + u16 vid; + u16 portvec; }; static void assert_reg_lock(struct mv88e6xxx_chip *chip) @@ -2974,6 +2982,7 @@ mv88e6xxx_bridge_create(struct mv88e6xxx_chip *chip, struct net_device *br_dev) return ERR_PTR(-ENOMEM); mv_bridge->br_dev = br_dev; + INIT_LIST_HEAD(&mv_bridge->br_mdb_list); list_add(&mv_bridge->head, &chip->bridge_list); return mv_bridge; @@ -2984,6 +2993,7 @@ static void mv88e6xxx_bridge_destroy(struct mv88e6xxx_bridge *mv_bridge) list_del(&mv_bridge->head); WARN_ON(mv_bridge->ports); + WARN_ON(!list_empty(&mv_bridge->br_mdb_list)); kfree(mv_bridge); } @@ -6583,16 +6593,101 @@ static int mv88e6xxx_change_tag_protocol(struct dsa_switch *ds, return err; } +static struct mv88e6xxx_br_mdb * +mv88e6xxx_br_mdb_create(struct mv88e6xxx_bridge *mv_bridge, + const struct switchdev_obj_port_mdb *mdb) +{ + struct mv88e6xxx_br_mdb *mv_br_mdb; + + mv_br_mdb = kzalloc(sizeof(*mv_br_mdb), GFP_KERNEL); + if (!mv_br_mdb) + return ERR_PTR(-ENOMEM); + + ether_addr_copy(mv_br_mdb->addr, mdb->addr); + mv_br_mdb->vid = mdb->vid; + list_add(&mv_br_mdb->head, &mv_bridge->br_mdb_list); + + return mv_br_mdb; +} + +static void mv88e6xxx_br_mdb_destroy(struct mv88e6xxx_br_mdb *mv_br_mdb) +{ + list_del(&mv_br_mdb->head); + + WARN_ON(mv_br_mdb->portvec); + kfree(mv_br_mdb); +} + +static struct mv88e6xxx_br_mdb * +mv88e6xxx_br_mdb_find(struct mv88e6xxx_bridge *mv_bridge, + const struct switchdev_obj_port_mdb *mdb) +{ + struct mv88e6xxx_br_mdb *mv_br_mdb; + + list_for_each_entry(mv_br_mdb, &mv_bridge->br_mdb_list, head) + if (ether_addr_equal(mv_br_mdb->addr, mdb->addr) && + mv_br_mdb->vid == mdb->vid) + return mv_br_mdb; + + return NULL; +} + +static struct mv88e6xxx_br_mdb * +mv88e6xxx_br_mdb_get(struct mv88e6xxx_bridge *mv_bridge, + const struct switchdev_obj_port_mdb *mdb) +{ + struct mv88e6xxx_br_mdb *mv_br_mdb; + + mv_br_mdb = mv88e6xxx_br_mdb_find(mv_bridge, mdb); + if (!mv_br_mdb) + mv_br_mdb = mv88e6xxx_br_mdb_create(mv_bridge, mdb); + + return mv_br_mdb; +} + +static void mv88e6xxx_br_mdb_put(struct mv88e6xxx_br_mdb *mv_br_mdb) +{ + if (!mv_br_mdb->portvec) + mv88e6xxx_br_mdb_destroy(mv_br_mdb); +} + static int mv88e6xxx_port_mdb_add(struct dsa_switch *ds, int port, const struct switchdev_obj_port_mdb *mdb, struct dsa_db db) { struct mv88e6xxx_chip *chip = ds->priv; + struct mv88e6xxx_bridge *mv_bridge; + struct mv88e6xxx_br_mdb *mv_br_mdb; + struct net_device *orig_dev; + struct net_device *br_dev; int err; + orig_dev = mdb->obj.orig_dev; + br_dev = netdev_master_upper_dev_get(orig_dev); + if (!br_dev) + br_dev = orig_dev; + + mv_bridge = mv88e6xxx_bridge_by_dev(chip, br_dev); + if (!mv_bridge) + return -EINVAL; + + mv_br_mdb = mv88e6xxx_br_mdb_get(mv_bridge, mdb); + if (IS_ERR(mv_br_mdb)) + return PTR_ERR(mv_br_mdb); + + if (mv_br_mdb->portvec & BIT(port)) + return -EEXIST; + mv88e6xxx_reg_lock(chip); err = mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC); + + if (err) + goto out; + + mv_br_mdb->portvec |= BIT(port); + +out: mv88e6xxx_reg_unlock(chip); return err; @@ -6603,10 +6698,32 @@ static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port, struct dsa_db db) { struct mv88e6xxx_chip *chip = ds->priv; + struct mv88e6xxx_bridge *mv_bridge; + struct mv88e6xxx_br_mdb *mv_br_mdb; + struct net_device *orig_dev; + struct net_device *br_dev; int err; + orig_dev = mdb->obj.orig_dev; + br_dev = netdev_master_upper_dev_get(orig_dev); + if (!br_dev) + br_dev = orig_dev; + + mv_bridge = mv88e6xxx_bridge_by_dev(chip, br_dev); + if (!mv_bridge) + return -EINVAL; + + mv_br_mdb = mv88e6xxx_br_mdb_find(mv_bridge, mdb); + if (!mv_br_mdb) + return -ENOENT; + + if (!(mv_br_mdb->portvec & BIT(port))) + return -ENOENT; + mv88e6xxx_reg_lock(chip); err = mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, 0); + mv_br_mdb->portvec &= ~BIT(port); + mv88e6xxx_br_mdb_put(mv_br_mdb); mv88e6xxx_reg_unlock(chip); return err; From patchwork Tue Apr 2 00:11:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 13613180 X-Patchwork-Delegate: kuba@kernel.org Received: from mx0b-000eb902.pphosted.com (mx0b-000eb902.pphosted.com [205.220.177.212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 991AF8F55; Tue, 2 Apr 2024 00:12:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.212 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016778; cv=fail; b=FDFck6g87xjORP5m+t932K1YetvChLLA2OhizevtWySn/2jaVf7OaDDC9yl1UHL7zxqH4opdTVl+UYlTmVQgUxeQsjLpV3dxUu23vYoDoygUuhYx0lFtMcHmWp69JqsgiNLZJlH1uMzgdiZ/t7a1WqWIVi/TefVk/jyXxWrrSr8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016778; c=relaxed/simple; bh=5TGqXAvhXwrSbRgkS004xwxIpl8XG1LCoaH1KiwOVpo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pp473rXl5xU0M7FUV7Okq3MBeA4HK9sWGvgbPAVxoXP6VPJQGrPtxnWNJp+XVSqf3kGl89rBYJTLq6ky+Zc4I4VCgr80AYgUVeMYYbLUlN3WvuK/9I6mY+yOTYCC1p+nie6Rvn90y9GdadYNB/YVGks+vH9HbFWJlZrvu8G3zlg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com; spf=pass smtp.mailfrom=garmin.com; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=d2MgsXi/; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=WZsp86om; arc=fail smtp.client-ip=205.220.177.212 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=garmin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="d2MgsXi/"; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="WZsp86om" Received: from pps.filterd (m0220299.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 431IxkdW023959; Mon, 1 Apr 2024 19:12:40 -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=goUQk12ltS91eBM/WmM3D11GRLslmEU7So87SEeWlzM=; b=d2MgsXi/UhkC PF6IytJBK0xk0jgOvfDy5B4Qz6p7t8PYk6RsNy2y3UvK9qBns6vytqk5MJfA497R DzRQEcw3wJJd+JlE2FDEiwygMmEo94w38d2ReUd463scyQjBWzMCOUOT/YViD5la 3Vb9/BPHnGhspj5w78A5ZQpyVmug/mdJ514WJ4RVemEMFURUTJQlbcptY+GVknzp nv2KcIEcVeYvQyx2celxsoz5QkwDsgsM4SfOw+nB90gxq22ZKgkpYgj++GYbK1Uh ku6YDX0l64MfYpim5VbJ3iCyB5+HjaoxhdpRue/YE7swoCUwmTKCYLReb+HFMOJU 20q6HqhpSg== Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by mx0a-000eb902.pphosted.com (PPS) with ESMTPS id 3x80hys4n1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Apr 2024 19:12:40 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nRY+vpuRPURrVG3ddpqhEZK85/gLP+1/4ZjkrUcQv1/+Tm1nyY9W9NaWG6tfIxzt4hvQsI30+vHEKCEDEVllYQeFbXCZmgn+Q+Z3qsN2wP2aFkzRCAhwQBlLw+afCHbu0+t9bC7PsUdGroLgDgfiMDm2j7nqldyKXAJUeMG+WhJW7gCux/0PEjK8vWM9PeOo/v+KXZy7AkD2DUuu4lhPjn4wUGa1H5YofGDafUvqSb6uwtM3z4gjOprfDPP7URNbJlj+9kLtYywaoz7MjbCN1y5jmkecSAlAKqpTQVr4+pRJzYFFDyJVcm0C4m8Q+V8RheUCH5Hk6GzQCC3I2l72sg== 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=goUQk12ltS91eBM/WmM3D11GRLslmEU7So87SEeWlzM=; b=VRroQG9nl2QWAmCdugO5V7iGpSE/npjKqRgasRdc49RXcodGjZ0xDMR3GNMGxdkDKxaX5kyuTLLEErtLdHRs9Yr5nSwJdWO/5MnqXfzEsCgKT270tCP8T/vSx3I/5/2gH6ljeqHlJXFRit5nOHMudSOYVKumBvmVT8qb95fApDik7dX5BdRd4l4QGkzYYC8hegvxySQT5uMDItZZOoQ31mZfHdyUDaJtEpAv525CfER5l5XrTWV3lczFGbhbf7e7LRFJBgdQI0swPQ2wH0i7OGs275eYHRNUUHahbqQOvNnAJFSTOIQ2TME06X2xVUsVsXVhaFotVFWLxbyK0g7aVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=vger.kernel.org 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 (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=goUQk12ltS91eBM/WmM3D11GRLslmEU7So87SEeWlzM=; b=WZsp86ommixX0EuqsL3mK9TH6fhqgtXlXZ1BHwrkc+a7K6Xw0hijKTFLB/u8W9BYs4ICAMD/NBh9Wvqgb8eC8gocyYylVMZqVCHdHE5ZJN9Fog/a2G2uF2bN86LZaarsmdr9equo0C9dMOTn5wg/CB6LAF3EDkBiJ8zKxaMH1voV/V8VD0z6lwkackYN9b2FvzbBrra21HwM6KrNgRDH7hbve6bYiQYmQ/H4kk38wdFJvgZxHM1dt1bHk0JVw+LIi3QrhbDczLOVUcVpTdIOG9ybW1QCpJafGQ3B+T9zWCv0A9yW7omW7zPOTpqOzITAJ/FX69Z2SRx2MVD4KEfWPA== Received: from DM6PR06CA0017.namprd06.prod.outlook.com (2603:10b6:5:120::30) by SJ2PR04MB8534.namprd04.prod.outlook.com (2603:10b6:a03:4f4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 00:12:38 +0000 Received: from CH1PEPF0000AD7B.namprd04.prod.outlook.com (2603:10b6:5:120:cafe::1a) by DM6PR06CA0017.outlook.office365.com (2603:10b6:5:120::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46 via Frontend Transport; Tue, 2 Apr 2024 00:12:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from edgetransport.garmin.com (204.77.163.244) by CH1PEPF0000AD7B.mail.protection.outlook.com (10.167.244.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Tue, 2 Apr 2024 00:12:38 +0000 Received: from cv1wpa-exmb3.ad.garmin.com (10.5.144.73) by olawpa-edge2.garmin.com (10.60.4.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Mon, 1 Apr 2024 19:12:29 -0500 Received: from OLAWPA-EXMB2.ad.garmin.com (10.5.144.14) by cv1wpa-exmb3.ad.garmin.com (10.5.144.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.37; Mon, 1 Apr 2024 19:12:37 -0500 Received: from kc3wpa-exmb3.ad.garmin.com (10.65.32.83) by OLAWPA-EXMB2.ad.garmin.com (10.5.144.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.37; Mon, 1 Apr 2024 19:12:37 -0500 Received: from CAR-4RCMR33.ad.garmin.com (10.5.209.17) by mail.garmin.com (10.65.32.83) with Microsoft SMTP Server id 15.2.1258.32 via Frontend Transport; Mon, 1 Apr 2024 19:12:36 -0500 From: Joseph Huang To: CC: Joseph Huang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Roopa Prabhu" , Nikolay Aleksandrov , =?utf-8?q?Linus_L=C3=BCssing?= , , Subject: [PATCH RFC net-next 08/10] net: dsa: mv88e6xxx: Convert MAB to use bit flags Date: Mon, 1 Apr 2024 20:11:07 -0400 Message-ID: <20240402001137.2980589-9-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240402001137.2980589-1-Joseph.Huang@garmin.com> References: <20240402001137.2980589-1-Joseph.Huang@garmin.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD7B:EE_|SJ2PR04MB8534:EE_ X-MS-Office365-Filtering-Correlation-Id: 2cbedd3a-2d67-4f62-c60e-08dc52a99b0b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7JlLqAQsNgq03AzZjW0OLw6UKaI8N6gKb9pmpQMQ7mFfZFkHtqsk/n7ZiPmat4xyCEzn9SAnbnY+Uz8VZuRohecgXj6OVFVcWDBk7/OYbF0WVYYLWYK4oQvQolC1X7hzY79zwEp0ZrG/sRQDSmwpIvUgS+S2mFX6v3LWLubi727V4kzdt+hKZt5qM62cDayNOql3NKjCa+M9/VptgF/aV3J2+6pCa0+8nRIjwVjCxitJBBQ2tOIJXL2gx9gsjtV/zKu8a7ktLwKQIet8F0nvg+IF+yV9nEAY+0xx58lhbKQRXzFnTFj3sgDm58l822Vik9FwIIdqOPlWeRzYq4rVw1ZuJ+sZEkDsHu2P4sZRbAxb1ebYqIHUEBQTVgpjiboLihaMVGYvD73JD3MJ2Y8yx2VdMHQGl+DbGVrI8wJFG4QjVi+j+XixNObA0Y/XL9neoXRxMxcL5EEEBCj+zqaLBVq689Me66Dg3YuEUAJfh06tjz38OAnpNPgOdI+2fqcGDP8Gk5/QIhsGrQi8ZshCWgHVoorFGv0GLxMw2g2OEAEuSj1ZJ8/Cf84nhw1JaygcfGJu1D7HM4UvYFeztQHm/IIgcyo70UcQu+zOp22fNxjZtiw6JcIWJHwCmMm19MfJjOYVzsYN4oll3rZx6MS/ijhPlFoTWAmPb/8AHaPy0CV7BZrSqm2BXgPhhmYcgKeorjhL6VUZ/iS2yQ0tBTqYGTyiECAKsy5lOwXFbKq7u8+gxnCfu7tpgC9umu4dbiqh 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:(13230031)(376005)(82310400014)(36860700004)(7416005)(1800799015);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 00:12:38.2864 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2cbedd3a-2d67-4f62-c60e-08dc52a99b0b 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: CH1PEPF0000AD7B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR04MB8534 X-Proofpoint-GUID: PToDxVzJGDt2txwy7UwejQEUci7ug19t X-Proofpoint-ORIG-GUID: PToDxVzJGDt2txwy7UwejQEUci7ug19t X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-01_16,2024-04-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 suspectscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2404010168 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Convert MAB (MacAuth Bypass) flag to use bitmap. A new port flag will be added with a subsequent patch. Convert the 'mab' member to a bit in a bitmask to save space. Signed-off-by: Joseph Huang --- drivers/net/dsa/mv88e6xxx/chip.h | 12 ++++++++---- drivers/net/dsa/mv88e6xxx/global1_atu.c | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index a32e4564eb3d..205f6777c2ac 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -272,6 +272,9 @@ struct mv88e6xxx_vlan { bool valid; }; +/* MacAuth Bypass Control Flag */ +#define MV88E6XXX_PORT_FLAG_MAB BIT(0) + struct mv88e6xxx_port { struct mv88e6xxx_chip *chip; int port; @@ -288,9 +291,7 @@ struct mv88e6xxx_port { bool mirror_egress; struct devlink_region *region; void *pcs_private; - - /* MacAuth Bypass control flag */ - bool mab; + unsigned int flags; }; enum mv88e6xxx_region_id { @@ -802,7 +803,10 @@ static inline bool mv88e6xxx_is_invalid_port(struct mv88e6xxx_chip *chip, int po static inline void mv88e6xxx_port_set_mab(struct mv88e6xxx_chip *chip, int port, bool mab) { - chip->ports[port].mab = mab; + if (mab) + chip->ports[port].flags |= MV88E6XXX_PORT_FLAG_MAB; + else + chip->ports[port].flags &= ~MV88E6XXX_PORT_FLAG_MAB; } int mv88e6xxx_read(struct mv88e6xxx_chip *chip, int addr, int reg, u16 *val); diff --git a/drivers/net/dsa/mv88e6xxx/global1_atu.c b/drivers/net/dsa/mv88e6xxx/global1_atu.c index ce3b3690c3c0..06d0c526e33d 100644 --- a/drivers/net/dsa/mv88e6xxx/global1_atu.c +++ b/drivers/net/dsa/mv88e6xxx/global1_atu.c @@ -445,7 +445,8 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) fid); chip->ports[spid].atu_miss_violation++; - if (fid != MV88E6XXX_FID_STANDALONE && chip->ports[spid].mab) { + if (fid != MV88E6XXX_FID_STANDALONE && + !!(chip->ports[spid].flags & MV88E6XXX_PORT_FLAG_MAB)) { err = mv88e6xxx_handle_miss_violation(chip, spid, &entry, fid); if (err) From patchwork Tue Apr 2 00:11:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 13613183 X-Patchwork-Delegate: kuba@kernel.org Received: from mx0b-000eb902.pphosted.com (mx0b-000eb902.pphosted.com [205.220.177.212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1069217C7F; Tue, 2 Apr 2024 00:13:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.212 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016785; cv=fail; b=gHLuP/r7OjAy4M7uQR9oR4PaDQySFkOSZkemvaAkUVmB/iraBmwyttCtdHy6l4pqFOk7q03h/LKu7XwoouK6IMSr032Z+X86WefWksb5PGoQkFV3j0jdA8Lc+avoSDP+5dVBBsSEhgrLeTW8fsGjB2vULos2jtl1UoKlTAKuy0Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016785; c=relaxed/simple; bh=Wc73mW7EnGFKOH9xhFC4rNfn4cnTBtDwqBe/JF6WTO4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Qq0rj54Lh8OYgxM/3qklY20krzG/svE8Gxz1bljWc0hp5TzVLw+djFWy4FtFEdjGOhw79N/rAU1q6fLcq2WjE4EUXHGopsoB+esv/8SdUdc5wunAtp2JANj4guOJmjyHmil8qimEuDaI2RW3qXf5Fs7Gm0CSFX1jf9TC+vp1Ni4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com; spf=pass smtp.mailfrom=garmin.com; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=tvd8MLjO; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=AfPqKO0I; arc=fail smtp.client-ip=205.220.177.212 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=garmin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="tvd8MLjO"; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="AfPqKO0I" Received: from pps.filterd (m0220297.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 431IxpjL002781; Mon, 1 Apr 2024 19:12:46 -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=mMJgjAePvMZmBF+A9ormyhlsr8Ss5uPilTWqIEI2O+Y=; b=tvd8MLjO5dMt G8E8bj6/mC64+idH3j0Rmz0QprIvoGHwpuGSyKwYLUCoi6qr/inIGaaW0ETQAm/N stgBxCMQAFj5yBOgBjhK6jQdhk0HPWcsUobkUOCcPeJnnb+xvHoIHTPjX/fpFDgZ 79K4NaTELt5XAqou40+faT2g6Cg7l0fa+H/S0Xk7Jw4k9B1QVxtSlS8cdBXgFp0p WzIy1iYnvu9zUHRLScjScGjD0nbiueIteDGSBIwf50rYDQ+wy9n1B/9ZYP8ULQ+Q hD+JgNL+7+R3aLgw6IeAImtZqFdUrzuV5wzdWQ8uVerf0MQoOTAotyHmDvXJpFnc agDu60RTXg== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by mx0a-000eb902.pphosted.com (PPS) with ESMTPS id 3x808696h9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Apr 2024 19:12:46 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CjJUIMQzvlgo5rsOG1UkE5itxULbfNTWsf+L7PRMbouELAGBVZcupykWrGA5pJd4uDLYyiizR266tYpX+4h8pHxCjwJaV9fVkjxmxQIQxxazcsUg63wAOBJlft/aqALqBJsribHCx9KhSOZb5WKxhZcuE4cmnztJfdbKg2xhOHvEzzklAKIQUThhT8oTJBn656eXlY+BDdWVj2REyOQ4fWcOkNSYNcxXD9swF47kdyiCGZ+2wKRqlUc6EWxw88su3tM+HI3CVXG+efM8v+lljP8pv2Lb00bhmLaVK2Yujh8bv0ynWzp6lLl4XNwZI9fXHRi2ObULPsnywU94UbrrpQ== 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=mMJgjAePvMZmBF+A9ormyhlsr8Ss5uPilTWqIEI2O+Y=; b=JXNWAAURgho2lZ3PVW5TGtMmA9jTLkgoKPKFGcoJhnpSwokHxiVWY6zHX1ri/yQPlZnJGBoA+x7hr7QlM5OjEtM+M1VZqGfZok0p1b5X566osw7grdE8p1a56Yb9DtCr3SF8hx3KqXgFguUdD6h4cmjiU/et8CAIaW9QYFbeyE/otQXaeFaHiA1D7Tx14eYIxNiOoGhVV1vrHJBcm/SjbNTnBMNnU42eD+egE35eFbQtO50DpHMmoJr+fM2lRy67CGEq87Gq7ePu09U+37LwPNchRju72H/rlVCKrAYu2IH0vgip+/OU25UCxsHjmJ9dFLEUiy+U61sXHg4Cf0vTHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=vger.kernel.org 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 (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mMJgjAePvMZmBF+A9ormyhlsr8Ss5uPilTWqIEI2O+Y=; b=AfPqKO0IZLdUuYq5scLrWhHVVn5V7JE8Qk5VVhK69Rk2S6kj1fI0lS1Ok730gfEifCxaIsjdqdrAU10oFU7fBKfGlknEOPo9T1zS6iMplO1pWU9kfBCpkpuPSn0XiHv1BPdtfJCPzklRX415Ndt11QAGwPKbuuvsvNgHt1RXN30xqqinjoOfEcXMXloHa/VW1zszmFQ4sBY9An3ExsuipS+dNcq6AWbZT1kyif5QPKdVId22iNzJM2wP513+RrBsR9riTfL0RqmOeKtYJYGf2LGGxTDWijPoPbK9LJ49Wv88OzvwbXfzNX6US4KmhVr79JrSfwSMq3vUPPwUehky8g== Received: from PH7PR17CA0003.namprd17.prod.outlook.com (2603:10b6:510:324::23) by DM6PR04MB7004.namprd04.prod.outlook.com (2603:10b6:5:245::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 00:12:42 +0000 Received: from CY4PEPF0000E9D9.namprd05.prod.outlook.com (2603:10b6:510:324:cafe::6c) by PH7PR17CA0003.outlook.office365.com (2603:10b6:510:324::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46 via Frontend Transport; Tue, 2 Apr 2024 00:12:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from edgetransport.garmin.com (204.77.163.244) by CY4PEPF0000E9D9.mail.protection.outlook.com (10.167.241.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Tue, 2 Apr 2024 00:12:42 +0000 Received: from OLAWPA-EXMB1.ad.garmin.com (10.5.144.23) by olawpa-edge4.garmin.com (10.60.4.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Mon, 1 Apr 2024 19:12:34 -0500 Received: from cv1wpa-exmb5.ad.garmin.com (10.5.144.75) by olawpa-exmb1.ad.garmin.com (10.5.144.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Mon, 1 Apr 2024 19:12:41 -0500 Received: from kc3wpa-exmb3.ad.garmin.com (10.65.32.83) by cv1wpa-exmb5.ad.garmin.com (10.5.144.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.32; Mon, 1 Apr 2024 19:12:40 -0500 Received: from CAR-4RCMR33.ad.garmin.com (10.5.209.17) by mail.garmin.com (10.65.32.83) with Microsoft SMTP Server id 15.2.1258.32 via Frontend Transport; Mon, 1 Apr 2024 19:12:39 -0500 From: Joseph Huang To: CC: Joseph Huang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Roopa Prabhu" , Nikolay Aleksandrov , =?utf-8?q?Linus_L=C3=BCssing?= , , Subject: [PATCH RFC net-next 09/10] net: dsa: mv88e6xxx: Enable mc flood for mrouter port Date: Mon, 1 Apr 2024 20:11:08 -0400 Message-ID: <20240402001137.2980589-10-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240402001137.2980589-1-Joseph.Huang@garmin.com> References: <20240402001137.2980589-1-Joseph.Huang@garmin.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D9:EE_|DM6PR04MB7004:EE_ X-MS-Office365-Filtering-Correlation-Id: 3dc8e2b4-5a84-4462-d0e1-08dc52a99d48 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8ijRXn2wR6VV5h88zPUj8FZVMIyktsqRphsNs3tPS6xFISAQfkl48MqDOtCUotmMXoacrAPPWClcBO/xXxUhWFpyS4WYrorQYgOjBNzXT4wHDhOwuc2KrKiirgS1jckKvk8H4sNA7hXgp2QfTdboiI6e1cVxpgFfPCEBGalpzMInuASJd9scA2+PkjHQBzm76vC6VK5J6mNYFVdA/7olpl3PDPTVFZDZLnRfeAvaKdmP2dPsrgm2f3okZoEsQ59YmG8rUyW5eOn6ACPpc2nktw8s7Vzlwsv6Jsbgiypo9i1+hFoCAV5/YXTDKAuuBIvqjGGZYNneFs5RQzfF927JUYO8Lvht0JbubtMjMyjOABW9hiyNjauVaNZvNE+zn4jxWtSJIRSML1agoqbAHR9HaE9YgzEhmtk2fYq6kq8d9lpdhAfTIEpNu+GTvhj40eS2dHRRZU3DRZNPs+n5P5E0i+rbOupQCygflsrBgBxuCLmzqk5GCjvvfNM7ZVctSahlD/Ygsr7t8kp4+V/Kcdt13+gC1+OgfVGNwa/RjMgC9fRKF/l5VrFCer54FzbLVe1eKxTcvqpCW5VshJdEriaILbPfmW06GJ1NzI/PG3Gl2ZmriEFAWpgP7zi20f8+rMT1TqBGXAcoy0dMighjIzbg7pmDBgBKrhMPNxttxE7n4B267/EPKATeMlU2g5/MDhuP5uDjb6/NHEwM8UuoS5/urY8xZxQncfn6HqhBLqvfaFQs1EzVTwtFwDwkXvz1DqpM 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:(13230031)(1800799015)(376005)(82310400014)(7416005)(36860700004);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 00:12:42.0107 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3dc8e2b4-5a84-4462-d0e1-08dc52a99d48 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: CY4PEPF0000E9D9.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB7004 X-Proofpoint-ORIG-GUID: 9AFrCKegaumqDp1-oi1oZPU64ACH3ExY X-Proofpoint-GUID: 9AFrCKegaumqDp1-oi1oZPU64ACH3ExY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-01_16,2024-04-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 impostorscore=0 malwarescore=0 mlxscore=0 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2404010168 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC When a port turns into an mrouter port, enable multicast flooding on that port even if multicast flooding is disabled by user config. This is necessary so that in a distributed system, the multicast packets can be forwarded 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 multicast flooding is disabled on the mrouter port on Snooping Bridge 2. Signed-off-by: Joseph Huang --- drivers/net/dsa/mv88e6xxx/chip.c | 86 ++++++++++++++++++++++++++++++-- drivers/net/dsa/mv88e6xxx/chip.h | 1 + 2 files changed, 83 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 32a613c965b1..9831aa370921 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -47,6 +47,7 @@ struct mv88e6xxx_bridge { struct list_head head; struct net_device *br_dev; u16 ports; + u16 mrouter_ports; struct list_head br_mdb_list; }; @@ -2993,6 +2994,7 @@ static void mv88e6xxx_bridge_destroy(struct mv88e6xxx_bridge *mv_bridge) list_del(&mv_bridge->head); WARN_ON(mv_bridge->ports); + WARN_ON(mv_bridge->mrouter_ports); WARN_ON(!list_empty(&mv_bridge->br_mdb_list)); kfree(mv_bridge); } @@ -3010,6 +3012,19 @@ struct mv88e6xxx_bridge *mv88e6xxx_bridge_by_dev(struct mv88e6xxx_chip *chip, return NULL; } +static +struct mv88e6xxx_bridge *mv88e6xxx_bridge_by_port(struct mv88e6xxx_chip *chip, + int port) +{ + struct mv88e6xxx_bridge *mv_bridge; + + list_for_each_entry(mv_bridge, &chip->bridge_list, head) + if (mv_bridge->ports & BIT(port)) + return mv_bridge; + + return NULL; +} + static struct mv88e6xxx_bridge * mv88e6xxx_bridge_get(struct mv88e6xxx_chip *chip, struct net_device *br_dev) { @@ -6849,11 +6864,28 @@ static int mv88e6xxx_port_bridge_flags(struct dsa_switch *ds, int port, if (flags.mask & BR_MCAST_FLOOD) { bool multicast = !!(flags.val & BR_MCAST_FLOOD); + struct mv88e6xxx_bridge *mv_bridge; + struct mv88e6xxx_port *p; + bool mrouter; - err = chip->info->ops->port_set_mcast_flood(chip, port, - multicast); - if (err) - goto out; + mv_bridge = mv88e6xxx_bridge_by_port(chip, port); + if (!mv_bridge) + return -EINVAL; + + p = &chip->ports[port]; + mrouter = !!(mv_bridge->mrouter_ports & BIT(port)); + + if (!mrouter) { + err = chip->info->ops->port_set_mcast_flood(chip, port, + multicast); + if (err) + goto out; + } + + if (multicast) + p->flags |= MV88E6XXX_PORT_FLAG_MC_FLOOD; + else + p->flags &= ~MV88E6XXX_PORT_FLAG_MC_FLOOD; } if (flags.mask & BR_BCAST_FLOOD) { @@ -6883,6 +6915,51 @@ static int mv88e6xxx_port_bridge_flags(struct dsa_switch *ds, int port, return err; } +static int mv88e6xxx_port_mrouter(struct dsa_switch *ds, int port, + bool mrouter, + struct netlink_ext_ack *extack) +{ + struct mv88e6xxx_chip *chip = ds->priv; + struct mv88e6xxx_bridge *mv_bridge; + struct mv88e6xxx_port *p; + bool old_mrouter; + bool mc_flood; + int err; + + if (!chip->info->ops->port_set_mcast_flood) + return -EOPNOTSUPP; + + mv_bridge = mv88e6xxx_bridge_by_port(chip, port); + if (!mv_bridge) + return -EINVAL; + + old_mrouter = !!(mv_bridge->mrouter_ports & BIT(port)); + if (mrouter == old_mrouter) + return 0; + + p = &chip->ports[port]; + mc_flood = !!(p->flags & MV88E6XXX_PORT_FLAG_MC_FLOOD); + + mv88e6xxx_reg_lock(chip); + + if (!mc_flood) { + err = chip->info->ops->port_set_mcast_flood(chip, port, + mrouter); + if (err) + goto out; + } + + if (mrouter) + mv_bridge->mrouter_ports |= BIT(port); + else + mv_bridge->mrouter_ports &= ~BIT(port); + +out: + mv88e6xxx_reg_unlock(chip); + + return err; +} + static bool mv88e6xxx_lag_can_offload(struct dsa_switch *ds, struct dsa_lag lag, struct netdev_lag_upper_info *info, @@ -7199,6 +7276,7 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = { .port_bridge_leave = mv88e6xxx_port_bridge_leave, .port_pre_bridge_flags = mv88e6xxx_port_pre_bridge_flags, .port_bridge_flags = mv88e6xxx_port_bridge_flags, + .port_mrouter = mv88e6xxx_port_mrouter, .port_stp_state_set = mv88e6xxx_port_stp_state_set, .port_mst_state_set = mv88e6xxx_port_mst_state_set, .port_fast_age = mv88e6xxx_port_fast_age, diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index 205f6777c2ac..47e056dc7925 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -274,6 +274,7 @@ struct mv88e6xxx_vlan { /* MacAuth Bypass Control Flag */ #define MV88E6XXX_PORT_FLAG_MAB BIT(0) +#define MV88E6XXX_PORT_FLAG_MC_FLOOD BIT(1) struct mv88e6xxx_port { struct mv88e6xxx_chip *chip; From patchwork Tue Apr 2 00:11:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Huang X-Patchwork-Id: 13613184 X-Patchwork-Delegate: kuba@kernel.org Received: from mx0a-000eb902.pphosted.com (mx0a-000eb902.pphosted.com [205.220.165.212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2C198BE5; Tue, 2 Apr 2024 00:13:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.212 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016790; cv=fail; b=ZzKDpU0WBu3GlPEbTWTbbcDSmZJqXJl0QJD1oY7Av1nf5jmR1oB+iI+cyOPsZoQ/BaDhRRTdfOz4FWFPDXIL2lHfX3f5xeFWKuy+oC0XPcaB72gWibkqVBZDiCrtfNec0/0+KcQVO48L56wGYHK1rbNFlkmjI8eG4F8mZV85JuQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712016790; c=relaxed/simple; bh=d5S34E/iXzM43tARvSbiaNhoyfF8l5I8oWBQHnKRCkM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mFrXV9Mng1JRBneIAzQ5UTeYk+0qBjAVGw+RKMlv8d2aR0Pg/YA2URASQ/z8D4ZGAm0FJ+2Odo8EPFXEO35o7v2SMM4Ry7No+8kyHE2qM7GnOFddRDYTqnEkpyT/tiXqEwq+NlQb4xaVGa1J5ROR9BYfjWxa0Lsgyn//aZpQzd0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com; spf=pass smtp.mailfrom=garmin.com; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=BrZtose8; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b=Nq/vjVmH; arc=fail smtp.client-ip=205.220.165.212 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=garmin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=garmin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="BrZtose8"; dkim=pass (2048-bit key) header.d=garmin.com header.i=@garmin.com header.b="Nq/vjVmH" Received: from pps.filterd (m0220296.ppops.net [127.0.0.1]) by mx0a-000eb902.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 431IxgfX023122; Mon, 1 Apr 2024 19:12:49 -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=hLplZnSuUkFYB855mcaK/aOKAKXTOkfxg/5K7XfhhUE=; b=BrZtose82gMH JuVwK63caSknRsyytO9873027JNQIkknVKlxJc49J/KnIfyykACq+MwAyhCzmoxt Mapa+khM7nKmwikod/ycPyJ+OBY6mQM+t1xYJoUlJQLX/P9xvLVWZ1kFTRraOekO Vn6oML8hlra9xa2U81m7dgFtC2pqP32UpSxlx1YTN7mslVP4GZSGNA0Zsw9KV2qi Xwh3m6feAA9dU8sFxwDkLXXLxLrgA5BXnIBkSH6rNhHV3GT+bEnRifSZAGW7li54 7F4ry7kL/E5KSPerU2hQTKz7KFYL/mL9XTw6wElXICnHvtk0Gx2ukZ6yyavpz6mT vljQxuVTVA== Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by mx0a-000eb902.pphosted.com (PPS) with ESMTPS id 3x6g44qfce-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Apr 2024 19:12:49 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KlfCv64nN/xzh++GZ/IbJgf4+3ecc0JmeJt0z6i0OfA7fbeKf+b3wTtmy+I3MOvq1Sx7sg9KXjnihHNLgergct54Bg1bDRitQR//WP9cfAtWw8FFI+6rflPevFGHZSNfZTtFR+v2NNyOKZFvFxLTAu6J9LhQNz3BRB0POuRWLFK36s5qkf3RstTOQ/Fbh9JRFhCZuQ7TCL4JF+U5cxcRESydaRKP7nUF34WHNBd4KFWhgG3HwRk9uQD2bIBbuM23i1MlFVFmebXUVp+EVQl5kq48e6oQ0Y8APiC/whFdHqIMjnQsXUB6jo/kHa7yDLQ42cWu/k4/LeKGV2KVNTdenA== 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=hLplZnSuUkFYB855mcaK/aOKAKXTOkfxg/5K7XfhhUE=; b=LYymD/8z+H9bwbemBrbpdztDya2VCSG5i4nI8IV7zPsTSyT7KhZTzVjKHedzMAp3K0/UJeklh5PqcUsQYqUf7sAsnjid3VLEk3TE3wtIcB/i2WV6Ce4hGf1SlI5cegYkbtup0MRpwzckKkgt6hcoa4k9PnDtbTuyqqCW9aMv18VvFEtHevBN0lWrMWn33GltpOGYzAY+xRu1T785/n13OFciqDj1RPFxaeUF3jyivS3g3rNc7jlL8c2X6BFCQet2Up6XP9iuEUtZtZiU578YVpw4izaGorG0XB2P7d4mYQ2p0o39w1NjYBypRYUefEapPksogEdR9T8I/Kct4xbFvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 204.77.163.244) smtp.rcpttodomain=vger.kernel.org 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 (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garmin.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hLplZnSuUkFYB855mcaK/aOKAKXTOkfxg/5K7XfhhUE=; b=Nq/vjVmHfYf50gEe8YJDKBdy3rYWJygOrOhTdZX652bZ0zR9mqXbFGu/RLlZR/qqYLiLwFXQ3IkavPx6Ei+FN6PQBy2EJw2TdmzshdWDQGOageKkUVcfQDG/xnOsEFDl+m2ulzaDJpAT1OaZh078TP67hiLlbyq1JDjPd/giTAkdKq1IOolBUGhiippf33sZkvgJJN6U30U6acWo/qc7Tb1mnJJq/5oqmTtfTdkF9JaI+ch1H9tf2zvW9ghWhze/K1uN5mUAHtkHT1YoRYGv3Q4LNiY6jPBmMcnSroga3DCeogTgho4OHIdDwBm7ynOAmwVIAzm00AqSMijvz4ZziQ== Received: from CH2PR08CA0009.namprd08.prod.outlook.com (2603:10b6:610:5a::19) by SJ0PR04MB7744.namprd04.prod.outlook.com (2603:10b6:a03:32e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 2 Apr 2024 00:12:47 +0000 Received: from CH3PEPF00000017.namprd21.prod.outlook.com (2603:10b6:610:5a:cafe::25) by CH2PR08CA0009.outlook.office365.com (2603:10b6:610:5a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46 via Frontend Transport; Tue, 2 Apr 2024 00:12:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 204.77.163.244) smtp.mailfrom=garmin.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from edgetransport.garmin.com (204.77.163.244) by CH3PEPF00000017.mail.protection.outlook.com (10.167.244.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.0 via Frontend Transport; Tue, 2 Apr 2024 00:12:47 +0000 Received: from OLAWPA-EXMB12.ad.garmin.com (10.5.144.16) by olawpa-edge1.garmin.com (10.60.4.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Mon, 1 Apr 2024 19:12:36 -0500 Received: from cv1wpa-exmb5.ad.garmin.com (10.5.144.75) by OLAWPA-EXMB12.ad.garmin.com (10.5.144.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Mon, 1 Apr 2024 19:12:45 -0500 Received: from kc3wpa-exmb3.ad.garmin.com (10.65.32.83) by cv1wpa-exmb5.ad.garmin.com (10.5.144.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.32; Mon, 1 Apr 2024 19:12:44 -0500 Received: from CAR-4RCMR33.ad.garmin.com (10.5.209.17) by mail.garmin.com (10.65.32.83) with Microsoft SMTP Server id 15.2.1258.32 via Frontend Transport; Mon, 1 Apr 2024 19:12:43 -0500 From: Joseph Huang To: CC: Joseph Huang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Roopa Prabhu" , Nikolay Aleksandrov , =?utf-8?q?Linus_L=C3=BCssing?= , , Subject: [PATCH RFC net-next 10/10] net: dsa: mv88e6xxx: Offload mrouter port Date: Mon, 1 Apr 2024 20:11:09 -0400 Message-ID: <20240402001137.2980589-11-Joseph.Huang@garmin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240402001137.2980589-1-Joseph.Huang@garmin.com> References: <20240402001137.2980589-1-Joseph.Huang@garmin.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000017:EE_|SJ0PR04MB7744:EE_ X-MS-Office365-Filtering-Correlation-Id: acdae5a1-2fdc-4f7c-1289-08dc52a9a049 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pQuscw4fHJaKklmvZYr7oaVf8CgfhQJD78w6urgU6SVD2pnkvZBAQxntaxF6ZltRLQtllrFVrK0Z701tfwsxchyF4KPhLaY/LfrNpllG4+67gUVcTQ00Pc68ceS5bPcn30dEwnbw3KDndvanGVvkVddhoQ6f2daydj87BYsz6Rsmf6S8ydYr/tgt7HSQ9g+tFnlbiXab33fJ6Z8AzyfaQaAw4pUwOv7VnCsMeGDjgasNRvwzvUfQqZUMtKw1jOr7OP6Eq1D8Ce8ao3wLEh9/ITaQ8txCT/NrMAEW33J3akxXWV//lvV3sfhTEU8+koUSIJRoEPVVMt4vbYhlhF8pqHhM41rBBiUDf6na5FuVA7wR5VHv0SIhPb7tgucXl+lXaH9JlLsjFizbikvPpxUnE/7UV1PWWaF+iul6CAkVkVj4Zj/V7mJyt1lhdL1pcu6YGq1thOGdR8UgIw20RzaioKjgZ31LcL8ZTgLBX+jv5EXSYX99cUpuGZlGP8Atmm9OmEfnW4qO5G1tqIzqPJBwtmeQTgZECNzk52mVyE9/U3OBt24TKjrntNWqLq7CL4I3c/3l8luj9ZTzaGoLzccltQpjVI536M7DukG9Jd+ulHRLG5wEY3BKOqLHUMane43HQJ3wdbZ+en5OQ7RAkzV9+a0wfJSVqxFZKXPvLdfctF2vs1HFKUTESKZKml11n0Ro+F2uw4zwWiEE0cw8pC83KE/oieIwQvJViaQ+Xe7h/m4/Hg4vWg2lePpk4aBM6MWT 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:(13230031)(36860700004)(82310400014)(7416005)(376005)(1800799015);DIR:OUT;SFP:1102; X-OriginatorOrg: garmin.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2024 00:12:47.0768 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: acdae5a1-2fdc-4f7c-1289-08dc52a9a049 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: CH3PEPF00000017.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR04MB7744 X-Proofpoint-GUID: z5TMBgS6yqwOLReJtOEv4nMEwdA-lVFd X-Proofpoint-ORIG-GUID: z5TMBgS6yqwOLReJtOEv4nMEwdA-lVFd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-01_17,2024-04-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 priorityscore=1501 phishscore=0 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2404020000 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Offload mrouter port forwarding to mv88e6xxx. Currently multicast snooping fails to forward traffic in some cases where there are 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 unto the switch chip 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 switch chip of Snooping Bridge 2. Even if nbp_switchdev_allowed_egress() did not block the forwarding, it would still be better to offload the forwarding to the switch rather than letting the bridge handle the forwarding in software. Before this patch, mv88e6xxx programming matches exactly with mdb: +-----+ | mdb | +-----+ | +----------------------------------------------+ | | +--------------------------------+ | | | | both in mdb and mv88e6xxx | | | | | +------+ +------+ +------+ | | | +--------|-| port |---| port |---| port | | | | | +------+ +------+ +------+ | | | mv88e6xxx +--------------------------------+ | +----------------------------------------------+ After this patch, some entries will only exist in mv88e6xxx and not in mdb: +-----+ | mdb | +-----+ | +---------------------------------------------------------------------+ | | +--------------------------------++---------------------+ | | | | both in mdb and mv88e6xxx || only in mv88e6xxx | | | | | +------+ +------+ +------+ || +------+ +------+ | | | +--------|-| port |---| port |---| port |-||-| mr |---| mr | | | | | +------+ +------+ +------+ || +------+ +------+ | | | mv88e6xxx +--------------------------------++---------------------+ | +---------------------------------------------------------------------+ Signed-off-by: Joseph Huang --- drivers/net/dsa/mv88e6xxx/chip.c | 104 ++++++++++++++++++++++++++++--- 1 file changed, 94 insertions(+), 10 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 9831aa370921..ab519e4d9e4f 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -2194,13 +2194,10 @@ mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port, return err; } -static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port, - const unsigned char *addr, u16 vid, - u8 state) +static int mv88e6xxx_fid_from_vid(struct mv88e6xxx_chip *chip, u16 vid, + u16 *fid) { - struct mv88e6xxx_atu_entry entry; struct mv88e6xxx_vtu_entry vlan; - u16 fid; int err; /* Ports have two private address databases: one for when the port is @@ -2211,7 +2208,7 @@ static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port, * VLAN ID into the port's database used for VLAN-unaware bridging. */ if (vid == 0) { - fid = MV88E6XXX_FID_BRIDGED; + *fid = MV88E6XXX_FID_BRIDGED; } else { err = mv88e6xxx_vtu_get(chip, vid, &vlan); if (err) @@ -2221,9 +2218,24 @@ static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port, if (!vlan.valid) return -EOPNOTSUPP; - fid = vlan.fid; + *fid = vlan.fid; } + return 0; +} + +static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port, + const unsigned char *addr, u16 vid, + u8 state) +{ + struct mv88e6xxx_atu_entry entry; + u16 fid; + int err; + + err = mv88e6xxx_fid_from_vid(chip, vid, &fid); + if (err) + return err; + entry.state = 0; ether_addr_copy(entry.mac, addr); eth_addr_dec(entry.mac); @@ -2255,6 +2267,30 @@ static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port, return mv88e6xxx_g1_atu_loadpurge(chip, fid, &entry); } +static int mv88e6xxx_port_mdb_load_purge(struct mv88e6xxx_chip *chip, + int portvec, + const unsigned char *addr, + u16 vid) +{ + struct mv88e6xxx_atu_entry entry; + u16 fid; + int err; + + err = mv88e6xxx_fid_from_vid(chip, vid, &fid); + if (err) + return err; + + memset(&entry, 0, sizeof(entry)); + ether_addr_copy(entry.mac, addr); + entry.portvec = portvec; + if (!entry.portvec) + entry.state = 0; + else + entry.state = MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC; + + return mv88e6xxx_g1_atu_loadpurge(chip, fid, &entry); +} + static int mv88e6xxx_policy_apply(struct mv88e6xxx_chip *chip, int port, const struct mv88e6xxx_policy *policy) { @@ -6666,6 +6702,12 @@ static void mv88e6xxx_br_mdb_put(struct mv88e6xxx_br_mdb *mv_br_mdb) mv88e6xxx_br_mdb_destroy(mv_br_mdb); } +static u16 mv88e6xxx_br_mdb_portvec_fixup(struct mv88e6xxx_bridge *mv_bridge, + u16 portvec) +{ + return portvec ? (portvec | mv_bridge->mrouter_ports) : portvec; +} + static int mv88e6xxx_port_mdb_add(struct dsa_switch *ds, int port, const struct switchdev_obj_port_mdb *mdb, struct dsa_db db) @@ -6675,6 +6717,7 @@ static int mv88e6xxx_port_mdb_add(struct dsa_switch *ds, int port, struct mv88e6xxx_br_mdb *mv_br_mdb; struct net_device *orig_dev; struct net_device *br_dev; + u16 portvec; int err; orig_dev = mdb->obj.orig_dev; @@ -6693,9 +6736,11 @@ static int mv88e6xxx_port_mdb_add(struct dsa_switch *ds, int port, if (mv_br_mdb->portvec & BIT(port)) return -EEXIST; + portvec = mv_br_mdb->portvec | BIT(port); + portvec = mv88e6xxx_br_mdb_portvec_fixup(mv_bridge, portvec); + mv88e6xxx_reg_lock(chip); - err = mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, - MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC); + err = mv88e6xxx_port_mdb_load_purge(chip, portvec, mdb->addr, mdb->vid); if (err) goto out; @@ -6717,6 +6762,7 @@ static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port, struct mv88e6xxx_br_mdb *mv_br_mdb; struct net_device *orig_dev; struct net_device *br_dev; + u16 portvec; int err; orig_dev = mdb->obj.orig_dev; @@ -6735,8 +6781,11 @@ static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port, if (!(mv_br_mdb->portvec & BIT(port))) return -ENOENT; + portvec = mv_br_mdb->portvec & ~BIT(port); + portvec = mv88e6xxx_br_mdb_portvec_fixup(mv_bridge, portvec); + mv88e6xxx_reg_lock(chip); - err = mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, 0); + err = mv88e6xxx_port_mdb_load_purge(chip, portvec, mdb->addr, mdb->vid); mv_br_mdb->portvec &= ~BIT(port); mv88e6xxx_br_mdb_put(mv_br_mdb); mv88e6xxx_reg_unlock(chip); @@ -6921,9 +6970,11 @@ static int mv88e6xxx_port_mrouter(struct dsa_switch *ds, int port, { struct mv88e6xxx_chip *chip = ds->priv; struct mv88e6xxx_bridge *mv_bridge; + struct mv88e6xxx_br_mdb *mv_br_mdb; struct mv88e6xxx_port *p; bool old_mrouter; bool mc_flood; + u16 portvec; int err; if (!chip->info->ops->port_set_mcast_flood) @@ -6949,11 +7000,44 @@ static int mv88e6xxx_port_mrouter(struct dsa_switch *ds, int port, goto out; } + list_for_each_entry(mv_br_mdb, &mv_bridge->br_mdb_list, head) { + portvec = mv_br_mdb->portvec; + portvec = mv88e6xxx_br_mdb_portvec_fixup(mv_bridge, portvec); + + if (mrouter) + portvec |= BIT(port); + else + portvec &= ~BIT(port); + + err = mv88e6xxx_port_mdb_load_purge(chip, portvec, + mv_br_mdb->addr, + mv_br_mdb->vid); + if (err) + goto out_port_mdb_load_purge; + } + if (mrouter) mv_bridge->mrouter_ports |= BIT(port); else mv_bridge->mrouter_ports &= ~BIT(port); + mv88e6xxx_reg_unlock(chip); + + return 0; + +out_port_mdb_load_purge: + list_for_each_entry_continue_reverse(mv_br_mdb, + &mv_bridge->br_mdb_list, + head) { + portvec = mv_br_mdb->portvec; + portvec = mv88e6xxx_br_mdb_portvec_fixup(mv_bridge, portvec); + mv88e6xxx_port_mdb_load_purge(chip, portvec, + mv_br_mdb->addr, + mv_br_mdb->vid); + } + + if (!mc_flood) + chip->info->ops->port_set_mcast_flood(chip, port, old_mrouter); out: mv88e6xxx_reg_unlock(chip);