Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp110734ybg; Mon, 8 Jun 2020 17:54:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzejicx79sYJxKZr32voIgDiaa2WQSx/9InfQHE1c9gPFOJrYrY/moolZnrmRusIiN+rUAj X-Received: by 2002:a17:907:20f4:: with SMTP id rh20mr22792161ejb.55.1591664071943; Mon, 08 Jun 2020 17:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591664071; cv=none; d=google.com; s=arc-20160816; b=R8UCLE/jDpjkpDC0GpXNyRVXVeInp10Dw1Q4xwDl3xNvTb9WmgE69WMRZ70dMs5AgY ZaPr3d6AE+f1mqoESeuqXjcDD2ZY+DQ0vP95IBbkoMerbiPsQr1ZIzF0RGtpwSacgvTK da3JmHQQcp7SARJAWFViWe2GSQsavhX8rB/kvnVkXgQhiY8Zr1kAVg2JuCe6v4xMNw83 oshi3VkTQxQDORH1NrG/lriP0+JCEYR7XLSfZocECxQ+m8pUaVGSwgivuFGE6fWVzErn aDHEega0LFi8Q9HI3fu5OBbpWs7kvdEHKgGI5kv46Ddlqb8wOQcy/utaU1mERNU3K2BV CwTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hbtIgWWsnsS2qCmcKqRF10WhHSI2F+nJ49O4tqK4cX8=; b=ODlahEnQohPOEQbVzUBXHP09/OpH58cK+EIEUbjFCEvT4xgrfLqkZ68iYk3sStjIEQ +4v3DJSdk9qjX0gzx6KYjAyG3/k07j8nnS7EYRtnDTSUx7AGrl1WfDzW4VOLK/Sex+AT JOnLo8AW5tRf3HgTat7R25RBaT8i4GXZckc3SpdYt76ajLxDz3h4esvkArVRppwJA4Pc 6tHE9zY4xXaoVeXpeQwb8ITEBqu/Hw1V950H6tvSNd3C8B8lPywLa4RDyoazBxrxFC1F LpaG+hyK3mX7MtBCcc2ZxVkqPmufqtNjtMQcHQ7pU2uSd4jQIH0W5/DXyI9y2YLJUjue 3q0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=l0qSSwPM; 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 dp8si11762146ejc.281.2020.06.08.17.54.08; Mon, 08 Jun 2020 17:54:31 -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=default header.b=l0qSSwPM; 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 S1730904AbgFIAuT (ORCPT + 99 others); Mon, 8 Jun 2020 20:50:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:56648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728680AbgFHXKb (ORCPT ); Mon, 8 Jun 2020 19:10:31 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 102CA20B80; Mon, 8 Jun 2020 23:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657831; bh=eZBp0tsDujcrF4Qv8GoWmXbcnp4p9Qe7aDwVYZD6/yg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l0qSSwPM5IgKH3FNyWY8dE9U1ZF/8XvrKxJ0rtiohfV8syQpcnfZbzkHzlIg0MOIi Qs52tNU3de00EmHgsIOhH5sDwWo1zOE24giowPgQdt4t4vj5Lib5Kaq+Vd5qG5qNMV yMdY6Ej4LDfj853T/upz42t3wY5JYXD2c8JQv2VM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: DENG Qingfang , Florian Fainelli , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH AUTOSEL 5.7 201/274] net: dsa: mt7530: set CPU port to fallback mode Date: Mon, 8 Jun 2020 19:04:54 -0400 Message-Id: <20200608230607.3361041-201-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: DENG Qingfang [ Upstream commit 38152ea37d8bdaffa22603e0a5b5b86cfa8714c9 ] Currently, setting a bridge's self PVID to other value and deleting the default VID 1 renders untagged ports of that VLAN unable to talk to the CPU port: bridge vlan add dev br0 vid 2 pvid untagged self bridge vlan del dev br0 vid 1 self bridge vlan add dev sw0p0 vid 2 pvid untagged bridge vlan del dev sw0p0 vid 1 # br0 cannot send untagged frames out of sw0p0 anymore That is because the CPU port is set to security mode and its PVID is still 1, and untagged frames are dropped due to VLAN member violation. Set the CPU port to fallback mode so untagged frames can pass through. Fixes: 83163f7dca56 ("net: dsa: mediatek: add VLAN support for MT7530") Signed-off-by: DENG Qingfang Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/dsa/mt7530.c | 11 ++++++++--- drivers/net/dsa/mt7530.h | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 34e4aadfa705..b75d09783a05 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -807,10 +807,15 @@ mt7530_port_set_vlan_aware(struct dsa_switch *ds, int port) PCR_MATRIX_MASK, PCR_MATRIX(MT7530_ALL_MEMBERS)); /* Trapped into security mode allows packet forwarding through VLAN - * table lookup. + * table lookup. CPU port is set to fallback mode to let untagged + * frames pass through. */ - mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, - MT7530_PORT_SECURITY_MODE); + if (dsa_is_cpu_port(ds, port)) + mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, + MT7530_PORT_FALLBACK_MODE); + else + mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, + MT7530_PORT_SECURITY_MODE); /* Set the port as a user port which is to be able to recognize VID * from incoming packets before fetching entry within the VLAN table. diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h index 82af4d2d406e..14de60d0b9ca 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -153,6 +153,12 @@ enum mt7530_port_mode { /* Port Matrix Mode: Frames are forwarded by the PCR_MATRIX members. */ MT7530_PORT_MATRIX_MODE = PORT_VLAN(0), + /* Fallback Mode: Forward received frames with ingress ports that do + * not belong to the VLAN member. Frames whose VID is not listed on + * the VLAN table are forwarded by the PCR_MATRIX members. + */ + MT7530_PORT_FALLBACK_MODE = PORT_VLAN(1), + /* Security Mode: Discard any frame due to ingress membership * violation or VID missed on the VLAN table. */ -- 2.25.1