[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1515478402-6048-9-git-send-email-andy@greyhouse.net>
Date: Tue, 9 Jan 2018 01:13:20 -0500
From: Andy Gospodarek <andy@...yhouse.net>
To: netdev@...r.kernel.org
Cc: mchan@...adcom.com, talgi@...lanox.com, ogerlitz@...lanox.com,
Andy Gospodarek <gospo@...adcom.com>
Subject: [PATCH net-next v3 08/10] net/dim: use struct net_dim_sample as arg to net_dim
From: Andy Gospodarek <gospo@...adcom.com>
Simplify the arguments net_dim() by formatting them into a struct
net_dim_sample before calling the function.
Signed-off-by: Andy Gospodarek <gospo@...adcom.com>
Suggested-by: Tal Gilboa <talgi@...lanox.com>
Acked-by: Tal Gilboa <talgi@...lanox.com>
Acked-by: Saeed Mahameed <saeedm@...lanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 13 ++++++++-----
include/linux/net_dim.h | 10 +++-------
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
index a1c94fd..f292bb3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
@@ -78,11 +78,14 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
for (i = 0; i < c->num_tc; i++)
mlx5e_cq_arm(&c->sq[i].cq);
- if (MLX5E_TEST_BIT(c->rq.state, MLX5E_RQ_STATE_AM))
- net_dim(&c->rq.dim,
- c->rq.cq.event_ctr,
- c->rq.stats.packets,
- c->rq.stats.bytes);
+ if (MLX5E_TEST_BIT(c->rq.state, MLX5E_RQ_STATE_AM)) {
+ struct net_dim_sample dim_sample;
+ net_dim_sample(c->rq.cq.event_ctr,
+ c->rq.stats.packets,
+ c->rq.stats.bytes,
+ &dim_sample);
+ net_dim(&c->rq.dim, dim_sample);
+ }
mlx5e_cq_arm(&c->rq.cq);
mlx5e_cq_arm(&c->icosq.cq);
diff --git a/include/linux/net_dim.h b/include/linux/net_dim.h
index 741510f..1c7e450 100644
--- a/include/linux/net_dim.h
+++ b/include/linux/net_dim.h
@@ -342,21 +342,18 @@ static inline void net_dim_calc_stats(struct net_dim_sample *start,
}
static inline void net_dim(struct net_dim *dim,
- u16 event_ctr,
- u64 packets,
- u64 bytes)
+ struct net_dim_sample end_sample)
{
- struct net_dim_sample end_sample;
struct net_dim_stats curr_stats;
u16 nevents;
switch (dim->state) {
case NET_DIM_MEASURE_IN_PROGRESS:
- nevents = BIT_GAP(BITS_PER_TYPE(u16), event_ctr,
+ nevents = BIT_GAP(BITS_PER_TYPE(u16),
+ end_sample.event_ctr,
dim->start_sample.event_ctr);
if (nevents < NET_DIM_NEVENTS)
break;
- net_dim_sample(event_ctr, packets, bytes, &end_sample);
net_dim_calc_stats(&dim->start_sample, &end_sample,
&curr_stats);
if (net_dim_decision(&curr_stats, dim)) {
@@ -366,7 +363,6 @@ static inline void net_dim(struct net_dim *dim,
}
/* fall through */
case NET_DIM_START_MEASURE:
- net_dim_sample(event_ctr, packets, bytes, &dim->start_sample);
dim->state = NET_DIM_MEASURE_IN_PROGRESS;
break;
case NET_DIM_APPLY_NEW_PROFILE:
--
2.7.4
Powered by blists - more mailing lists