From patchwork Thu Jun 13 22:25:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 166737 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1291141ilk; Thu, 13 Jun 2019 15:26:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwWNYBRjfPd31xIppOb2SPJxH1Sci6zbh/DmjFy+gaNG45/m9oe8vZ9vMtWie72py8uSmWy X-Received: by 2002:aa7:8d4d:: with SMTP id s13mr85944572pfe.259.1560464769227; Thu, 13 Jun 2019 15:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560464769; cv=none; d=google.com; s=arc-20160816; b=gCfOR7YibTt4K7k8KDlQT/a64D1QdIDxz7WoRDxtVTuhSTBtfWpBmW0e7M1PuOSfs/ 3N/WrRbWu5wGsoUzrFrtvrVFkNF6XEVrCn8gamFv8J0kJzTNVLY26UmXcly6yg/YiiJe 5QmDDAZmiN/KIEmTqqVqie+bXtKnMycfFpA7OvG5tfJuuWdtwtTFyToCWa5CyCkkC09Y 7NgyM+bUqWqoa6yCn82yB4xyXNO8FwkPbTtOxlyut+W/CUMf0i9JkpGW7FpxlrF2T3a0 lxxylbNu0Xbl1kmosjBbYv9jMd584gr3ATFlJq6uF578Yy/ZQcOWmk/uhv+jKb/+tXdf DgHw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=rks0Y0tF/0uIFUiwoag1iJEl5awYzobXVEIXdeNluJI=; b=u49SKdz8bWs7+MeUi8ywvle8mT7HpDnyfmU3B8gA7h0k4pGmm4LLgRep+EmOij/LeS bV72HCGFZ8CTtvG0p6AYeOEjgLapXFiuq71UQmujZtXfzVqhsVBZluMMvhBh8hFytlM+ l6I8X9cVlMpVIluAdSHXkV/tfEY3wXhRdYxBKyUfaoxpSmF2CUMfIKP/YE1IBxi+PrNz nWPc/No72Ga3cBdL58L1k/poujeR8dv74uaFG2McXOIJ0p5s+8dsjJVj/laZMdKXRWKL wWm7956Wq9qIm/rZYYqb2AkWWn67zw3Cojq2DPTKPFdAjrHYh2FW6hn5f+uxbDzrI4bQ zi0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="MK/Zd796"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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. [209.132.180.67]) by mx.google.com with ESMTP id l11si721698pgp.438.2019.06.13.15.26.08; Thu, 13 Jun 2019 15:26:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="MK/Zd796"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 S1727046AbfFMW0H (ORCPT + 14 others); Thu, 13 Jun 2019 18:26:07 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:40388 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725793AbfFMW0H (ORCPT ); Thu, 13 Jun 2019 18:26:07 -0400 Received: by mail-lj1-f194.google.com with SMTP id a21so315158ljh.7 for ; Thu, 13 Jun 2019 15:26:06 -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:mime-version :content-transfer-encoding; bh=rks0Y0tF/0uIFUiwoag1iJEl5awYzobXVEIXdeNluJI=; b=MK/Zd796Vs4QS13x0pfCu9Imp3xKpR1nhntOF84QSXr5Uw9zbZHWH4zQ3UrICyMJz+ Nj+vHEJo7iSReHyon88G3i1+v3jb7Fn+6DeQJOf8TEu1p2ZS3iQXzklujD6tgZ2BXvQt rqUR2Dl43wU8an7C2F/hf/MBLM9bO+ip6eJpn2Lciswn0M955MnHLZE8Ob/cT1URg3PD 7h4wifMCfcXKuL/eyufIjUHXhR9/5FeEDROxd4tTR0pw17HBwY3HFOHcDK0VyvwX1Meq h8e/2sn36L/gqXkwaWdUoYer4jsFPoMXOFi8tM8K73TFF2n1d0lZy/BFaqYehZkTJwOc OGqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rks0Y0tF/0uIFUiwoag1iJEl5awYzobXVEIXdeNluJI=; b=V3NM20jO2C3RXZuTg3EZKL/2QzrG33c3BlbRGFH+CYLZsBYUMTZFvvJ74iaYKYGNFJ 8PSStD6WKFUg5nvw31ohWyIjfsY0QTiZrzNk9PWAgCQYrW4yIsx0YNuQuLmix/r16X+T qbaDJjeuMtx3zv4qO4zOTcHjFI1aH+RWMzU3Kb390y4fVVo0ThIuq59CYERAHlJr4x7U h6NPPj+xQtdeqGTcjnKIMxDfK5WFv5n8sRTLaEf4/cLILZZbZVZTwvfnMk4d3NZ+IP5U r40Y7QPULzIOrL036oPC/4uEq0L/4pU2dWht3sBkg1lCzTAhCB/UxY5xcXB7x6GXg2zv cgzQ== X-Gm-Message-State: APjAAAVtgiS6jz+BwFN64foeArJhpclDe4r4X0VdfAYFuWKt5Cm7SdUg 1/zgjch2RA1jneeelCP40smq1A== X-Received: by 2002:a2e:2c04:: with SMTP id s4mr23657051ljs.61.1560464765716; Thu, 13 Jun 2019 15:26:05 -0700 (PDT) Received: from linux.local (c-d2cd225c.014-348-6c756e10.bbcust.telenor.se. [92.34.205.210]) by smtp.gmail.com with ESMTPSA id b62sm213433ljb.71.2019.06.13.15.26.04 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 13 Jun 2019 15:26:04 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli Cc: netdev@vger.kernel.org, Linus Walleij , stable@vger.kernel.org Subject: [PATCH] net: dsa: rtl8366: Fix up VLAN filtering Date: Fri, 14 Jun 2019 00:25:20 +0200 Message-Id: <20190613222520.19182-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org We get this regression when using RTL8366RB as part of a bridge with OpenWrt: WARNING: CPU: 0 PID: 1347 at net/switchdev/switchdev.c:291 switchdev_port_attr_set_now+0x80/0xa4 lan0: Commit of attribute (id=7) failed. (...) realtek-smi switch lan0: failed to initialize vlan filtering on this port This is because it is trying to disable VLAN filtering on VLAN0, as we have forgot to add 1 to the port number to get the right VLAN in rtl8366_vlan_filtering(): when we initialize the VLAN we associate VLAN1 with port 0, VLAN2 with port 1 etc, so we need to add 1 to the port offset. Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver") Cc: stable@vger.kernel.org Signed-off-by: Linus Walleij --- drivers/net/dsa/rtl8366.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.21.0 diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index 6dedd43442cc..35b767baf21f 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -307,7 +307,8 @@ int rtl8366_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering) struct rtl8366_vlan_4k vlan4k; int ret; - if (!smi->ops->is_vlan_valid(smi, port)) + /* Use VLAN nr port + 1 since VLAN0 is not valid */ + if (!smi->ops->is_vlan_valid(smi, port + 1)) return -EINVAL; dev_info(smi->dev, "%s filtering on port %d\n", @@ -318,12 +319,12 @@ int rtl8366_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering) * The hardware support filter ID (FID) 0..7, I have no clue how to * support this in the driver when the callback only says on/off. */ - ret = smi->ops->get_vlan_4k(smi, port, &vlan4k); + ret = smi->ops->get_vlan_4k(smi, port + 1, &vlan4k); if (ret) return ret; /* Just set the filter to FID 1 for now then */ - ret = rtl8366_set_vlan(smi, port, + ret = rtl8366_set_vlan(smi, port + 1, vlan4k.member, vlan4k.untag, 1);