Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2894582pxb; Tue, 24 Aug 2021 10:03:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRwg6lx/lNJlcOxyuN9JvI63RXYHh0xDIgGniuDkFFUBdzz3fot6H6JhC3IWF8V6peamv+ X-Received: by 2002:a5d:94c6:: with SMTP id y6mr32844219ior.202.1629824603005; Tue, 24 Aug 2021 10:03:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629824602; cv=none; d=google.com; s=arc-20160816; b=tZN0B7QqbuoWVv70u5GXK9FsiDyspBtg3u9WwOfZ1fUOPuZGfgf74jCwvLCHmHpBj1 +gvErgSoK3qDUitTSOrWUx2bvqNiD0UD8ndY4sHLk6ZjuKT0LyhfsdIUnAMkg7KUmI3Z 8ii+xqxUsICbDtapv30WJbeV/E89FLmUB/nTDVi/wH/zQ2e90NDm3Uw692sQdGx3DQ0C 8anoc5+CQfQ8GySevF6xF55v11/xndpZZVyCmtgoYO+JObDKuXB0NRYt2/untHyegYfK RvIKvh8yokYCSkcuRqu7yz/5X/GqfeF0RVPnb8h9pwIHogL4pofIt/TfH8Jef7VwWqtU V4dQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MN2GLXznm/t4CFGDWtd0b31Vx+4VtFAT0pfIyIbGiC0=; b=cvpUKwdpQppwUHNE+crm9FlmoNB0o62/C5ndaRGVqfD4HaFf1pj23uygPE1nM8KDiB XospIDCamjg121MS9cvJUg5n2ys6W0moMUcGwHwwzO5kNAKuYFDhq3W+Cfib6kARr1N0 Tw7KBP00e1+pje5P0qMHjrMxpclM8a/87bi5/gLukN8hCw2rO1lfCHZ8KJyjTE5/q59Q FQHpfjcOtieFdpUp5PKDql3b7QSH9+gS4dOuq9Sb6Y3JCgaShnr4oFWLR//MObi2Xer4 LQZ+w1F0VTl31+mSV5S8j+MPSIJCffxfsgybM4jd3wmGLgcHjMP8ap8eOBpbG2lrfgCl i4/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KEjXydSp; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si14122372ilt.54.2021.08.24.10.02.59; Tue, 24 Aug 2021 10:03:22 -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=@kernel.org header.s=k20201202 header.b=KEjXydSp; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234166AbhHXRBp (ORCPT + 99 others); Tue, 24 Aug 2021 13:01:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:39542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234763AbhHXQ6s (ORCPT ); Tue, 24 Aug 2021 12:58:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3991B61406; Tue, 24 Aug 2021 16:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824242; bh=xBwl2Vca0Jv/CiffPehhNuOtZFSIZI85WMB7Eam6TRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KEjXydSp2Djb4ljz6DA2tus0m2rJwvzUYmzUza6MWSWPjphEWwPjAQfgCbG5f6bPN vjQi7mJ6IimfW6qzkbB7fBmNsj6U+V4avm1qqFXWBqaViA1Lf5smhauw6iRZfoVPXE FIwaRfkHxEsHL3X5xjvQ7bphPgPP0Z8fGYmMfmiJf+4CIs2aMsDNPOle9+Q/aSW2cB JLNiyflLdXoGc/EgAiYVUuGKb+TNm29himDTqBz8hhNVsyNG7T9vaJwhzg09FTzoKU EROstdhpOjuMLe3Rne9JgGG9/DvVwd8TetA6/L0DXUbb34RV9cDiVqk2K57MQWGkHL jKHd5HsIgrgLA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.13 075/127] net: mscc: ocelot: allow forwarding from bridge ports to the tag_8021q CPU port Date: Tue, 24 Aug 2021 12:55:15 -0400 Message-Id: <20210824165607.709387-76-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165607.709387-1-sashal@kernel.org> References: <20210824165607.709387-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.13.13-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.13.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.13.13-rc1 X-KernelTest-Deadline: 2021-08-26T16:55+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vladimir Oltean [ Upstream commit c1930148a3941f891ddbd76fceaa4e10a957ccf2 ] Currently we are unable to ping a bridge on top of a felix switch which uses the ocelot-8021q tagger. The packets are dropped on the ingress of the user port and the 'drop_local' counter increments (the counter which denotes drops due to no valid destinations). Dumping the PGID tables, it becomes clear that the PGID_SRC of the user port is zero, so it has no valid destinations. But looking at the code, the cpu_fwd_mask (the bit mask of DSA tag_8021q ports) is clearly missing from the forwarding mask of ports that are under a bridge. So this has always been broken. Looking at the version history of the patch, in v7 https://patchwork.kernel.org/project/netdevbpf/patch/20210125220333.1004365-12-olteanv@gmail.com/ the code looked like this: /* Standalone ports forward only to DSA tag_8021q CPU ports */ unsigned long mask = cpu_fwd_mask; (...) } else if (ocelot->bridge_fwd_mask & BIT(port)) { mask |= ocelot->bridge_fwd_mask & ~BIT(port); while in v8 (the merged version) https://patchwork.kernel.org/project/netdevbpf/patch/20210129010009.3959398-12-olteanv@gmail.com/ it looked like this: unsigned long mask; (...) } else if (ocelot->bridge_fwd_mask & BIT(port)) { mask = ocelot->bridge_fwd_mask & ~BIT(port); So the breakage was introduced between v7 and v8 of the patch. Fixes: e21268efbe26 ("net: dsa: felix: perform switch setup for tag_8021q") Signed-off-by: Vladimir Oltean Link: https://lore.kernel.org/r/20210817160425.3702809-1-vladimir.oltean@nxp.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/mscc/ocelot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index adfb9781799e..2948d731a1c1 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1334,6 +1334,7 @@ void ocelot_apply_bridge_fwd_mask(struct ocelot *ocelot) struct net_device *bond = ocelot_port->bond; mask = ocelot_get_bridge_fwd_mask(ocelot, bridge); + mask |= cpu_fwd_mask; mask &= ~BIT(port); if (bond) { mask &= ~ocelot_get_bond_mask(ocelot, bond, -- 2.30.2