From: Greg Kroah-Hartman Date: Fri, 19 Mar 2021 10:48:52 +0000 (+0100) Subject: 4.14-stable patches X-Git-Tag: v4.19.182~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=99ae01e4450ea57218bfe34e6bb6e4d04148b0e1;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: net-dsa-b53-support-setting-learning-on-port.patch --- diff --git a/queue-4.14/net-dsa-b53-support-setting-learning-on-port.patch b/queue-4.14/net-dsa-b53-support-setting-learning-on-port.patch new file mode 100644 index 00000000000..255e94d44a2 --- /dev/null +++ b/queue-4.14/net-dsa-b53-support-setting-learning-on-port.patch @@ -0,0 +1,121 @@ +From f9b3827ee66cfcf297d0acd6ecf33653a5f297ef Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 22 Feb 2021 14:30:10 -0800 +Subject: net: dsa: b53: Support setting learning on port + +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 | 20 ++++++++++++++++++++ + drivers/net/dsa/b53/b53_regs.h | 1 + + drivers/net/dsa/bcm_sf2.c | 5 +++++ + drivers/net/dsa/bcm_sf2_regs.h | 2 ++ + 4 files changed, 28 insertions(+) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -501,6 +501,19 @@ static void b53_imp_vlan_setup(struct ds + } + } + ++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); ++} ++ + static int b53_enable_port(struct dsa_switch *ds, int port, + struct phy_device *phy) + { +@@ -508,6 +521,8 @@ static int b53_enable_port(struct dsa_sw + unsigned int cpu_port = dev->cpu_port; + u16 pvlan; + ++ b53_port_set_learning(dev, port, false); ++ + /* Clear the Rx and Tx disable bits and set to no spanning tree */ + b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), 0); + +@@ -551,6 +566,8 @@ static void b53_enable_cpu_port(struct b + PORT_CTRL_RX_MCST_EN | + PORT_CTRL_RX_UCST_EN; + b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(cpu_port), port_ctrl); ++ ++ b53_port_set_learning(dev, cpu_port, false); + } + + static void b53_enable_mib(struct b53_device *dev) +@@ -1342,6 +1359,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); +@@ -1392,6 +1411,7 @@ void b53_br_leave(struct dsa_switch *ds, + vl->untag |= BIT(port) | BIT(dev->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 +@@ -112,6 +112,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 +@@ -252,6 +252,11 @@ static int bcm_sf2_port_setup(struct dsa + reg &= ~P_TXQ_PSM_VDD(port); + core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL); + ++ /* Disable 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)) + bcm_sf2_brcm_hdr_setup(priv, port); +--- a/drivers/net/dsa/bcm_sf2_regs.h ++++ b/drivers/net/dsa/bcm_sf2_regs.h +@@ -150,6 +150,8 @@ enum bcm_sf2_reg_offs { + #define CORE_SWITCH_CTRL 0x00088 + #define MII_DUMB_FWDG_EN (1 << 6) + ++#define CORE_DIS_LEARN 0x000f0 ++ + #define CORE_SFT_LRN_CTRL 0x000f8 + #define SW_LEARN_CNTL(x) (1 << (x)) + diff --git a/queue-4.14/series b/queue-4.14/series index e466cc94f53..b8bacb57800 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -4,3 +4,4 @@ ext4-check-journal-inode-extents-more-carefully.patch bpf-fix-off-by-one-for-area-size-in-creating-mask-to-left.patch bpf-simplify-alu_limit-masking-for-pointer-arithmetic.patch bpf-add-sanity-check-for-upper-ptr_limit.patch +net-dsa-b53-support-setting-learning-on-port.patch