From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2F90C4363D for ; Fri, 25 Sep 2020 12:58:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A70DE206DB for ; Fri, 25 Sep 2020 12:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601038712; bh=3CxEedJgFMUT9aAxvc8DjPu3Fk3FQFyN00bflofktYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iERRO8wzPvDtMmPcjtwBNjEadKzD9jMLpWzcjVrMhpBzeCvKiqtTX2cNVs6f/zhBm nRSWZYv3rCuNDqqRxn46zlkwtXlYmNkSXqGLmqwV4f0MZ8uJox/K0x/UGpMdcQwPb7 VVbqhaMLtFdtqhy0P2hVCNOlHs6y7/SIbRdNIGs8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728678AbgIYM6b (ORCPT ); Fri, 25 Sep 2020 08:58:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:52284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728702AbgIYMs4 (ORCPT ); Fri, 25 Sep 2020 08:48:56 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0526221741; Fri, 25 Sep 2020 12:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601038136; bh=3CxEedJgFMUT9aAxvc8DjPu3Fk3FQFyN00bflofktYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v3ZMBGPhf0vXk3PnbzXHlvzjZcGbMZbjTY+Rhj+3mi6VlB1+IbM7FlvmSENXBn4VM FCb5ReScKi83BUaPFVeIxnR6vxKIZ/G18ovUwUh7m26zykkWIyz5KdJLh3vzlCXFXR Pfz9Lm2wgmlss1yhnYh/2wAUgP0+FpuVV1iR1G+Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Linus Walleij , Jakub Kicinski Subject: [PATCH 5.8 17/56] net: dsa: rtl8366: Properly clear member config Date: Fri, 25 Sep 2020 14:48:07 +0200 Message-Id: <20200925124730.414777419@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200925124727.878494124@linuxfoundation.org> References: <20200925124727.878494124@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Walleij [ Upstream commit 4ddcaf1ebb5e4e99240f29d531ee69d4244fe416 ] 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 Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver") Signed-off-by: Linus Walleij Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/dsa/rtl8366.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -452,13 +452,19 @@ int rtl8366_vlan_del(struct dsa_switch * 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,