Skip to content

Commit b9b7cee

Browse files
idoschdavem330
authored andcommitted
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>
1 parent d6b7c13 commit b9b7cee

File tree

1 file changed

+127
-0
lines changed
  • drivers/net/ethernet/mellanox/mlxsw

1 file changed

+127
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/reg.h

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,6 +1805,131 @@ static inline void mlxsw_reg_spvmlr_pack(char *payload, u8 local_port,
18051805
}
18061806
}
18071807

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+
1815+
static 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+
*/
1826+
MLXSW_ITEM32(reg, qeec, local_port, 0x00, 16, 8);
1827+
1828+
enum 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+
*/
1842+
MLXSW_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+
*/
1848+
MLXSW_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+
*/
1856+
MLXSW_ITEM32(reg, qeec, next_element_index, 0x08, 0, 8);
1857+
1858+
enum {
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+
*/
1872+
MLXSW_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+
*/
1881+
MLXSW_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+
*/
1892+
MLXSW_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+
*/
1901+
MLXSW_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+
*/
1910+
MLXSW_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+
*/
1920+
MLXSW_ITEM32(reg, qeec, dwrr_weight, 0x18, 0, 8);
1921+
1922+
static 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+
18081933
/* PMLP - Ports Module to Local Port Register
18091934
* ------------------------------------------
18101935
* Configures the assignment of modules to local ports.
@@ -3366,6 +3491,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)
33663491
return "SFMR";
33673492
case MLXSW_REG_SPVMLR_ID:
33683493
return "SPVMLR";
3494+
case MLXSW_REG_QEEC_ID:
3495+
return "QEEC";
33693496
case MLXSW_REG_PMLP_ID:
33703497
return "PMLP";
33713498
case MLXSW_REG_PMTU_ID:

0 commit comments

Comments
 (0)