Skip to content

Commit 4b61d3e

Browse files
liupoerdavem330
authored andcommitted
net: qos offload add flow status with dropped count
This patch adds a drop frames counter to tc flower offloading. Reporting h/w dropped frames is necessary for some actions. Some actions like police action and the coming introduced stream gate action would produce dropped frames which is necessary for user. Status update shows how many filtered packets increasing and how many dropped in those packets. v2: Changes - Update commit comments suggest by Jiri Pirko. Signed-off-by: Po Liu <Po.Liu@nxp.com> Reviewed-by: Simon Horman <simon.horman@netronome.com> Reviewed-by: Vlad Buslov <vladbu@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7cc373d commit 4b61d3e

25 files changed

Lines changed: 60 additions & 50 deletions

File tree

‎drivers/net/dsa/sja1105/sja1105_vl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ int sja1105_vl_stats(struct sja1105_private *priv, int port,
771771

772772
pkts = timingerr + unreleased + lengtherr;
773773

774-
flow_stats_update(stats, 0, pkts - rule->vl.stats.pkts,
774+
flow_stats_update(stats, 0, pkts - rule->vl.stats.pkts, 0,
775775
jiffies - rule->vl.stats.lastused,
776776
FLOW_ACTION_HW_STATS_IMMEDIATE);
777777

‎drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ static int bnxt_tc_get_flow_stats(struct bnxt *bp,
16381638
lastused = flow->lastused;
16391639
spin_unlock(&flow->stats_lock);
16401640

1641-
flow_stats_update(&tc_flow_cmd->stats, stats.bytes, stats.packets,
1641+
flow_stats_update(&tc_flow_cmd->stats, stats.bytes, stats.packets, 0,
16421642
lastused, FLOW_ACTION_HW_STATS_DELAYED);
16431643
return 0;
16441644
}

‎drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ int cxgb4_tc_flower_stats(struct net_device *dev,
902902
if (ofld_stats->prev_packet_count != packets)
903903
ofld_stats->last_used = jiffies;
904904
flow_stats_update(&cls->stats, bytes - ofld_stats->byte_count,
905-
packets - ofld_stats->packet_count,
905+
packets - ofld_stats->packet_count, 0,
906906
ofld_stats->last_used,
907907
FLOW_ACTION_HW_STATS_IMMEDIATE);
908908

‎drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_matchall.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ int cxgb4_tc_matchall_stats(struct net_device *dev,
346346
flow_stats_update(&cls_matchall->stats,
347347
bytes - tc_port_matchall->ingress.bytes,
348348
packets - tc_port_matchall->ingress.packets,
349-
tc_port_matchall->ingress.last_used,
349+
0, tc_port_matchall->ingress.last_used,
350350
FLOW_ACTION_HW_STATS_IMMEDIATE);
351351

352352
tc_port_matchall->ingress.packets = packets;

‎drivers/net/ethernet/freescale/enetc/enetc_qos.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,12 +1291,15 @@ static int enetc_psfp_get_stats(struct enetc_ndev_priv *priv,
12911291

12921292
spin_lock(&epsfp.psfp_lock);
12931293
stats.pkts = counters.matching_frames_count - filter->stats.pkts;
1294+
stats.drops = counters.not_passing_frames_count -
1295+
filter->stats.drops;
12941296
stats.lastused = filter->stats.lastused;
12951297
filter->stats.pkts += stats.pkts;
1298+
filter->stats.drops += stats.drops;
12961299
spin_unlock(&epsfp.psfp_lock);
12971300

1298-
flow_stats_update(&f->stats, 0x0, stats.pkts, stats.lastused,
1299-
FLOW_ACTION_HW_STATS_DELAYED);
1301+
flow_stats_update(&f->stats, 0x0, stats.pkts, stats.drops,
1302+
stats.lastused, FLOW_ACTION_HW_STATS_DELAYED);
13001303

13011304
return 0;
13021305
}

‎drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ mlx5_tc_ct_block_flow_offload_stats(struct mlx5_ct_ft *ft,
672672
return -ENOENT;
673673

674674
mlx5_fc_query_cached(entry->counter, &bytes, &packets, &lastuse);
675-
flow_stats_update(&f->stats, bytes, packets, lastuse,
675+
flow_stats_update(&f->stats, bytes, packets, 0, lastuse,
676676
FLOW_ACTION_HW_STATS_DELAYED);
677677

678678
return 0;

‎drivers/net/ethernet/mellanox/mlx5/core/en_tc.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4828,7 +4828,7 @@ int mlx5e_stats_flower(struct net_device *dev, struct mlx5e_priv *priv,
48284828
no_peer_counter:
48294829
mlx5_devcom_release_peer_data(devcom, MLX5_DEVCOM_ESW_OFFLOADS);
48304830
out:
4831-
flow_stats_update(&f->stats, bytes, packets, lastuse,
4831+
flow_stats_update(&f->stats, bytes, packets, 0, lastuse,
48324832
FLOW_ACTION_HW_STATS_DELAYED);
48334833
trace_mlx5e_stats_flower(f);
48344834
errout:
@@ -4946,7 +4946,7 @@ void mlx5e_tc_stats_matchall(struct mlx5e_priv *priv,
49464946
dpkts = cur_stats.rx_packets - rpriv->prev_vf_vport_stats.rx_packets;
49474947
dbytes = cur_stats.rx_bytes - rpriv->prev_vf_vport_stats.rx_bytes;
49484948
rpriv->prev_vf_vport_stats = cur_stats;
4949-
flow_stats_update(&ma->stats, dbytes, dpkts, jiffies,
4949+
flow_stats_update(&ma->stats, dbytes, dpkts, 0, jiffies,
49504950
FLOW_ACTION_HW_STATS_DELAYED);
49514951
}
49524952

‎drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ int mlxsw_sp_flower_stats(struct mlxsw_sp *mlxsw_sp,
633633
if (err)
634634
goto err_rule_get_stats;
635635

636-
flow_stats_update(&f->stats, bytes, packets, lastuse, used_hw_stats);
636+
flow_stats_update(&f->stats, bytes, packets, 0, lastuse, used_hw_stats);
637637

638638
mlxsw_sp_acl_ruleset_put(mlxsw_sp, ruleset);
639639
return 0;

‎drivers/net/ethernet/mscc/ocelot_flower.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ int ocelot_cls_flower_stats(struct ocelot *ocelot, int port,
244244
if (ret)
245245
return ret;
246246

247-
flow_stats_update(&f->stats, 0x0, ace.stats.pkts, 0x0,
247+
flow_stats_update(&f->stats, 0x0, ace.stats.pkts, 0, 0x0,
248248
FLOW_ACTION_HW_STATS_IMMEDIATE);
249249
return 0;
250250
}

‎drivers/net/ethernet/netronome/nfp/flower/offload.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ nfp_flower_get_stats(struct nfp_app *app, struct net_device *netdev,
14911491
nfp_flower_update_merge_stats(app, nfp_flow);
14921492

14931493
flow_stats_update(&flow->stats, priv->stats[ctx_id].bytes,
1494-
priv->stats[ctx_id].pkts, priv->stats[ctx_id].used,
1494+
priv->stats[ctx_id].pkts, 0, priv->stats[ctx_id].used,
14951495
FLOW_ACTION_HW_STATS_DELAYED);
14961496

14971497
priv->stats[ctx_id].pkts = 0;

0 commit comments

Comments
 (0)