Skip to content

Commit aef833c

Browse files
ummakynesdavem330
authored andcommitted
net: openvswitch: rename flow_stats to sw_flow_stats
There is a flow_stats structure defined in include/net/flow_offload.h and a follow up patch adds #include <net/flow_offload.h> to net/sch_generic.h. This breaks compilation since OVS codebase includes net/sock.h which pulls in linux/filter.h which includes net/sch_generic.h. In file included from ./include/net/sch_generic.h:18:0, from ./include/linux/filter.h:25, from ./include/net/sock.h:59, from ./include/linux/tcp.h:19, from net/openvswitch/datapath.c:24 This definition takes precedence on OVS since it is placed in the networking core, so rename flow_stats in OVS to sw_flow_stats since this structure is contained in sw_flow. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9a2f97b commit aef833c

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎net/openvswitch/flow.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ u64 ovs_flow_used_time(unsigned long flow_jiffies)
5959
void ovs_flow_stats_update(struct sw_flow *flow, __be16 tcp_flags,
6060
const struct sk_buff *skb)
6161
{
62-
struct flow_stats *stats;
62+
struct sw_flow_stats *stats;
6363
unsigned int cpu = smp_processor_id();
6464
int len = skb->len + (skb_vlan_tag_present(skb) ? VLAN_HLEN : 0);
6565

@@ -87,7 +87,7 @@ void ovs_flow_stats_update(struct sw_flow *flow, __be16 tcp_flags,
8787
if (likely(flow->stats_last_writer != -1) &&
8888
likely(!rcu_access_pointer(flow->stats[cpu]))) {
8989
/* Try to allocate CPU-specific stats. */
90-
struct flow_stats *new_stats;
90+
struct sw_flow_stats *new_stats;
9191

9292
new_stats =
9393
kmem_cache_alloc_node(flow_stats_cache,
@@ -134,7 +134,7 @@ void ovs_flow_stats_get(const struct sw_flow *flow,
134134

135135
/* We open code this to make sure cpu 0 is always considered */
136136
for (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, &flow->cpu_used_mask)) {
137-
struct flow_stats *stats = rcu_dereference_ovsl(flow->stats[cpu]);
137+
struct sw_flow_stats *stats = rcu_dereference_ovsl(flow->stats[cpu]);
138138

139139
if (stats) {
140140
/* Local CPU may write on non-local stats, so we must
@@ -158,7 +158,7 @@ void ovs_flow_stats_clear(struct sw_flow *flow)
158158

159159
/* We open code this to make sure cpu 0 is always considered */
160160
for (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, &flow->cpu_used_mask)) {
161-
struct flow_stats *stats = ovsl_dereference(flow->stats[cpu]);
161+
struct sw_flow_stats *stats = ovsl_dereference(flow->stats[cpu]);
162162

163163
if (stats) {
164164
spin_lock_bh(&stats->lock);

‎net/openvswitch/flow.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ struct sw_flow_actions {
194194
struct nlattr actions[];
195195
};
196196

197-
struct flow_stats {
197+
struct sw_flow_stats {
198198
u64 packet_count; /* Number of packets matched. */
199199
u64 byte_count; /* Number of bytes matched. */
200200
unsigned long used; /* Last used time (in jiffies). */
@@ -216,7 +216,7 @@ struct sw_flow {
216216
struct cpumask cpu_used_mask;
217217
struct sw_flow_mask *mask;
218218
struct sw_flow_actions __rcu *sf_acts;
219-
struct flow_stats __rcu *stats[]; /* One for each CPU. First one
219+
struct sw_flow_stats __rcu *stats[]; /* One for each CPU. First one
220220
* is allocated at flow creation time,
221221
* the rest are allocated on demand
222222
* while holding the 'stats[0].lock'.

‎net/openvswitch/flow_table.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void ovs_flow_mask_key(struct sw_flow_key *dst, const struct sw_flow_key *src,
6666
struct sw_flow *ovs_flow_alloc(void)
6767
{
6868
struct sw_flow *flow;
69-
struct flow_stats *stats;
69+
struct sw_flow_stats *stats;
7070

7171
flow = kmem_cache_zalloc(flow_cache, GFP_KERNEL);
7272
if (!flow)
@@ -110,7 +110,7 @@ static void flow_free(struct sw_flow *flow)
110110
for (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, &flow->cpu_used_mask))
111111
if (flow->stats[cpu])
112112
kmem_cache_free(flow_stats_cache,
113-
(struct flow_stats __force *)flow->stats[cpu]);
113+
(struct sw_flow_stats __force *)flow->stats[cpu]);
114114
kmem_cache_free(flow_cache, flow);
115115
}
116116

@@ -712,13 +712,13 @@ int ovs_flow_init(void)
712712

713713
flow_cache = kmem_cache_create("sw_flow", sizeof(struct sw_flow)
714714
+ (nr_cpu_ids
715-
* sizeof(struct flow_stats *)),
715+
* sizeof(struct sw_flow_stats *)),
716716
0, 0, NULL);
717717
if (flow_cache == NULL)
718718
return -ENOMEM;
719719

720720
flow_stats_cache
721-
= kmem_cache_create("sw_flow_stats", sizeof(struct flow_stats),
721+
= kmem_cache_create("sw_flow_stats", sizeof(struct sw_flow_stats),
722722
0, SLAB_HWCACHE_ALIGN, NULL);
723723
if (flow_stats_cache == NULL) {
724724
kmem_cache_destroy(flow_cache);

0 commit comments

Comments
 (0)