Commit 24cc59d1ebaac54d933dc0b30abcd8bd86193eef
Committed by
David S. Miller
1 parent
843925f33f
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
openvswitch: Consistently include VLAN header in flow and port stats.
Until now, when VLAN acceleration was in use, the bytes of the VLAN header were not included in port or flow byte counters. They were however included when VLAN acceleration was not used. This commit corrects the inconsistency, by always including the VLAN header in byte counters. Previous discussion at http://openvswitch.org/pipermail/dev/2014-December/049521.html Reported-by: Motonori Shindo <mshindo@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Reviewed-by: Flavio Leitner <fbl@sysclose.org> Acked-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 2 changed files with 4 additions and 3 deletions Side-by-side Diff
net/openvswitch/flow.c
... | ... | @@ -70,6 +70,7 @@ |
70 | 70 | { |
71 | 71 | struct flow_stats *stats; |
72 | 72 | int node = numa_node_id(); |
73 | + int len = skb->len + (vlan_tx_tag_present(skb) ? VLAN_HLEN : 0); | |
73 | 74 | |
74 | 75 | stats = rcu_dereference(flow->stats[node]); |
75 | 76 | |
... | ... | @@ -105,7 +106,7 @@ |
105 | 106 | if (likely(new_stats)) { |
106 | 107 | new_stats->used = jiffies; |
107 | 108 | new_stats->packet_count = 1; |
108 | - new_stats->byte_count = skb->len; | |
109 | + new_stats->byte_count = len; | |
109 | 110 | new_stats->tcp_flags = tcp_flags; |
110 | 111 | spin_lock_init(&new_stats->lock); |
111 | 112 | |
... | ... | @@ -120,7 +121,7 @@ |
120 | 121 | |
121 | 122 | stats->used = jiffies; |
122 | 123 | stats->packet_count++; |
123 | - stats->byte_count += skb->len; | |
124 | + stats->byte_count += len; | |
124 | 125 | stats->tcp_flags |= tcp_flags; |
125 | 126 | unlock: |
126 | 127 | spin_unlock(&stats->lock); |
net/openvswitch/vport.c
... | ... | @@ -480,7 +480,7 @@ |
480 | 480 | stats = this_cpu_ptr(vport->percpu_stats); |
481 | 481 | u64_stats_update_begin(&stats->syncp); |
482 | 482 | stats->rx_packets++; |
483 | - stats->rx_bytes += skb->len; | |
483 | + stats->rx_bytes += skb->len + (vlan_tx_tag_present(skb) ? VLAN_HLEN : 0); | |
484 | 484 | u64_stats_update_end(&stats->syncp); |
485 | 485 | |
486 | 486 | OVS_CB(skb)->input_vport = vport; |