mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-06 22:44:40 +00:00
net/dim: use struct net_dim_sample as arg to net_dim
Simplify the arguments net_dim() by formatting them into a struct net_dim_sample before calling the function. Signed-off-by: Andy Gospodarek <gospo@broadcom.com> Suggested-by: Tal Gilboa <talgi@mellanox.com> Acked-by: Tal Gilboa <talgi@mellanox.com> Acked-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4c4dbb4a73
commit
8115b750db
2 changed files with 11 additions and 12 deletions
|
@ -78,11 +78,14 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
|
||||||
for (i = 0; i < c->num_tc; i++)
|
for (i = 0; i < c->num_tc; i++)
|
||||||
mlx5e_cq_arm(&c->sq[i].cq);
|
mlx5e_cq_arm(&c->sq[i].cq);
|
||||||
|
|
||||||
if (MLX5E_TEST_BIT(c->rq.state, MLX5E_RQ_STATE_AM))
|
if (MLX5E_TEST_BIT(c->rq.state, MLX5E_RQ_STATE_AM)) {
|
||||||
net_dim(&c->rq.dim,
|
struct net_dim_sample dim_sample;
|
||||||
c->rq.cq.event_ctr,
|
net_dim_sample(c->rq.cq.event_ctr,
|
||||||
c->rq.stats.packets,
|
c->rq.stats.packets,
|
||||||
c->rq.stats.bytes);
|
c->rq.stats.bytes,
|
||||||
|
&dim_sample);
|
||||||
|
net_dim(&c->rq.dim, dim_sample);
|
||||||
|
}
|
||||||
|
|
||||||
mlx5e_cq_arm(&c->rq.cq);
|
mlx5e_cq_arm(&c->rq.cq);
|
||||||
mlx5e_cq_arm(&c->icosq.cq);
|
mlx5e_cq_arm(&c->icosq.cq);
|
||||||
|
|
|
@ -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,
|
static inline void net_dim(struct net_dim *dim,
|
||||||
u16 event_ctr,
|
struct net_dim_sample end_sample)
|
||||||
u64 packets,
|
|
||||||
u64 bytes)
|
|
||||||
{
|
{
|
||||||
struct net_dim_sample end_sample;
|
|
||||||
struct net_dim_stats curr_stats;
|
struct net_dim_stats curr_stats;
|
||||||
u16 nevents;
|
u16 nevents;
|
||||||
|
|
||||||
switch (dim->state) {
|
switch (dim->state) {
|
||||||
case NET_DIM_MEASURE_IN_PROGRESS:
|
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);
|
dim->start_sample.event_ctr);
|
||||||
if (nevents < NET_DIM_NEVENTS)
|
if (nevents < NET_DIM_NEVENTS)
|
||||||
break;
|
break;
|
||||||
net_dim_sample(event_ctr, packets, bytes, &end_sample);
|
|
||||||
net_dim_calc_stats(&dim->start_sample, &end_sample,
|
net_dim_calc_stats(&dim->start_sample, &end_sample,
|
||||||
&curr_stats);
|
&curr_stats);
|
||||||
if (net_dim_decision(&curr_stats, dim)) {
|
if (net_dim_decision(&curr_stats, dim)) {
|
||||||
|
@ -366,7 +363,6 @@ 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(event_ctr, packets, bytes, &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:
|
||||||
|
|
Loading…
Add table
Reference in a new issue