Commit 4b61d3e8 authored by Po Liu's avatar Po Liu Committed by David S. Miller
Browse files

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: default avatarPo Liu <Po.Liu@nxp.com>
Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
Reviewed-by: default avatarVlad Buslov <vladbu@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7cc373db
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -771,7 +771,7 @@ int sja1105_vl_stats(struct sja1105_private *priv, int port,

	pkts = timingerr + unreleased + lengtherr;

	flow_stats_update(stats, 0, pkts - rule->vl.stats.pkts,
	flow_stats_update(stats, 0, pkts - rule->vl.stats.pkts, 0,
			  jiffies - rule->vl.stats.lastused,
			  FLOW_ACTION_HW_STATS_IMMEDIATE);

+1 −1
Original line number Diff line number Diff line
@@ -1638,7 +1638,7 @@ static int bnxt_tc_get_flow_stats(struct bnxt *bp,
	lastused = flow->lastused;
	spin_unlock(&flow->stats_lock);

	flow_stats_update(&tc_flow_cmd->stats, stats.bytes, stats.packets,
	flow_stats_update(&tc_flow_cmd->stats, stats.bytes, stats.packets, 0,
			  lastused, FLOW_ACTION_HW_STATS_DELAYED);
	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -902,7 +902,7 @@ int cxgb4_tc_flower_stats(struct net_device *dev,
		if (ofld_stats->prev_packet_count != packets)
			ofld_stats->last_used = jiffies;
		flow_stats_update(&cls->stats, bytes - ofld_stats->byte_count,
				  packets - ofld_stats->packet_count,
				  packets - ofld_stats->packet_count, 0,
				  ofld_stats->last_used,
				  FLOW_ACTION_HW_STATS_IMMEDIATE);

+1 −1
Original line number Diff line number Diff line
@@ -346,7 +346,7 @@ int cxgb4_tc_matchall_stats(struct net_device *dev,
		flow_stats_update(&cls_matchall->stats,
				  bytes - tc_port_matchall->ingress.bytes,
				  packets - tc_port_matchall->ingress.packets,
				  tc_port_matchall->ingress.last_used,
				  0, tc_port_matchall->ingress.last_used,
				  FLOW_ACTION_HW_STATS_IMMEDIATE);

		tc_port_matchall->ingress.packets = packets;
+5 −2
Original line number Diff line number Diff line
@@ -1291,12 +1291,15 @@ static int enetc_psfp_get_stats(struct enetc_ndev_priv *priv,

	spin_lock(&epsfp.psfp_lock);
	stats.pkts = counters.matching_frames_count - filter->stats.pkts;
	stats.drops = counters.not_passing_frames_count -
					filter->stats.drops;
	stats.lastused = filter->stats.lastused;
	filter->stats.pkts += stats.pkts;
	filter->stats.drops += stats.drops;
	spin_unlock(&epsfp.psfp_lock);

	flow_stats_update(&f->stats, 0x0, stats.pkts, stats.lastused,
			  FLOW_ACTION_HW_STATS_DELAYED);
	flow_stats_update(&f->stats, 0x0, stats.pkts, stats.drops,
			  stats.lastused, FLOW_ACTION_HW_STATS_DELAYED);

	return 0;
}
Loading