summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c
diff options
context:
space:
mode:
authorPetr Machata <petrm@nvidia.com>2020-09-16 09:35:18 +0300
committerDavid S. Miller <davem@davemloft.net>2020-09-17 01:19:29 +0300
commitca21e84e7e14d2357386d7828402dcc6c5ccf77c (patch)
tree97db091aa9c48c4b4cc4cbc56f847e2762d6f9bd /drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c
parent5df825ede4d3007b3401d4b06111a124fac29d21 (diff)
downloadlinux-ca21e84e7e14d2357386d7828402dcc6c5ccf77c.tar.xz
mlxsw: spectrum: Track lossiness in struct mlxsw_sp_hdroom
Client-side configuration has lossiness as an attribute of a priority. Therefore add a "lossy" attribute to struct mlxsw_sp_hdroom_prio. To a Spectrum ASIC, lossiness is a feature of a port buffer. Therefore add struct mlxsw_sp_hdroom_buf, which in the following patches will get more attributes, but right now only use it to track port buffer lossiness. Instead of passing around the primary indicators of PFC and pause_en, add a function mlxsw_sp_hdroom_bufs_reset_lossiness() to compute the buffer lossiness from the priority map and priority lossiness. Change mlxsw_sp_port_headroom_set() to take the buffer lossy flag from the headroom configuration. Have the PFC and pause handlers configure priority lossiness in mlxsw_sp_hdroom, from where it will propagate. Signed-off-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c
index 36c02c66bb14..b527391860bf 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c
@@ -204,6 +204,7 @@ static int mlxsw_sp_port_set_pauseparam(struct net_device *dev,
bool pause_en = pause->tx_pause || pause->rx_pause;
struct mlxsw_sp_hdroom orig_hdroom;
struct mlxsw_sp_hdroom hdroom;
+ int prio;
int err;
if (mlxsw_sp_port->dcb.pfc && mlxsw_sp_port->dcb.pfc->pfc_en) {
@@ -224,7 +225,12 @@ static int mlxsw_sp_port_set_pauseparam(struct net_device *dev,
else
hdroom.delay_bytes = 0;
- err = mlxsw_sp_port_headroom_set(mlxsw_sp_port, &hdroom, pause_en);
+ for (prio = 0; prio < IEEE_8021QAZ_MAX_TCS; prio++)
+ hdroom.prios.prio[prio].lossy = !pause_en;
+
+ mlxsw_sp_hdroom_bufs_reset_lossiness(&hdroom);
+
+ err = mlxsw_sp_port_headroom_set(mlxsw_sp_port, &hdroom);
if (err) {
netdev_err(dev, "Failed to configure port's headroom\n");
return err;
@@ -242,8 +248,7 @@ static int mlxsw_sp_port_set_pauseparam(struct net_device *dev,
return 0;
err_port_pause_configure:
- pause_en = mlxsw_sp_port_is_pause_en(mlxsw_sp_port);
- mlxsw_sp_port_headroom_set(mlxsw_sp_port, &orig_hdroom, pause_en);
+ mlxsw_sp_port_headroom_set(mlxsw_sp_port, &orig_hdroom);
return err;
}