Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Kirjanov <dkirjanov@suse.com>2019-03-20 14:34:27 +0100
committerDenis Kirjanov <dkirjanov@suse.com>2019-03-21 09:58:24 +0100
commit69b065ba3ef3f7e78bb3bad4db75b7c5d067e5ca (patch)
treead03c7acbe8ae0afd8c3a681f57094b744814e2b
parent5cdea6c4fa8a9de12d8c23980c3dc6758993cb31 (diff)
mlxsw: __mlxsw_sp_port_headroom_set(): Fix a use of local variable (git-fixes).
-rw-r--r--patches.fixes/0001-mlxsw-__mlxsw_sp_port_headroom_set-Fix-a-use-of-loca.patch55
-rw-r--r--series.conf1
2 files changed, 56 insertions, 0 deletions
diff --git a/patches.fixes/0001-mlxsw-__mlxsw_sp_port_headroom_set-Fix-a-use-of-loca.patch b/patches.fixes/0001-mlxsw-__mlxsw_sp_port_headroom_set-Fix-a-use-of-loca.patch
new file mode 100644
index 0000000000..21c1f1ce62
--- /dev/null
+++ b/patches.fixes/0001-mlxsw-__mlxsw_sp_port_headroom_set-Fix-a-use-of-loca.patch
@@ -0,0 +1,55 @@
+From: Petr Machata <petrm@mellanox.com>
+Subject: mlxsw: __mlxsw_sp_port_headroom_set(): Fix a use of local variable
+Patch-mainline: v5.0-rc8
+Git-commit: 289460404f6947ef1c38e67d680be9a84161250b
+References: git-fixes
+
+The function-local variable "delay" enters the loop interpreted as delay
+in bits. However, inside the loop it gets overwritten by the result of
+mlxsw_sp_pg_buf_delay_get(), and thus leaves the loop as quantity in
+cells. Thus on second and further loop iterations, the headroom for a
+given priority is configured with a wrong size.
+
+Fix by introducing a loop-local variable, delay_cells. Rename thres to
+thres_cells for consistency.
+
+Fixes: f417f04da589 ("mlxsw: spectrum: Refactor port buffer configuration")
+Signed-off-by: Petr Machata <petrm@mellanox.com>
+Acked-by: Jiri Pirko <jiri@mellanox.com>
+Signed-off-by: Ido Schimmel <idosch@mellanox.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Acked-by: Denis Kirjanov <dkirjanov@suse.com>
+---
+ drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+@@ -867,8 +867,9 @@ int __mlxsw_sp_port_headroom_set(struct
+ for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
+ bool configure = false;
+ bool pfc = false;
++ u16 thres_cells;
++ u16 delay_cells;
+ bool lossy;
+- u16 thres;
+
+ for (j = 0; j < IEEE_8021QAZ_MAX_TCS; j++) {
+ if (prio_tc[j] == i) {
+@@ -881,11 +882,11 @@ int __mlxsw_sp_port_headroom_set(struct
+ if (!configure)
+ continue;
+
+- lossy = !(pfc || pause_en);
+- thres = mlxsw_sp_pg_buf_threshold_get(mlxsw_sp, mtu);
+- delay = mlxsw_sp_pg_buf_delay_get(mlxsw_sp, mtu, delay, pfc,
+- pause_en);
+- mlxsw_sp_pg_buf_pack(pbmc_pl, i, thres + delay, thres, lossy);
++ thres_cells = mlxsw_sp_pg_buf_threshold_get(mlxsw_sp, mtu);
++ delay_cells = mlxsw_sp_pg_buf_delay_get(mlxsw_sp, mtu, delay,
++ pfc, pause_en);
++ mlxsw_sp_pg_buf_pack(pbmc_pl, i, thres_cells + delay_cells,
++ thres_cells, lossy);
+ }
+
+ return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pbmc), pbmc_pl);
diff --git a/series.conf b/series.conf
index 265289a2aa..205d7f8a8f 100644
--- a/series.conf
+++ b/series.conf
@@ -20705,6 +20705,7 @@
patches.fixes/mailbox-bcm-flexrm-mailbox-Fix-FlexRM-ring-flush-tim.patch
patches.fixes/mac80211-Free-mpath-object-when-rhashtable-insertion.patch
patches.fixes/mac80211-Restore-vif-beacon-interval-if-start-ap-fai.patch
+ patches.fixes/0001-mlxsw-__mlxsw_sp_port_headroom_set-Fix-a-use-of-loca.patch
patches.fixes/0001-net-stmmac-handle-endianness-in-dwmac4_get_timestamp.patch
patches.fixes/net-crypto-set-sk-to-NULL-when-af_alg_release.patch
patches.fixes/0001-net-stmmac-Fix-a-race-in-EEE-enable-callback.patch