Commit b8e07695 authored by Tal Gilboa's avatar Tal Gilboa Committed by Greg Kroah-Hartman

net/dim: Update DIM start sample after each DIM iteration

[ Upstream commit 0211dda6 ]

On every iteration of net_dim, the algorithm may choose to
check for the system state by comparing current data sample
with previous data sample. After each of these comparison,
regardless of the action taken, the sample used as baseline
is needed to be updated.

This patch fixes a bug that causes DIM to take wrong decisions,
due to never updating the baseline sample for comparison between
iterations. This way, DIM always compares current sample with
zeros.

Although this is a functional fix, it also improves and stabilizes
performance as the algorithm works properly now.

Performance:
Tested single UDP TX stream with pktgen:
samples/pktgen/pktgen_sample03_burst_single_flow.sh -i p4p2 -d 1.1.1.1
-m 24:8a:07:88:26:8b -f 3 -b 128

ConnectX-5 100GbE packet rate improved from 15-19Mpps to 19-20Mpps.
Also, toggling between profiles is less frequent with the fix.

Fixes: 8115b750 ("net/dim: use struct net_dim_sample as arg to net_dim")
Signed-off-by: default avatarTal Gilboa <talgi@mellanox.com>
Reviewed-by: default avatarTariq Toukan <tariqt@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b06510bf
...@@ -406,6 +406,8 @@ static inline void net_dim(struct net_dim *dim, ...@@ -406,6 +406,8 @@ static inline void net_dim(struct net_dim *dim,
} }
/* fall through */ /* fall through */
case NET_DIM_START_MEASURE: case NET_DIM_START_MEASURE:
net_dim_sample(end_sample.event_ctr, end_sample.pkt_ctr, end_sample.byte_ctr,
&dim->start_sample);
dim->state = NET_DIM_MEASURE_IN_PROGRESS; dim->state = NET_DIM_MEASURE_IN_PROGRESS;
break; break;
case NET_DIM_APPLY_NEW_PROFILE: case NET_DIM_APPLY_NEW_PROFILE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment