aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2016-04-06 11:10:06 -0400
committerDavid S. Miller <davem@davemloft.net>2016-04-06 17:24:17 -0400
commitb9b7cee405797cc395f699d8dee4747b96b1e0a8 (patch)
tree7612387779695c084a9b8395bbbdadfd908d15b4
parentd6b7c13b018f1785743150f079638bb3ed69fff1 (diff)
mlxsw: reg: Add QoS ETS Element Configuration register
We are going to introduce support for DCB, so we need to be able to configure the traffic selection algorithm (TSA) used by each traffic class (TC), as well as the bandwidth percentage allocated to each TC in case of ETS. Add the QoS ETS Element Configuration register, which controls the above parameters. Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/reg.h127
1 files changed, 127 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h
index 370914e607e0..bc08f8bdca7a 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/reg.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h
@@ -1805,6 +1805,131 @@ static inline void mlxsw_reg_spvmlr_pack(char *payload, u8 local_port,
1805 } 1805 }
1806} 1806}
1807 1807
1808/* QEEC - QoS ETS Element Configuration Register
1809 * ---------------------------------------------
1810 * Configures the ETS elements.
1811 */
1812#define MLXSW_REG_QEEC_ID 0x400D
1813#define MLXSW_REG_QEEC_LEN 0x1C
1814
1815static const struct mlxsw_reg_info mlxsw_reg_qeec = {
1816 .id = MLXSW_REG_QEEC_ID,
1817 .len = MLXSW_REG_QEEC_LEN,
1818};
1819
1820/* reg_qeec_local_port
1821 * Local port number.
1822 * Access: Index
1823 *
1824 * Note: CPU port is supported.
1825 */
1826MLXSW_ITEM32(reg, qeec, local_port, 0x00, 16, 8);
1827
1828enum mlxsw_reg_qeec_hr {
1829 MLXSW_REG_QEEC_HIERARCY_PORT,
1830 MLXSW_REG_QEEC_HIERARCY_GROUP,
1831 MLXSW_REG_QEEC_HIERARCY_SUBGROUP,
1832 MLXSW_REG_QEEC_HIERARCY_TC,
1833};
1834
1835/* reg_qeec_element_hierarchy
1836 * 0 - Port
1837 * 1 - Group
1838 * 2 - Subgroup
1839 * 3 - Traffic Class
1840 * Access: Index
1841 */
1842MLXSW_ITEM32(reg, qeec, element_hierarchy, 0x04, 16, 4);
1843
1844/* reg_qeec_element_index
1845 * The index of the element in the hierarchy.
1846 * Access: Index
1847 */
1848MLXSW_ITEM32(reg, qeec, element_index, 0x04, 0, 8);
1849
1850/* reg_qeec_next_element_index
1851 * The index of the next (lower) element in the hierarchy.
1852 * Access: RW
1853 *
1854 * Note: Reserved for element_hierarchy 0.
1855 */
1856MLXSW_ITEM32(reg, qeec, next_element_index, 0x08, 0, 8);
1857
1858enum {
1859 MLXSW_REG_QEEC_BYTES_MODE,
1860 MLXSW_REG_QEEC_PACKETS_MODE,
1861};
1862
1863/* reg_qeec_pb
1864 * Packets or bytes mode.
1865 * 0 - Bytes mode
1866 * 1 - Packets mode
1867 * Access: RW
1868 *
1869 * Note: Used for max shaper configuration. For Spectrum, packets mode
1870 * is supported only for traffic classes of CPU port.
1871 */
1872MLXSW_ITEM32(reg, qeec, pb, 0x0C, 28, 1);
1873
1874/* reg_qeec_mase
1875 * Max shaper configuration enable. Enables configuration of the max
1876 * shaper on this ETS element.
1877 * 0 - Disable
1878 * 1 - Enable
1879 * Access: RW
1880 */
1881MLXSW_ITEM32(reg, qeec, mase, 0x10, 31, 1);
1882
1883/* A large max rate will disable the max shaper. */
1884#define MLXSW_REG_QEEC_MAS_DIS 200000000 /* Kbps */
1885
1886/* reg_qeec_max_shaper_rate
1887 * Max shaper information rate.
1888 * For CPU port, can only be configured for port hierarchy.
1889 * When in bytes mode, value is specified in units of 1000bps.
1890 * Access: RW
1891 */
1892MLXSW_ITEM32(reg, qeec, max_shaper_rate, 0x10, 0, 28);
1893
1894/* reg_qeec_de
1895 * DWRR configuration enable. Enables configuration of the dwrr and
1896 * dwrr_weight.
1897 * 0 - Disable
1898 * 1 - Enable
1899 * Access: RW
1900 */
1901MLXSW_ITEM32(reg, qeec, de, 0x18, 31, 1);
1902
1903/* reg_qeec_dwrr
1904 * Transmission selection algorithm to use on the link going down from
1905 * the ETS element.
1906 * 0 - Strict priority
1907 * 1 - DWRR
1908 * Access: RW
1909 */
1910MLXSW_ITEM32(reg, qeec, dwrr, 0x18, 15, 1);
1911
1912/* reg_qeec_dwrr_weight
1913 * DWRR weight on the link going down from the ETS element. The
1914 * percentage of bandwidth guaranteed to an ETS element within
1915 * its hierarchy. The sum of all weights across all ETS elements
1916 * within one hierarchy should be equal to 100. Reserved when
1917 * transmission selection algorithm is strict priority.
1918 * Access: RW
1919 */
1920MLXSW_ITEM32(reg, qeec, dwrr_weight, 0x18, 0, 8);
1921
1922static inline void mlxsw_reg_qeec_pack(char *payload, u8 local_port,
1923 enum mlxsw_reg_qeec_hr hr, u8 index,
1924 u8 next_index)
1925{
1926 MLXSW_REG_ZERO(qeec, payload);
1927 mlxsw_reg_qeec_local_port_set(payload, local_port);
1928 mlxsw_reg_qeec_element_hierarchy_set(payload, hr);
1929 mlxsw_reg_qeec_element_index_set(payload, index);
1930 mlxsw_reg_qeec_next_element_index_set(payload, next_index);
1931}
1932
1808/* PMLP - Ports Module to Local Port Register 1933/* PMLP - Ports Module to Local Port Register
1809 * ------------------------------------------ 1934 * ------------------------------------------
1810 * Configures the assignment of modules to local ports. 1935 * Configures the assignment of modules to local ports.
@@ -3366,6 +3491,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)
3366 return "SFMR"; 3491 return "SFMR";
3367 case MLXSW_REG_SPVMLR_ID: 3492 case MLXSW_REG_SPVMLR_ID:
3368 return "SPVMLR"; 3493 return "SPVMLR";
3494 case MLXSW_REG_QEEC_ID:
3495 return "QEEC";
3369 case MLXSW_REG_PMLP_ID: 3496 case MLXSW_REG_PMLP_ID:
3370 return "PMLP"; 3497 return "PMLP";
3371 case MLXSW_REG_PMTU_ID: 3498 case MLXSW_REG_PMTU_ID: