From d84d34e6e077f27bb20aafd5b9f639b297a077ab Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 20 Nov 2020 03:03:54 +0100 Subject: [PATCH 01/10] sdk: expose binary strip settings Expose the SDK options for binary stripping to the menuconfig. This way, packages can easily be built with debug symbols using the SDK. Signed-off-by: David Bauer (cherry picked from commit bb817bb4b8b0b546a70e45bd907ebfeea2370dcd) --- target/sdk/files/Config.in | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/target/sdk/files/Config.in b/target/sdk/files/Config.in index 4393daab5b..f687992497 100644 --- a/target/sdk/files/Config.in +++ b/target/sdk/files/Config.in @@ -18,6 +18,52 @@ menu "Global build settings" bool "Cryptographically sign package lists" default y + comment "Package build options" + + config DEBUG + bool + prompt "Compile packages with debugging info" + default n + help + Adds -g3 to the CFLAGS. + + comment "Stripping options" + + choice + prompt "Binary stripping method" + default USE_STRIP if EXTERNAL_TOOLCHAIN + default USE_STRIP if USE_GLIBC + default USE_SSTRIP + help + Select the binary stripping method you wish to use. + + config NO_STRIP + bool "none" + help + This will install unstripped binaries (useful for native + compiling/debugging). + + config USE_STRIP + bool "strip" + help + This will install binaries stripped using strip from binutils. + + config USE_SSTRIP + bool "sstrip" + depends on !USE_GLIBC + help + This will install binaries stripped using sstrip. + endchoice + + config STRIP_ARGS + string + prompt "Strip arguments" + depends on USE_STRIP + default "--strip-unneeded --remove-section=.comment --remove-section=.note" if DEBUG + default "--strip-all" + help + Specifies arguments passed to the strip command when stripping binaries. + endmenu menu "Advanced configuration options (for developers)" From 904581c59e0c326a865b0ebf802db8ae5fec95f0 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 12 Sep 2022 00:29:00 +0200 Subject: [PATCH 02/10] toolchain: Select USE_SSTRIP with external musl toolchain When we use the internal toolchain USE_SSTRIP will be selected by default for musl libc and USE_STRIP when glibc is used. Do the same when an external toolchain is used. USE_GLIBC will also be set for external toolchain builds based on the EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC setting. Signed-off-by: Hauke Mehrtens (cherry picked from commit 9403810c020cca136149973a3929bf77a1f501aa) --- config/Config-build.in | 1 - target/sdk/files/Config.in | 1 - 2 files changed, 2 deletions(-) diff --git a/config/Config-build.in b/config/Config-build.in index 196d4e67a0..a43f218c89 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -164,7 +164,6 @@ menu "Global build settings" choice prompt "Binary stripping method" - default USE_STRIP if EXTERNAL_TOOLCHAIN default USE_STRIP if USE_GLIBC default USE_SSTRIP help diff --git a/target/sdk/files/Config.in b/target/sdk/files/Config.in index f687992497..b1e18949f6 100644 --- a/target/sdk/files/Config.in +++ b/target/sdk/files/Config.in @@ -31,7 +31,6 @@ menu "Global build settings" choice prompt "Binary stripping method" - default USE_STRIP if EXTERNAL_TOOLCHAIN default USE_STRIP if USE_GLIBC default USE_SSTRIP help From d03c520e75ec0a744483a3f57eea35d01fcd298f Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 5 Dec 2022 23:23:04 +0100 Subject: [PATCH 03/10] CI: build: fix use of sdk as toolchain The toolchain included in a sdk have a different format than an external toolchain tar. Since sdk is a more integrated setup doesn't use and include wrapper bin that use the external toolchain config and use an alternative and more standard way to include all the toolchain headers. External toolchain use wrapper.sh to append the configured include header when each tool is called. Fix the sdk toolchain by reverting their own sdk wrapper scripts and to simulate an external toolchain build copying what is done in the toolchain target makefile. This handle compilation error and warning caused by not using fortify header on building packages. Fixes: 006e52545d14 ("CI: build: add support to fallback to sdk for external toolchain") Signed-off-by: Christian Marangi (cherry picked from commit 42f0ab028e2eae0d4e7acf9db7fd68b256f23503) --- .github/workflows/build.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 115bf2c654..43f30617d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -266,6 +266,34 @@ jobs: --overwrite-config \ --config ${{ env.TARGET }}/${{ env.SUBTARGET }} + - name: Adapt external sdk to external toolchain format + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + TOOLCHAIN_DIR=${{ env.TOOLCHAIN_FILE }}/staging_dir/$(ls ${{ env.TOOLCHAIN_FILE }}/staging_dir | grep toolchain) + TOOLCHAIN_BIN=$TOOLCHAIN_DIR/bin + OPENWRT_DIR=$(pwd) + + # Find target name from toolchain info.mk + GNU_TARGET_NAME=$(cat $TOOLCHAIN_DIR/info.mk | grep TARGET_CROSS | sed 's/^TARGET_CROSS=\(.*\)-$/\1/') + + cd $TOOLCHAIN_BIN + + # Revert sdk wrapper scripts applied to all the bins + for app in $(find . -name "*.bin"); do + TARGET_APP=$(echo $app | sed 's/\.\/\.\(.*\)\.bin/\1/') + rm $TARGET_APP + mv .$TARGET_APP.bin $TARGET_APP + done + + # Setup the wrapper script in the sdk toolchain dir simulating an external toolchain build + cp $OPENWRT_DIR/target/toolchain/files/wrapper.sh $GNU_TARGET_NAME-wrapper.sh + for app in cc gcc g++ c++ cpp ld as ; do + [ -f $GNU_TARGET_NAME-$app ] && mv $GNU_TARGET_NAME-$app $GNU_TARGET_NAME-$app.bin + ln -sf $GNU_TARGET_NAME-wrapper.sh $GNU_TARGET_NAME-$app + done + - name: Configure external toolchain with sdk if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' shell: su buildbot -c "sh -e {0}" From 202d404f743a49a50e253c54f43ebd47fd028496 Mon Sep 17 00:00:00 2001 From: Adam Konrad Date: Sat, 26 Nov 2022 22:23:20 -0600 Subject: [PATCH 04/10] cmake: update to version 3.19.8 Updating CMake to latest patched version 3.19.8 which is fixing issue with ccache. Related issue: https://github.com/openwrt/openwrt/issues/8555 Compile-tested: arm64 Signed-off-by: Adam Konrad --- tools/cmake/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index 006934466a..54ac6891a7 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,14 +7,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.19.1 +PKG_VERSION:=3.19.8 PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \ https://cmake.org/files/v3.19/ -PKG_HASH:=1d266ea3a76ef650cdcf16c782a317cb4a7aa461617ee941e389cb48738a3aba +PKG_HASH:=09b4fa4837aae55c75fb170f6a6e2b44818deba48335d1969deddfbb34e30369 HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 From 067d7e9f90abcbabc5be5a38c4dedbcdab6c96ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 7 Dec 2022 09:26:11 +0100 Subject: [PATCH 05/10] kernel: backport b53/bcm_sf2 changes from v5.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...b53-Use-dev_-err-info-instead-of-pr_.patch | 4 +- ...-support-BCM4908-s-integrated-switch.patch | 8 +- ...store-PHY-interface-mode-in-port-str.patch | 6 +- ..._sf2-setup-BCM4908-internal-crossbar.patch | 18 +-- ...-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch | 2 +- ...-add-function-finding-RGMII-register.patch | 10 +- ...-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch | 2 +- ...dsa-bcm_sf2-refactor-LED-regs-access.patch | 4 +- ...m_sf2-enable-GPHY-for-switch-probing.patch | 2 +- ...sf2-keep-GPHY-enabled-on-the-BCM4908.patch | 2 +- ...53-Fix-valid-setting-for-MDB-entries.patch | 31 +++++ ...0001-net-dsa-b53-Add-support-for-MDB.patch | 130 ++++++++++++++++++ ...t-dsa-bcm_sf2-Wire-up-MDB-operations.patch | 27 ++++ ...Add-support-for-optional-reset-contr.patch | 81 +++++++++++ ...53-Fix-valid-setting-for-MDB-entries.patch | 30 ++++ ...e-resolved-link-config-via-mac_link_.patch | 2 +- 16 files changed, 329 insertions(+), 30 deletions(-) create mode 100644 target/linux/generic/backport-5.4/702-Revert-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch create mode 100644 target/linux/generic/backport-5.4/703-v5.5-0001-net-dsa-b53-Add-support-for-MDB.patch create mode 100644 target/linux/generic/backport-5.4/703-v5.5-0002-net-dsa-bcm_sf2-Wire-up-MDB-operations.patch create mode 100644 target/linux/generic/backport-5.4/703-v5.5-0003-net-dsa-bcm_sf2-Add-support-for-optional-reset-contr.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch diff --git a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch index be09ab9e7d..0b2ebbe1f8 100644 --- a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch +++ b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller #include #include #include -@@ -2475,8 +2473,9 @@ int b53_switch_detect(struct b53_device +@@ -2533,8 +2531,9 @@ int b53_switch_detect(struct b53_device dev->chip_id = id32; break; default: @@ -38,7 +38,7 @@ Signed-off-by: David S. Miller return -ENODEV; } } -@@ -2506,7 +2505,8 @@ int b53_switch_register(struct b53_devic +@@ -2564,7 +2563,8 @@ int b53_switch_register(struct b53_devic if (ret) return ret; diff --git a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch index 766db3e641..bd8bb1e51e 100644 --- a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch +++ b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch @@ -23,7 +23,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -2271,6 +2271,22 @@ static const struct b53_chip_data b53_sw +@@ -2329,6 +2329,22 @@ static const struct b53_chip_data b53_sw .jumbo_pm_reg = B53_JUMBO_PORT_MASK, .jumbo_size_reg = B53_JUMBO_MAX_SIZE, }, @@ -68,7 +68,7 @@ Signed-off-by: Jakub Kicinski offset = CORE_STS_OVERRIDE_IMP; else offset = CORE_STS_OVERRIDE_IMP2; -@@ -543,7 +544,8 @@ static void bcm_sf2_sw_mac_config(struct +@@ -555,7 +556,8 @@ static void bcm_sf2_sw_mac_config(struct if (port == core_readl(priv, CORE_IMP0_PRT_ID)) return; @@ -78,7 +78,7 @@ Signed-off-by: Jakub Kicinski offset = CORE_STS_OVERRIDE_GMIIP_PORT(port); else offset = CORE_STS_OVERRIDE_GMIIP2_PORT(port); -@@ -990,6 +992,30 @@ struct bcm_sf2_of_data { +@@ -1005,6 +1007,30 @@ struct bcm_sf2_of_data { unsigned int num_cfp_rules; }; @@ -109,7 +109,7 @@ Signed-off-by: Jakub Kicinski /* Register offsets for the SWITCH_REG_* block */ static const u16 bcm_sf2_7445_reg_offsets[] = { [REG_SWITCH_CNTRL] = 0x00, -@@ -1038,6 +1064,9 @@ static const struct bcm_sf2_of_data bcm_ +@@ -1053,6 +1079,9 @@ static const struct bcm_sf2_of_data bcm_ }; static const struct of_device_id bcm_sf2_of_match[] = { diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch index 69bf2d0d2f..9590327649 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -380,8 +380,9 @@ static void bcm_sf2_intr_disable(struct +@@ -392,8 +392,9 @@ static void bcm_sf2_intr_disable(struct static void bcm_sf2_identify_ports(struct bcm_sf2_priv *priv, struct device_node *dn) { @@ -29,7 +29,7 @@ Signed-off-by: David S. Miller unsigned int port_num; priv->moca_port = -1; -@@ -390,19 +391,26 @@ static void bcm_sf2_identify_ports(struc +@@ -402,19 +403,26 @@ static void bcm_sf2_identify_ports(struc if (of_property_read_u32(port, "reg", &port_num)) continue; @@ -62,7 +62,7 @@ Signed-off-by: David S. Miller if (of_property_read_bool(port, "brcm,use-bcm-hdr")) --- a/drivers/net/dsa/bcm_sf2.h +++ b/drivers/net/dsa/bcm_sf2.h -@@ -43,6 +43,7 @@ struct bcm_sf2_hw_params { +@@ -44,6 +44,7 @@ struct bcm_sf2_hw_params { #define BCM_SF2_REGS_NUM 6 struct bcm_sf2_port_status { diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch index 09fb5dbd15..21717ffc3c 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch @@ -37,7 +37,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -369,6 +369,44 @@ static int bcm_sf2_sw_rst(struct bcm_sf2 +@@ -381,6 +381,44 @@ static int bcm_sf2_sw_rst(struct bcm_sf2 return 0; } @@ -82,7 +82,7 @@ Signed-off-by: David S. Miller static void bcm_sf2_intr_disable(struct bcm_sf2_priv *priv) { intrl2_0_mask_set(priv, 0xffffffff); -@@ -739,6 +777,8 @@ static int bcm_sf2_sw_resume(struct dsa_ +@@ -751,6 +789,8 @@ static int bcm_sf2_sw_resume(struct dsa_ return ret; } @@ -91,7 +91,7 @@ Signed-off-by: David S. Miller ret = bcm_sf2_cfp_resume(ds); if (ret) return ret; -@@ -1001,6 +1041,7 @@ struct bcm_sf2_of_data { +@@ -1016,6 +1056,7 @@ struct bcm_sf2_of_data { const u16 *reg_offsets; unsigned int core_reg_align; unsigned int num_cfp_rules; @@ -99,7 +99,7 @@ Signed-off-by: David S. Miller }; static const u16 bcm_sf2_4908_reg_offsets[] = { -@@ -1025,6 +1066,7 @@ static const struct bcm_sf2_of_data bcm_ +@@ -1040,6 +1081,7 @@ static const struct bcm_sf2_of_data bcm_ .core_reg_align = 0, .reg_offsets = bcm_sf2_4908_reg_offsets, .num_cfp_rules = 0, /* FIXME */ @@ -107,15 +107,15 @@ Signed-off-by: David S. Miller }; /* Register offsets for the SWITCH_REG_* block */ -@@ -1135,6 +1177,7 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1150,6 +1192,7 @@ static int bcm_sf2_sw_probe(struct platf priv->reg_offsets = data->reg_offsets; priv->core_reg_align = data->core_reg_align; priv->num_cfp_rules = data->num_cfp_rules; + priv->num_crossbar_int_ports = data->num_crossbar_int_ports; - /* Auto-detection using standard registers will not work, so - * provide an indication of what kind of device we are for -@@ -1189,6 +1232,8 @@ static int bcm_sf2_sw_probe(struct platf + priv->rcdev = devm_reset_control_get_optional_exclusive(&pdev->dev, + "switch"); +@@ -1209,6 +1252,8 @@ static int bcm_sf2_sw_probe(struct platf return ret; } @@ -126,7 +126,7 @@ Signed-off-by: David S. Miller ret = bcm_sf2_mdio_register(ds); --- a/drivers/net/dsa/bcm_sf2.h +++ b/drivers/net/dsa/bcm_sf2.h -@@ -70,6 +70,7 @@ struct bcm_sf2_priv { +@@ -73,6 +73,7 @@ struct bcm_sf2_priv { const u16 *reg_offsets; unsigned int core_reg_align; unsigned int num_cfp_rules; diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch index 8b5332cdda..a2aa554a60 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch @@ -14,7 +14,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1065,7 +1065,7 @@ static const struct bcm_sf2_of_data bcm_ +@@ -1080,7 +1080,7 @@ static const struct bcm_sf2_of_data bcm_ .type = BCM4908_DEVICE_ID, .core_reg_align = 0, .reg_offsets = bcm_sf2_4908_reg_offsets, diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch index c6b724215f..162b7ece3b 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch @@ -57,7 +57,7 @@ Signed-off-by: David S. Miller static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) { struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); -@@ -588,6 +613,7 @@ static void bcm_sf2_sw_mac_config(struct +@@ -600,6 +625,7 @@ static void bcm_sf2_sw_mac_config(struct { struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); u32 id_mode_dis = 0, port_mode; @@ -65,7 +65,7 @@ Signed-off-by: David S. Miller u32 reg, offset; if (port == core_readl(priv, CORE_IMP0_PRT_ID)) -@@ -617,10 +643,12 @@ static void bcm_sf2_sw_mac_config(struct +@@ -629,10 +655,12 @@ static void bcm_sf2_sw_mac_config(struct goto force_link; } @@ -79,7 +79,7 @@ Signed-off-by: David S. Miller reg &= ~ID_MODE_DIS; reg &= ~(PORT_MODE_MASK << PORT_MODE_SHIFT); reg &= ~(RX_PAUSE_EN | TX_PAUSE_EN); -@@ -635,7 +663,7 @@ static void bcm_sf2_sw_mac_config(struct +@@ -647,7 +675,7 @@ static void bcm_sf2_sw_mac_config(struct reg |= RX_PAUSE_EN; } @@ -88,7 +88,7 @@ Signed-off-by: David S. Miller force_link: /* Force link settings detected from the PHY */ -@@ -666,6 +694,7 @@ static void bcm_sf2_sw_mac_link_set(stru +@@ -678,6 +706,7 @@ static void bcm_sf2_sw_mac_link_set(stru phy_interface_t interface, bool link) { struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); @@ -96,7 +96,7 @@ Signed-off-by: David S. Miller u32 reg; if (!phy_interface_mode_is_rgmii(interface) && -@@ -673,13 +702,15 @@ static void bcm_sf2_sw_mac_link_set(stru +@@ -685,13 +714,15 @@ static void bcm_sf2_sw_mac_link_set(stru interface != PHY_INTERFACE_MODE_REVMII) return; diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch index 81f3ff5d4d..09e00d5a5f 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch @@ -33,7 +33,7 @@ Signed-off-by: David S. Miller break; default: switch (port) { -@@ -1084,9 +1089,7 @@ static const u16 bcm_sf2_4908_reg_offset +@@ -1099,9 +1104,7 @@ static const u16 bcm_sf2_4908_reg_offset [REG_PHY_REVISION] = 0x14, [REG_SPHY_CNTRL] = 0x24, [REG_CROSSBAR] = 0xc8, diff --git a/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch b/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch index 9f67fe71c1..12db03ef0c 100644 --- a/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch +++ b/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch @@ -82,7 +82,7 @@ Signed-off-by: Jakub Kicinski } } -@@ -1090,9 +1127,14 @@ static const u16 bcm_sf2_4908_reg_offset +@@ -1105,9 +1142,14 @@ static const u16 bcm_sf2_4908_reg_offset [REG_SPHY_CNTRL] = 0x24, [REG_CROSSBAR] = 0xc8, [REG_RGMII_11_CNTRL] = 0x014c, @@ -102,7 +102,7 @@ Signed-off-by: Jakub Kicinski static const struct bcm_sf2_of_data bcm_sf2_4908_data = { --- a/drivers/net/dsa/bcm_sf2.h +++ b/drivers/net/dsa/bcm_sf2.h -@@ -203,6 +203,16 @@ SF2_IO_MACRO(acb); +@@ -206,6 +206,16 @@ SF2_IO_MACRO(acb); SWITCH_INTR_L2(0); SWITCH_INTR_L2(1); diff --git a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch index ea9089e7ed..d7a4c5b1b8 100644 --- a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch +++ b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch @@ -29,7 +29,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1368,10 +1368,14 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1388,10 +1388,14 @@ static int bcm_sf2_sw_probe(struct platf rev = reg_readl(priv, REG_PHY_REVISION); priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK; diff --git a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch index 2b860f4ed1..7ddbb44d35 100644 --- a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch +++ b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch @@ -15,7 +15,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1382,6 +1382,12 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1402,6 +1402,12 @@ static int bcm_sf2_sw_probe(struct platf priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff, priv->irq0, priv->irq1); diff --git a/target/linux/generic/backport-5.4/702-Revert-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch b/target/linux/generic/backport-5.4/702-Revert-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch new file mode 100644 index 0000000000..d9602fab7a --- /dev/null +++ b/target/linux/generic/backport-5.4/702-Revert-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch @@ -0,0 +1,31 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 7 Dec 2022 07:57:58 +0100 +Subject: [PATCH] Revert "net: dsa: b53: Fix valid setting for MDB entries" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit 1fae6eb0fc91d3ecb539e03f9e4dcd1c53ada553. + +Upstream commit was a fix for an overlook of setting "ent.is_valid" +twice after 5d65b64a3d97 ("net: dsa: b53: Add support for MDB"). + +Since MDB support was not backported to stable kernels (it's not a bug +fix) there is nothing to fix there. Backporting this commit resulted in +"env.is_valid" not being set at all. + +Signed-off-by: Rafał Miłecki +--- + drivers/net/dsa/b53/b53_common.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1551,6 +1551,7 @@ static int b53_arl_op(struct b53_device + + memset(&ent, 0, sizeof(ent)); + ent.port = port; ++ ent.is_valid = is_valid; + ent.vid = vid; + ent.is_static = true; + memcpy(ent.mac, addr, ETH_ALEN); diff --git a/target/linux/generic/backport-5.4/703-v5.5-0001-net-dsa-b53-Add-support-for-MDB.patch b/target/linux/generic/backport-5.4/703-v5.5-0001-net-dsa-b53-Add-support-for-MDB.patch new file mode 100644 index 0000000000..8349d31900 --- /dev/null +++ b/target/linux/generic/backport-5.4/703-v5.5-0001-net-dsa-b53-Add-support-for-MDB.patch @@ -0,0 +1,130 @@ +From 5d65b64a3d97011796b225ce315b3ce0011551e7 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Thu, 24 Oct 2019 12:45:07 -0700 +Subject: [PATCH] net: dsa: b53: Add support for MDB + +In preparation for supporting IGMP snooping with or without the use of +a bridge, add support within b53_common.c to program the ARL entries for +multicast operations. The key difference is that a multicast ARL entry +is comprised of a bitmask of enabled ports, instead of a port number. + +Signed-off-by: Florian Fainelli +Reviewed-by: Vivien Didelot +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 62 ++++++++++++++++++++++++++++++-- + drivers/net/dsa/b53/b53_priv.h | 8 ++++- + 2 files changed, 67 insertions(+), 3 deletions(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1549,11 +1549,25 @@ static int b53_arl_op(struct b53_device + break; + } + +- memset(&ent, 0, sizeof(ent)); +- ent.port = port; ++ /* For multicast address, the port is a bitmask and the validity ++ * is determined by having at least one port being still active ++ */ ++ if (!is_multicast_ether_addr(addr)) { ++ ent.port = port; ++ ent.is_valid = is_valid; ++ } else { ++ if (is_valid) ++ ent.port |= BIT(port); ++ else ++ ent.port &= ~BIT(port); ++ ++ ent.is_valid = !!(ent.port); ++ } ++ + ent.is_valid = is_valid; + ent.vid = vid; + ent.is_static = true; ++ ent.is_age = false; + memcpy(ent.mac, addr, ETH_ALEN); + b53_arl_from_entry(&mac_vid, &fwd_entry, &ent); + +@@ -1672,6 +1686,47 @@ int b53_fdb_dump(struct dsa_switch *ds, + } + EXPORT_SYMBOL(b53_fdb_dump); + ++int b53_mdb_prepare(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb) ++{ ++ struct b53_device *priv = ds->priv; ++ ++ /* 5325 and 5365 require some more massaging, but could ++ * be supported eventually ++ */ ++ if (is5325(priv) || is5365(priv)) ++ return -EOPNOTSUPP; ++ ++ return 0; ++} ++EXPORT_SYMBOL(b53_mdb_prepare); ++ ++void b53_mdb_add(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb) ++{ ++ struct b53_device *priv = ds->priv; ++ int ret; ++ ++ ret = b53_arl_op(priv, 0, port, mdb->addr, mdb->vid, true); ++ if (ret) ++ dev_err(ds->dev, "failed to add MDB entry\n"); ++} ++EXPORT_SYMBOL(b53_mdb_add); ++ ++int b53_mdb_del(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb) ++{ ++ struct b53_device *priv = ds->priv; ++ int ret; ++ ++ ret = b53_arl_op(priv, 0, port, mdb->addr, mdb->vid, false); ++ if (ret) ++ dev_err(ds->dev, "failed to delete MDB entry\n"); ++ ++ return ret; ++} ++EXPORT_SYMBOL(b53_mdb_del); ++ + int b53_br_join(struct dsa_switch *ds, int port, struct net_device *br) + { + struct b53_device *dev = ds->priv; +@@ -2050,6 +2105,9 @@ static const struct dsa_switch_ops b53_s + .port_fdb_del = b53_fdb_del, + .port_mirror_add = b53_mirror_add, + .port_mirror_del = b53_mirror_del, ++ .port_mdb_prepare = b53_mdb_prepare, ++ .port_mdb_add = b53_mdb_add, ++ .port_mdb_del = b53_mdb_del, + }; + + struct b53_chip_data { +--- a/drivers/net/dsa/b53/b53_priv.h ++++ b/drivers/net/dsa/b53/b53_priv.h +@@ -250,7 +250,7 @@ b53_build_op(write48, u64); + b53_build_op(write64, u64); + + struct b53_arl_entry { +- u8 port; ++ u16 port; + u8 mac[ETH_ALEN]; + u16 vid; + u8 is_valid:1; +@@ -351,6 +351,12 @@ int b53_fdb_del(struct dsa_switch *ds, i + const unsigned char *addr, u16 vid); + int b53_fdb_dump(struct dsa_switch *ds, int port, + dsa_fdb_dump_cb_t *cb, void *data); ++int b53_mdb_prepare(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb); ++void b53_mdb_add(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb); ++int b53_mdb_del(struct dsa_switch *ds, int port, ++ const struct switchdev_obj_port_mdb *mdb); + int b53_mirror_add(struct dsa_switch *ds, int port, + struct dsa_mall_mirror_tc_entry *mirror, bool ingress); + enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port); diff --git a/target/linux/generic/backport-5.4/703-v5.5-0002-net-dsa-bcm_sf2-Wire-up-MDB-operations.patch b/target/linux/generic/backport-5.4/703-v5.5-0002-net-dsa-bcm_sf2-Wire-up-MDB-operations.patch new file mode 100644 index 0000000000..98c69fc51e --- /dev/null +++ b/target/linux/generic/backport-5.4/703-v5.5-0002-net-dsa-bcm_sf2-Wire-up-MDB-operations.patch @@ -0,0 +1,27 @@ +From 29bb5e8337caf2e3d9802ee6a6804561f125bfcf Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Thu, 24 Oct 2019 12:45:08 -0700 +Subject: [PATCH] net: dsa: bcm_sf2: Wire up MDB operations + +Leverage the recently add b53_mdb_{add,del,prepare} functions since they +work as-is for bcm_sf2. + +Signed-off-by: Florian Fainelli +Reviewed-by: Vivien Didelot +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -981,6 +981,9 @@ static const struct dsa_switch_ops bcm_s + .set_rxnfc = bcm_sf2_set_rxnfc, + .port_mirror_add = b53_mirror_add, + .port_mirror_del = b53_mirror_del, ++ .port_mdb_prepare = b53_mdb_prepare, ++ .port_mdb_add = b53_mdb_add, ++ .port_mdb_del = b53_mdb_del, + }; + + struct bcm_sf2_of_data { diff --git a/target/linux/generic/backport-5.4/703-v5.5-0003-net-dsa-bcm_sf2-Add-support-for-optional-reset-contr.patch b/target/linux/generic/backport-5.4/703-v5.5-0003-net-dsa-bcm_sf2-Add-support-for-optional-reset-contr.patch new file mode 100644 index 0000000000..be62e7f077 --- /dev/null +++ b/target/linux/generic/backport-5.4/703-v5.5-0003-net-dsa-bcm_sf2-Add-support-for-optional-reset-contr.patch @@ -0,0 +1,81 @@ +From eee87e4377a4b86dc2eea0ade162b0dc33f40576 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 4 Nov 2019 13:51:39 -0800 +Subject: [PATCH] net: dsa: bcm_sf2: Add support for optional reset controller + line + +Grab an optional and exclusive reset controller line for the switch and +manage it during probe/remove functions accordingly. For 7278 devices we +change bcm_sf2_sw_rst() to use the reset controller line since the +WATCHDOG_CTRL register does not reset the switch contrary to stated +documentation. + +Signed-off-by: Florian Fainelli +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2.c | 19 +++++++++++++++++++ + drivers/net/dsa/bcm_sf2.h | 3 +++ + 2 files changed, 22 insertions(+) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -346,6 +346,18 @@ static int bcm_sf2_sw_rst(struct bcm_sf2 + { + unsigned int timeout = 1000; + u32 reg; ++ int ret; ++ ++ /* The watchdog reset does not work on 7278, we need to hit the ++ * "external" reset line through the reset controller. ++ */ ++ if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev)) { ++ ret = reset_control_assert(priv->rcdev); ++ if (ret) ++ return ret; ++ ++ return reset_control_deassert(priv->rcdev); ++ } + + reg = core_readl(priv, CORE_WATCHDOG_CTRL); + reg |= SOFTWARE_RESET | EN_CHIP_RST | EN_SW_RESET; +@@ -1099,6 +1111,11 @@ static int bcm_sf2_sw_probe(struct platf + priv->core_reg_align = data->core_reg_align; + priv->num_cfp_rules = data->num_cfp_rules; + ++ priv->rcdev = devm_reset_control_get_optional_exclusive(&pdev->dev, ++ "switch"); ++ if (PTR_ERR(priv->rcdev) == -EPROBE_DEFER) ++ return PTR_ERR(priv->rcdev); ++ + /* Auto-detection using standard registers will not work, so + * provide an indication of what kind of device we are for + * b53_common to work with +@@ -1237,6 +1254,8 @@ static int bcm_sf2_sw_remove(struct plat + dsa_unregister_switch(priv->dev->ds); + bcm_sf2_cfp_exit(priv->dev->ds); + bcm_sf2_mdio_unregister(priv); ++ if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev)) ++ reset_control_assert(priv->rcdev); + + return 0; + } +--- a/drivers/net/dsa/bcm_sf2.h ++++ b/drivers/net/dsa/bcm_sf2.h +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + + #include + +@@ -64,6 +65,8 @@ struct bcm_sf2_priv { + void __iomem *fcb; + void __iomem *acb; + ++ struct reset_control *rcdev; ++ + /* Register offsets indirection tables */ + u32 type; + const u16 *reg_offsets; diff --git a/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch b/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch new file mode 100644 index 0000000000..cb6497f28a --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch @@ -0,0 +1,30 @@ +From eab167f4851a19c514469dfa81147f77e17b5b20 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 20 Apr 2020 20:26:52 -0700 +Subject: [PATCH] net: dsa: b53: Fix valid setting for MDB entries + +When support for the MDB entries was added, the valid bit was correctly +changed to be assigned depending on the remaining port bitmask, that is, +if there were no more ports added to the entry's port bitmask, the entry +now becomes invalid. There was another assignment a few lines below that +would override this which would invalidate entries even when there were +still multiple ports left in the MDB entry. + +Fixes: 5d65b64a3d97 ("net: dsa: b53: Add support for MDB") +Reviewed-by: Andrew Lunn +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1564,7 +1564,6 @@ static int b53_arl_op(struct b53_device + ent.is_valid = !!(ent.port); + } + +- ent.is_valid = is_valid; + ent.vid = vid; + ent.is_static = true; + ent.is_age = false; diff --git a/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch b/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch index 888d5cb621..22db45aced 100644 --- a/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch +++ b/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch @@ -38,7 +38,7 @@ Signed-off-by: David S. Miller const struct switchdev_obj_port_vlan *vlan); --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -641,7 +641,9 @@ static void bcm_sf2_sw_mac_link_down(str +@@ -653,7 +653,9 @@ static void bcm_sf2_sw_mac_link_down(str static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, From 1f5024aa73fcf3b67bba7785401f9cd7067c88f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 7 Dec 2022 09:37:08 +0100 Subject: [PATCH 06/10] kernel: backport b53/bcm_sf2 changes from v5.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This b53 backport significantly stabilizes switch traffic performance. Signed-off-by: Rafał Miłecki --- ...b53-Use-dev_-err-info-instead-of-pr_.patch | 4 +- ...-Print-err-message-on-SW_RST-timeout.patch | 2 +- ...-support-BCM4908-s-integrated-switch.patch | 2 +- ...formation-about-stacked-DSA-protocol.patch | 363 ++++++++++++++++++ ...le-Broadcom-tags-for-531x5-539x-fami.patch | 104 +++++ ...53-Fix-valid-setting-for-MDB-entries.patch | 2 +- ...t7530-add-support-for-port-mirroring.patch | 6 +- ...e6xxx-Add-support-for-port-mirroring.patch | 4 +- ...x-fix-broken-if-statement-because-of.patch | 2 +- ...an-option-for-drivers-to-always-rece.patch | 8 +- ...3-v5.8-net-dsa-mt7530-fix-VLAN-setup.patch | 2 +- ...sa-rtl8366rb-Support-the-CPU-DSA-tag.patch | 6 +- ...cally-bring-up-DSA-master-when-openi.patch | 2 +- ...r-when-a-non-legacy-FDB-operation-fa.patch | 4 +- ...e-switchdev_notifier_fdb_info-in-dsa.patch | 8 +- ...tchdev-event-implementation-under-th.patch | 4 +- ...ly-in-dsa_slave_switchdev_event-if-w.patch | 2 +- ...or-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch | 6 +- ...-support-hardware-flow-table-offload.patch | 4 +- ...-net-dsa-mt7530-Support-EEE-features.patch | 6 +- ...local-addresses-in-assisted-CPU-port.patch | 2 +- ...bridge-addresses-in-assisted-CPU-por.patch | 2 +- ...tic-FDB-entries-on-foreign-interface.patch | 4 +- ...equest-assisted-learning-on-CPU-port.patch | 2 +- ...lot-add-tsn-support-for-felix-switch.patch | 2 +- ...e-resolved-link-config-via-mac_link_.patch | 10 +- ...se-resolved-link-config-in-mac_link_.patch | 8 +- ...xtend-device-data-ready-for-adding-a.patch | 12 +- ...530-Add-the-support-of-MT7531-switch.patch | 34 +- 29 files changed, 542 insertions(+), 75 deletions(-) create mode 100644 target/linux/generic/backport-5.4/704-v5.6-net-dsa-Get-information-about-stacked-DSA-protocol.patch create mode 100644 target/linux/generic/backport-5.4/705-v5.6-0001-net-dsa-b53-Enable-Broadcom-tags-for-531x5-539x-fami.patch diff --git a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch index 0b2ebbe1f8..04e506f6fe 100644 --- a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch +++ b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller #include #include #include -@@ -2533,8 +2531,9 @@ int b53_switch_detect(struct b53_device +@@ -2567,8 +2565,9 @@ int b53_switch_detect(struct b53_device dev->chip_id = id32; break; default: @@ -38,7 +38,7 @@ Signed-off-by: David S. Miller return -ENODEV; } } -@@ -2564,7 +2563,8 @@ int b53_switch_register(struct b53_devic +@@ -2598,7 +2597,8 @@ int b53_switch_register(struct b53_devic if (ret) return ret; diff --git a/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch b/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch index 2661b0918e..d619aa45b7 100644 --- a/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch +++ b/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch @@ -15,7 +15,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -755,8 +755,11 @@ static int b53_switch_reset(struct b53_d +@@ -768,8 +768,11 @@ static int b53_switch_reset(struct b53_d usleep_range(1000, 2000); } while (timeout-- > 0); diff --git a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch index bd8bb1e51e..e27ecc3498 100644 --- a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch +++ b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch @@ -23,7 +23,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -2329,6 +2329,22 @@ static const struct b53_chip_data b53_sw +@@ -2363,6 +2363,22 @@ static const struct b53_chip_data b53_sw .jumbo_pm_reg = B53_JUMBO_PORT_MASK, .jumbo_size_reg = B53_JUMBO_MAX_SIZE, }, diff --git a/target/linux/generic/backport-5.4/704-v5.6-net-dsa-Get-information-about-stacked-DSA-protocol.patch b/target/linux/generic/backport-5.4/704-v5.6-net-dsa-Get-information-about-stacked-DSA-protocol.patch new file mode 100644 index 0000000000..0a05721864 --- /dev/null +++ b/target/linux/generic/backport-5.4/704-v5.6-net-dsa-Get-information-about-stacked-DSA-protocol.patch @@ -0,0 +1,363 @@ +From 4d776482ecc689bdd68627985ac4cb5a6f325953 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Tue, 7 Jan 2020 21:06:05 -0800 +Subject: [PATCH] net: dsa: Get information about stacked DSA protocol + +It is possible to stack multiple DSA switches in a way that they are not +part of the tree (disjoint) but the DSA master of a switch is a DSA +slave of another. When that happens switch drivers may have to know this +is the case so as to determine whether their tagging protocol has a +remove chance of working. + +This is useful for specific switch drivers such as b53 where devices +have been known to be stacked in the wild without the Broadcom tag +protocol supporting that feature. This allows b53 to continue supporting +those devices by forcing the disabling of Broadcom tags on the outermost +switches if necessary. + +The get_tag_protocol() function is therefore updated to gain an +additional enum dsa_tag_protocol argument which denotes the current +tagging protocol used by the DSA master we are attached to, else +DSA_TAG_PROTO_NONE for the top of the dsa_switch_tree. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 22 +++++++++++------- + drivers/net/dsa/b53/b53_priv.h | 4 +++- + drivers/net/dsa/dsa_loop.c | 3 ++- + drivers/net/dsa/lan9303-core.c | 3 ++- + drivers/net/dsa/lantiq_gswip.c | 3 ++- + drivers/net/dsa/microchip/ksz8795.c | 3 ++- + drivers/net/dsa/microchip/ksz9477.c | 3 ++- + drivers/net/dsa/mt7530.c | 3 ++- + drivers/net/dsa/mv88e6060.c | 3 ++- + drivers/net/dsa/mv88e6xxx/chip.c | 3 ++- + drivers/net/dsa/ocelot/felix.c | 3 ++- + drivers/net/dsa/qca/ar9331.c | 3 ++- + drivers/net/dsa/qca8k.c | 3 ++- + drivers/net/dsa/rtl8366rb.c | 3 ++- + drivers/net/dsa/sja1105/sja1105_main.c | 3 ++- + drivers/net/dsa/vitesse-vsc73xx-core.c | 3 ++- + include/net/dsa.h | 3 ++- + net/dsa/dsa2.c | 31 ++++++++++++++++++++++++-- + net/dsa/dsa_priv.h | 1 + + net/dsa/slave.c | 4 +--- + 20 files changed, 78 insertions(+), 29 deletions(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -587,9 +587,8 @@ EXPORT_SYMBOL(b53_disable_port); + + void b53_brcm_hdr_setup(struct dsa_switch *ds, int port) + { +- bool tag_en = !(ds->ops->get_tag_protocol(ds, port) == +- DSA_TAG_PROTO_NONE); + struct b53_device *dev = ds->priv; ++ bool tag_en = !(dev->tag_protocol == DSA_TAG_PROTO_NONE); + u8 hdr_ctl, val; + u16 reg; + +@@ -1921,7 +1920,8 @@ static bool b53_can_enable_brcm_tags(str + return ret; + } + +-enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port) ++enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port, ++ enum dsa_tag_protocol mprot) + { + struct b53_device *dev = ds->priv; + +@@ -1931,16 +1931,22 @@ enum dsa_tag_protocol b53_get_tag_protoc + * misses on multicast addresses (TBD). + */ + if (is5325(dev) || is5365(dev) || is539x(dev) || is531x5(dev) || +- !b53_can_enable_brcm_tags(ds, port)) +- return DSA_TAG_PROTO_NONE; ++ !b53_can_enable_brcm_tags(ds, port)) { ++ dev->tag_protocol = DSA_TAG_PROTO_NONE; ++ goto out; ++ } + + /* Broadcom BCM58xx chips have a flow accelerator on Port 8 + * which requires us to use the prepended Broadcom tag type + */ +- if (dev->chip_id == BCM58XX_DEVICE_ID && port == B53_CPU_PORT) +- return DSA_TAG_PROTO_BRCM_PREPEND; ++ if (dev->chip_id == BCM58XX_DEVICE_ID && port == B53_CPU_PORT) { ++ dev->tag_protocol = DSA_TAG_PROTO_BRCM_PREPEND; ++ goto out; ++ } + +- return DSA_TAG_PROTO_BRCM; ++ dev->tag_protocol = DSA_TAG_PROTO_BRCM; ++out: ++ return dev->tag_protocol; + } + EXPORT_SYMBOL(b53_get_tag_protocol); + +--- a/drivers/net/dsa/b53/b53_priv.h ++++ b/drivers/net/dsa/b53/b53_priv.h +@@ -118,6 +118,7 @@ struct b53_device { + u8 jumbo_size_reg; + int reset_gpio; + u8 num_arl_entries; ++ enum dsa_tag_protocol tag_protocol; + + /* used ports mask */ + u16 enabled_ports; +@@ -359,7 +360,8 @@ int b53_mdb_del(struct dsa_switch *ds, i + const struct switchdev_obj_port_mdb *mdb); + int b53_mirror_add(struct dsa_switch *ds, int port, + struct dsa_mall_mirror_tc_entry *mirror, bool ingress); +-enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port); ++enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port, ++ enum dsa_tag_protocol mprot); + void b53_mirror_del(struct dsa_switch *ds, int port, + struct dsa_mall_mirror_tc_entry *mirror); + int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy); +--- a/drivers/net/dsa/dsa_loop.c ++++ b/drivers/net/dsa/dsa_loop.c +@@ -61,7 +61,8 @@ struct dsa_loop_priv { + static struct phy_device *phydevs[PHY_MAX_ADDR]; + + static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol mp) + { + dev_dbg(ds->dev, "%s: port: %d\n", __func__, port); + +--- a/drivers/net/dsa/lan9303-core.c ++++ b/drivers/net/dsa/lan9303-core.c +@@ -889,7 +889,8 @@ static int lan9303_check_device(struct l + /* ---------------------------- DSA -----------------------------------*/ + + static enum dsa_tag_protocol lan9303_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol mp) + { + return DSA_TAG_PROTO_LAN9303; + } +--- a/drivers/net/dsa/lantiq_gswip.c ++++ b/drivers/net/dsa/lantiq_gswip.c +@@ -860,7 +860,8 @@ static int gswip_setup(struct dsa_switch + } + + static enum dsa_tag_protocol gswip_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol mp) + { + return DSA_TAG_PROTO_GSWIP; + } +--- a/drivers/net/dsa/microchip/ksz8795.c ++++ b/drivers/net/dsa/microchip/ksz8795.c +@@ -645,7 +645,8 @@ static void ksz8795_w_phy(struct ksz_dev + } + + static enum dsa_tag_protocol ksz8795_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol mp) + { + return DSA_TAG_PROTO_KSZ8795; + } +--- a/drivers/net/dsa/microchip/ksz9477.c ++++ b/drivers/net/dsa/microchip/ksz9477.c +@@ -295,7 +295,8 @@ static void ksz9477_port_init_cnt(struct + } + + static enum dsa_tag_protocol ksz9477_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol mp) + { + enum dsa_tag_protocol proto = DSA_TAG_PROTO_KSZ9477; + struct ksz_device *dev = ds->priv; +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -1144,7 +1144,8 @@ mt7530_port_vlan_del(struct dsa_switch * + } + + static enum dsa_tag_protocol +-mtk_get_tag_protocol(struct dsa_switch *ds, int port) ++mtk_get_tag_protocol(struct dsa_switch *ds, int port, ++ enum dsa_tag_protocol mp) + { + struct mt7530_priv *priv = ds->priv; + +--- a/drivers/net/dsa/mv88e6060.c ++++ b/drivers/net/dsa/mv88e6060.c +@@ -43,7 +43,8 @@ static const char *mv88e6060_get_name(st + } + + static enum dsa_tag_protocol mv88e6060_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol m) + { + return DSA_TAG_PROTO_TRAILER; + } +--- a/drivers/net/dsa/mv88e6xxx/chip.c ++++ b/drivers/net/dsa/mv88e6xxx/chip.c +@@ -4878,7 +4878,8 @@ static struct mv88e6xxx_chip *mv88e6xxx_ + } + + static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol m) + { + struct mv88e6xxx_chip *chip = ds->priv; + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -1016,7 +1016,8 @@ qca8k_port_fdb_dump(struct dsa_switch *d + } + + static enum dsa_tag_protocol +-qca8k_get_tag_protocol(struct dsa_switch *ds, int port) ++qca8k_get_tag_protocol(struct dsa_switch *ds, int port, ++ enum dsa_tag_protocol mp) + { + return DSA_TAG_PROTO_QCA; + } +--- a/drivers/net/dsa/rtl8366rb.c ++++ b/drivers/net/dsa/rtl8366rb.c +@@ -964,7 +964,8 @@ static int rtl8366rb_setup(struct dsa_sw + } + + static enum dsa_tag_protocol rtl8366_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol mp) + { + /* For now, the RTL switches are handled without any custom tags. + * +--- a/drivers/net/dsa/sja1105/sja1105_main.c ++++ b/drivers/net/dsa/sja1105/sja1105_main.c +@@ -1591,7 +1591,8 @@ static int sja1105_setup_8021q_tagging(s + } + + static enum dsa_tag_protocol +-sja1105_get_tag_protocol(struct dsa_switch *ds, int port) ++sja1105_get_tag_protocol(struct dsa_switch *ds, int port, ++ enum dsa_tag_protocol mp) + { + return DSA_TAG_PROTO_SJA1105; + } +--- a/drivers/net/dsa/vitesse-vsc73xx-core.c ++++ b/drivers/net/dsa/vitesse-vsc73xx-core.c +@@ -542,7 +542,8 @@ static int vsc73xx_phy_write(struct dsa_ + } + + static enum dsa_tag_protocol vsc73xx_get_tag_protocol(struct dsa_switch *ds, +- int port) ++ int port, ++ enum dsa_tag_protocol mp) + { + /* The switch internally uses a 8 byte header with length, + * source port, tag, LPA and priority. This is supposedly +--- a/include/net/dsa.h ++++ b/include/net/dsa.h +@@ -353,7 +353,8 @@ typedef int dsa_fdb_dump_cb_t(const unsi + bool is_static, void *data); + struct dsa_switch_ops { + enum dsa_tag_protocol (*get_tag_protocol)(struct dsa_switch *ds, +- int port); ++ int port, ++ enum dsa_tag_protocol mprot); + + int (*setup)(struct dsa_switch *ds); + void (*teardown)(struct dsa_switch *ds); +--- a/net/dsa/dsa2.c ++++ b/net/dsa/dsa2.c +@@ -631,6 +631,32 @@ static int dsa_port_parse_dsa(struct dsa + return 0; + } + ++static enum dsa_tag_protocol dsa_get_tag_protocol(struct dsa_port *dp, ++ struct net_device *master) ++{ ++ enum dsa_tag_protocol tag_protocol = DSA_TAG_PROTO_NONE; ++ struct dsa_switch *mds, *ds = dp->ds; ++ unsigned int mdp_upstream; ++ struct dsa_port *mdp; ++ ++ /* It is possible to stack DSA switches onto one another when that ++ * happens the switch driver may want to know if its tagging protocol ++ * is going to work in such a configuration. ++ */ ++ if (dsa_slave_dev_check(master)) { ++ mdp = dsa_slave_to_port(master); ++ mds = mdp->ds; ++ mdp_upstream = dsa_upstream_port(mds, mdp->index); ++ tag_protocol = mds->ops->get_tag_protocol(mds, mdp_upstream, ++ DSA_TAG_PROTO_NONE); ++ } ++ ++ /* If the master device is not itself a DSA slave in a disjoint DSA ++ * tree, then return immediately. ++ */ ++ return ds->ops->get_tag_protocol(ds, dp->index, tag_protocol); ++} ++ + static int dsa_port_parse_cpu(struct dsa_port *dp, struct net_device *master) + { + struct dsa_switch *ds = dp->ds; +@@ -638,20 +664,21 @@ static int dsa_port_parse_cpu(struct dsa + const struct dsa_device_ops *tag_ops; + enum dsa_tag_protocol tag_protocol; + +- tag_protocol = ds->ops->get_tag_protocol(ds, dp->index); ++ tag_protocol = dsa_get_tag_protocol(dp, master); + tag_ops = dsa_tag_driver_get(tag_protocol); + if (IS_ERR(tag_ops)) { + if (PTR_ERR(tag_ops) == -ENOPROTOOPT) + return -EPROBE_DEFER; + dev_warn(ds->dev, "No tagger for this switch\n"); ++ dp->master = NULL; + return PTR_ERR(tag_ops); + } + ++ dp->master = master; + dp->type = DSA_PORT_TYPE_CPU; + dp->filter = tag_ops->filter; + dp->rcv = tag_ops->rcv; + dp->tag_ops = tag_ops; +- dp->master = master; + dp->dst = dst; + + return 0; +--- a/net/dsa/dsa_priv.h ++++ b/net/dsa/dsa_priv.h +@@ -189,6 +189,7 @@ extern const struct dsa_device_ops notag + void dsa_slave_mii_bus_init(struct dsa_switch *ds); + int dsa_slave_create(struct dsa_port *dp); + void dsa_slave_destroy(struct net_device *slave_dev); ++bool dsa_slave_dev_check(const struct net_device *dev); + int dsa_slave_suspend(struct net_device *slave_dev); + int dsa_slave_resume(struct net_device *slave_dev); + int dsa_slave_register_notifier(void); +--- a/net/dsa/slave.c ++++ b/net/dsa/slave.c +@@ -22,8 +22,6 @@ + + #include "dsa_priv.h" + +-static bool dsa_slave_dev_check(const struct net_device *dev); +- + /* slave mii_bus handling ***************************************************/ + static int dsa_slave_phy_read(struct mii_bus *bus, int addr, int reg) + { +@@ -1494,7 +1492,7 @@ void dsa_slave_destroy(struct net_device + free_netdev(slave_dev); + } + +-static bool dsa_slave_dev_check(const struct net_device *dev) ++bool dsa_slave_dev_check(const struct net_device *dev) + { + return dev->netdev_ops == &dsa_slave_netdev_ops; + } diff --git a/target/linux/generic/backport-5.4/705-v5.6-0001-net-dsa-b53-Enable-Broadcom-tags-for-531x5-539x-fami.patch b/target/linux/generic/backport-5.4/705-v5.6-0001-net-dsa-b53-Enable-Broadcom-tags-for-531x5-539x-fami.patch new file mode 100644 index 0000000000..abc2dc836a --- /dev/null +++ b/target/linux/generic/backport-5.4/705-v5.6-0001-net-dsa-b53-Enable-Broadcom-tags-for-531x5-539x-fami.patch @@ -0,0 +1,104 @@ +From 8fab459e69abfd04a66d76423d18ba853fced4ab Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Tue, 7 Jan 2020 21:06:06 -0800 +Subject: [PATCH] net: dsa: b53: Enable Broadcom tags for 531x5/539x families + +The BCM531x5 and BCM539x families require that the IMP port be enabled +within the management page and that management mode (SM_SW_FWD_MODE) be +turned on. Once this is done, everything works as expected, including +multicast with standalone DSA devices or bridge devices. + +Because such switches are frequencly cascaded with other internal +Broadcom switches on which we want to enable Broadcom tags, update +b53_can_enable_brcm_tags() to check the kind of DSA master tagging +protocol being used, if it is one of the two supported Broadcom tagging +protocols, force DSA_TAG_PROTO_NONE. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 46 +++++++++++++++++++++++++------- + 1 file changed, 37 insertions(+), 9 deletions(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -371,8 +371,6 @@ static void b53_enable_vlan(struct b53_d + b53_read8(dev, B53_VLAN_PAGE, B53_VLAN_CTRL5, &vc5); + } + +- mgmt &= ~SM_SW_FWD_MODE; +- + if (enable) { + vc0 |= VC0_VLAN_EN | VC0_VID_CHK_EN | VC0_VID_HASH_VID; + vc1 |= VC1_RX_MCST_UNTAG_EN | VC1_RX_MCST_FWD_EN; +@@ -608,6 +606,22 @@ void b53_brcm_hdr_setup(struct dsa_switc + break; + } + ++ /* Enable management mode if tagging is requested */ ++ b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, &hdr_ctl); ++ if (tag_en) ++ hdr_ctl |= SM_SW_FWD_MODE; ++ else ++ hdr_ctl &= ~SM_SW_FWD_MODE; ++ b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, hdr_ctl); ++ ++ /* Configure the appropriate IMP port */ ++ b53_read8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, &hdr_ctl); ++ if (port == 8) ++ hdr_ctl |= GC_FRM_MGMT_PORT_MII; ++ else if (port == 5) ++ hdr_ctl |= GC_FRM_MGMT_PORT_M; ++ b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, hdr_ctl); ++ + /* Enable Broadcom tags for IMP port */ + b53_read8(dev, B53_MGMT_PAGE, B53_BRCM_HDR, &hdr_ctl); + if (tag_en) +@@ -1910,13 +1924,29 @@ static bool b53_possible_cpu_port(struct + return false; + } + +-static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port) ++static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port, ++ enum dsa_tag_protocol tag_protocol) + { + bool ret = b53_possible_cpu_port(ds, port); + +- if (!ret) ++ if (!ret) { + dev_warn(ds->dev, "Port %d is not Broadcom tag capable\n", + port); ++ return ret; ++ } ++ ++ switch (tag_protocol) { ++ case DSA_TAG_PROTO_BRCM: ++ case DSA_TAG_PROTO_BRCM_PREPEND: ++ dev_warn(ds->dev, ++ "Port %d is stacked to Broadcom tag switch\n", port); ++ ret = false; ++ break; ++ default: ++ ret = true; ++ break; ++ } ++ + return ret; + } + +@@ -1926,12 +1956,10 @@ enum dsa_tag_protocol b53_get_tag_protoc + struct b53_device *dev = ds->priv; + + /* Older models (5325, 5365) support a different tag format that we do +- * not support in net/dsa/tag_brcm.c yet. 539x and 531x5 require managed +- * mode to be turned on which means we need to specifically manage ARL +- * misses on multicast addresses (TBD). ++ * not support in net/dsa/tag_brcm.c yet. + */ +- if (is5325(dev) || is5365(dev) || is539x(dev) || is531x5(dev) || +- !b53_can_enable_brcm_tags(ds, port)) { ++ if (is5325(dev) || is5365(dev) || ++ !b53_can_enable_brcm_tags(ds, port, mprot)) { + dev->tag_protocol = DSA_TAG_PROTO_NONE; + goto out; + } diff --git a/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch b/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch index cb6497f28a..8225ca1d29 100644 --- a/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch +++ b/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch @@ -20,7 +20,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -1564,7 +1564,6 @@ static int b53_arl_op(struct b53_device +@@ -1577,7 +1577,6 @@ static int b53_arl_op(struct b53_device ent.is_valid = !!(ent.port); } diff --git a/target/linux/generic/backport-5.4/745-v5.7-net-dsa-mt7530-add-support-for-port-mirroring.patch b/target/linux/generic/backport-5.4/745-v5.7-net-dsa-mt7530-add-support-for-port-mirroring.patch index 71a06997c3..566dfce5ca 100644 --- a/target/linux/generic/backport-5.4/745-v5.7-net-dsa-mt7530-add-support-for-port-mirroring.patch +++ b/target/linux/generic/backport-5.4/745-v5.7-net-dsa-mt7530-add-support-for-port-mirroring.patch @@ -80,9 +80,9 @@ Signed-off-by: David S. Miller +} + static enum dsa_tag_protocol - mtk_get_tag_protocol(struct dsa_switch *ds, int port) - { -@@ -1520,6 +1578,8 @@ static const struct dsa_switch_ops mt753 + mtk_get_tag_protocol(struct dsa_switch *ds, int port, + enum dsa_tag_protocol mp) +@@ -1521,6 +1579,8 @@ static const struct dsa_switch_ops mt753 .port_vlan_prepare = mt7530_port_vlan_prepare, .port_vlan_add = mt7530_port_vlan_add, .port_vlan_del = mt7530_port_vlan_del, diff --git a/target/linux/generic/backport-5.4/747-v5.5-net-dsa-mv88e6xxx-Add-support-for-port-mirroring.patch b/target/linux/generic/backport-5.4/747-v5.5-net-dsa-mv88e6xxx-Add-support-for-port-mirroring.patch index a45a22e485..81acdaecd2 100644 --- a/target/linux/generic/backport-5.4/747-v5.5-net-dsa-mv88e6xxx-Add-support-for-port-mirroring.patch +++ b/target/linux/generic/backport-5.4/747-v5.5-net-dsa-mv88e6xxx-Add-support-for-port-mirroring.patch @@ -25,7 +25,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -4928,6 +4928,80 @@ static int mv88e6xxx_port_mdb_del(struct +@@ -4929,6 +4929,80 @@ static int mv88e6xxx_port_mdb_del(struct return err; } @@ -106,7 +106,7 @@ Signed-off-by: David S. Miller static int mv88e6xxx_port_egress_floods(struct dsa_switch *ds, int port, bool unicast, bool multicast) { -@@ -4982,6 +5056,8 @@ static const struct dsa_switch_ops mv88e +@@ -4983,6 +5057,8 @@ static const struct dsa_switch_ops mv88e .port_mdb_prepare = mv88e6xxx_port_mdb_prepare, .port_mdb_add = mv88e6xxx_port_mdb_add, .port_mdb_del = mv88e6xxx_port_mdb_del, diff --git a/target/linux/generic/backport-5.4/748-v5.5-net-dsa-mv88e6xxx-fix-broken-if-statement-because-of.patch b/target/linux/generic/backport-5.4/748-v5.5-net-dsa-mv88e6xxx-fix-broken-if-statement-because-of.patch index 837126a336..9985e1cf56 100644 --- a/target/linux/generic/backport-5.4/748-v5.5-net-dsa-mv88e6xxx-fix-broken-if-statement-because-of.patch +++ b/target/linux/generic/backport-5.4/748-v5.5-net-dsa-mv88e6xxx-fix-broken-if-statement-because-of.patch @@ -19,7 +19,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -4995,7 +4995,7 @@ static void mv88e6xxx_port_mirror_del(st +@@ -4996,7 +4996,7 @@ static void mv88e6xxx_port_mirror_del(st if (chip->info->ops->set_egress_port(chip, direction, dsa_upstream_port(ds, diff --git a/target/linux/generic/backport-5.4/752-v5.8-net-dsa-provide-an-option-for-drivers-to-always-rece.patch b/target/linux/generic/backport-5.4/752-v5.8-net-dsa-provide-an-option-for-drivers-to-always-rece.patch index 52d9351b70..86f1f8300e 100644 --- a/target/linux/generic/backport-5.4/752-v5.8-net-dsa-provide-an-option-for-drivers-to-always-rece.patch +++ b/target/linux/generic/backport-5.4/752-v5.8-net-dsa-provide-an-option-for-drivers-to-always-rece.patch @@ -83,7 +83,7 @@ Signed-off-by: David S. Miller { --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -319,7 +319,7 @@ static int dsa_slave_vlan_add(struct net +@@ -317,7 +317,7 @@ static int dsa_slave_vlan_add(struct net if (obj->orig_dev != dev) return -EOPNOTSUPP; @@ -92,7 +92,7 @@ Signed-off-by: David S. Miller return 0; vlan = *SWITCHDEV_OBJ_PORT_VLAN(obj); -@@ -386,7 +386,7 @@ static int dsa_slave_vlan_del(struct net +@@ -384,7 +384,7 @@ static int dsa_slave_vlan_del(struct net if (obj->orig_dev != dev) return -EOPNOTSUPP; @@ -101,7 +101,7 @@ Signed-off-by: David S. Miller return 0; /* Do not deprogram the CPU port as it may be shared with other user -@@ -1120,7 +1120,7 @@ static int dsa_slave_vlan_rx_add_vid(str +@@ -1118,7 +1118,7 @@ static int dsa_slave_vlan_rx_add_vid(str * need to emulate the switchdev prepare + commit phase. */ if (dp->bridge_dev) { @@ -110,7 +110,7 @@ Signed-off-by: David S. Miller return 0; /* br_vlan_get_info() returns -EINVAL or -ENOENT if the -@@ -1154,7 +1154,7 @@ static int dsa_slave_vlan_rx_kill_vid(st +@@ -1152,7 +1152,7 @@ static int dsa_slave_vlan_rx_kill_vid(st * need to emulate the switchdev prepare + commit phase. */ if (dp->bridge_dev) { diff --git a/target/linux/generic/backport-5.4/753-v5.8-net-dsa-mt7530-fix-VLAN-setup.patch b/target/linux/generic/backport-5.4/753-v5.8-net-dsa-mt7530-fix-VLAN-setup.patch index 0804cea9f7..e26829ee60 100644 --- a/target/linux/generic/backport-5.4/753-v5.8-net-dsa-mt7530-fix-VLAN-setup.patch +++ b/target/linux/generic/backport-5.4/753-v5.8-net-dsa-mt7530-fix-VLAN-setup.patch @@ -41,7 +41,7 @@ Signed-off-by: David S. Miller mutex_lock(&priv->reg_mutex); pvid = priv->ports[port].pvid; -@@ -1232,6 +1220,7 @@ mt7530_setup(struct dsa_switch *ds) +@@ -1233,6 +1221,7 @@ mt7530_setup(struct dsa_switch *ds) * as two netdev instances. */ dn = ds->ports[MT7530_CPU_PORT].master->dev.of_node->parent; diff --git a/target/linux/generic/backport-5.4/758-v5.8-net-dsa-rtl8366rb-Support-the-CPU-DSA-tag.patch b/target/linux/generic/backport-5.4/758-v5.8-net-dsa-rtl8366rb-Support-the-CPU-DSA-tag.patch index b68c033bbe..cabb9d9a92 100644 --- a/target/linux/generic/backport-5.4/758-v5.8-net-dsa-rtl8366rb-Support-the-CPU-DSA-tag.patch +++ b/target/linux/generic/backport-5.4/758-v5.8-net-dsa-rtl8366rb-Support-the-CPU-DSA-tag.patch @@ -74,9 +74,9 @@ Signed-off-by: David S. Miller if (ret) return ret; -@@ -966,21 +964,8 @@ static int rtl8366rb_setup(struct dsa_sw - static enum dsa_tag_protocol rtl8366_get_tag_protocol(struct dsa_switch *ds, - int port) +@@ -967,21 +965,8 @@ static enum dsa_tag_protocol rtl8366_get + int port, + enum dsa_tag_protocol mp) { - /* For now, the RTL switches are handled without any custom tags. - * diff --git a/target/linux/generic/backport-5.4/765-v5.12-net-dsa-automatically-bring-up-DSA-master-when-openi.patch b/target/linux/generic/backport-5.4/765-v5.12-net-dsa-automatically-bring-up-DSA-master-when-openi.patch index 7ec26899f9..3b630377f9 100644 --- a/target/linux/generic/backport-5.4/765-v5.12-net-dsa-automatically-bring-up-DSA-master-when-openi.patch +++ b/target/linux/generic/backport-5.4/765-v5.12-net-dsa-automatically-bring-up-DSA-master-when-openi.patch @@ -69,7 +69,7 @@ Signed-off-by: Jakub Kicinski --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -70,8 +70,11 @@ static int dsa_slave_open(struct net_dev +@@ -68,8 +68,11 @@ static int dsa_slave_open(struct net_dev struct dsa_port *dp = dsa_slave_to_port(dev); int err; diff --git a/target/linux/generic/backport-5.4/771-v5.12-net-dsa-be-louder-when-a-non-legacy-FDB-operation-fa.patch b/target/linux/generic/backport-5.4/771-v5.12-net-dsa-be-louder-when-a-non-legacy-FDB-operation-fa.patch index 893eb719ca..f889489915 100644 --- a/target/linux/generic/backport-5.4/771-v5.12-net-dsa-be-louder-when-a-non-legacy-FDB-operation-fa.patch +++ b/target/linux/generic/backport-5.4/771-v5.12-net-dsa-be-louder-when-a-non-legacy-FDB-operation-fa.patch @@ -25,7 +25,7 @@ Signed-off-by: Jakub Kicinski --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1593,7 +1593,9 @@ static void dsa_slave_switchdev_event_wo +@@ -1591,7 +1591,9 @@ static void dsa_slave_switchdev_event_wo err = dsa_port_fdb_add(dp, fdb_info->addr, fdb_info->vid); if (err) { @@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski break; } fdb_info->offloaded = true; -@@ -1608,9 +1610,11 @@ static void dsa_slave_switchdev_event_wo +@@ -1606,9 +1608,11 @@ static void dsa_slave_switchdev_event_wo err = dsa_port_fdb_del(dp, fdb_info->addr, fdb_info->vid); if (err) { diff --git a/target/linux/generic/backport-5.4/772-v5.12-net-dsa-don-t-use-switchdev_notifier_fdb_info-in-dsa.patch b/target/linux/generic/backport-5.4/772-v5.12-net-dsa-don-t-use-switchdev_notifier_fdb_info-in-dsa.patch index 275870d19f..bd1685a16a 100644 --- a/target/linux/generic/backport-5.4/772-v5.12-net-dsa-don-t-use-switchdev_notifier_fdb_info-in-dsa.patch +++ b/target/linux/generic/backport-5.4/772-v5.12-net-dsa-don-t-use-switchdev_notifier_fdb_info-in-dsa.patch @@ -54,7 +54,7 @@ Signed-off-by: Jakub Kicinski struct sk_buff * (*xmit)(struct sk_buff *skb, --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1568,76 +1568,66 @@ static int dsa_slave_netdevice_event(str +@@ -1566,76 +1566,66 @@ static int dsa_slave_netdevice_event(str return NOTIFY_DONE; } @@ -167,7 +167,7 @@ Signed-off-by: Jakub Kicinski } /* Called under rcu_read_lock() */ -@@ -1645,7 +1635,9 @@ static int dsa_slave_switchdev_event(str +@@ -1643,7 +1633,9 @@ static int dsa_slave_switchdev_event(str unsigned long event, void *ptr) { struct net_device *dev = switchdev_notifier_info_to_dev(ptr); @@ -177,7 +177,7 @@ Signed-off-by: Jakub Kicinski int err; if (event == SWITCHDEV_PORT_ATTR_SET) { -@@ -1658,20 +1650,32 @@ static int dsa_slave_switchdev_event(str +@@ -1656,20 +1648,32 @@ static int dsa_slave_switchdev_event(str if (!dsa_slave_dev_check(dev)) return NOTIFY_DONE; @@ -213,7 +213,7 @@ Signed-off-by: Jakub Kicinski dev_hold(dev); break; default: -@@ -1681,10 +1685,6 @@ static int dsa_slave_switchdev_event(str +@@ -1679,10 +1683,6 @@ static int dsa_slave_switchdev_event(str dsa_schedule_work(&switchdev_work->work); return NOTIFY_OK; diff --git a/target/linux/generic/backport-5.4/773-v5.12-net-dsa-move-switchdev-event-implementation-under-th.patch b/target/linux/generic/backport-5.4/773-v5.12-net-dsa-move-switchdev-event-implementation-under-th.patch index b70986fcc1..acc6e16117 100644 --- a/target/linux/generic/backport-5.4/773-v5.12-net-dsa-move-switchdev-event-implementation-under-th.patch +++ b/target/linux/generic/backport-5.4/773-v5.12-net-dsa-move-switchdev-event-implementation-under-th.patch @@ -20,7 +20,7 @@ Signed-off-by: Jakub Kicinski --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1640,31 +1640,29 @@ static int dsa_slave_switchdev_event(str +@@ -1638,31 +1638,29 @@ static int dsa_slave_switchdev_event(str struct dsa_port *dp; int err; @@ -68,7 +68,7 @@ Signed-off-by: Jakub Kicinski fdb_info = ptr; if (!fdb_info->added_by_user) { -@@ -1677,13 +1675,12 @@ static int dsa_slave_switchdev_event(str +@@ -1675,13 +1673,12 @@ static int dsa_slave_switchdev_event(str switchdev_work->vid = fdb_info->vid; dev_hold(dev); diff --git a/target/linux/generic/backport-5.4/774-v5.12-net-dsa-exit-early-in-dsa_slave_switchdev_event-if-w.patch b/target/linux/generic/backport-5.4/774-v5.12-net-dsa-exit-early-in-dsa_slave_switchdev_event-if-w.patch index c7ed4064e8..35266b71bc 100644 --- a/target/linux/generic/backport-5.4/774-v5.12-net-dsa-exit-early-in-dsa_slave_switchdev_event-if-w.patch +++ b/target/linux/generic/backport-5.4/774-v5.12-net-dsa-exit-early-in-dsa_slave_switchdev_event-if-w.patch @@ -30,7 +30,7 @@ Signed-off-by: Jakub Kicinski --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1653,6 +1653,9 @@ static int dsa_slave_switchdev_event(str +@@ -1651,6 +1651,9 @@ static int dsa_slave_switchdev_event(str dp = dsa_slave_to_port(dev); diff --git a/target/linux/generic/backport-5.4/775-v5.12-net-dsa-listen-for-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch b/target/linux/generic/backport-5.4/775-v5.12-net-dsa-listen-for-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch index e4ed6e808f..e49a97c81d 100644 --- a/target/linux/generic/backport-5.4/775-v5.12-net-dsa-listen-for-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch +++ b/target/linux/generic/backport-5.4/775-v5.12-net-dsa-listen-for-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch @@ -172,7 +172,7 @@ Signed-off-by: DENG Qingfang */ --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1630,6 +1630,25 @@ static void dsa_slave_switchdev_event_wo +@@ -1628,6 +1628,25 @@ static void dsa_slave_switchdev_event_wo dev_put(dp->slave); } @@ -198,7 +198,7 @@ Signed-off-by: DENG Qingfang /* Called under rcu_read_lock() */ static int dsa_slave_switchdev_event(struct notifier_block *unused, unsigned long event, void *ptr) -@@ -1648,10 +1667,37 @@ static int dsa_slave_switchdev_event(str +@@ -1646,10 +1665,37 @@ static int dsa_slave_switchdev_event(str return notifier_from_errno(err); case SWITCHDEV_FDB_ADD_TO_DEVICE: case SWITCHDEV_FDB_DEL_TO_DEVICE: @@ -239,7 +239,7 @@ Signed-off-by: DENG Qingfang if (!dp->ds->ops->port_fdb_add || !dp->ds->ops->port_fdb_del) return NOTIFY_DONE; -@@ -1666,18 +1712,13 @@ static int dsa_slave_switchdev_event(str +@@ -1664,18 +1710,13 @@ static int dsa_slave_switchdev_event(str switchdev_work->port = dp->index; switchdev_work->event = event; diff --git a/target/linux/generic/pending-5.4/647-net-dsa-support-hardware-flow-table-offload.patch b/target/linux/generic/pending-5.4/647-net-dsa-support-hardware-flow-table-offload.patch index 369a09caac..ff41a17c62 100644 --- a/target/linux/generic/pending-5.4/647-net-dsa-support-hardware-flow-table-offload.patch +++ b/target/linux/generic/pending-5.4/647-net-dsa-support-hardware-flow-table-offload.patch @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau #include "dsa_priv.h" -@@ -1226,6 +1230,27 @@ static struct devlink_port *dsa_slave_ge +@@ -1224,6 +1228,27 @@ static struct devlink_port *dsa_slave_ge return dp->ds->devlink ? &dp->devlink_port : NULL; } @@ -66,7 +66,7 @@ Signed-off-by: Felix Fietkau static const struct net_device_ops dsa_slave_netdev_ops = { .ndo_open = dsa_slave_open, .ndo_stop = dsa_slave_close, -@@ -1250,6 +1275,9 @@ static const struct net_device_ops dsa_s +@@ -1248,6 +1273,9 @@ static const struct net_device_ops dsa_s .ndo_vlan_rx_add_vid = dsa_slave_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = dsa_slave_vlan_rx_kill_vid, .ndo_get_devlink_port = dsa_slave_get_devlink_port, diff --git a/target/linux/generic/pending-5.4/761-net-dsa-mt7530-Support-EEE-features.patch b/target/linux/generic/pending-5.4/761-net-dsa-mt7530-Support-EEE-features.patch index c2dc35d134..93ed193747 100644 --- a/target/linux/generic/pending-5.4/761-net-dsa-mt7530-Support-EEE-features.patch +++ b/target/linux/generic/pending-5.4/761-net-dsa-mt7530-Support-EEE-features.patch @@ -9,7 +9,7 @@ Content-Transfer-Encoding: 8bit Signed-off-by: René van Dorst --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -1407,9 +1407,13 @@ static void mt7530_phylink_mac_config(st +@@ -1408,9 +1408,13 @@ static void mt7530_phylink_mac_config(st switch (state->speed) { case SPEED_1000: mcr_new |= PMCR_FORCE_SPEED_1000; @@ -23,7 +23,7 @@ Signed-off-by: René van Dorst break; } if (state->duplex == DUPLEX_FULL) { -@@ -1545,6 +1549,54 @@ mt7530_phylink_mac_link_state(struct dsa +@@ -1546,6 +1550,54 @@ mt7530_phylink_mac_link_state(struct dsa return 1; } @@ -78,7 +78,7 @@ Signed-off-by: René van Dorst static const struct dsa_switch_ops mt7530_switch_ops = { .get_tag_protocol = mtk_get_tag_protocol, .setup = mt7530_setup, -@@ -1572,6 +1624,8 @@ static const struct dsa_switch_ops mt753 +@@ -1573,6 +1625,8 @@ static const struct dsa_switch_ops mt753 .phylink_mac_config = mt7530_phylink_mac_config, .phylink_mac_link_down = mt7530_phylink_mac_link_down, .phylink_mac_link_up = mt7530_phylink_mac_link_up, diff --git a/target/linux/generic/pending-5.4/765-net-dsa-Include-local-addresses-in-assisted-CPU-port.patch b/target/linux/generic/pending-5.4/765-net-dsa-Include-local-addresses-in-assisted-CPU-port.patch index d951246260..4c0c4391a3 100644 --- a/target/linux/generic/pending-5.4/765-net-dsa-Include-local-addresses-in-assisted-CPU-port.patch +++ b/target/linux/generic/pending-5.4/765-net-dsa-Include-local-addresses-in-assisted-CPU-port.patch @@ -18,7 +18,7 @@ Signed-off-by: Tobias Waldekranz --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1698,10 +1698,12 @@ static int dsa_slave_switchdev_event(str +@@ -1696,10 +1696,12 @@ static int dsa_slave_switchdev_event(str fdb_info = ptr; if (dsa_slave_dev_check(dev)) { diff --git a/target/linux/generic/pending-5.4/766-net-dsa-Include-bridge-addresses-in-assisted-CPU-por.patch b/target/linux/generic/pending-5.4/766-net-dsa-Include-bridge-addresses-in-assisted-CPU-por.patch index 46504aeeff..14f62ec19a 100644 --- a/target/linux/generic/pending-5.4/766-net-dsa-Include-bridge-addresses-in-assisted-CPU-por.patch +++ b/target/linux/generic/pending-5.4/766-net-dsa-Include-bridge-addresses-in-assisted-CPU-por.patch @@ -15,7 +15,7 @@ Signed-off-by: Tobias Waldekranz --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1712,7 +1712,11 @@ static int dsa_slave_switchdev_event(str +@@ -1710,7 +1710,11 @@ static int dsa_slave_switchdev_event(str struct net_device *br_dev; struct dsa_slave_priv *p; diff --git a/target/linux/generic/pending-5.4/767-net-dsa-Sync-static-FDB-entries-on-foreign-interface.patch b/target/linux/generic/pending-5.4/767-net-dsa-Sync-static-FDB-entries-on-foreign-interface.patch index e626086bc1..33f49685bf 100644 --- a/target/linux/generic/pending-5.4/767-net-dsa-Sync-static-FDB-entries-on-foreign-interface.patch +++ b/target/linux/generic/pending-5.4/767-net-dsa-Sync-static-FDB-entries-on-foreign-interface.patch @@ -28,7 +28,7 @@ Signed-off-by: Tobias Waldekranz --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1705,9 +1705,12 @@ static int dsa_slave_switchdev_event(str +@@ -1703,9 +1703,12 @@ static int dsa_slave_switchdev_event(str else if (!fdb_info->added_by_user) return NOTIFY_OK; } else { @@ -44,7 +44,7 @@ Signed-off-by: Tobias Waldekranz */ struct net_device *br_dev; struct dsa_slave_priv *p; -@@ -1729,7 +1732,8 @@ static int dsa_slave_switchdev_event(str +@@ -1727,7 +1730,8 @@ static int dsa_slave_switchdev_event(str dp = p->dp->cpu_dp; diff --git a/target/linux/generic/pending-5.4/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch b/target/linux/generic/pending-5.4/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch index 65b0e1084e..dc9e61eb9d 100644 --- a/target/linux/generic/pending-5.4/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch +++ b/target/linux/generic/pending-5.4/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch @@ -17,7 +17,7 @@ Signed-off-by: Tobias Waldekranz --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -5082,6 +5082,7 @@ static int mv88e6xxx_register_switch(str +@@ -5083,6 +5083,7 @@ static int mv88e6xxx_register_switch(str ds->ops = &mv88e6xxx_switch_ops; ds->ageing_time_min = chip->info->age_time_coeff; ds->ageing_time_max = chip->info->age_time_coeff * U8_MAX; diff --git a/target/linux/layerscape/patches-5.4/701-net-0273-net-dsa-ocelot-add-tsn-support-for-felix-switch.patch b/target/linux/layerscape/patches-5.4/701-net-0273-net-dsa-ocelot-add-tsn-support-for-felix-switch.patch index 72b101bfb0..8214e1a310 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0273-net-dsa-ocelot-add-tsn-support-for-felix-switch.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0273-net-dsa-ocelot-add-tsn-support-for-felix-switch.patch @@ -648,7 +648,7 @@ Signed-off-by: Xiaoliang Yang static const u32 vsc9959_gcb_regmap[] = { --- a/include/net/dsa.h +++ b/include/net/dsa.h -@@ -559,6 +559,7 @@ struct dsa_switch_ops { +@@ -560,6 +560,7 @@ struct dsa_switch_ops { */ netdev_tx_t (*port_deferred_xmit)(struct dsa_switch *ds, int port, struct sk_buff *skb); diff --git a/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch b/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch index 22db45aced..6fc9a1643e 100644 --- a/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch +++ b/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch @@ -12,7 +12,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -1284,7 +1284,9 @@ EXPORT_SYMBOL(b53_phylink_mac_link_down) +@@ -1297,7 +1297,9 @@ EXPORT_SYMBOL(b53_phylink_mac_link_down) void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, @@ -25,7 +25,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/b53/b53_priv.h +++ b/drivers/net/dsa/b53/b53_priv.h -@@ -337,7 +337,9 @@ void b53_phylink_mac_link_down(struct ds +@@ -338,7 +338,9 @@ void b53_phylink_mac_link_down(struct ds void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, @@ -51,7 +51,7 @@ Signed-off-by: David S. Miller struct ethtool_eee *p = &priv->dev->ports[port].eee; --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c -@@ -1661,7 +1661,9 @@ static void gswip_phylink_mac_link_down( +@@ -1662,7 +1662,9 @@ static void gswip_phylink_mac_link_down( static void gswip_phylink_mac_link_up(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, @@ -64,7 +64,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -1440,7 +1440,9 @@ static void mt7530_phylink_mac_link_down +@@ -1441,7 +1441,9 @@ static void mt7530_phylink_mac_link_down static void mt7530_phylink_mac_link_up(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, @@ -103,7 +103,7 @@ Signed-off-by: David S. Miller } --- a/include/net/dsa.h +++ b/include/net/dsa.h -@@ -406,7 +406,9 @@ struct dsa_switch_ops { +@@ -407,7 +407,9 @@ struct dsa_switch_ops { void (*phylink_mac_link_up)(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, diff --git a/target/linux/mediatek/patches-5.4/0602-net-dsa-mt7530-use-resolved-link-config-in-mac_link_.patch b/target/linux/mediatek/patches-5.4/0602-net-dsa-mt7530-use-resolved-link-config-in-mac_link_.patch index 23fba85252..57066a3607 100644 --- a/target/linux/mediatek/patches-5.4/0602-net-dsa-mt7530-use-resolved-link-config-in-mac_link_.patch +++ b/target/linux/mediatek/patches-5.4/0602-net-dsa-mt7530-use-resolved-link-config-in-mac_link_.patch @@ -51,7 +51,7 @@ Signed-off-by: David S. Miller mutex_unlock(&priv->reg_mutex); } -@@ -1395,8 +1384,7 @@ static void mt7530_phylink_mac_config(st +@@ -1396,8 +1385,7 @@ static void mt7530_phylink_mac_config(st mcr_cur = mt7530_read(priv, MT7530_PMCR_P(port)); mcr_new = mcr_cur; @@ -61,7 +61,7 @@ Signed-off-by: David S. Miller mcr_new |= PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | PMCR_BACKOFF_EN | PMCR_BACKPR_EN | PMCR_FORCE_MODE; -@@ -1404,26 +1392,6 @@ static void mt7530_phylink_mac_config(st +@@ -1405,26 +1393,6 @@ static void mt7530_phylink_mac_config(st if (port == 5 && dsa_is_user_port(ds, 5)) mcr_new |= PMCR_EXT_PHY; @@ -88,7 +88,7 @@ Signed-off-by: David S. Miller if (mcr_new != mcr_cur) mt7530_write(priv, MT7530_PMCR_P(port), mcr_new); } -@@ -1434,7 +1402,7 @@ static void mt7530_phylink_mac_link_down +@@ -1435,7 +1403,7 @@ static void mt7530_phylink_mac_link_down { struct mt7530_priv *priv = ds->priv; @@ -97,7 +97,7 @@ Signed-off-by: David S. Miller } static void mt7530_phylink_mac_link_up(struct dsa_switch *ds, int port, -@@ -1445,8 +1413,31 @@ static void mt7530_phylink_mac_link_up(s +@@ -1446,8 +1414,31 @@ static void mt7530_phylink_mac_link_up(s bool tx_pause, bool rx_pause) { struct mt7530_priv *priv = ds->priv; diff --git a/target/linux/mediatek/patches-5.4/0603-net-dsa-mt7530-Extend-device-data-ready-for-adding-a.patch b/target/linux/mediatek/patches-5.4/0603-net-dsa-mt7530-Extend-device-data-ready-for-adding-a.patch index 718ed8ea2d..84579ac2c5 100644 --- a/target/linux/mediatek/patches-5.4/0603-net-dsa-mt7530-Extend-device-data-ready-for-adding-a.patch +++ b/target/linux/mediatek/patches-5.4/0603-net-dsa-mt7530-Extend-device-data-ready-for-adding-a.patch @@ -47,7 +47,7 @@ Signed-off-by: Sean Wang return -EINVAL; } -@@ -1332,12 +1334,11 @@ mt7530_setup(struct dsa_switch *ds) +@@ -1333,12 +1335,11 @@ mt7530_setup(struct dsa_switch *ds) return 0; } @@ -63,7 +63,7 @@ Signed-off-by: Sean Wang switch (port) { case 0: /* Internal phy */ -@@ -1346,33 +1347,114 @@ static void mt7530_phylink_mac_config(st +@@ -1347,33 +1348,114 @@ static void mt7530_phylink_mac_config(st case 3: case 4: if (state->interface != PHY_INTERFACE_MODE_GMII) @@ -189,7 +189,7 @@ Signed-off-by: Sean Wang return; } -@@ -1440,61 +1522,44 @@ static void mt7530_phylink_mac_link_up(s +@@ -1441,61 +1523,44 @@ static void mt7530_phylink_mac_link_up(s mt7530_set(priv, MT7530_PMCR_P(port), mcr); } @@ -274,7 +274,7 @@ Signed-off-by: Sean Wang phylink_set(mask, Pause); phylink_set(mask, Asym_Pause); -@@ -1590,12 +1655,45 @@ static int mt7530_set_mac_eee(struct dsa +@@ -1591,12 +1656,45 @@ static int mt7530_set_mac_eee(struct dsa return 0; } @@ -323,7 +323,7 @@ Signed-off-by: Sean Wang .get_ethtool_stats = mt7530_get_ethtool_stats, .get_sset_count = mt7530_get_sset_count, .port_enable = mt7530_port_enable, -@@ -1612,18 +1710,43 @@ static const struct dsa_switch_ops mt753 +@@ -1613,18 +1711,43 @@ static const struct dsa_switch_ops mt753 .port_vlan_del = mt7530_port_vlan_del, .port_mirror_add = mt7530_port_mirror_add, .port_mirror_del = mt7530_port_mirror_del, @@ -372,7 +372,7 @@ Signed-off-by: Sean Wang { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, mt7530_of_match); -@@ -1661,8 +1784,21 @@ mt7530_probe(struct mdio_device *mdiodev +@@ -1662,8 +1785,21 @@ mt7530_probe(struct mdio_device *mdiodev /* Get the hardware identifier from the devicetree node. * We will need it for some of the clock and regulator setup. */ diff --git a/target/linux/mediatek/patches-5.4/0604-net-dsa-mt7530-Add-the-support-of-MT7531-switch.patch b/target/linux/mediatek/patches-5.4/0604-net-dsa-mt7530-Add-the-support-of-MT7531-switch.patch index 8ede862204..95dddf68b0 100644 --- a/target/linux/mediatek/patches-5.4/0604-net-dsa-mt7530-Add-the-support-of-MT7531-switch.patch +++ b/target/linux/mediatek/patches-5.4/0604-net-dsa-mt7530-Add-the-support-of-MT7531-switch.patch @@ -466,7 +466,7 @@ Signed-off-by: Sean Wang } } -@@ -1280,7 +1619,7 @@ mt7530_setup(struct dsa_switch *ds) +@@ -1281,7 +1620,7 @@ mt7530_setup(struct dsa_switch *ds) PCR_MATRIX_CLR); if (dsa_is_cpu_port(ds, i)) @@ -475,7 +475,7 @@ Signed-off-by: Sean Wang else mt7530_port_disable(ds, i); -@@ -1334,6 +1673,118 @@ mt7530_setup(struct dsa_switch *ds) +@@ -1335,6 +1674,118 @@ mt7530_setup(struct dsa_switch *ds) return 0; } @@ -594,7 +594,7 @@ Signed-off-by: Sean Wang static bool mt7530_phy_mode_supported(struct dsa_switch *ds, int port, const struct phylink_link_state *state) -@@ -1372,6 +1823,47 @@ unsupported: +@@ -1373,6 +1824,47 @@ unsupported: return false; } @@ -642,7 +642,7 @@ Signed-off-by: Sean Wang static bool mt753x_phy_mode_supported(struct dsa_switch *ds, int port, const struct phylink_link_state *state) -@@ -1404,6 +1896,227 @@ mt7530_mac_config(struct dsa_switch *ds, +@@ -1405,6 +1897,227 @@ mt7530_mac_config(struct dsa_switch *ds, return 0; } @@ -870,7 +870,7 @@ Signed-off-by: Sean Wang static int mt753x_mac_config(struct dsa_switch *ds, int port, unsigned int mode, const struct phylink_link_state *state) -@@ -1439,6 +2152,8 @@ mt753x_phylink_mac_config(struct dsa_swi +@@ -1440,6 +2153,8 @@ mt753x_phylink_mac_config(struct dsa_swi if (mt753x_mac_config(ds, port, mode, state) < 0) goto unsupported; @@ -879,7 +879,7 @@ Signed-off-by: Sean Wang break; case 6: /* 1st cpu port */ if (priv->p6_interface == state->interface) -@@ -1458,7 +2173,8 @@ unsupported: +@@ -1459,7 +2174,8 @@ unsupported: return; } @@ -889,7 +889,7 @@ Signed-off-by: Sean Wang dev_err(ds->dev, "%s: in-band negotiation unsupported\n", __func__); return; -@@ -1468,7 +2184,7 @@ unsupported: +@@ -1469,7 +2185,7 @@ unsupported: mcr_new = mcr_cur; mcr_new &= ~PMCR_LINK_SETTINGS_MASK; mcr_new |= PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | PMCR_BACKOFF_EN | @@ -898,7 +898,7 @@ Signed-off-by: Sean Wang /* Are we connected to external phy */ if (port == 5 && dsa_is_user_port(ds, 5)) -@@ -1478,7 +2194,18 @@ unsupported: +@@ -1479,7 +2195,18 @@ unsupported: mt7530_write(priv, MT7530_PMCR_P(port), mcr_new); } @@ -918,7 +918,7 @@ Signed-off-by: Sean Wang unsigned int mode, phy_interface_t interface) { -@@ -1487,7 +2214,19 @@ static void mt7530_phylink_mac_link_down +@@ -1488,7 +2215,19 @@ static void mt7530_phylink_mac_link_down mt7530_clear(priv, MT7530_PMCR_P(port), PMCR_LINK_SETTINGS_MASK); } @@ -939,7 +939,7 @@ Signed-off-by: Sean Wang unsigned int mode, phy_interface_t interface, struct phy_device *phydev, -@@ -1497,18 +2236,29 @@ static void mt7530_phylink_mac_link_up(s +@@ -1498,18 +2237,29 @@ static void mt7530_phylink_mac_link_up(s struct mt7530_priv *priv = ds->priv; u32 mcr; @@ -971,7 +971,7 @@ Signed-off-by: Sean Wang break; } if (duplex == DUPLEX_FULL) { -@@ -1522,6 +2272,45 @@ static void mt7530_phylink_mac_link_up(s +@@ -1523,6 +2273,45 @@ static void mt7530_phylink_mac_link_up(s mt7530_set(priv, MT7530_PMCR_P(port), mcr); } @@ -1017,7 +1017,7 @@ Signed-off-by: Sean Wang static void mt7530_mac_port_validate(struct dsa_switch *ds, int port, unsigned long *supported) -@@ -1530,6 +2319,14 @@ mt7530_mac_port_validate(struct dsa_swit +@@ -1531,6 +2320,14 @@ mt7530_mac_port_validate(struct dsa_swit phylink_set(supported, 1000baseX_Full); } @@ -1032,7 +1032,7 @@ Signed-off-by: Sean Wang static void mt753x_phylink_validate(struct dsa_switch *ds, int port, unsigned long *supported, -@@ -1546,7 +2343,8 @@ mt753x_phylink_validate(struct dsa_switc +@@ -1547,7 +2344,8 @@ mt753x_phylink_validate(struct dsa_switc phylink_set_port_modes(mask); @@ -1042,7 +1042,7 @@ Signed-off-by: Sean Wang phylink_set(mask, 10baseT_Half); phylink_set(mask, 10baseT_Full); phylink_set(mask, 100baseT_Half); -@@ -1565,6 +2363,11 @@ mt753x_phylink_validate(struct dsa_switc +@@ -1566,6 +2364,11 @@ mt753x_phylink_validate(struct dsa_switc linkmode_and(supported, supported, mask); linkmode_and(state->advertising, state->advertising, mask); @@ -1054,7 +1054,7 @@ Signed-off-by: Sean Wang } static int -@@ -1655,6 +2458,63 @@ static int mt7530_set_mac_eee(struct dsa +@@ -1656,6 +2459,63 @@ static int mt7530_set_mac_eee(struct dsa return 0; } @@ -1118,7 +1118,7 @@ Signed-off-by: Sean Wang static int mt753x_phylink_mac_link_state(struct dsa_switch *ds, int port, struct phylink_link_state *state) -@@ -1708,13 +2568,14 @@ static const struct dsa_switch_ops mt753 +@@ -1709,13 +2569,14 @@ static const struct dsa_switch_ops mt753 .port_vlan_prepare = mt7530_port_vlan_prepare, .port_vlan_add = mt7530_port_vlan_add, .port_vlan_del = mt7530_port_vlan_del, @@ -1137,7 +1137,7 @@ Signed-off-by: Sean Wang .get_mac_eee = mt7530_get_mac_eee, .set_mac_eee = mt7530_set_mac_eee, }; -@@ -1742,11 +2603,26 @@ static const struct mt753x_info mt753x_t +@@ -1743,11 +2604,26 @@ static const struct mt753x_info mt753x_t .mac_port_get_state = mt7530_phylink_mac_link_state, .mac_port_config = mt7530_mac_config, }, From 88a71fbe774b048457bfca3721098f6da0b167d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 7 Dec 2022 09:48:32 +0100 Subject: [PATCH 07/10] kernel: backport b53/bcm_sf2 changes from v5.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...b53-Use-dev_-err-info-instead-of-pr_.patch | 4 +- ...-Print-err-message-on-SW_RST-timeout.patch | 2 +- ...-support-BCM4908-s-integrated-switch.patch | 8 +- ...store-PHY-interface-mode-in-port-str.patch | 4 +- ..._sf2-setup-BCM4908-internal-crossbar.patch | 12 +- ...-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch | 2 +- ...-add-function-finding-RGMII-register.patch | 10 +- ...-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch | 2 +- ...dsa-bcm_sf2-refactor-LED-regs-access.patch | 2 +- ...m_sf2-enable-GPHY-for-switch-probing.patch | 2 +- ...sf2-keep-GPHY-enabled-on-the-BCM4908.patch | 2 +- ...Also-configure-Port-5-for-2Gb-sec-on.patch | 37 ++++ ...cm_sf2-Also-configure-Port-5-for-2Gb.patch | 43 +++++ ...ore-VLAN-entries-upon-re-configurati.patch | 48 +++++ ...event-tagged-VLAN-on-port-7-for-7278.patch | 33 ++++ ...-enslaving-port-7-for-7278-into-a-br.patch | 31 +++ ...cm_sf2-Disable-learning-for-ASP-port.patch | 36 ++++ ...Check-earlier-for-FLOW_EXT-and-FLOW_.patch | 33 ++++ ...Move-writing-of-CFP_DATA-5-into-slic.patch | 131 +++++++++++++ ...f2-Add-support-for-matching-VLAN-TCI.patch | 181 ++++++++++++++++++ ...Support-specifying-VLAN-tag-egress-r.patch | 94 +++++++++ ...53-Fix-valid-setting-for-MDB-entries.patch | 2 +- ...e-resolved-link-config-via-mac_link_.patch | 4 +- 23 files changed, 695 insertions(+), 28 deletions(-) create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0001-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb-sec-on.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0002-Revert-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0005-net-dsa-b53-Restore-VLAN-entries-upon-re-configurati.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0006-net-dsa-b53-Prevent-tagged-VLAN-on-port-7-for-7278.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0007-net-dsa-b53-Deny-enslaving-port-7-for-7278-into-a-br.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0008-net-dsa-bcm_sf2-Disable-learning-for-ASP-port.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0009-net-dsa-bcm_sf2-Check-earlier-for-FLOW_EXT-and-FLOW_.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0010-net-dsa-bcm_sf2-Move-writing-of-CFP_DATA-5-into-slic.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0011-net-dsa-bcm_sf2-Add-support-for-matching-VLAN-TCI.patch create mode 100644 target/linux/generic/backport-5.4/707-v5.7-0012-net-dsa-bcm_sf2-Support-specifying-VLAN-tag-egress-r.patch diff --git a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch index 04e506f6fe..776cf4a1f2 100644 --- a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch +++ b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller #include #include #include -@@ -2567,8 +2565,9 @@ int b53_switch_detect(struct b53_device +@@ -2596,8 +2594,9 @@ int b53_switch_detect(struct b53_device dev->chip_id = id32; break; default: @@ -38,7 +38,7 @@ Signed-off-by: David S. Miller return -ENODEV; } } -@@ -2598,7 +2597,8 @@ int b53_switch_register(struct b53_devic +@@ -2627,7 +2626,8 @@ int b53_switch_register(struct b53_devic if (ret) return ret; diff --git a/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch b/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch index d619aa45b7..a83cec3950 100644 --- a/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch +++ b/target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch @@ -15,7 +15,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -768,8 +768,11 @@ static int b53_switch_reset(struct b53_d +@@ -783,8 +783,11 @@ static int b53_switch_reset(struct b53_d usleep_range(1000, 2000); } while (timeout-- > 0); diff --git a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch index e27ecc3498..531388da70 100644 --- a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch +++ b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch @@ -23,7 +23,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -2363,6 +2363,22 @@ static const struct b53_chip_data b53_sw +@@ -2392,6 +2392,22 @@ static const struct b53_chip_data b53_sw .jumbo_pm_reg = B53_JUMBO_PORT_MASK, .jumbo_size_reg = B53_JUMBO_MAX_SIZE, }, @@ -68,7 +68,7 @@ Signed-off-by: Jakub Kicinski offset = CORE_STS_OVERRIDE_IMP; else offset = CORE_STS_OVERRIDE_IMP2; -@@ -555,7 +556,8 @@ static void bcm_sf2_sw_mac_config(struct +@@ -563,7 +564,8 @@ static void bcm_sf2_sw_mac_config(struct if (port == core_readl(priv, CORE_IMP0_PRT_ID)) return; @@ -78,7 +78,7 @@ Signed-off-by: Jakub Kicinski offset = CORE_STS_OVERRIDE_GMIIP_PORT(port); else offset = CORE_STS_OVERRIDE_GMIIP2_PORT(port); -@@ -1005,6 +1007,30 @@ struct bcm_sf2_of_data { +@@ -1013,6 +1015,30 @@ struct bcm_sf2_of_data { unsigned int num_cfp_rules; }; @@ -109,7 +109,7 @@ Signed-off-by: Jakub Kicinski /* Register offsets for the SWITCH_REG_* block */ static const u16 bcm_sf2_7445_reg_offsets[] = { [REG_SWITCH_CNTRL] = 0x00, -@@ -1053,6 +1079,9 @@ static const struct bcm_sf2_of_data bcm_ +@@ -1061,6 +1087,9 @@ static const struct bcm_sf2_of_data bcm_ }; static const struct of_device_id bcm_sf2_of_match[] = { diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch index 9590327649..a4bab32f95 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0001-net-dsa-bcm_sf2-store-PHY-interface-mode-in-port-str.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -392,8 +392,9 @@ static void bcm_sf2_intr_disable(struct +@@ -400,8 +400,9 @@ static void bcm_sf2_intr_disable(struct static void bcm_sf2_identify_ports(struct bcm_sf2_priv *priv, struct device_node *dn) { @@ -29,7 +29,7 @@ Signed-off-by: David S. Miller unsigned int port_num; priv->moca_port = -1; -@@ -402,19 +403,26 @@ static void bcm_sf2_identify_ports(struc +@@ -410,19 +411,26 @@ static void bcm_sf2_identify_ports(struc if (of_property_read_u32(port, "reg", &port_num)) continue; diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch index 21717ffc3c..e13be23a65 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0002-net-dsa-bcm_sf2-setup-BCM4908-internal-crossbar.patch @@ -37,7 +37,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -381,6 +381,44 @@ static int bcm_sf2_sw_rst(struct bcm_sf2 +@@ -389,6 +389,44 @@ static int bcm_sf2_sw_rst(struct bcm_sf2 return 0; } @@ -82,7 +82,7 @@ Signed-off-by: David S. Miller static void bcm_sf2_intr_disable(struct bcm_sf2_priv *priv) { intrl2_0_mask_set(priv, 0xffffffff); -@@ -751,6 +789,8 @@ static int bcm_sf2_sw_resume(struct dsa_ +@@ -759,6 +797,8 @@ static int bcm_sf2_sw_resume(struct dsa_ return ret; } @@ -91,7 +91,7 @@ Signed-off-by: David S. Miller ret = bcm_sf2_cfp_resume(ds); if (ret) return ret; -@@ -1016,6 +1056,7 @@ struct bcm_sf2_of_data { +@@ -1024,6 +1064,7 @@ struct bcm_sf2_of_data { const u16 *reg_offsets; unsigned int core_reg_align; unsigned int num_cfp_rules; @@ -99,7 +99,7 @@ Signed-off-by: David S. Miller }; static const u16 bcm_sf2_4908_reg_offsets[] = { -@@ -1040,6 +1081,7 @@ static const struct bcm_sf2_of_data bcm_ +@@ -1048,6 +1089,7 @@ static const struct bcm_sf2_of_data bcm_ .core_reg_align = 0, .reg_offsets = bcm_sf2_4908_reg_offsets, .num_cfp_rules = 0, /* FIXME */ @@ -107,7 +107,7 @@ Signed-off-by: David S. Miller }; /* Register offsets for the SWITCH_REG_* block */ -@@ -1150,6 +1192,7 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1158,6 +1200,7 @@ static int bcm_sf2_sw_probe(struct platf priv->reg_offsets = data->reg_offsets; priv->core_reg_align = data->core_reg_align; priv->num_cfp_rules = data->num_cfp_rules; @@ -115,7 +115,7 @@ Signed-off-by: David S. Miller priv->rcdev = devm_reset_control_get_optional_exclusive(&pdev->dev, "switch"); -@@ -1209,6 +1252,8 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1217,6 +1260,8 @@ static int bcm_sf2_sw_probe(struct platf return ret; } diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch index a2aa554a60..da27963bf8 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0003-net-dsa-bcm_sf2-Fill-in-BCM4908-CFP-entries.patch @@ -14,7 +14,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1080,7 +1080,7 @@ static const struct bcm_sf2_of_data bcm_ +@@ -1088,7 +1088,7 @@ static const struct bcm_sf2_of_data bcm_ .type = BCM4908_DEVICE_ID, .core_reg_align = 0, .reg_offsets = bcm_sf2_4908_reg_offsets, diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch index 162b7ece3b..442e35ad98 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0004-net-dsa-bcm_sf2-add-function-finding-RGMII-register.patch @@ -57,7 +57,7 @@ Signed-off-by: David S. Miller static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) { struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); -@@ -600,6 +625,7 @@ static void bcm_sf2_sw_mac_config(struct +@@ -608,6 +633,7 @@ static void bcm_sf2_sw_mac_config(struct { struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); u32 id_mode_dis = 0, port_mode; @@ -65,7 +65,7 @@ Signed-off-by: David S. Miller u32 reg, offset; if (port == core_readl(priv, CORE_IMP0_PRT_ID)) -@@ -629,10 +655,12 @@ static void bcm_sf2_sw_mac_config(struct +@@ -637,10 +663,12 @@ static void bcm_sf2_sw_mac_config(struct goto force_link; } @@ -79,7 +79,7 @@ Signed-off-by: David S. Miller reg &= ~ID_MODE_DIS; reg &= ~(PORT_MODE_MASK << PORT_MODE_SHIFT); reg &= ~(RX_PAUSE_EN | TX_PAUSE_EN); -@@ -647,7 +675,7 @@ static void bcm_sf2_sw_mac_config(struct +@@ -655,7 +683,7 @@ static void bcm_sf2_sw_mac_config(struct reg |= RX_PAUSE_EN; } @@ -88,7 +88,7 @@ Signed-off-by: David S. Miller force_link: /* Force link settings detected from the PHY */ -@@ -678,6 +706,7 @@ static void bcm_sf2_sw_mac_link_set(stru +@@ -686,6 +714,7 @@ static void bcm_sf2_sw_mac_link_set(stru phy_interface_t interface, bool link) { struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); @@ -96,7 +96,7 @@ Signed-off-by: David S. Miller u32 reg; if (!phy_interface_mode_is_rgmii(interface) && -@@ -685,13 +714,15 @@ static void bcm_sf2_sw_mac_link_set(stru +@@ -693,13 +722,15 @@ static void bcm_sf2_sw_mac_link_set(stru interface != PHY_INTERFACE_MODE_REVMII) return; diff --git a/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch b/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch index 09e00d5a5f..1abec90243 100644 --- a/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch +++ b/target/linux/bcm4908/patches-5.4/075-v5.13-0005-net-dsa-bcm_sf2-fix-BCM4908-RGMII-reg-s.patch @@ -33,7 +33,7 @@ Signed-off-by: David S. Miller break; default: switch (port) { -@@ -1099,9 +1104,7 @@ static const u16 bcm_sf2_4908_reg_offset +@@ -1107,9 +1112,7 @@ static const u16 bcm_sf2_4908_reg_offset [REG_PHY_REVISION] = 0x14, [REG_SPHY_CNTRL] = 0x24, [REG_CROSSBAR] = 0xc8, diff --git a/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch b/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch index 12db03ef0c..00ea23005b 100644 --- a/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch +++ b/target/linux/bcm4908/patches-5.4/076-v5.17-net-dsa-bcm_sf2-refactor-LED-regs-access.patch @@ -82,7 +82,7 @@ Signed-off-by: Jakub Kicinski } } -@@ -1105,9 +1142,14 @@ static const u16 bcm_sf2_4908_reg_offset +@@ -1113,9 +1150,14 @@ static const u16 bcm_sf2_4908_reg_offset [REG_SPHY_CNTRL] = 0x24, [REG_CROSSBAR] = 0xc8, [REG_RGMII_11_CNTRL] = 0x014c, diff --git a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch index d7a4c5b1b8..39efb11d81 100644 --- a/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch +++ b/target/linux/bcm4908/patches-5.4/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch @@ -29,7 +29,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1388,10 +1388,14 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1396,10 +1396,14 @@ static int bcm_sf2_sw_probe(struct platf rev = reg_readl(priv, REG_PHY_REVISION); priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK; diff --git a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch index 7ddbb44d35..d18bfc0dea 100644 --- a/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch +++ b/target/linux/bcm4908/patches-5.4/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch @@ -15,7 +15,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1402,6 +1402,12 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1410,6 +1410,12 @@ static int bcm_sf2_sw_probe(struct platf priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff, priv->irq0, priv->irq1); diff --git a/target/linux/generic/backport-5.4/707-v5.7-0001-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb-sec-on.patch b/target/linux/generic/backport-5.4/707-v5.7-0001-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb-sec-on.patch new file mode 100644 index 0000000000..61a037b361 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0001-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb-sec-on.patch @@ -0,0 +1,37 @@ +From 7458bd540fa0a90220b9e8c349d910d9dde9caf8 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Fri, 14 Feb 2020 16:32:29 -0800 +Subject: [PATCH] net: dsa: bcm_sf2: Also configure Port 5 for 2Gb/sec on 7278 + +Either port 5 or port 8 can be used on a 7278 device, make sure that +port 5 also gets configured properly for 2Gb/sec in that case. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2.c | 3 +++ + drivers/net/dsa/bcm_sf2_regs.h | 1 + + 2 files changed, 4 insertions(+) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -620,6 +620,9 @@ force_link: + reg |= RXFLOW_CNTL; + } + ++ if (priv->type == BCM7278_DEVICE_ID && dsa_is_cpu_port(ds, port)) ++ reg |= GMIIP_SPEED_UP_2G; ++ + core_writel(priv, reg, offset); + } + +--- a/drivers/net/dsa/bcm_sf2_regs.h ++++ b/drivers/net/dsa/bcm_sf2_regs.h +@@ -178,6 +178,7 @@ enum bcm_sf2_reg_offs { + #define RXFLOW_CNTL (1 << 4) + #define TXFLOW_CNTL (1 << 5) + #define SW_OVERRIDE (1 << 6) ++#define GMIIP_SPEED_UP_2G (1 << 7) + + #define CORE_WATCHDOG_CTRL 0x001e4 + #define SOFTWARE_RESET (1 << 7) diff --git a/target/linux/generic/backport-5.4/707-v5.7-0002-Revert-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb.patch b/target/linux/generic/backport-5.4/707-v5.7-0002-Revert-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb.patch new file mode 100644 index 0000000000..2b99f47436 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0002-Revert-net-dsa-bcm_sf2-Also-configure-Port-5-for-2Gb.patch @@ -0,0 +1,43 @@ +From 3f02735e5da5367e4cd563ce6e5c21ce27922248 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 24 Feb 2020 15:44:26 -0800 +Subject: [PATCH] Revert "net: dsa: bcm_sf2: Also configure Port 5 for 2Gb/sec + on 7278" + +This reverts commit 7458bd540fa0a90220b9e8c349d910d9dde9caf8 ("net: dsa: +bcm_sf2: Also configure Port 5 for 2Gb/sec on 7278") as it causes +advanced congestion buffering issues with 7278 switch devices when using +their internal Giabit PHY. While this is being debugged, continue with +conservative defaults that work and do not cause packet loss. + +Fixes: 7458bd540fa0 ("net: dsa: bcm_sf2: Also configure Port 5 for 2Gb/sec on 7278") +Signed-off-by: Florian Fainelli +Reviewed-by: Vivien Didelot +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2.c | 3 --- + drivers/net/dsa/bcm_sf2_regs.h | 1 - + 2 files changed, 4 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -620,9 +620,6 @@ force_link: + reg |= RXFLOW_CNTL; + } + +- if (priv->type == BCM7278_DEVICE_ID && dsa_is_cpu_port(ds, port)) +- reg |= GMIIP_SPEED_UP_2G; +- + core_writel(priv, reg, offset); + } + +--- a/drivers/net/dsa/bcm_sf2_regs.h ++++ b/drivers/net/dsa/bcm_sf2_regs.h +@@ -178,7 +178,6 @@ enum bcm_sf2_reg_offs { + #define RXFLOW_CNTL (1 << 4) + #define TXFLOW_CNTL (1 << 5) + #define SW_OVERRIDE (1 << 6) +-#define GMIIP_SPEED_UP_2G (1 << 7) + + #define CORE_WATCHDOG_CTRL 0x001e4 + #define SOFTWARE_RESET (1 << 7) diff --git a/target/linux/generic/backport-5.4/707-v5.7-0005-net-dsa-b53-Restore-VLAN-entries-upon-re-configurati.patch b/target/linux/generic/backport-5.4/707-v5.7-0005-net-dsa-b53-Restore-VLAN-entries-upon-re-configurati.patch new file mode 100644 index 0000000000..cf8be49075 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0005-net-dsa-b53-Restore-VLAN-entries-upon-re-configurati.patch @@ -0,0 +1,48 @@ +From d7a0b1f7652f9f6b7ba0c9d8ad8edd6b8c0c1511 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:47 -0700 +Subject: [PATCH] net: dsa: b53: Restore VLAN entries upon (re)configuration + +The first time b53_configure_vlan() is called we have not configured any +VLAN entries yet, since that happens later when interfaces get brought +up. When b53_configure_vlan() is called again from suspend/resume we +need to restore all VLAN entries though. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -696,7 +696,9 @@ int b53_configure_vlan(struct dsa_switch + { + struct b53_device *dev = ds->priv; + struct b53_vlan vl = { 0 }; ++ struct b53_vlan *v; + int i, def_vid; ++ u16 vid; + + def_vid = b53_default_pvid(dev); + +@@ -717,6 +719,19 @@ int b53_configure_vlan(struct dsa_switch + if (!is5325(dev) && !is5365(dev)) + b53_set_jumbo(dev, dev->enable_jumbo, false); + ++ /* Upon initial call we have not set-up any VLANs, but upon ++ * system resume, we need to restore all VLAN entries. ++ */ ++ for (vid = def_vid; vid < dev->num_vlans; vid++) { ++ v = &dev->vlans[vid]; ++ ++ if (!v->members) ++ continue; ++ ++ b53_set_vlan_entry(dev, vid, v); ++ b53_fast_age_vlan(dev, vid); ++ } ++ + return 0; + } + EXPORT_SYMBOL(b53_configure_vlan); diff --git a/target/linux/generic/backport-5.4/707-v5.7-0006-net-dsa-b53-Prevent-tagged-VLAN-on-port-7-for-7278.patch b/target/linux/generic/backport-5.4/707-v5.7-0006-net-dsa-b53-Prevent-tagged-VLAN-on-port-7-for-7278.patch new file mode 100644 index 0000000000..12c9546f7b --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0006-net-dsa-b53-Prevent-tagged-VLAN-on-port-7-for-7278.patch @@ -0,0 +1,33 @@ +From 88631864da093377ce6d5e60b5639328622a8e5c Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:48 -0700 +Subject: [PATCH] net: dsa: b53: Prevent tagged VLAN on port 7 for 7278 + +On 7278, port 7 of the switch connects to the ASP UniMAC which is not +capable of processing VLAN tagged frames. We can still allow the port to +be part of a VLAN entry, and we may want it to be untagged on egress on +that VLAN because of that limitation. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1366,6 +1366,14 @@ int b53_vlan_prepare(struct dsa_switch * + if ((is5325(dev) || is5365(dev)) && vlan->vid_begin == 0) + return -EOPNOTSUPP; + ++ /* Port 7 on 7278 connects to the ASP's UniMAC which is not capable of ++ * receiving VLAN tagged frames at all, we can still allow the port to ++ * be configured for egress untagged. ++ */ ++ if (dev->chip_id == BCM7278_DEVICE_ID && port == 7 && ++ !(vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED)) ++ return -EINVAL; ++ + if (vlan->vid_end >= dev->num_vlans) + return -ERANGE; + diff --git a/target/linux/generic/backport-5.4/707-v5.7-0007-net-dsa-b53-Deny-enslaving-port-7-for-7278-into-a-br.patch b/target/linux/generic/backport-5.4/707-v5.7-0007-net-dsa-b53-Deny-enslaving-port-7-for-7278-into-a-br.patch new file mode 100644 index 0000000000..0cddffa363 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0007-net-dsa-b53-Deny-enslaving-port-7-for-7278-into-a-br.patch @@ -0,0 +1,31 @@ +From 31bfc2d42cae6e8b1440fc5db3f0aba6c5d7e602 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:49 -0700 +Subject: [PATCH] net: dsa: b53: Deny enslaving port 7 for 7278 into a bridge + +On 7278, port 7 connects to the ASP which should only receive frames +through the use of CFP rules, it is not desirable to have it be part of +a bridge at all since that would make it pick up unwanted traffic that +it may not even be able to filter or sustain. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1770,6 +1770,12 @@ int b53_br_join(struct dsa_switch *ds, i + u16 pvlan, reg; + unsigned int i; + ++ /* On 7278, port 7 which connects to the ASP should only receive ++ * traffic from matching CFP rules. ++ */ ++ if (dev->chip_id == BCM7278_DEVICE_ID && port == 7) ++ return -EINVAL; ++ + /* Make this port leave the all VLANs join since we will have proper + * VLAN entries from now on + */ diff --git a/target/linux/generic/backport-5.4/707-v5.7-0008-net-dsa-bcm_sf2-Disable-learning-for-ASP-port.patch b/target/linux/generic/backport-5.4/707-v5.7-0008-net-dsa-bcm_sf2-Disable-learning-for-ASP-port.patch new file mode 100644 index 0000000000..c3ba9ae37a --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0008-net-dsa-bcm_sf2-Disable-learning-for-ASP-port.patch @@ -0,0 +1,36 @@ +From 8b6b208b69917d88bb3e087f8c9e61c6b05ed571 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:50 -0700 +Subject: [PATCH] net: dsa: bcm_sf2: Disable learning for ASP port + +We don't want to enable learning for the ASP port since it only receives +directed traffic, this allows us to bypass ARL-driven forwarding rules +which could conflict with Broadcom tags and/or CFP forwarding. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -173,9 +173,17 @@ static int bcm_sf2_port_setup(struct dsa + core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL); + + /* 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 + */ diff --git a/target/linux/generic/backport-5.4/707-v5.7-0009-net-dsa-bcm_sf2-Check-earlier-for-FLOW_EXT-and-FLOW_.patch b/target/linux/generic/backport-5.4/707-v5.7-0009-net-dsa-bcm_sf2-Check-earlier-for-FLOW_EXT-and-FLOW_.patch new file mode 100644 index 0000000000..5c445ee9b9 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0009-net-dsa-bcm_sf2-Check-earlier-for-FLOW_EXT-and-FLOW_.patch @@ -0,0 +1,33 @@ +From 5ae8c0d51ace3bdbfb89c27e7661f081cc9287de Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:51 -0700 +Subject: [PATCH] net: dsa: bcm_sf2: Check earlier for FLOW_EXT and + FLOW_MAC_EXT + +We do not currently support matching on FLOW_EXT or FLOW_MAC_EXT, but we +were not checking for those bits being set in the flow specification. + +The check for FLOW_EXT and FLOW_MAC_EXT are separated out because a +subsequent commit will add support for matching VLAN TCI which are +covered by FLOW_EXT. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2_cfp.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2_cfp.c ++++ b/drivers/net/dsa/bcm_sf2_cfp.c +@@ -878,8 +878,9 @@ static int bcm_sf2_cfp_rule_set(struct d + int ret = -EINVAL; + + /* Check for unsupported extensions */ +- if ((fs->flow_type & FLOW_EXT) && (fs->m_ext.vlan_etype || +- fs->m_ext.data[1])) ++ if ((fs->flow_type & FLOW_EXT) || ++ (fs->flow_type & FLOW_MAC_EXT) || ++ fs->m_ext.data[1]) + return -EINVAL; + + if (fs->location != RX_CLS_LOC_ANY && diff --git a/target/linux/generic/backport-5.4/707-v5.7-0010-net-dsa-bcm_sf2-Move-writing-of-CFP_DATA-5-into-slic.patch b/target/linux/generic/backport-5.4/707-v5.7-0010-net-dsa-bcm_sf2-Move-writing-of-CFP_DATA-5-into-slic.patch new file mode 100644 index 0000000000..93b47aff71 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0010-net-dsa-bcm_sf2-Move-writing-of-CFP_DATA-5-into-slic.patch @@ -0,0 +1,131 @@ +From c2d639d118d27d6419f5848675ed5c112a86910f Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:52 -0700 +Subject: [PATCH] net: dsa: bcm_sf2: Move writing of CFP_DATA(5) into slicing + functions + +In preparation for matching VLANs, move the writing of CFP_DATA(5) into +the IPv4 and IPv6 slicing logic since they are part of the per-flow +configuration. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2_cfp.c | 64 +++++++++++++++++------------------ + 1 file changed, 32 insertions(+), 32 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2_cfp.c ++++ b/drivers/net/dsa/bcm_sf2_cfp.c +@@ -261,11 +261,20 @@ static int bcm_sf2_cfp_act_pol_set(struc + static void bcm_sf2_cfp_slice_ipv4(struct bcm_sf2_priv *priv, + struct flow_dissector_key_ipv4_addrs *addrs, + struct flow_dissector_key_ports *ports, +- unsigned int slice_num, ++ unsigned int slice_num, u8 num_udf, + bool mask) + { + u32 reg, offset; + ++ /* UDF_Valid[7:0] [31:24] ++ * S-Tag [23:8] ++ * C-Tag [7:0] ++ */ ++ if (mask) ++ core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_MASK_PORT(5)); ++ else ++ core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_DATA_PORT(5)); ++ + /* C-Tag [31:24] + * UDF_n_A8 [23:8] + * UDF_n_A7 [7:0] +@@ -421,18 +430,11 @@ static int bcm_sf2_cfp_ipv4_rule_set(str + core_writel(priv, layout->udfs[slice_num].mask_value | + udf_upper_bits(num_udf), CORE_CFP_MASK_PORT(6)); + +- /* UDF_Valid[7:0] [31:24] +- * S-Tag [23:8] +- * C-Tag [7:0] +- */ +- core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_DATA_PORT(5)); +- +- /* Mask all but valid UDFs */ +- core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_MASK_PORT(5)); +- + /* Program the match and the mask */ +- bcm_sf2_cfp_slice_ipv4(priv, ipv4.key, ports.key, slice_num, false); +- bcm_sf2_cfp_slice_ipv4(priv, ipv4.mask, ports.mask, SLICE_NUM_MASK, true); ++ bcm_sf2_cfp_slice_ipv4(priv, ipv4.key, ports.key, slice_num, ++ num_udf, false); ++ bcm_sf2_cfp_slice_ipv4(priv, ipv4.mask, ports.mask, SLICE_NUM_MASK, ++ num_udf, true); + + /* Insert into TCAM now */ + bcm_sf2_cfp_rule_addr_set(priv, rule_index); +@@ -468,11 +470,20 @@ out_err_flow_rule: + + static void bcm_sf2_cfp_slice_ipv6(struct bcm_sf2_priv *priv, + const __be32 *ip6_addr, const __be16 port, +- unsigned int slice_num, ++ unsigned int slice_num, u32 udf_bits, + bool mask) + { + u32 reg, tmp, val, offset; + ++ /* UDF_Valid[7:0] [31:24] ++ * S-Tag [23:8] ++ * C-Tag [7:0] ++ */ ++ if (mask) ++ core_writel(priv, udf_bits << 24, CORE_CFP_MASK_PORT(5)); ++ else ++ core_writel(priv, udf_bits << 24, CORE_CFP_DATA_PORT(5)); ++ + /* C-Tag [31:24] + * UDF_n_B8 [23:8] (port) + * UDF_n_B7 (upper) [7:0] (addr[15:8]) +@@ -704,20 +715,13 @@ static int bcm_sf2_cfp_ipv6_rule_set(str + reg = layout->udfs[slice_num].mask_value | udf_upper_bits(num_udf); + core_writel(priv, reg, CORE_CFP_MASK_PORT(6)); + +- /* UDF_Valid[7:0] [31:24] +- * S-Tag [23:8] +- * C-Tag [7:0] +- */ +- core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_DATA_PORT(5)); +- +- /* Mask all but valid UDFs */ +- core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_MASK_PORT(5)); +- + /* Slice the IPv6 source address and port */ + bcm_sf2_cfp_slice_ipv6(priv, ipv6.key->src.in6_u.u6_addr32, +- ports.key->src, slice_num, false); ++ ports.key->src, slice_num, ++ udf_lower_bits(num_udf), false); + bcm_sf2_cfp_slice_ipv6(priv, ipv6.mask->src.in6_u.u6_addr32, +- ports.mask->src, SLICE_NUM_MASK, true); ++ ports.mask->src, SLICE_NUM_MASK, ++ udf_lower_bits(num_udf), true); + + /* Insert into TCAM now because we need to insert a second rule */ + bcm_sf2_cfp_rule_addr_set(priv, rule_index[0]); +@@ -768,16 +772,12 @@ static int bcm_sf2_cfp_ipv6_rule_set(str + udf_lower_bits(num_udf) << 8; + core_writel(priv, reg, CORE_CFP_MASK_PORT(6)); + +- /* Don't care */ +- core_writel(priv, 0, CORE_CFP_DATA_PORT(5)); +- +- /* Mask all */ +- core_writel(priv, 0, CORE_CFP_MASK_PORT(5)); +- + bcm_sf2_cfp_slice_ipv6(priv, ipv6.key->dst.in6_u.u6_addr32, +- ports.key->dst, slice_num, false); ++ ports.key->dst, slice_num, ++ 0, false); + bcm_sf2_cfp_slice_ipv6(priv, ipv6.mask->dst.in6_u.u6_addr32, +- ports.key->dst, SLICE_NUM_MASK, true); ++ ports.key->dst, SLICE_NUM_MASK, ++ 0, true); + + /* Insert into TCAM now */ + bcm_sf2_cfp_rule_addr_set(priv, rule_index[1]); diff --git a/target/linux/generic/backport-5.4/707-v5.7-0011-net-dsa-bcm_sf2-Add-support-for-matching-VLAN-TCI.patch b/target/linux/generic/backport-5.4/707-v5.7-0011-net-dsa-bcm_sf2-Add-support-for-matching-VLAN-TCI.patch new file mode 100644 index 0000000000..71de609870 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0011-net-dsa-bcm_sf2-Add-support-for-matching-VLAN-TCI.patch @@ -0,0 +1,181 @@ +From 7555020c44db75a0d934dffc0aa6c678b52b2a13 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:53 -0700 +Subject: [PATCH] net: dsa: bcm_sf2: Add support for matching VLAN TCI + +Update relevant code paths to support the programming and matching of +VLAN TCI, this is the only member of the ethtool_flow_ext that we can +match, the switch does not permit matching the VLAN Ethernet Type field. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2_cfp.c | 53 +++++++++++++++++++++++++---------- + 1 file changed, 38 insertions(+), 15 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2_cfp.c ++++ b/drivers/net/dsa/bcm_sf2_cfp.c +@@ -261,6 +261,7 @@ static int bcm_sf2_cfp_act_pol_set(struc + static void bcm_sf2_cfp_slice_ipv4(struct bcm_sf2_priv *priv, + struct flow_dissector_key_ipv4_addrs *addrs, + struct flow_dissector_key_ports *ports, ++ const __be16 vlan_tci, + unsigned int slice_num, u8 num_udf, + bool mask) + { +@@ -270,16 +271,17 @@ static void bcm_sf2_cfp_slice_ipv4(struc + * S-Tag [23:8] + * C-Tag [7:0] + */ ++ reg = udf_lower_bits(num_udf) << 24 | be16_to_cpu(vlan_tci) >> 8; + if (mask) +- core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_MASK_PORT(5)); ++ core_writel(priv, reg, CORE_CFP_MASK_PORT(5)); + else +- core_writel(priv, udf_lower_bits(num_udf) << 24, CORE_CFP_DATA_PORT(5)); ++ core_writel(priv, reg, CORE_CFP_DATA_PORT(5)); + + /* C-Tag [31:24] + * UDF_n_A8 [23:8] + * UDF_n_A7 [7:0] + */ +- reg = 0; ++ reg = (u32)(be16_to_cpu(vlan_tci) & 0xff) << 24; + if (mask) + offset = CORE_CFP_MASK_PORT(4); + else +@@ -345,6 +347,7 @@ static int bcm_sf2_cfp_ipv4_rule_set(str + struct ethtool_rx_flow_spec *fs) + { + struct ethtool_rx_flow_spec_input input = {}; ++ __be16 vlan_tci = 0 , vlan_m_tci = 0xffff; + const struct cfp_udf_layout *layout; + unsigned int slice_num, rule_index; + struct ethtool_rx_flow_rule *flow; +@@ -369,6 +372,12 @@ static int bcm_sf2_cfp_ipv4_rule_set(str + + ip_frag = !!(be32_to_cpu(fs->h_ext.data[0]) & 1); + ++ /* Extract VLAN TCI */ ++ if (fs->flow_type & FLOW_EXT) { ++ vlan_tci = fs->h_ext.vlan_tci; ++ vlan_m_tci = fs->m_ext.vlan_tci; ++ } ++ + /* Locate the first rule available */ + if (fs->location == RX_CLS_LOC_ANY) + rule_index = find_first_zero_bit(priv->cfp.used, +@@ -431,10 +440,10 @@ static int bcm_sf2_cfp_ipv4_rule_set(str + udf_upper_bits(num_udf), CORE_CFP_MASK_PORT(6)); + + /* Program the match and the mask */ +- bcm_sf2_cfp_slice_ipv4(priv, ipv4.key, ports.key, slice_num, +- num_udf, false); +- bcm_sf2_cfp_slice_ipv4(priv, ipv4.mask, ports.mask, SLICE_NUM_MASK, +- num_udf, true); ++ bcm_sf2_cfp_slice_ipv4(priv, ipv4.key, ports.key, vlan_tci, ++ slice_num, num_udf, false); ++ bcm_sf2_cfp_slice_ipv4(priv, ipv4.mask, ports.mask, vlan_m_tci, ++ SLICE_NUM_MASK, num_udf, true); + + /* Insert into TCAM now */ + bcm_sf2_cfp_rule_addr_set(priv, rule_index); +@@ -470,6 +479,7 @@ out_err_flow_rule: + + static void bcm_sf2_cfp_slice_ipv6(struct bcm_sf2_priv *priv, + const __be32 *ip6_addr, const __be16 port, ++ const __be16 vlan_tci, + unsigned int slice_num, u32 udf_bits, + bool mask) + { +@@ -479,10 +489,11 @@ static void bcm_sf2_cfp_slice_ipv6(struc + * S-Tag [23:8] + * C-Tag [7:0] + */ ++ reg = udf_bits << 24 | be16_to_cpu(vlan_tci) >> 8; + if (mask) +- core_writel(priv, udf_bits << 24, CORE_CFP_MASK_PORT(5)); ++ core_writel(priv, reg, CORE_CFP_MASK_PORT(5)); + else +- core_writel(priv, udf_bits << 24, CORE_CFP_DATA_PORT(5)); ++ core_writel(priv, reg, CORE_CFP_DATA_PORT(5)); + + /* C-Tag [31:24] + * UDF_n_B8 [23:8] (port) +@@ -490,6 +501,7 @@ static void bcm_sf2_cfp_slice_ipv6(struc + */ + reg = be32_to_cpu(ip6_addr[3]); + val = (u32)be16_to_cpu(port) << 8 | ((reg >> 8) & 0xff); ++ val |= (u32)(be16_to_cpu(vlan_tci) & 0xff) << 24; + if (mask) + offset = CORE_CFP_MASK_PORT(4); + else +@@ -598,6 +610,11 @@ static int bcm_sf2_cfp_rule_cmp(struct b + + ret = memcmp(&rule->fs.h_u, &fs->h_u, fs_size); + ret |= memcmp(&rule->fs.m_u, &fs->m_u, fs_size); ++ /* Compare VLAN TCI values as well */ ++ if (rule->fs.flow_type & FLOW_EXT) { ++ ret |= rule->fs.h_ext.vlan_tci != fs->h_ext.vlan_tci; ++ ret |= rule->fs.m_ext.vlan_tci != fs->m_ext.vlan_tci; ++ } + if (ret == 0) + break; + } +@@ -611,6 +628,7 @@ static int bcm_sf2_cfp_ipv6_rule_set(str + struct ethtool_rx_flow_spec *fs) + { + struct ethtool_rx_flow_spec_input input = {}; ++ __be16 vlan_tci = 0, vlan_m_tci = 0xffff; + unsigned int slice_num, rule_index[2]; + const struct cfp_udf_layout *layout; + struct ethtool_rx_flow_rule *flow; +@@ -634,6 +652,12 @@ static int bcm_sf2_cfp_ipv6_rule_set(str + + ip_frag = !!(be32_to_cpu(fs->h_ext.data[0]) & 1); + ++ /* Extract VLAN TCI */ ++ if (fs->flow_type & FLOW_EXT) { ++ vlan_tci = fs->h_ext.vlan_tci; ++ vlan_m_tci = fs->m_ext.vlan_tci; ++ } ++ + layout = &udf_tcpip6_layout; + slice_num = bcm_sf2_get_slice_number(layout, 0); + if (slice_num == UDF_NUM_SLICES) +@@ -717,10 +741,10 @@ static int bcm_sf2_cfp_ipv6_rule_set(str + + /* Slice the IPv6 source address and port */ + bcm_sf2_cfp_slice_ipv6(priv, ipv6.key->src.in6_u.u6_addr32, +- ports.key->src, slice_num, ++ ports.key->src, vlan_tci, slice_num, + udf_lower_bits(num_udf), false); + bcm_sf2_cfp_slice_ipv6(priv, ipv6.mask->src.in6_u.u6_addr32, +- ports.mask->src, SLICE_NUM_MASK, ++ ports.mask->src, vlan_m_tci, SLICE_NUM_MASK, + udf_lower_bits(num_udf), true); + + /* Insert into TCAM now because we need to insert a second rule */ +@@ -773,10 +797,10 @@ static int bcm_sf2_cfp_ipv6_rule_set(str + core_writel(priv, reg, CORE_CFP_MASK_PORT(6)); + + bcm_sf2_cfp_slice_ipv6(priv, ipv6.key->dst.in6_u.u6_addr32, +- ports.key->dst, slice_num, ++ ports.key->dst, 0, slice_num, + 0, false); + bcm_sf2_cfp_slice_ipv6(priv, ipv6.mask->dst.in6_u.u6_addr32, +- ports.key->dst, SLICE_NUM_MASK, ++ ports.key->dst, 0, SLICE_NUM_MASK, + 0, true); + + /* Insert into TCAM now */ +@@ -878,8 +902,7 @@ static int bcm_sf2_cfp_rule_set(struct d + int ret = -EINVAL; + + /* Check for unsupported extensions */ +- if ((fs->flow_type & FLOW_EXT) || +- (fs->flow_type & FLOW_MAC_EXT) || ++ if ((fs->flow_type & FLOW_MAC_EXT) || + fs->m_ext.data[1]) + return -EINVAL; + diff --git a/target/linux/generic/backport-5.4/707-v5.7-0012-net-dsa-bcm_sf2-Support-specifying-VLAN-tag-egress-r.patch b/target/linux/generic/backport-5.4/707-v5.7-0012-net-dsa-bcm_sf2-Support-specifying-VLAN-tag-egress-r.patch new file mode 100644 index 0000000000..174d76c7e6 --- /dev/null +++ b/target/linux/generic/backport-5.4/707-v5.7-0012-net-dsa-bcm_sf2-Support-specifying-VLAN-tag-egress-r.patch @@ -0,0 +1,94 @@ +From 8b3abe304c5f1057b7bac70fd5576dfa67e3e2b3 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 30 Mar 2020 14:38:54 -0700 +Subject: [PATCH] net: dsa: bcm_sf2: Support specifying VLAN tag egress rule + +The port to which the ASP is connected on 7278 is not capable of +processing VLAN tags as part of the Ethernet frame, so allow an user to +configure the egress VLAN policy they want to see applied by purposing +the h_ext.data[1] field. Bit 0 is used to indicate that 0=tagged, +1=untagged. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/bcm_sf2_cfp.c | 40 +++++++++++++++++++++++++++++++++-- + 1 file changed, 38 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2_cfp.c ++++ b/drivers/net/dsa/bcm_sf2_cfp.c +@@ -13,6 +13,8 @@ + #include + #include + #include ++#include ++#include + + #include "bcm_sf2.h" + #include "bcm_sf2_regs.h" +@@ -847,7 +849,9 @@ static int bcm_sf2_cfp_rule_insert(struc + struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); + s8 cpu_port = ds->ports[port].cpu_dp->index; + __u64 ring_cookie = fs->ring_cookie; ++ struct switchdev_obj_port_vlan vlan; + unsigned int queue_num, port_num; ++ u16 vid; + int ret; + + /* This rule is a Wake-on-LAN filter and we must specifically +@@ -867,6 +871,34 @@ static int bcm_sf2_cfp_rule_insert(struc + dsa_is_cpu_port(ds, port_num)) || + port_num >= priv->hw_params.num_ports) + return -EINVAL; ++ ++ /* If the rule is matching a particular VLAN, make sure that we honor ++ * the matching and have it tagged or untagged on the destination port, ++ * we do this on egress with a VLAN entry. The egress tagging attribute ++ * is expected to be provided in h_ext.data[1] bit 0. A 1 means untagged, ++ * a 0 means tagged. ++ */ ++ if (fs->flow_type & FLOW_EXT) { ++ /* We cannot support matching multiple VLAN IDs yet */ ++ if ((be16_to_cpu(fs->m_ext.vlan_tci) & VLAN_VID_MASK) != ++ VLAN_VID_MASK) ++ return -EINVAL; ++ ++ vid = be16_to_cpu(fs->h_ext.vlan_tci) & VLAN_VID_MASK; ++ vlan.vid_begin = vid; ++ vlan.vid_end = vid; ++ if (cpu_to_be32(fs->h_ext.data[1]) & 1) ++ vlan.flags = BRIDGE_VLAN_INFO_UNTAGGED; ++ else ++ vlan.flags = 0; ++ ++ ret = ds->ops->port_vlan_prepare(ds, port_num, &vlan); ++ if (ret) ++ return ret; ++ ++ ds->ops->port_vlan_add(ds, port_num, &vlan); ++ } ++ + /* + * We have a small oddity where Port 6 just does not have a + * valid bit here (so we substract by one). +@@ -902,14 +934,18 @@ static int bcm_sf2_cfp_rule_set(struct d + int ret = -EINVAL; + + /* Check for unsupported extensions */ +- if ((fs->flow_type & FLOW_MAC_EXT) || +- fs->m_ext.data[1]) ++ if (fs->flow_type & FLOW_MAC_EXT) + return -EINVAL; + + if (fs->location != RX_CLS_LOC_ANY && + fs->location > bcm_sf2_cfp_rule_size(priv)) + return -EINVAL; + ++ if ((fs->flow_type & FLOW_EXT) && ++ !(ds->ops->port_vlan_prepare || ds->ops->port_vlan_add || ++ ds->ops->port_vlan_del)) ++ return -EOPNOTSUPP; ++ + if (fs->location != RX_CLS_LOC_ANY && + test_bit(fs->location, priv->cfp.used)) + return -EBUSY; diff --git a/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch b/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch index 8225ca1d29..f77aee1a87 100644 --- a/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch +++ b/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch @@ -20,7 +20,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -1577,7 +1577,6 @@ static int b53_arl_op(struct b53_device +@@ -1600,7 +1600,6 @@ static int b53_arl_op(struct b53_device ent.is_valid = !!(ent.port); } diff --git a/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch b/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch index 6fc9a1643e..b25f3c0d11 100644 --- a/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch +++ b/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch @@ -12,7 +12,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -1297,7 +1297,9 @@ EXPORT_SYMBOL(b53_phylink_mac_link_down) +@@ -1312,7 +1312,9 @@ EXPORT_SYMBOL(b53_phylink_mac_link_down) void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, @@ -38,7 +38,7 @@ Signed-off-by: David S. Miller const struct switchdev_obj_port_vlan *vlan); --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -653,7 +653,9 @@ static void bcm_sf2_sw_mac_link_down(str +@@ -661,7 +661,9 @@ static void bcm_sf2_sw_mac_link_down(str static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, From 50d255d4a8e8a89ce4b593b3c6b5c4484798553b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 7 Dec 2022 09:57:47 +0100 Subject: [PATCH 08/10] kernel: backport b53/bcm_sf2 changes from v5.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...b53-Use-dev_-err-info-instead-of-pr_.patch | 4 +- ...-support-BCM4908-s-integrated-switch.patch | 2 +- ...b53-per-port-interrupts-are-optional.patch | 25 ++ ...name-num_arl_entries-to-num_arl_bins.patch | 255 ++++++++++++++++++ ...sa-b53-Provide-number-of-ARL-buckets.patch | 198 ++++++++++++++ ...net-dsa-b53-Bound-check-ARL-searches.patch | 43 +++ ...ve-is_static-argument-to-b53_read_op.patch | 36 +++ ...ve-redundant-premature-assignment-to.patch | 28 ++ ...e-resolved-link-config-via-mac_link_.patch | 2 +- 9 files changed, 589 insertions(+), 4 deletions(-) create mode 100644 target/linux/generic/backport-5.4/709-v5.8-0001-net-dsa-b53-per-port-interrupts-are-optional.patch create mode 100644 target/linux/generic/backport-5.4/709-v5.8-0002-net-dsa-b53-Rename-num_arl_entries-to-num_arl_bins.patch create mode 100644 target/linux/generic/backport-5.4/709-v5.8-0003-net-dsa-b53-Provide-number-of-ARL-buckets.patch create mode 100644 target/linux/generic/backport-5.4/709-v5.8-0004-net-dsa-b53-Bound-check-ARL-searches.patch create mode 100644 target/linux/generic/backport-5.4/709-v5.8-0005-net-dsa-b53-Remove-is_static-argument-to-b53_read_op.patch create mode 100644 target/linux/generic/backport-5.4/709-v5.8-0006-net-dsa-b53-remove-redundant-premature-assignment-to.patch diff --git a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch index 776cf4a1f2..83a9b9345f 100644 --- a/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch +++ b/target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller #include #include #include -@@ -2596,8 +2594,9 @@ int b53_switch_detect(struct b53_device +@@ -2616,8 +2614,9 @@ int b53_switch_detect(struct b53_device dev->chip_id = id32; break; default: @@ -38,7 +38,7 @@ Signed-off-by: David S. Miller return -ENODEV; } } -@@ -2627,7 +2626,8 @@ int b53_switch_register(struct b53_devic +@@ -2647,7 +2646,8 @@ int b53_switch_register(struct b53_devic if (ret) return ret; diff --git a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch index 531388da70..5c698a342f 100644 --- a/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch +++ b/target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch @@ -23,7 +23,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c -@@ -2392,6 +2392,22 @@ static const struct b53_chip_data b53_sw +@@ -2409,6 +2409,22 @@ static const struct b53_chip_data b53_sw .jumbo_pm_reg = B53_JUMBO_PORT_MASK, .jumbo_size_reg = B53_JUMBO_MAX_SIZE, }, diff --git a/target/linux/generic/backport-5.4/709-v5.8-0001-net-dsa-b53-per-port-interrupts-are-optional.patch b/target/linux/generic/backport-5.4/709-v5.8-0001-net-dsa-b53-per-port-interrupts-are-optional.patch new file mode 100644 index 0000000000..ee1c883585 --- /dev/null +++ b/target/linux/generic/backport-5.4/709-v5.8-0001-net-dsa-b53-per-port-interrupts-are-optional.patch @@ -0,0 +1,25 @@ +From 007fc3c0ca478f3a8ad687cf9ecbe672d3a64700 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Fri, 17 Apr 2020 11:33:41 -0700 +Subject: [PATCH] net: dsa: b53: per-port interrupts are optional + +Make use of platform_get_irq_byname_optional() to avoid printing +messages on the kernel console that interrupts cannot be found. + +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_srab.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/dsa/b53/b53_srab.c ++++ b/drivers/net/dsa/b53/b53_srab.c +@@ -524,7 +524,7 @@ static void b53_srab_prepare_irq(struct + + port->num = i; + port->dev = dev; +- port->irq = platform_get_irq_byname(pdev, name); ++ port->irq = platform_get_irq_byname_optional(pdev, name); + kfree(name); + } + diff --git a/target/linux/generic/backport-5.4/709-v5.8-0002-net-dsa-b53-Rename-num_arl_entries-to-num_arl_bins.patch b/target/linux/generic/backport-5.4/709-v5.8-0002-net-dsa-b53-Rename-num_arl_entries-to-num_arl_bins.patch new file mode 100644 index 0000000000..7b566ddb6c --- /dev/null +++ b/target/linux/generic/backport-5.4/709-v5.8-0002-net-dsa-b53-Rename-num_arl_entries-to-num_arl_bins.patch @@ -0,0 +1,255 @@ +From 673e69a67dd63fc3b40f109d1677a5dc72185fbb Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Thu, 30 Apr 2020 11:49:08 -0700 +Subject: [PATCH] net: dsa: b53: Rename num_arl_entries to num_arl_bins + +The variable currently holds the number of ARL bins per ARL buckets, +which is different from the number of ARL entries which would be bins +times buckets. We will be adding a num_arl_buckets in a subsequent patch +so get variables straight now. + +Signed-off-by: Florian Fainelli +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 52 ++++++++++++++++---------------- + drivers/net/dsa/b53/b53_priv.h | 2 +- + 2 files changed, 27 insertions(+), 27 deletions(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1506,10 +1506,10 @@ static int b53_arl_read(struct b53_devic + if (ret) + return ret; + +- bitmap_zero(free_bins, dev->num_arl_entries); ++ bitmap_zero(free_bins, dev->num_arl_bins); + + /* Read the bins */ +- for (i = 0; i < dev->num_arl_entries; i++) { ++ for (i = 0; i < dev->num_arl_bins; i++) { + u64 mac_vid; + u32 fwd_entry; + +@@ -1532,10 +1532,10 @@ static int b53_arl_read(struct b53_devic + return 0; + } + +- if (bitmap_weight(free_bins, dev->num_arl_entries) == 0) ++ if (bitmap_weight(free_bins, dev->num_arl_bins) == 0) + return -ENOSPC; + +- *idx = find_first_bit(free_bins, dev->num_arl_entries); ++ *idx = find_first_bit(free_bins, dev->num_arl_bins); + + return -ENOENT; + } +@@ -1705,7 +1705,7 @@ int b53_fdb_dump(struct dsa_switch *ds, + if (ret) + return ret; + +- if (priv->num_arl_entries > 2) { ++ if (priv->num_arl_bins > 2) { + b53_arl_search_rd(priv, 1, &results[1]); + ret = b53_fdb_copy(port, &results[1], cb, data); + if (ret) +@@ -2179,7 +2179,7 @@ struct b53_chip_data { + u16 enabled_ports; + u8 cpu_port; + u8 vta_regs[3]; +- u8 arl_entries; ++ u8 arl_bins; + u8 duplex_reg; + u8 jumbo_pm_reg; + u8 jumbo_size_reg; +@@ -2198,7 +2198,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM5325", + .vlans = 16, + .enabled_ports = 0x1f, +- .arl_entries = 2, ++ .arl_bins = 2, + .cpu_port = B53_CPU_PORT_25, + .duplex_reg = B53_DUPLEX_STAT_FE, + }, +@@ -2207,7 +2207,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM5365", + .vlans = 256, + .enabled_ports = 0x1f, +- .arl_entries = 2, ++ .arl_bins = 2, + .cpu_port = B53_CPU_PORT_25, + .duplex_reg = B53_DUPLEX_STAT_FE, + }, +@@ -2216,7 +2216,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM5389", + .vlans = 4096, + .enabled_ports = 0x1f, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2228,7 +2228,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM5395", + .vlans = 4096, + .enabled_ports = 0x1f, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2240,7 +2240,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM5397", + .vlans = 4096, + .enabled_ports = 0x1f, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS_9798, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2252,7 +2252,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM5398", + .vlans = 4096, + .enabled_ports = 0x7f, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS_9798, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2264,7 +2264,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53115", + .vlans = 4096, + .enabled_ports = 0x1f, +- .arl_entries = 4, ++ .arl_bins = 4, + .vta_regs = B53_VTA_REGS, + .cpu_port = B53_CPU_PORT, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2276,7 +2276,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53125", + .vlans = 4096, + .enabled_ports = 0xff, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2288,7 +2288,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53128", + .vlans = 4096, + .enabled_ports = 0x1ff, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2300,7 +2300,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM63xx", + .vlans = 4096, + .enabled_ports = 0, /* pdata must provide them */ +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS_63XX, + .duplex_reg = B53_DUPLEX_STAT_63XX, +@@ -2312,7 +2312,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53010", + .vlans = 4096, + .enabled_ports = 0x1f, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2324,7 +2324,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53011", + .vlans = 4096, + .enabled_ports = 0x1bf, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2336,7 +2336,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53012", + .vlans = 4096, + .enabled_ports = 0x1bf, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2348,7 +2348,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53018", + .vlans = 4096, + .enabled_ports = 0x1f, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2360,7 +2360,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM53019", + .vlans = 4096, + .enabled_ports = 0x1f, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2372,7 +2372,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM585xx/586xx/88312", + .vlans = 4096, + .enabled_ports = 0x1ff, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2384,7 +2384,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM583xx/11360", + .vlans = 4096, + .enabled_ports = 0x103, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2396,7 +2396,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM7445", + .vlans = 4096, + .enabled_ports = 0x1ff, +- .arl_entries = 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2408,7 +2408,7 @@ static const struct b53_chip_data b53_sw + .dev_name = "BCM7278", + .vlans = 4096, + .enabled_ports = 0x1ff, +- .arl_entries= 4, ++ .arl_bins = 4, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2436,7 +2436,7 @@ static int b53_switch_init(struct b53_de + dev->jumbo_pm_reg = chip->jumbo_pm_reg; + dev->cpu_port = chip->cpu_port; + dev->num_vlans = chip->vlans; +- dev->num_arl_entries = chip->arl_entries; ++ dev->num_arl_bins = chip->arl_bins; + break; + } + } +--- a/drivers/net/dsa/b53/b53_priv.h ++++ b/drivers/net/dsa/b53/b53_priv.h +@@ -117,7 +117,7 @@ struct b53_device { + u8 jumbo_pm_reg; + u8 jumbo_size_reg; + int reset_gpio; +- u8 num_arl_entries; ++ u8 num_arl_bins; + enum dsa_tag_protocol tag_protocol; + + /* used ports mask */ diff --git a/target/linux/generic/backport-5.4/709-v5.8-0003-net-dsa-b53-Provide-number-of-ARL-buckets.patch b/target/linux/generic/backport-5.4/709-v5.8-0003-net-dsa-b53-Provide-number-of-ARL-buckets.patch new file mode 100644 index 0000000000..3c278d4a54 --- /dev/null +++ b/target/linux/generic/backport-5.4/709-v5.8-0003-net-dsa-b53-Provide-number-of-ARL-buckets.patch @@ -0,0 +1,198 @@ +From e3da4038f4ca1094596a7604c6edac4a6a4f6ee9 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Thu, 30 Apr 2020 11:49:09 -0700 +Subject: [PATCH] net: dsa: b53: Provide number of ARL buckets + +In preparation for doing proper upper bound checking of FDB/MDB entries +being added to the ARL, provide the number of ARL buckets for each +switch chip we support. All chips have 1024 buckets, except 7278 which +has only 256. + +Signed-off-by: Florian Fainelli +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 21 +++++++++++++++++++++ + drivers/net/dsa/b53/b53_priv.h | 1 + + 2 files changed, 22 insertions(+) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -2180,6 +2180,7 @@ struct b53_chip_data { + u8 cpu_port; + u8 vta_regs[3]; + u8 arl_bins; ++ u16 arl_buckets; + u8 duplex_reg; + u8 jumbo_pm_reg; + u8 jumbo_size_reg; +@@ -2199,6 +2200,7 @@ static const struct b53_chip_data b53_sw + .vlans = 16, + .enabled_ports = 0x1f, + .arl_bins = 2, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT_25, + .duplex_reg = B53_DUPLEX_STAT_FE, + }, +@@ -2208,6 +2210,7 @@ static const struct b53_chip_data b53_sw + .vlans = 256, + .enabled_ports = 0x1f, + .arl_bins = 2, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT_25, + .duplex_reg = B53_DUPLEX_STAT_FE, + }, +@@ -2217,6 +2220,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2229,6 +2233,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2241,6 +2246,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS_9798, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2253,6 +2259,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x7f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS_9798, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2265,6 +2272,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .vta_regs = B53_VTA_REGS, + .cpu_port = B53_CPU_PORT, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2277,6 +2285,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0xff, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2289,6 +2298,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1ff, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2301,6 +2311,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0, /* pdata must provide them */ + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS_63XX, + .duplex_reg = B53_DUPLEX_STAT_63XX, +@@ -2313,6 +2324,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2325,6 +2337,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1bf, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2337,6 +2350,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1bf, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2349,6 +2363,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2361,6 +2376,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1f, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2373,6 +2389,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1ff, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2385,6 +2402,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x103, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2397,6 +2415,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1ff, + .arl_bins = 4, ++ .arl_buckets = 1024, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2409,6 +2428,7 @@ static const struct b53_chip_data b53_sw + .vlans = 4096, + .enabled_ports = 0x1ff, + .arl_bins = 4, ++ .arl_buckets = 256, + .cpu_port = B53_CPU_PORT, + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, +@@ -2437,6 +2457,7 @@ static int b53_switch_init(struct b53_de + dev->cpu_port = chip->cpu_port; + dev->num_vlans = chip->vlans; + dev->num_arl_bins = chip->arl_bins; ++ dev->num_arl_buckets = chip->arl_buckets; + break; + } + } +--- a/drivers/net/dsa/b53/b53_priv.h ++++ b/drivers/net/dsa/b53/b53_priv.h +@@ -118,6 +118,7 @@ struct b53_device { + u8 jumbo_size_reg; + int reset_gpio; + u8 num_arl_bins; ++ u16 num_arl_buckets; + enum dsa_tag_protocol tag_protocol; + + /* used ports mask */ diff --git a/target/linux/generic/backport-5.4/709-v5.8-0004-net-dsa-b53-Bound-check-ARL-searches.patch b/target/linux/generic/backport-5.4/709-v5.8-0004-net-dsa-b53-Bound-check-ARL-searches.patch new file mode 100644 index 0000000000..8faf2ace82 --- /dev/null +++ b/target/linux/generic/backport-5.4/709-v5.8-0004-net-dsa-b53-Bound-check-ARL-searches.patch @@ -0,0 +1,43 @@ +From cd169d799beeb738fa2d3e891960924cdcaf8414 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Thu, 30 Apr 2020 11:49:10 -0700 +Subject: [PATCH] net: dsa: b53: Bound check ARL searches + +ARL searches are done by reading two ARL entries at a time, do not cap +the search at 1024 which would only limit us to half of the possible ARL +capacity, but use b53_max_arl_entries() instead which does the right +multiplication between bins and indexes. + +Signed-off-by: Florian Fainelli +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 2 +- + drivers/net/dsa/b53/b53_priv.h | 5 +++++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1715,7 +1715,7 @@ int b53_fdb_dump(struct dsa_switch *ds, + break; + } + +- } while (count++ < 1024); ++ } while (count++ < b53_max_arl_entries(priv) / 2); + + return 0; + } +--- a/drivers/net/dsa/b53/b53_priv.h ++++ b/drivers/net/dsa/b53/b53_priv.h +@@ -213,6 +213,11 @@ static inline int is58xx(struct b53_devi + #define B53_CPU_PORT_25 5 + #define B53_CPU_PORT 8 + ++static inline unsigned int b53_max_arl_entries(struct b53_device *dev) ++{ ++ return dev->num_arl_buckets * dev->num_arl_bins; ++} ++ + struct b53_device *b53_switch_alloc(struct device *base, + const struct b53_io_ops *ops, + void *priv); diff --git a/target/linux/generic/backport-5.4/709-v5.8-0005-net-dsa-b53-Remove-is_static-argument-to-b53_read_op.patch b/target/linux/generic/backport-5.4/709-v5.8-0005-net-dsa-b53-Remove-is_static-argument-to-b53_read_op.patch new file mode 100644 index 0000000000..e4dad7d924 --- /dev/null +++ b/target/linux/generic/backport-5.4/709-v5.8-0005-net-dsa-b53-Remove-is_static-argument-to-b53_read_op.patch @@ -0,0 +1,36 @@ +From ef2a0bd99b1549a3a4253355be247d5dff25d720 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Thu, 30 Apr 2020 11:49:11 -0700 +Subject: [PATCH] net: dsa: b53: Remove is_static argument to b53_read_op() + +This argument is not used. + +Signed-off-by: Florian Fainelli +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1495,8 +1495,7 @@ static int b53_arl_rw_op(struct b53_devi + } + + static int b53_arl_read(struct b53_device *dev, u64 mac, +- u16 vid, struct b53_arl_entry *ent, u8 *idx, +- bool is_valid) ++ u16 vid, struct b53_arl_entry *ent, u8 *idx) + { + DECLARE_BITMAP(free_bins, B53_ARLTBL_MAX_BIN_ENTRIES); + unsigned int i; +@@ -1561,7 +1560,8 @@ static int b53_arl_op(struct b53_device + if (ret) + return ret; + +- ret = b53_arl_read(dev, mac, vid, &ent, &idx, is_valid); ++ ret = b53_arl_read(dev, mac, vid, &ent, &idx); ++ + /* If this is a read, just finish now */ + if (op) + return ret; diff --git a/target/linux/generic/backport-5.4/709-v5.8-0006-net-dsa-b53-remove-redundant-premature-assignment-to.patch b/target/linux/generic/backport-5.4/709-v5.8-0006-net-dsa-b53-remove-redundant-premature-assignment-to.patch new file mode 100644 index 0000000000..1360aa4631 --- /dev/null +++ b/target/linux/generic/backport-5.4/709-v5.8-0006-net-dsa-b53-remove-redundant-premature-assignment-to.patch @@ -0,0 +1,28 @@ +From 9f01a71c5cbec10b851588457089d17c20dc5a40 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Wed, 27 May 2020 13:01:29 +0100 +Subject: [PATCH] net: dsa: b53: remove redundant premature assignment to + new_pvid + +Variable new_pvid is being assigned with a value that is never read, +the following if statement updates new_pvid with a new value in both +of the if paths. The assignment is redundant and can be removed. + +Addresses-Coverity: ("Unused value") +Signed-off-by: Colin Ian King +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/b53/b53_common.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1336,7 +1336,6 @@ int b53_vlan_filtering(struct dsa_switch + u16 pvid, new_pvid; + + b53_read16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), &pvid); +- new_pvid = pvid; + if (!vlan_filtering) { + /* Filtering is currently enabled, use the default PVID since + * the bridge does not expect tagging anymore diff --git a/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch b/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch index b25f3c0d11..dbba2f65a2 100644 --- a/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch +++ b/target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch @@ -25,7 +25,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/b53/b53_priv.h +++ b/drivers/net/dsa/b53/b53_priv.h -@@ -338,7 +338,9 @@ void b53_phylink_mac_link_down(struct ds +@@ -344,7 +344,9 @@ void b53_phylink_mac_link_down(struct ds void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, From 50ad1e5619b7c28b6bda96b67d4cc14091e9e4db Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 7 Dec 2022 18:09:18 +0100 Subject: [PATCH 09/10] CI: build: skip sdk adapt to external toolchain on cache hit On cache hit, skip sdk adapt to external toolchain. This is needed because we cache the already extracted sdk and that is already adapted to be used as external toolchain. Rerunning the adap step will result in the test to fail for missing file as the file are already got wrapped to the external toolchain format. Fixes: 42f0ab028e2e ("CI: build: fix use of sdk as toolchain") Signed-off-by: Christian Marangi (cherry picked from commit 99eaedfe3966b1ca812e8a962197cf91286247f7) --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 43f30617d8..1c665cb869 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -267,7 +267,7 @@ jobs: --config ${{ env.TARGET }}/${{ env.SUBTARGET }} - name: Adapt external sdk to external toolchain format - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' && steps.cache-external-toolchain.outputs.cache-hit != 'true' shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | From 295c612a4a76e9f0860e2efdb609a38bc74d3e4a Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 7 Dec 2022 18:12:31 +0100 Subject: [PATCH 10/10] CI: kernel: don't checkout and install feeds We don't need to checkout feed and install feeds for kernel tests. This saves up to 2 minutes for each target kernel build test. Signed-off-by: Christian Marangi (cherry picked from commit 925e2a155ee4d4cc792fbf68aa9666e32a1f649b) --- .github/workflows/kernel.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 5a8c1123af..0fd03749f3 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -68,7 +68,6 @@ jobs: with: target: ${{ matrix.target }} build_all_kmods: true - include_feeds: true check-kernel-patches: name: Check Kernel patches