Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3765867pxt; Tue, 10 Aug 2021 10:48:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCS5Km7TgXBtiHP7IL2frZWrbCMW+LWDhan+RSP8UeKNIk/iHlLxRfvGqGsCVQvL4h6d8w X-Received: by 2002:a5d:9707:: with SMTP id h7mr315877iol.28.1628617726910; Tue, 10 Aug 2021 10:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628617726; cv=none; d=google.com; s=arc-20160816; b=Z8XiOk0ToM7u2PbbeUcfyy9d3vOx0NkDDNf3rSixOVCyL3y69r5psqfd+HA1/0s40p h5R60nRwMFC5JKcp02fe4YztHyJqZEj/Ee7MlwY7YkGvACojrQQLHyXy0c7+jhpvtI9x YSWsnXIu3RrMUSEZNxelJa+0BHI9BRnxvpgH4K9HTQh9F/ZWOikho8t8N+JvGBHnCmE0 TppY3ZhkOJ2+MLBQxfhSF9G5jy3TH0wlGGy3NKoZd2M3C6Wyo0NgCtQ0f7iJI8aJRX98 +N4ZRXAtnYgc88/tj7QSYZHcvsFLysdNV4uKLykBmmflbRmOPVXB/VJPHjhns0SEmtWO 7qGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gZAPf5f7VxSkPrS0/W1Rr5Tqg5nlKNzRCWFQmlE/1Qo=; b=Z+VpBwhsvCRLnL5yxc6IKSYCWnslLSgFqOWuKszXcM7wXmWcQ1WzNZLIPKe11GXcBL eef5Lw3t9XiNEzZBeJrO8+1ymycgIuZClDPmSLw8Ft9zc+GzB5XlfOuZnpPlCm5WRT8j HHUBGyXDDZXIz0dlqKodXwGimZc+t30ruCdjPbvxOUbx6dVFs/xsXLsLpWxYW2WKsNuN YrF4njMCn24oqfmTeRZqMg959ftLZ4tdZHzN6z5rRuuRZQYwuudZhgpbZATEunH/vC9F CInNwRT0LC8Uw7NeV5nKwsHCRK2vZh9Oc72hy9n98u9omuKqWDzEyN3WkNOFAPQVPJpH z0KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hFFRThDy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h14si12007241iow.53.2021.08.10.10.48.35; Tue, 10 Aug 2021 10:48:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hFFRThDy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236431AbhHJRrH (ORCPT + 99 others); Tue, 10 Aug 2021 13:47:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:38108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236135AbhHJRoc (ORCPT ); Tue, 10 Aug 2021 13:44:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4124361153; Tue, 10 Aug 2021 17:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628617173; bh=rDS+T/bSYJHtSBoCHfROASL+OmGu6kaC/U4rdsey30s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hFFRThDy8/X9NhcGPc4qezXTxyua4F6bYg/C5JCXIfb0wzOvR1+/CqAKYDIp1MY/O fDlyBDC+KEr+aPJtOYamt29/E05gbDB9t/k0UETKSdxo9lPhPo71n9gMUTfMN0Ylwm sAfGOFx4C/r79InelGb4Y8XwnXhGO3gNLT2SJBvE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 033/135] net: dsa: sja1105: be stateless with FDB entries on SJA1105P/Q/R/S/SJA1110 too Date: Tue, 10 Aug 2021 19:29:27 +0200 Message-Id: <20210810172956.791232073@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210810172955.660225700@linuxfoundation.org> References: <20210810172955.660225700@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vladimir Oltean [ Upstream commit 589918df93226a1e5f104306c185b6dcf2bd8051 ] Similar but not quite the same with what was done in commit b11f0a4c0c81 ("net: dsa: sja1105: be stateless when installing FDB entries") for SJA1105E/T, it is desirable to drop the priv->vlan_aware check and simply go ahead and install FDB entries in the VLAN that was given by the bridge. As opposed to SJA1105E/T, in SJA1105P/Q/R/S and SJA1110, the FDB is a maskable TCAM, and we are installing VLAN-unaware FDB entries with the VLAN ID masked off. However, such FDB entries might completely obscure VLAN-aware entries where the VLAN ID is included in the search mask, because the switch looks up the FDB from left to right and picks the first entry which results in a masked match. So it depends on whether the bridge installs first the VLAN-unaware or the VLAN-aware FDB entries. Anyway, if we had a VLAN-unaware FDB entry towards one set of DESTPORTS and a VLAN-aware one towards other set of DESTPORTS, the result is that the packets in VLAN-aware mode will be forwarded towards the DESTPORTS specified by the VLAN-unaware entry. To solve this, simply do not use the masked matching ability of the FDB for VLAN ID, and always match precisely on it. In VLAN-unaware mode, we configure the switch for shared VLAN learning, so the VLAN ID will be ignored anyway during lookup, so it is redundant to mask it off in the TCAM. This patch conflicts with net-next commit 0fac6aa098ed ("net: dsa: sja1105: delete the best_effort_vlan_filtering mode") which changed this line: if (priv->vlan_state != SJA1105_VLAN_UNAWARE) { into: if (priv->vlan_aware) { When merging with net-next, the lines added by this patch should take precedence in the conflict resolution (i.e. the "if" condition should be deleted in both cases). Fixes: 1da73821343c ("net: dsa: sja1105: Add FDB operations for P/Q/R/S series") Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/dsa/sja1105/sja1105_main.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index 52d8cc1a95fa..e65be1380803 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -1389,13 +1389,8 @@ int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port, l2_lookup.vlanid = vid; l2_lookup.iotag = SJA1105_S_TAG; l2_lookup.mask_macaddr = GENMASK_ULL(ETH_ALEN * 8 - 1, 0); - if (priv->vlan_state != SJA1105_VLAN_UNAWARE) { - l2_lookup.mask_vlanid = VLAN_VID_MASK; - l2_lookup.mask_iotag = BIT(0); - } else { - l2_lookup.mask_vlanid = 0; - l2_lookup.mask_iotag = 0; - } + l2_lookup.mask_vlanid = VLAN_VID_MASK; + l2_lookup.mask_iotag = BIT(0); l2_lookup.destports = BIT(port); rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP, @@ -1482,13 +1477,8 @@ int sja1105pqrs_fdb_del(struct dsa_switch *ds, int port, l2_lookup.vlanid = vid; l2_lookup.iotag = SJA1105_S_TAG; l2_lookup.mask_macaddr = GENMASK_ULL(ETH_ALEN * 8 - 1, 0); - if (priv->vlan_state != SJA1105_VLAN_UNAWARE) { - l2_lookup.mask_vlanid = VLAN_VID_MASK; - l2_lookup.mask_iotag = BIT(0); - } else { - l2_lookup.mask_vlanid = 0; - l2_lookup.mask_iotag = 0; - } + l2_lookup.mask_vlanid = VLAN_VID_MASK; + l2_lookup.mask_iotag = BIT(0); l2_lookup.destports = BIT(port); rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP, -- 2.30.2