Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1347961pxf; Fri, 19 Mar 2021 05:23:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/zfBeOy2MOrs6BDubfph7u0afmgPmnnFbaoZ0Bm81fpxmqjWL0vqCZIWiW7/wWykV4gac X-Received: by 2002:a17:907:7637:: with SMTP id jy23mr3926105ejc.12.1616156638501; Fri, 19 Mar 2021 05:23:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616156638; cv=none; d=google.com; s=arc-20160816; b=qltzxXYdS3ka5tXybVAGz7BtwA8qvOGWJlA3NQrEXSvKhq4TxgU+3avjoWXIuj+VtR rIbtjY7t4WhZUjGB4YnUh1ZzxWd+Z7VbgJYQ+aeAZeutZZKFdWxdG4UfTm+fuKhJJtKC gi3FLTcnwBeVCa3wbYuiT0gWSf5PreAZ6v4/QM507rVP8Qhm7tGUJEIejZnhQSn4gB15 nMqQuoBuWgwW9Sj3ZszEJMqUBErlkYNzuDUzNu9HOb/DJwVV2M6VJUfivRL84/jANOq7 bCc+dmU3gRQDBoGslRvhwqsnxGKeiGKulvzZz9BSH2yzTGqZ1TtqGXW9y8/FSD13IiIy 6V0w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4FmU8yspdexp2CFP91FaD5RXGYx8S2r8Ws4/T3fdmVw=; b=IvlgymWhjUswoESYCVmjeXK/a1A0O5cxuHli0hx9MjO7D+IHZ5nn29jT1tmLz1VR3U mwOEGdQY1IPhg6sE40Ut92U9FahWdU9T5beQsTOO98RpGlsDTx80pB9Cjx3vWyJWbX7A YqwwWOJk/EIilwFUviYaAhm5PJ0LpyrVOmvkoB28Bil1MDugAf/nD5kkDIoczLhKU1ll Q2qniVi8ZTUv7/HNCI9x7pXFKer1vF2ceb7XdCLk8YUGf8pUP26quThMynmGQBWAiwHT EZDuE4kybM/qJbPmVt349vCqysmLjo4I05igrQAE9K6K35IBUvpoFyqHTwrQgkOisyzs PXYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NBnzNm5i; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q1si4006271edn.100.2021.03.19.05.23.35; Fri, 19 Mar 2021 05:23:58 -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=@linuxfoundation.org header.s=korg header.b=NBnzNm5i; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231313AbhCSMVw (ORCPT + 99 others); Fri, 19 Mar 2021 08:21:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:60248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231317AbhCSMVT (ORCPT ); Fri, 19 Mar 2021 08:21:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 808AF6146D; Fri, 19 Mar 2021 12:21:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616156479; bh=XKDqBZZfl+KZQVlMjVScLpjaVVbp4NEIbL8ssPi90og=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NBnzNm5iNUkn4Mt8l+lNCuh+87sj3t6zOJOXjeP7s8tpY4HeeiTgSg+eK6sXVU3HQ //lLU1pxhuZSb9lDawwa8XWM1O3e1WBzFc2tsjKZ+xT6ml7l35cY8eDiNbLJ3WN5nr 21DLjSLE0k10r7ZFkC4KxesFQnW+5j/L4bVXrZY0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Vladimir Oltean , Jakub Kicinski Subject: [PATCH 5.11 30/31] net: dsa: b53: Support setting learning on port Date: Fri, 19 Mar 2021 13:19:24 +0100 Message-Id: <20210319121748.182764766@linuxfoundation.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210319121747.203523570@linuxfoundation.org> References: <20210319121747.203523570@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: Florian Fainelli commit f9b3827ee66cfcf297d0acd6ecf33653a5f297ef upstream. Add support for being able to set the learning attribute on port, and make sure that the standalone ports start up with learning disabled. We can remove the code in bcm_sf2 that configured the ports learning attribute because we want the standalone ports to have learning disabled by default and port 7 cannot be bridged, so its learning attribute will not change past its initial configuration. Signed-off-by: Florian Fainelli Reviewed-by: Vladimir Oltean Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/dsa/b53/b53_common.c | 18 ++++++++++++++++++ drivers/net/dsa/b53/b53_regs.h | 1 + drivers/net/dsa/bcm_sf2.c | 15 +-------------- 3 files changed, 20 insertions(+), 14 deletions(-) --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -510,6 +510,19 @@ void b53_imp_vlan_setup(struct dsa_switc } EXPORT_SYMBOL(b53_imp_vlan_setup); +static void b53_port_set_learning(struct b53_device *dev, int port, + bool learning) +{ + u16 reg; + + b53_read16(dev, B53_CTRL_PAGE, B53_DIS_LEARNING, ®); + if (learning) + reg &= ~BIT(port); + else + reg |= BIT(port); + b53_write16(dev, B53_CTRL_PAGE, B53_DIS_LEARNING, reg); +} + int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy) { struct b53_device *dev = ds->priv; @@ -523,6 +536,7 @@ int b53_enable_port(struct dsa_switch *d cpu_port = dsa_to_port(ds, port)->cpu_dp->index; b53_br_egress_floods(ds, port, true, true); + b53_port_set_learning(dev, port, false); if (dev->ops->irq_enable) ret = dev->ops->irq_enable(dev, port); @@ -656,6 +670,7 @@ static void b53_enable_cpu_port(struct b b53_brcm_hdr_setup(dev->ds, port); b53_br_egress_floods(dev->ds, port, true, true); + b53_port_set_learning(dev, port, false); } static void b53_enable_mib(struct b53_device *dev) @@ -1839,6 +1854,8 @@ int b53_br_join(struct dsa_switch *ds, i b53_write16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(port), pvlan); dev->ports[port].vlan_ctl_mask = pvlan; + b53_port_set_learning(dev, port, true); + return 0; } EXPORT_SYMBOL(b53_br_join); @@ -1886,6 +1903,7 @@ void b53_br_leave(struct dsa_switch *ds, vl->untag |= BIT(port) | BIT(cpu_port); b53_set_vlan_entry(dev, pvid, vl); } + b53_port_set_learning(dev, port, false); } EXPORT_SYMBOL(b53_br_leave); --- a/drivers/net/dsa/b53/b53_regs.h +++ b/drivers/net/dsa/b53/b53_regs.h @@ -115,6 +115,7 @@ #define B53_UC_FLOOD_MASK 0x32 #define B53_MC_FLOOD_MASK 0x34 #define B53_IPMC_FLOOD_MASK 0x36 +#define B53_DIS_LEARNING 0x3c /* * Override Ports 0-7 State on devices with xMII interfaces (8 bit) --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -222,23 +222,10 @@ static int bcm_sf2_port_setup(struct dsa reg &= ~P_TXQ_PSM_VDD(port); core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL); - /* Enable learning */ - reg = core_readl(priv, CORE_DIS_LEARN); - reg &= ~BIT(port); - core_writel(priv, reg, CORE_DIS_LEARN); - /* Enable Broadcom tags for that port if requested */ - if (priv->brcm_tag_mask & BIT(port)) { + if (priv->brcm_tag_mask & BIT(port)) b53_brcm_hdr_setup(ds, port); - /* Disable learning on ASP port */ - if (port == 7) { - reg = core_readl(priv, CORE_DIS_LEARN); - reg |= BIT(port); - core_writel(priv, reg, CORE_DIS_LEARN); - } - } - /* Configure Traffic Class to QoS mapping, allow each priority to map * to a different queue number */