diff options
Diffstat (limited to 'net/openvswitch/flow.c')
-rw-r--r-- | net/openvswitch/flow.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index dda451f4429c..2998989e76db 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c | |||
@@ -103,30 +103,24 @@ static void stats_read(struct flow_stats *stats, | |||
103 | void ovs_flow_stats_get(struct sw_flow *flow, struct ovs_flow_stats *ovs_stats, | 103 | void ovs_flow_stats_get(struct sw_flow *flow, struct ovs_flow_stats *ovs_stats, |
104 | unsigned long *used, __be16 *tcp_flags) | 104 | unsigned long *used, __be16 *tcp_flags) |
105 | { | 105 | { |
106 | int cpu, cur_cpu; | 106 | int cpu; |
107 | 107 | ||
108 | *used = 0; | 108 | *used = 0; |
109 | *tcp_flags = 0; | 109 | *tcp_flags = 0; |
110 | memset(ovs_stats, 0, sizeof(*ovs_stats)); | 110 | memset(ovs_stats, 0, sizeof(*ovs_stats)); |
111 | 111 | ||
112 | local_bh_disable(); | ||
112 | if (!flow->stats.is_percpu) { | 113 | if (!flow->stats.is_percpu) { |
113 | stats_read(flow->stats.stat, ovs_stats, used, tcp_flags); | 114 | stats_read(flow->stats.stat, ovs_stats, used, tcp_flags); |
114 | } else { | 115 | } else { |
115 | cur_cpu = get_cpu(); | ||
116 | for_each_possible_cpu(cpu) { | 116 | for_each_possible_cpu(cpu) { |
117 | struct flow_stats *stats; | 117 | struct flow_stats *stats; |
118 | 118 | ||
119 | if (cpu == cur_cpu) | ||
120 | local_bh_disable(); | ||
121 | |||
122 | stats = per_cpu_ptr(flow->stats.cpu_stats, cpu); | 119 | stats = per_cpu_ptr(flow->stats.cpu_stats, cpu); |
123 | stats_read(stats, ovs_stats, used, tcp_flags); | 120 | stats_read(stats, ovs_stats, used, tcp_flags); |
124 | |||
125 | if (cpu == cur_cpu) | ||
126 | local_bh_enable(); | ||
127 | } | 121 | } |
128 | put_cpu(); | ||
129 | } | 122 | } |
123 | local_bh_enable(); | ||
130 | } | 124 | } |
131 | 125 | ||
132 | static void stats_reset(struct flow_stats *stats) | 126 | static void stats_reset(struct flow_stats *stats) |
@@ -141,25 +135,17 @@ static void stats_reset(struct flow_stats *stats) | |||
141 | 135 | ||
142 | void ovs_flow_stats_clear(struct sw_flow *flow) | 136 | void ovs_flow_stats_clear(struct sw_flow *flow) |
143 | { | 137 | { |
144 | int cpu, cur_cpu; | 138 | int cpu; |
145 | 139 | ||
140 | local_bh_disable(); | ||
146 | if (!flow->stats.is_percpu) { | 141 | if (!flow->stats.is_percpu) { |
147 | stats_reset(flow->stats.stat); | 142 | stats_reset(flow->stats.stat); |
148 | } else { | 143 | } else { |
149 | cur_cpu = get_cpu(); | ||
150 | |||
151 | for_each_possible_cpu(cpu) { | 144 | for_each_possible_cpu(cpu) { |
152 | |||
153 | if (cpu == cur_cpu) | ||
154 | local_bh_disable(); | ||
155 | |||
156 | stats_reset(per_cpu_ptr(flow->stats.cpu_stats, cpu)); | 145 | stats_reset(per_cpu_ptr(flow->stats.cpu_stats, cpu)); |
157 | |||
158 | if (cpu == cur_cpu) | ||
159 | local_bh_enable(); | ||
160 | } | 146 | } |
161 | put_cpu(); | ||
162 | } | 147 | } |
148 | local_bh_enable(); | ||
163 | } | 149 | } |
164 | 150 | ||
165 | static int check_header(struct sk_buff *skb, int len) | 151 | static int check_header(struct sk_buff *skb, int len) |