From patchwork Mon Sep 13 14:42:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 509793 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp668896jao; Mon, 13 Sep 2021 08:34:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOB7pTwPChlZg9pUEUp0+OTt2BYvexI+Xhf7/x0F+JGPeNH0bu4d6DtLduidNoA0E+3ZYM X-Received: by 2002:a17:906:38db:: with SMTP id r27mr13421813ejd.338.1631547270334; Mon, 13 Sep 2021 08:34:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631547270; cv=none; d=google.com; s=arc-20160816; b=FSiCbC34cgiUiPdCn/vW+0WB8foDi0VmAAVKcL9TdCc+POWSOHeFEeZN1XevwavaaY JwGJ8OlrNevNNdUVFZlkD1mLTGf4J/i2msIVVDcZzBthhxAKUaDIP4TJ5CuFiagQhXBM SvarzROu8R76Hcn4EdnKvMWhji34aZ69ccJ/GjgK70S4i1zj+cwitQFAKrwla6ABT/24 hVjGMno+r3s4DZUOgzDWNL0xfHoXK9R2njK8gzZakle4h0g4OQaxtDzdMEBwrBCkKlZ8 k4Icnh/HoPTtSpzKJFLyIO9uxKAq6NaFe3fMhETzFDOXBWM6CjbkCplefvKcCLKXXeCX vi2A== 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=xd3umkjYwct/iEHcKdn/6TrUhyPynjPbO3LzmHR3PlQ=; b=Jv1AzZIGsaa8Ufd48dh6LAXIsbjDJKFAmaGk6qmwrEcaQA5Bm8HR75PQgA4O24d5M2 xps4PqH7wY9QXR/PPP/YZOF+IRzGVWY20zBxICUoWjmWVKt66Z2zpbhqKMsx2IwZuUxK jcu027nN00QglNuFe/XbXrscHrrlZVH4Fn/I4KgVhs06gJ/nr990nZKvn2fQd2WRPeE2 nKMRAyvZ5XJqE0RrwQWjNIHHnrM5tj8uA4GdzdEiptLhE54J8RI1pzcKxyuFwD2ZjFbD BT5veK2f66U5AUFd+JTcT5QUTCVCAVqMWm9vTmljcYw1z3PilsNx8y4gEcQ+jgtChlp1 pHpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FGJxvDqc; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si7844974eji.452.2021.09.13.08.34.30; Mon, 13 Sep 2021 08:34:30 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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=@linaro.org header.s=google header.b=FGJxvDqc; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230046AbhIMPfo (ORCPT + 8 others); Mon, 13 Sep 2021 11:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239310AbhIMPf2 (ORCPT ); Mon, 13 Sep 2021 11:35:28 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17D52C12C757 for ; Mon, 13 Sep 2021 07:45:41 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id g1so10172539lfj.12 for ; Mon, 13 Sep 2021 07:45:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xd3umkjYwct/iEHcKdn/6TrUhyPynjPbO3LzmHR3PlQ=; b=FGJxvDqcWqiPbYFwhIrJ0dK0VR2FrCiR+FMhJpzBxx3KpTQ92J+P+Btd9IX3iHDpKN XNd0A3/tcrxnrP6AZ6y0w33syHd1m9xwQFg/nx2tsJwlGc0pB3YPr2TnFiEVNeWpG6ML 6Ub+akRJbSUbNlpwl/U8ALkJvRNGLg8LDO1NTe3fI/Wn5LJXxKTsMph97Nptg8euRCXA Q2LrJ8vh9xuFkjAw7ss4ICmkkCSIiUWzv/1WcFGkZqv7XBRBovLZC1bmHML27nnTElh4 mSS6H51EWXevgXJaV4EQM+np1tMbfkav1yCEqIKwwfWfN6u/f9arviRwo4KiNmajtX0P 55eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xd3umkjYwct/iEHcKdn/6TrUhyPynjPbO3LzmHR3PlQ=; b=0uaTSwLRX1cEuENM+BAERymul+qKmUHnwahcDS/zFZf+SqNDdV+t4rx7ZlIIvJ7t4C BwDw7w9E2MprRmvVI/JsXxKwafpdMOuXOxtr0S5Fmm85m8zYR/59SQ+VukrCNwufxG0n dG+q/sZ7pvAT/hWB8IiuQqdn1DPjvIXLvPRqRaVy8se36XXzFdWYBCB1Xos8Y7UqRAua DDTvlv442ZBpixiLA0woU/G3aQbKbmoPRdxIhOHVDqyGF9bF0hDk1eUNR/ZgX/vgcuuG 16xpZ3KIsVw1dh1m3ud3/ztfuEv8ziPDgAf2CDVo5RvCOTpqIEUz5tOdYwB/ovD23Lk4 MUHw== X-Gm-Message-State: AOAM533jsXNP3lkeQ8A4959+BlN+IxEeeTirRmIgIUaxBCwd8EESgZbM dYFqt/3kyEP7QrK5F82nrwD1Sg== X-Received: by 2002:a19:c145:: with SMTP id r66mr9687199lff.563.1631544339476; Mon, 13 Sep 2021 07:45:39 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id i12sm849825lfb.301.2021.09.13.07.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 07:45:39 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Linus Walleij , Mauri Sandberg , =?utf-8?q?Alvin_=C5=A0ipraga?= , DENG Qingfang Subject: [PATCH net-next 5/8] net: dsa: rtl8366: Disable "4K" VLANs Date: Mon, 13 Sep 2021 16:42:57 +0200 Message-Id: <20210913144300.1265143-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210913144300.1265143-1-linus.walleij@linaro.org> References: <20210913144300.1265143-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org I have to disable this feature to have working VLANs on the RTL8366RB at least, probably on all of them. It appears that the very custom VLAN set-up was using this feature by setting up one VLAN per port for a reason: when using "4K" VLAN, every frame transmitted by the switch MUST have a VLAN tag. This is the reason that every port had its own VLAN, including the CPU port, and all of them had PVID turned on: this way every frame going in or out of the switch will indeed have a VLAN tag. However the way Linux userspace like to use VLANs such as by default assigning all ports on a bridge to the same VLAN this does not work at all because PVID is not set for these, and all packets get lost. Therefore we have to do with 16 VLAN for now, the "4K" 4096 VLAN feature is clearly only for switches in environments where everything is a VLAN. This was discovered when testing with OpenWrt that join the LAN ports lan0 ... lan3 into a bridge and then assign each of them into VLAN 1 with PVID set on each port: without this patch this will not work and the bridge goes numb. Cc: Vladimir Oltean Cc: Mauri Sandberg Cc: Alvin Šipraga Cc: Florian Fainelli Cc: DENG Qingfang Signed-off-by: Linus Walleij --- ChangeLog v1->v4: - New patch after discovering that the VLAN configuration in OpenWrt was not working. --- drivers/net/dsa/rtl8366.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) -- 2.31.1 diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index fae14c448fe4..9652323167c2 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -313,13 +313,15 @@ int rtl8366_vlan_add(struct dsa_switch *ds, int port, untagged = true; - /* Enable VLAN in the hardware - * FIXME: what's with this 4k business? - * Just rtl8366_enable_vlan() seems inconclusive. + /* Enable VLAN in the hardware, do NOT enable VLAN4K, because the + * 4K VLAN will activate a 4096 entries VID table, but has the side + * effect that every processed frame MUST have a VID, meaning non-VLAN + * traffic will now work at all. So we will let the 16 VLAN entries + * suffice. */ - ret = rtl8366_enable_vlan4k(smi, true); + ret = rtl8366_enable_vlan(smi, true); if (ret) { - NL_SET_ERR_MSG_MOD(extack, "Failed to enable VLAN 4K"); + NL_SET_ERR_MSG_MOD(extack, "Failed to enable VLAN"); return ret; }