Message ID | 20230729115509.32601-5-ansuelsmth@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,v2,1/5] net: dsa: tag_qca: return early if dev is not found | expand |
Hi Christian, kernel test robot noticed the following build errors: [auto build test ERROR on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/net-dsa-qca8k-make-learning-configurable-and-keep-off-if-standalone/20230729-195747 base: net-next/main patch link: https://lore.kernel.org/r/20230729115509.32601-5-ansuelsmth%40gmail.com patch subject: [net-next PATCH v2 5/5] net: dsa: qca8k: use dsa_for_each macro instead of for loop config: i386-randconfig-i006-20230729 (https://download.01.org/0day-ci/archive/20230730/202307300000.UBj7WovP-lkp@intel.com/config) compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07) reproduce: (https://download.01.org/0day-ci/archive/20230730/202307300000.UBj7WovP-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202307300000.UBj7WovP-lkp@intel.com/ All errors (new ones prefixed by >>): >> drivers/net/dsa/qca/qca8k-8xxx.c:1869:28: error: use of undeclared identifier 'i' if (dsa_is_user_port(ds, i)) ^ 1 error generated. vim +/i +1869 drivers/net/dsa/qca/qca8k-8xxx.c 1798 1799 static int 1800 qca8k_setup(struct dsa_switch *ds) 1801 { 1802 struct qca8k_priv *priv = ds->priv; 1803 int cpu_port, ret, port; 1804 struct dsa_port *dp; 1805 u32 mask; 1806 1807 cpu_port = qca8k_find_cpu_port(ds); 1808 if (cpu_port < 0) { 1809 dev_err(priv->dev, "No cpu port configured in both cpu port0 and port6"); 1810 return cpu_port; 1811 } 1812 1813 /* Parse CPU port config to be later used in phy_link mac_config */ 1814 ret = qca8k_parse_port_config(priv); 1815 if (ret) 1816 return ret; 1817 1818 ret = qca8k_setup_mdio_bus(priv); 1819 if (ret) 1820 return ret; 1821 1822 ret = qca8k_setup_of_pws_reg(priv); 1823 if (ret) 1824 return ret; 1825 1826 ret = qca8k_setup_mac_pwr_sel(priv); 1827 if (ret) 1828 return ret; 1829 1830 ret = qca8k_setup_led_ctrl(priv); 1831 if (ret) 1832 return ret; 1833 1834 qca8k_setup_pcs(priv, &priv->pcs_port_0, 0); 1835 qca8k_setup_pcs(priv, &priv->pcs_port_6, 6); 1836 1837 /* Make sure MAC06 is disabled */ 1838 ret = regmap_clear_bits(priv->regmap, QCA8K_REG_PORT0_PAD_CTRL, 1839 QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN); 1840 if (ret) { 1841 dev_err(priv->dev, "failed disabling MAC06 exchange"); 1842 return ret; 1843 } 1844 1845 /* Enable CPU Port */ 1846 ret = regmap_set_bits(priv->regmap, QCA8K_REG_GLOBAL_FW_CTRL0, 1847 QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN); 1848 if (ret) { 1849 dev_err(priv->dev, "failed enabling CPU port"); 1850 return ret; 1851 } 1852 1853 /* Enable MIB counters */ 1854 ret = qca8k_mib_init(priv); 1855 if (ret) 1856 dev_warn(priv->dev, "mib init failed"); 1857 1858 /* Initial setup of all ports */ 1859 dsa_switch_for_each_port(dp, ds) { 1860 port = dp->index; 1861 1862 /* Disable forwarding by default on all ports */ 1863 ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port), 1864 QCA8K_PORT_LOOKUP_MEMBER, 0); 1865 if (ret) 1866 return ret; 1867 1868 /* Disable MAC by default on all user ports */ > 1869 if (dsa_is_user_port(ds, i)) 1870 qca8k_port_set_status(priv, port, 0); 1871 } 1872 1873 /* Enable QCA header mode on all cpu ports */ 1874 dsa_switch_for_each_cpu_port(dp, ds) { 1875 port = dp->index; 1876 1877 ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(port), 1878 FIELD_PREP(QCA8K_PORT_HDR_CTRL_TX_MASK, QCA8K_PORT_HDR_CTRL_ALL) | 1879 FIELD_PREP(QCA8K_PORT_HDR_CTRL_RX_MASK, QCA8K_PORT_HDR_CTRL_ALL)); 1880 if (ret) { 1881 dev_err(priv->dev, "failed enabling QCA header mode on port %d", port); 1882 return ret; 1883 } 1884 } 1885 1886 /* Forward all unknown frames to CPU port for Linux processing 1887 * Notice that in multi-cpu config only one port should be set 1888 * for igmp, unknown, multicast and broadcast packet 1889 */ 1890 ret = qca8k_write(priv, QCA8K_REG_GLOBAL_FW_CTRL1, 1891 FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_IGMP_DP_MASK, BIT(cpu_port)) | 1892 FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_BC_DP_MASK, BIT(cpu_port)) | 1893 FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_MC_DP_MASK, BIT(cpu_port)) | 1894 FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_UC_DP_MASK, BIT(cpu_port))); 1895 if (ret) 1896 return ret; 1897 1898 /* CPU port gets connected to all user ports of the switch */ 1899 ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(cpu_port), 1900 QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds)); 1901 if (ret) 1902 return ret; 1903 1904 /* Setup connection between CPU port & user ports 1905 * Individual user ports get connected to CPU port only 1906 */ 1907 dsa_switch_for_each_user_port(dp, ds) { 1908 port = dp->index; 1909 1910 ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port), 1911 QCA8K_PORT_LOOKUP_MEMBER, 1912 BIT(cpu_port)); 1913 if (ret) 1914 return ret; 1915 1916 ret = regmap_clear_bits(priv->regmap, QCA8K_PORT_LOOKUP_CTRL(port), 1917 QCA8K_PORT_LOOKUP_LEARN); 1918 if (ret) 1919 return ret; 1920 1921 /* For port based vlans to work we need to set the 1922 * default egress vid 1923 */ 1924 ret = qca8k_rmw(priv, QCA8K_EGRESS_VLAN(port), 1925 QCA8K_EGREES_VLAN_PORT_MASK(port), 1926 QCA8K_EGREES_VLAN_PORT(port, QCA8K_PORT_VID_DEF)); 1927 if (ret) 1928 return ret; 1929 1930 ret = qca8k_write(priv, QCA8K_REG_PORT_VLAN_CTRL0(port), 1931 QCA8K_PORT_VLAN_CVID(QCA8K_PORT_VID_DEF) | 1932 QCA8K_PORT_VLAN_SVID(QCA8K_PORT_VID_DEF)); 1933 if (ret) 1934 return ret; 1935 } 1936 1937 /* The port 5 of the qca8337 have some problem in flood condition. The 1938 * original legacy driver had some specific buffer and priority settings 1939 * for the different port suggested by the QCA switch team. Add this 1940 * missing settings to improve switch stability under load condition. 1941 * This problem is limited to qca8337 and other qca8k switch are not affected. 1942 */ 1943 if (priv->switch_id == QCA8K_ID_QCA8337) 1944 dsa_switch_for_each_available_port(dp, ds) 1945 qca8k_setup_hol_fixup(priv, dp->index); 1946 1947 /* Special GLOBAL_FC_THRESH value are needed for ar8327 switch */ 1948 if (priv->switch_id == QCA8K_ID_QCA8327) { 1949 mask = QCA8K_GLOBAL_FC_GOL_XON_THRES(288) | 1950 QCA8K_GLOBAL_FC_GOL_XOFF_THRES(496); 1951 qca8k_rmw(priv, QCA8K_REG_GLOBAL_FC_THRESH, 1952 QCA8K_GLOBAL_FC_GOL_XON_THRES_MASK | 1953 QCA8K_GLOBAL_FC_GOL_XOFF_THRES_MASK, 1954 mask); 1955 } 1956 1957 /* Setup our port MTUs to match power on defaults */ 1958 ret = qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, ETH_FRAME_LEN + ETH_FCS_LEN); 1959 if (ret) 1960 dev_warn(priv->dev, "failed setting MTU settings"); 1961 1962 /* Flush the FDB table */ 1963 qca8k_fdb_flush(priv); 1964 1965 /* Set min a max ageing value supported */ 1966 ds->ageing_time_min = 7000; 1967 ds->ageing_time_max = 458745000; 1968 1969 /* Set max number of LAGs supported */ 1970 ds->num_lag_ids = QCA8K_NUM_LAGS; 1971 1972 return 0; 1973 } 1974
Hi Christian, kernel test robot noticed the following build errors: [auto build test ERROR on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/net-dsa-qca8k-make-learning-configurable-and-keep-off-if-standalone/20230729-195747 base: net-next/main patch link: https://lore.kernel.org/r/20230729115509.32601-5-ansuelsmth%40gmail.com patch subject: [net-next PATCH v2 5/5] net: dsa: qca8k: use dsa_for_each macro instead of for loop config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230730/202307300305.RJlPYbyQ-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce: (https://download.01.org/0day-ci/archive/20230730/202307300305.RJlPYbyQ-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202307300305.RJlPYbyQ-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/net/dsa/qca/qca8k-8xxx.c: In function 'qca8k_setup': >> drivers/net/dsa/qca/qca8k-8xxx.c:1869:42: error: 'i' undeclared (first use in this function) 1869 | if (dsa_is_user_port(ds, i)) | ^ drivers/net/dsa/qca/qca8k-8xxx.c:1869:42: note: each undeclared identifier is reported only once for each function it appears in vim +/i +1869 drivers/net/dsa/qca/qca8k-8xxx.c 1798 1799 static int 1800 qca8k_setup(struct dsa_switch *ds) 1801 { 1802 struct qca8k_priv *priv = ds->priv; 1803 int cpu_port, ret, port; 1804 struct dsa_port *dp; 1805 u32 mask; 1806 1807 cpu_port = qca8k_find_cpu_port(ds); 1808 if (cpu_port < 0) { 1809 dev_err(priv->dev, "No cpu port configured in both cpu port0 and port6"); 1810 return cpu_port; 1811 } 1812 1813 /* Parse CPU port config to be later used in phy_link mac_config */ 1814 ret = qca8k_parse_port_config(priv); 1815 if (ret) 1816 return ret; 1817 1818 ret = qca8k_setup_mdio_bus(priv); 1819 if (ret) 1820 return ret; 1821 1822 ret = qca8k_setup_of_pws_reg(priv); 1823 if (ret) 1824 return ret; 1825 1826 ret = qca8k_setup_mac_pwr_sel(priv); 1827 if (ret) 1828 return ret; 1829 1830 ret = qca8k_setup_led_ctrl(priv); 1831 if (ret) 1832 return ret; 1833 1834 qca8k_setup_pcs(priv, &priv->pcs_port_0, 0); 1835 qca8k_setup_pcs(priv, &priv->pcs_port_6, 6); 1836 1837 /* Make sure MAC06 is disabled */ 1838 ret = regmap_clear_bits(priv->regmap, QCA8K_REG_PORT0_PAD_CTRL, 1839 QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN); 1840 if (ret) { 1841 dev_err(priv->dev, "failed disabling MAC06 exchange"); 1842 return ret; 1843 } 1844 1845 /* Enable CPU Port */ 1846 ret = regmap_set_bits(priv->regmap, QCA8K_REG_GLOBAL_FW_CTRL0, 1847 QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN); 1848 if (ret) { 1849 dev_err(priv->dev, "failed enabling CPU port"); 1850 return ret; 1851 } 1852 1853 /* Enable MIB counters */ 1854 ret = qca8k_mib_init(priv); 1855 if (ret) 1856 dev_warn(priv->dev, "mib init failed"); 1857 1858 /* Initial setup of all ports */ 1859 dsa_switch_for_each_port(dp, ds) { 1860 port = dp->index; 1861 1862 /* Disable forwarding by default on all ports */ 1863 ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port), 1864 QCA8K_PORT_LOOKUP_MEMBER, 0); 1865 if (ret) 1866 return ret; 1867 1868 /* Disable MAC by default on all user ports */ > 1869 if (dsa_is_user_port(ds, i)) 1870 qca8k_port_set_status(priv, port, 0); 1871 } 1872 1873 /* Enable QCA header mode on all cpu ports */ 1874 dsa_switch_for_each_cpu_port(dp, ds) { 1875 port = dp->index; 1876 1877 ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(port), 1878 FIELD_PREP(QCA8K_PORT_HDR_CTRL_TX_MASK, QCA8K_PORT_HDR_CTRL_ALL) | 1879 FIELD_PREP(QCA8K_PORT_HDR_CTRL_RX_MASK, QCA8K_PORT_HDR_CTRL_ALL)); 1880 if (ret) { 1881 dev_err(priv->dev, "failed enabling QCA header mode on port %d", port); 1882 return ret; 1883 } 1884 } 1885 1886 /* Forward all unknown frames to CPU port for Linux processing 1887 * Notice that in multi-cpu config only one port should be set 1888 * for igmp, unknown, multicast and broadcast packet 1889 */ 1890 ret = qca8k_write(priv, QCA8K_REG_GLOBAL_FW_CTRL1, 1891 FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_IGMP_DP_MASK, BIT(cpu_port)) | 1892 FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_BC_DP_MASK, BIT(cpu_port)) | 1893 FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_MC_DP_MASK, BIT(cpu_port)) | 1894 FIELD_PREP(QCA8K_GLOBAL_FW_CTRL1_UC_DP_MASK, BIT(cpu_port))); 1895 if (ret) 1896 return ret; 1897 1898 /* CPU port gets connected to all user ports of the switch */ 1899 ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(cpu_port), 1900 QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds)); 1901 if (ret) 1902 return ret; 1903 1904 /* Setup connection between CPU port & user ports 1905 * Individual user ports get connected to CPU port only 1906 */ 1907 dsa_switch_for_each_user_port(dp, ds) { 1908 port = dp->index; 1909 1910 ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port), 1911 QCA8K_PORT_LOOKUP_MEMBER, 1912 BIT(cpu_port)); 1913 if (ret) 1914 return ret; 1915 1916 ret = regmap_clear_bits(priv->regmap, QCA8K_PORT_LOOKUP_CTRL(port), 1917 QCA8K_PORT_LOOKUP_LEARN); 1918 if (ret) 1919 return ret; 1920 1921 /* For port based vlans to work we need to set the 1922 * default egress vid 1923 */ 1924 ret = qca8k_rmw(priv, QCA8K_EGRESS_VLAN(port), 1925 QCA8K_EGREES_VLAN_PORT_MASK(port), 1926 QCA8K_EGREES_VLAN_PORT(port, QCA8K_PORT_VID_DEF)); 1927 if (ret) 1928 return ret; 1929 1930 ret = qca8k_write(priv, QCA8K_REG_PORT_VLAN_CTRL0(port), 1931 QCA8K_PORT_VLAN_CVID(QCA8K_PORT_VID_DEF) | 1932 QCA8K_PORT_VLAN_SVID(QCA8K_PORT_VID_DEF)); 1933 if (ret) 1934 return ret; 1935 } 1936 1937 /* The port 5 of the qca8337 have some problem in flood condition. The 1938 * original legacy driver had some specific buffer and priority settings 1939 * for the different port suggested by the QCA switch team. Add this 1940 * missing settings to improve switch stability under load condition. 1941 * This problem is limited to qca8337 and other qca8k switch are not affected. 1942 */ 1943 if (priv->switch_id == QCA8K_ID_QCA8337) 1944 dsa_switch_for_each_available_port(dp, ds) 1945 qca8k_setup_hol_fixup(priv, dp->index); 1946 1947 /* Special GLOBAL_FC_THRESH value are needed for ar8327 switch */ 1948 if (priv->switch_id == QCA8K_ID_QCA8327) { 1949 mask = QCA8K_GLOBAL_FC_GOL_XON_THRES(288) | 1950 QCA8K_GLOBAL_FC_GOL_XOFF_THRES(496); 1951 qca8k_rmw(priv, QCA8K_REG_GLOBAL_FC_THRESH, 1952 QCA8K_GLOBAL_FC_GOL_XON_THRES_MASK | 1953 QCA8K_GLOBAL_FC_GOL_XOFF_THRES_MASK, 1954 mask); 1955 } 1956 1957 /* Setup our port MTUs to match power on defaults */ 1958 ret = qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, ETH_FRAME_LEN + ETH_FCS_LEN); 1959 if (ret) 1960 dev_warn(priv->dev, "failed setting MTU settings"); 1961 1962 /* Flush the FDB table */ 1963 qca8k_fdb_flush(priv); 1964 1965 /* Set min a max ageing value supported */ 1966 ds->ageing_time_min = 7000; 1967 ds->ageing_time_max = 458745000; 1968 1969 /* Set max number of LAGs supported */ 1970 ds->num_lag_ids = QCA8K_NUM_LAGS; 1971 1972 return 0; 1973 } 1974
diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 81c6fab0a01b..1434f145aa9c 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -1800,7 +1800,8 @@ static int qca8k_setup(struct dsa_switch *ds) { struct qca8k_priv *priv = ds->priv; - int cpu_port, ret, i; + int cpu_port, ret, port; + struct dsa_port *dp; u32 mask; cpu_port = qca8k_find_cpu_port(ds); @@ -1855,27 +1856,31 @@ qca8k_setup(struct dsa_switch *ds) dev_warn(priv->dev, "mib init failed"); /* Initial setup of all ports */ - for (i = 0; i < QCA8K_NUM_PORTS; i++) { + dsa_switch_for_each_port(dp, ds) { + port = dp->index; + /* Disable forwarding by default on all ports */ - ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i), + ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port), QCA8K_PORT_LOOKUP_MEMBER, 0); if (ret) return ret; - /* Enable QCA header mode on all cpu ports */ - if (dsa_is_cpu_port(ds, i)) { - ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(i), - FIELD_PREP(QCA8K_PORT_HDR_CTRL_TX_MASK, QCA8K_PORT_HDR_CTRL_ALL) | - FIELD_PREP(QCA8K_PORT_HDR_CTRL_RX_MASK, QCA8K_PORT_HDR_CTRL_ALL)); - if (ret) { - dev_err(priv->dev, "failed enabling QCA header mode"); - return ret; - } - } - /* Disable MAC by default on all user ports */ if (dsa_is_user_port(ds, i)) - qca8k_port_set_status(priv, i, 0); + qca8k_port_set_status(priv, port, 0); + } + + /* Enable QCA header mode on all cpu ports */ + dsa_switch_for_each_cpu_port(dp, ds) { + port = dp->index; + + ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(port), + FIELD_PREP(QCA8K_PORT_HDR_CTRL_TX_MASK, QCA8K_PORT_HDR_CTRL_ALL) | + FIELD_PREP(QCA8K_PORT_HDR_CTRL_RX_MASK, QCA8K_PORT_HDR_CTRL_ALL)); + if (ret) { + dev_err(priv->dev, "failed enabling QCA header mode on port %d", port); + return ret; + } } /* Forward all unknown frames to CPU port for Linux processing @@ -1897,48 +1902,48 @@ qca8k_setup(struct dsa_switch *ds) return ret; /* Setup connection between CPU port & user ports - * Configure specific switch configuration for ports + * Individual user ports get connected to CPU port only */ - for (i = 0; i < QCA8K_NUM_PORTS; i++) { - /* Individual user ports get connected to CPU port only */ - if (dsa_is_user_port(ds, i)) { - ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i), - QCA8K_PORT_LOOKUP_MEMBER, - BIT(cpu_port)); - if (ret) - return ret; - - ret = regmap_clear_bits(priv->regmap, QCA8K_PORT_LOOKUP_CTRL(i), - QCA8K_PORT_LOOKUP_LEARN); - if (ret) - return ret; - - /* For port based vlans to work we need to set the - * default egress vid - */ - ret = qca8k_rmw(priv, QCA8K_EGRESS_VLAN(i), - QCA8K_EGREES_VLAN_PORT_MASK(i), - QCA8K_EGREES_VLAN_PORT(i, QCA8K_PORT_VID_DEF)); - if (ret) - return ret; - - ret = qca8k_write(priv, QCA8K_REG_PORT_VLAN_CTRL0(i), - QCA8K_PORT_VLAN_CVID(QCA8K_PORT_VID_DEF) | - QCA8K_PORT_VLAN_SVID(QCA8K_PORT_VID_DEF)); - if (ret) - return ret; - } + dsa_switch_for_each_user_port(dp, ds) { + port = dp->index; - /* The port 5 of the qca8337 have some problem in flood condition. The - * original legacy driver had some specific buffer and priority settings - * for the different port suggested by the QCA switch team. Add this - * missing settings to improve switch stability under load condition. - * This problem is limited to qca8337 and other qca8k switch are not affected. + ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port), + QCA8K_PORT_LOOKUP_MEMBER, + BIT(cpu_port)); + if (ret) + return ret; + + ret = regmap_clear_bits(priv->regmap, QCA8K_PORT_LOOKUP_CTRL(port), + QCA8K_PORT_LOOKUP_LEARN); + if (ret) + return ret; + + /* For port based vlans to work we need to set the + * default egress vid */ - if (priv->switch_id == QCA8K_ID_QCA8337) - qca8k_setup_hol_fixup(priv, i); + ret = qca8k_rmw(priv, QCA8K_EGRESS_VLAN(port), + QCA8K_EGREES_VLAN_PORT_MASK(port), + QCA8K_EGREES_VLAN_PORT(port, QCA8K_PORT_VID_DEF)); + if (ret) + return ret; + + ret = qca8k_write(priv, QCA8K_REG_PORT_VLAN_CTRL0(port), + QCA8K_PORT_VLAN_CVID(QCA8K_PORT_VID_DEF) | + QCA8K_PORT_VLAN_SVID(QCA8K_PORT_VID_DEF)); + if (ret) + return ret; } + /* The port 5 of the qca8337 have some problem in flood condition. The + * original legacy driver had some specific buffer and priority settings + * for the different port suggested by the QCA switch team. Add this + * missing settings to improve switch stability under load condition. + * This problem is limited to qca8337 and other qca8k switch are not affected. + */ + if (priv->switch_id == QCA8K_ID_QCA8337) + dsa_switch_for_each_available_port(dp, ds) + qca8k_setup_hol_fixup(priv, dp->index); + /* Special GLOBAL_FC_THRESH value are needed for ar8327 switch */ if (priv->switch_id == QCA8K_ID_QCA8327) { mask = QCA8K_GLOBAL_FC_GOL_XON_THRES(288) |
Convert for loop to dsa_for_each macro to save some redundant write on unconnected/unused port and tidy things up. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> --- drivers/net/dsa/qca/qca8k-8xxx.c | 109 ++++++++++++++++--------------- 1 file changed, 57 insertions(+), 52 deletions(-)