From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796392438; b=epO3psvgaXPH4ZqDFZcJS5S+NeoUlj5Aqo9YkCBEStELWG9fwzDk7clq/9Uw/oMT9UBm bL8VgLMnoqB1ah59OR5k2qEP8Fja9ttuExxWWrsUqbrjsltU2lBC7/qaM09NBmjMBZhA7 HHt0+nETBg8Quz4+k5H2mVgw5ucCkEyXSLyzueDcfoPdIWxQAwjrE/dV2dQewVxiYH/Nm VM3vZ6uCXKw2ApdlL0aX6hwM4ZWWYK5Rhh3s+K5gtoLqvWtRUBzUj0AUoWyR87FwaXL0U 0dHQBAHFo+AffeNJySVtHfDbQXfUjAeJTXrDkeCdJbq1b7OzdmDNpqEsWwJU5xAb4eA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796392438; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:From:To:Cc:Subject:Date: Message-ID:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Scanned-By; bh=4k08jr6lkNqsHXr5rjuxCZnS01fD0rLENqBCVlCqqtY=; b=IWSMgF0RpxsT0j2kAN/D6XVj61a22oq86iso34dgihX/jY5z8H75tLNO6YGaB4dgaG9f nOzwCrBu+0nfsFSYnwbDdPhHDkJ2caGhipKROZJinMsh5hGr7hGJ5fzQcTAWQCfqnBWIS My1wolMEfmU277CSeE1RCuwUVPZQz6By6gojASfdChWvwBdpaxXRYdpY5Qn6Geua+yo6M w0X99ZXIM18NjSSdJkGYfkLkl7zYwj3tL85mm+ElHMD/27MPwDb7xL4QXuCK7cqtdNRUM jR5HVt4fK9caKrMwwzBDzbkAMpGQmQohxaEuoxwVscDGgVvaM9GOxKOrV1uF7T7Rrlw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MLEbkXX8; arc=none smtp.remote-ip=170.10.129.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B093606A32D for ; Fri, 4 Dec 2026 13:53:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3B093606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MLEbkXX8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796392438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4k08jr6lkNqsHXr5rjuxCZnS01fD0rLENqBCVlCqqtY=; b=MLEbkXX8FerjRQkQTd6/gpsF6vU9OP9Dhn3Fl5vLn9BDbX+de4UH3N1dieSvEmBWjcQ3QV AP5kiwypUAQZOApQDx3s6UcDLj0O6LB0xhMMGqo87RHPjnsqgeoHSwrHRlctt6FYwmtN3c 1nekj4cLDgMUNVCoQcMN0m+OA0b9a6Y= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-169-41FrEYEEP66zf24rIlnbVw-1; Fri, 4 Dec 2026 13:53:54 +0000 X-MC-Unique: 41FrEYEEP66zf24rIlnbVw-1 X-Mimecast-MFC-AGG-ID: 41FrEYEEP66zf24rIlnbVw_1796392433 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BD55618FC16F; Fri, 4 Dec 2026 13:53:52 +0000 (UTC) Received: from pabeni-thinkpadp1gen8.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D651F18019C3; Fri, 4 Dec 2026 13:53:48 +0000 (UTC) From: Paolo Abeni To: daniel@makrotopia.org Cc: hauke@hauke-m.de, andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, f.fainelli@gmail.com, netdev@vger.kernel.org, petzah@znik.co.uk, stable@vger.kernel.org Subject: Re: [PATCH net] net: dsa: lantiq_gswip: enable assisted learning on CPU port Date: Fri, 4 Dec 2026 14:53:26 +0100 Message-ID: <20261204135326.80725-1-pabeni@redhat.com> In-Reply-To: <10fd8e9784811ecfde8b31f59b8f1c6a94184342.1795890781.git.daniel@makrotopia.org> References: <10fd8e9784811ecfde8b31f59b8f1c6a94184342.1795890781.git.daniel@makrotopia.org> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible. Full review at: https://netdev-ai.bots.linux.dev/sashiko/ --- --- Patch [1]: [PATCH net] net: dsa: lantiq_gswip: enable assisted learning on CPU port --- commit b1076c543459c8d9d8dab1fbe56ed6d899ebf737 Author: Peter Zahradnik net: dsa: lantiq_gswip: enable assisted learning on CPU port This commit sets ds->assisted_learning_on_cpu_port in gswip_setup(). With it, DSA installs the addresses the software bridge learns on foreign ports, such as Wi-Fi interfaces, as static FDB entries on the CPU port. These entries are meant to replace stale learned entries that point at a user port and drop downlink traffic for roaming clients. Link: https://github.com/openwrt/openwrt/issues/11650 Link: https://github.com/openwrt/openwrt/pull/26988 > diff --git a/drivers/net/dsa/lantiq/lantiq_gswip_common.c b/drivers/net/dsa/lantiq/lantiq_gswip_common.c > index 861d9df4ff80b..d605b2e1c3153 100644 > --- a/drivers/net/dsa/lantiq/lantiq_gswip_common.c > +++ b/drivers/net/dsa/lantiq/lantiq_gswip_common.c > @@ -745,6 +745,7 @@ static int gswip_setup(struct dsa_switch *ds) > } > > ds->mtu_enforcement_ingress = true; > + ds->assisted_learning_on_cpu_port = true; [Severity: Medium] [Finding: main-1-0] [Sources: opus-5-5] With this flag set, each (MAC, VID) pair that the bridge learns on a foreign port becomes a separate refcounted host FDB entry on the CPU port. dsa_mac_addr_find() matches on addr, vid and db. Does gswip_port_fdb() keep those VIDs apart in hardware? The vid argument appears unused, and the FID depends only on the bridge: drivers/net/dsa/lantiq/lantiq_gswip_common.c:gswip_port_fdb() { ... for (i = max_ports; i < ARRAY_SIZE(priv->vlans); i++) { if (priv->vlans[i].bridge == bridge) { fid = priv->vlans[i].fid; break; } } ... mac_bridge.key[3] = FIELD_PREP(GSWIP_TABLE_MAC_BRIDGE_KEY3_FID, fid); ... mac_bridge.valid = add; ... } gswip_vlan_add() also gives every VLAN of a VLAN-aware bridge the same FID. Suppose a station MAC M is learned on a foreign port in VIDs A and B of a VLAN-aware bridge. Both adds write the same (M, FID) slot. Then, when (M, A) ages out of the bridge: dsa_port_do_fdb_del() refcount_dec_and_test(&a->refcount) -> true ds->ops->port_fdb_del() gswip_port_fdb(add=false) key-mode write of (M, FID) with valid = false Wouldn't this remove the hardware entry that (M, B) still needs? DSA would still have (M, B) in the CPU port's dp->fdbs list and would never reinstall it. The FID is shared, so a static CPU-port entry installed for VLAN B would also send M's traffic to the CPU in every other VLAN of the bridge. Would it also suppress hardware learning of M in those VLANs, even where M is behind a user port? Documentation/networking/dsa/dsa.rst says for DSA_DB_BRIDGE: Separation between the VLAN-unaware database and the per-VID databases of this bridge is expected to be done by the driver. Before this patch, gswip_port_fdb() already ignored the VID for local CPU-port addresses. This patch now sends every address learned on a foreign port through that path, and the fix depends on it. [Severity: Medium] [Finding: main-2-3] [Sources: opus-5-5] gswip_port_fdb_add() and gswip_port_fdb_del() pick the hardware FID from db.bridge.dev, but the driver never sets ds->fdb_isolation. Can enabling assisted learning without fdb_isolation leave CPU-port entries missing or stale when more than one bridge is offloaded? Without fdb_isolation, the host FDB helpers treat all bridges as one database for refcounting: net/dsa/port.c:dsa_port_bridge_host_fdb_add() { ... if (!dp->ds->fdb_isolation) db.bridge.num = 0; ... } dsa_port_bridge_host_fdb_del() does the same. db.bridge.dev is not changed. The driver therefore gets the dev of whichever bridge made the first add and of whichever bridge made the last delete. Take two VLAN-unaware bridges, br-lan and br-guest, each with a Wi-Fi port. A client MAC M is learned on both at VID 0: br-lan add -> gswip_port_fdb() writes (M, FID_lan) br-guest add -> refcount bump only, (M, FID_guest) never written br-lan del -> refcount drop only, (M, FID_lan) stays br-guest del -> gswip_port_fdb() clears the never-written (M, FID_guest) Would this leave (M, FID_lan) behind as a static CPU-port entry with no DSA record, so nothing ever removes it? Would br-guest also never get the entry this patch relies on? Documentation/networking/dsa/dsa.rst says: The drivers which act upon the dsa_db argument in port_fdb_add, port_mdb_add etc should declare ds->fdb_isolation as true. For comparison, mxl862xx, felix and rtl8365mb set both assisted_learning_on_cpu_port and fdb_isolation. Commit e29bbd73ad71 first broke this contract for local addresses. This patch extends it to every address learned on a foreign port. [Severity: Low] [Finding: main-1-1] [Sources: opus-5-5] gswip_setup() is in lantiq_gswip_common.c. Both lantiq_gswip.c and mxl-gsw1xx.c reach it through gswip_probe_common(). This line therefore turns on assisted learning for every GSWIP revision and for the MaxLinear GSW1xx family. Should the commit message say so, instead of only "the switch"? The testing note covers one GSWIP 2.1 (xRX200) device and says the change was not built or tested on net. On GSWIP 2.2_ETC and newer, gswip_port_fdb() encodes VAL1 differently: if (GSWIP_VERSION_GE(priv, GSWIP_VERSION_2_2_ETC)) mac_bridge.val[1] = add ? (GSWIP_TABLE_MAC_BRIDGE_VAL1_STATIC | GSWIP_TABLE_MAC_BRIDGE_VAL1_VALID) : 0; else mac_bridge.val[1] = GSWIP_TABLE_MAC_BRIDGE_VAL1_STATIC; The commit message says the static entries "replace a learned entry for the same address and FID", but that has only been tested with the 2.1 encoding. Has it been checked on 2.2+ or GSW1xx hardware? [Severity: Low] [Finding: main-6-9] [Sources: opus-5-5] With this flag set, dynamically learned foreign-port entries now pass this check in dsa_user_fdb_event(): if (!ds->assisted_learning_on_cpu_port) return 0; As a result, every source MAC the bridge learns on a foreign port becomes a non-aging STATIC entry in the MAC bridging table. There is no capacity accounting. Going by the loop in gswip_port_fast_age(), the table has 2048 entries. Could an untrusted party on an open or guest Wi-Fi network, or on another bridged non-DSA port, fill this hardware table by using many source MACs? The bridge's fdb_max_learned limit defaults to 0, which means unlimited. If learning on the wired ports then runs out of space, wired-to-wired unicast would fall back to the unknown-unicast map (GSWIP_PCE_PMAP3 = cpu_ports) and go through the CPU. This effect is not confirmed, because the driver does not document what the table does when a hash bucket is full. Other drivers that enable assisted learning, such as mt7530, felix, sja1105 and rtl8365mb, make the same trade-off. > > return 0; > } -- This is an AI-generated review.