net: add a per-cpu counter for the number of frames coalesced in GRO

A low cost method of determining GRO statistics is required. This
change introduces a new counter which tracks whenever GRO coalesces
ingress packets. The counter is per-CPU and exposed in
/proc/net/softnet_stat as the last column of data. No user space
impact is expected as a result of this change. However, this change
should be reverted if legacy tools have problems with the new column
in softnet_stat.

Change-Id: I05965c0cb150947935d5977884cc4d583b37131d
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
This commit is contained in:
Harout Hedeshian 2015-07-27 10:32:01 -06:00 committed by David Keitel
parent d04abc1ab2
commit e9a33bcd2f
3 changed files with 6 additions and 2 deletions

View file

@ -2526,6 +2526,8 @@ struct softnet_data {
unsigned int time_squeeze; unsigned int time_squeeze;
unsigned int cpu_collision; unsigned int cpu_collision;
unsigned int received_rps; unsigned int received_rps;
unsigned int gro_coalesced;
#ifdef CONFIG_RPS #ifdef CONFIG_RPS
struct softnet_data *rps_ipi_list; struct softnet_data *rps_ipi_list;
#endif #endif

View file

@ -4093,6 +4093,7 @@ static int napi_gro_complete(struct sk_buff *skb)
} }
out: out:
__this_cpu_add(softnet_data.gro_coalesced, NAPI_GRO_CB(skb)->count > 1);
return netif_receive_skb_internal(skb); return netif_receive_skb_internal(skb);
} }

View file

@ -159,10 +159,11 @@ static int softnet_seq_show(struct seq_file *seq, void *v)
#endif #endif
seq_printf(seq, seq_printf(seq,
"%08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x\n", "%08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x\n",
sd->processed, sd->dropped, sd->time_squeeze, 0, sd->processed, sd->dropped, sd->time_squeeze, 0,
0, 0, 0, 0, /* was fastroute */ 0, 0, 0, 0, /* was fastroute */
sd->cpu_collision, sd->received_rps, flow_limit_count); sd->cpu_collision, sd->received_rps, flow_limit_count,
sd->gro_coalesced);
return 0; return 0;
} }