From patchwork Sat Sep 5 10:32:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 249158 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp2153722ilg; Sat, 5 Sep 2020 03:32:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7LYCCx4PfR0mFN0R9nCxqfI+CPV46Ay6HKZa/0xfHjV4NGHRShXYMQk2Q6bW8XiZb/fT/ X-Received: by 2002:a05:6402:1212:: with SMTP id c18mr12645260edw.344.1599301971857; Sat, 05 Sep 2020 03:32:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599301971; cv=none; d=google.com; s=arc-20160816; b=uwaTZuK1EsNh70IFkuaFscndtkk4Q+IMCVvXJ870F3OOVr9iFZIf4OCXVcDaYCNJy6 mTAvQ2ny/r/Pi/5OfnAftOSxQJl8o8v/or2ogUYMUXeWQOBJVe4WAb6vLqI3EKTS33/Y HDLz3IEAMVwfxypMTJA9Kw++xlmZtozwDfYcZqR7HhTctN04PWlvUvCdtjw5Uxc2Fd+d auwfKWpyCVUjlsLjL2+MLlwuy801XYq2IYuzdOROQccpQ55qdwYKYYkG2sp68zPikMoX fVcJ7uUgxnPEC2X0zvo+3NZvBBTXhnUg/IdXHuSJFL2Eypi3dNiOwHP9MqDbHo0N9RA9 kDHQ== 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=iKozwlzrBwDOZZQyoYHJabN4r3Vpg15uwW4kvVojjxI=; b=QYbNUC9spck0l8UOGGUYoOEl2GFZn900wvoiNCoH1cRLgUCRHuq2MvuuUL9k5AlZ4C pTK0iNzSFH/LqCPxi15PSi+7gHQ8TrP1/GG78kgHGBgi2OYq7X+gnjJkrl/Y2dZZYTg7 xHL4UY1UWXpHhKXJYIRmBMbj3Q4E8JP8b4ccrVsQ6+s/NKASwAHuZVHsDU9c7GOUum0+ OtE49xJVQrlhZ0hrMDD+pT0Cy0e+sFkp4xQ0wrJ30LTUjIOdX3c9q7Su9Z110qtoEvyj F0q362qOq1g2QrXbLnVOiN6iVo3Ld1nToP3vGIACwkcDdgCHb50mkf3M8uGXanEyyGc3 UDIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TO3rfIfi; 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 u13si2599471edd.16.2020.09.05.03.32.51; Sat, 05 Sep 2020 03:32:51 -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=TO3rfIfi; 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 S1728328AbgIEKck (ORCPT + 9 others); Sat, 5 Sep 2020 06:32:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726302AbgIEKcj (ORCPT ); Sat, 5 Sep 2020 06:32:39 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A78F8C061244 for ; Sat, 5 Sep 2020 03:32:38 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id z19so5143861lfr.4 for ; Sat, 05 Sep 2020 03:32:38 -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=iKozwlzrBwDOZZQyoYHJabN4r3Vpg15uwW4kvVojjxI=; b=TO3rfIfiwSe8RuXHcYLMdP7GiXtvfHyOkB5OeCUqgp3hO/LBwESBmOkLQiYLAvZ5qW WUlnKZ+WmepflXs+HcTD1j70+/az9aU5fGp8O0XN4TOQG1phL7UkH1wlBaE+oH1HM3R8 blxGPWj08YFqGKUSw5urpzKQIkMkBydVHukwAOCVfWGjvvRAhlrfGczbq9o8MIwrJnyR waBFmc56vp652rBT82J0K1i5jsopHZv7GBKBMyHkSOr8nr6Bq86nxWGnrB0Orp8GQu0o ZYYsxGo1KIdB/fpcXfx6E1gmv5nNqg4UzeB819AApYACNiVbM/f4WInPZJDjzUsF+Xqv vQ1A== 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=iKozwlzrBwDOZZQyoYHJabN4r3Vpg15uwW4kvVojjxI=; b=kBK3O1KOLLW8yejHZbZqypNvBFaIbKSXLY1DYCpAcpy7/e6kgJqCYHONd2h8MJP4N1 X0KUkNEeXB69s1u8ziKq/S5SHXAFxj4b7+KxJDDFL5WJRHK/P+PxKMtOlmQCM+REVwUx l9ENRcRifw6m+YwXfYWwdpTwbfxGIh8cLaCHlRXbPoK6nF9legnJC1JAFAbW/hQvKJjh gzLISS5HsI0sA24QXjHVJjbtHWSmIJ7dHFCW0IVjMICUcRsg0+v1bA0/UrBGjiDlUcIm 9PHZrrrqORF8tGDahpjVm2SLbmOigD7WNyeE2W6QTphdNdKQHOM9PiT8UhuV7fQnMEze 8ruw== X-Gm-Message-State: AOAM531i3vhFI6nTqL1YrCY+eHhNTvsuLlaUXnom223lp/1TyXRU2nGP CrRXDK3WHyQPDbMUWsfCBRxlqQ== X-Received: by 2002:a05:6512:6cd:: with SMTP id u13mr2608373lff.17.1599301956275; Sat, 05 Sep 2020 03:32:36 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id 10sm1951292lfq.64.2020.09.05.03.32.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Sep 2020 03:32:35 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli , netdev@vger.kernel.org, "David S . Miller" Cc: Linus Walleij Subject: [net-next PATCH] net: dsa: rtl8366: Properly clear member config Date: Sat, 5 Sep 2020 12:32:33 +0200 Message-Id: <20200905103233.16922-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When removing a port from a VLAN we are just erasing the member config for the VLAN, which is wrong: other ports can be using it. Just mask off the port and only zero out the rest of the member config once ports using of the VLAN are removed from it. Reported-by: Florian Fainelli Signed-off-by: Linus Walleij --- drivers/net/dsa/rtl8366.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) -- 2.26.2 diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index 2dcde7a91721..bd3c947976ce 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -471,13 +471,19 @@ int rtl8366_vlan_del(struct dsa_switch *ds, int port, return ret; if (vid == vlanmc.vid) { - /* clear VLAN member configurations */ - vlanmc.vid = 0; - vlanmc.priority = 0; - vlanmc.member = 0; - vlanmc.untag = 0; - vlanmc.fid = 0; - + /* Remove this port from the VLAN */ + vlanmc.member &= ~BIT(port); + vlanmc.untag &= ~BIT(port); + /* + * If no ports are members of this VLAN + * anymore then clear the whole member + * config so it can be reused. + */ + if (!vlanmc.member && vlanmc.untag) { + vlanmc.vid = 0; + vlanmc.priority = 0; + vlanmc.fid = 0; + } ret = smi->ops->set_vlan_mc(smi, i, &vlanmc); if (ret) { dev_err(smi->dev,