]>
git.proxmox.com Git - ovs.git/blob - datapath/flow_table.h
2 * Copyright (c) 2007-2013 Nicira, Inc.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 #define FLOW_TABLE_H 1
22 #include <linux/kernel.h>
23 #include <linux/netlink.h>
24 #include <linux/openvswitch.h>
25 #include <linux/spinlock.h>
26 #include <linux/types.h>
27 #include <linux/rcupdate.h>
28 #include <linux/if_ether.h>
29 #include <linux/in6.h>
30 #include <linux/jiffies.h>
31 #include <linux/time.h>
32 #include <linux/flex_array.h>
34 #include <net/inet_ecn.h>
35 #include <net/ip_tunnels.h>
39 #define TBL_MIN_BUCKETS 1024
42 struct flex_array
*buckets
;
43 unsigned int count
, n_buckets
;
45 struct list_head
*mask_list
;
51 int ovs_flow_init(void);
52 void ovs_flow_exit(void);
54 struct sw_flow
*ovs_flow_alloc(void);
55 void ovs_flow_free(struct sw_flow
*, bool deferred
);
57 static inline int ovs_flow_tbl_count(struct flow_table
*table
)
62 static inline int ovs_flow_tbl_need_to_expand(struct flow_table
*table
)
64 return (table
->count
> table
->n_buckets
);
67 struct flow_table
*ovs_flow_tbl_alloc(int new_size
);
68 struct flow_table
*ovs_flow_tbl_expand(struct flow_table
*table
);
69 struct flow_table
*ovs_flow_tbl_rehash(struct flow_table
*table
);
70 void ovs_flow_tbl_destroy(struct flow_table
*table
, bool deferred
);
72 void ovs_flow_tbl_insert(struct flow_table
*table
, struct sw_flow
*flow
);
73 void ovs_flow_tbl_remove(struct flow_table
*table
, struct sw_flow
*flow
);
74 struct sw_flow
*ovs_flow_tbl_dump_next(struct flow_table
*table
,
75 u32
*bucket
, u32
*idx
);
76 struct sw_flow
*ovs_flow_tbl_lookup(struct flow_table
*,
77 const struct sw_flow_key
*);
79 bool ovs_flow_cmp_unmasked_key(const struct sw_flow
*flow
,
80 struct sw_flow_match
*match
);
82 struct sw_flow_mask
*ovs_sw_flow_mask_alloc(void);
83 void ovs_sw_flow_mask_add_ref(struct sw_flow_mask
*);
84 void ovs_sw_flow_mask_del_ref(struct sw_flow_mask
*, bool deferred
);
85 void ovs_sw_flow_mask_insert(struct flow_table
*, struct sw_flow_mask
*);
86 struct sw_flow_mask
*ovs_sw_flow_mask_find(const struct flow_table
*,
87 const struct sw_flow_mask
*);
88 void ovs_flow_mask_key(struct sw_flow_key
*dst
, const struct sw_flow_key
*src
,
89 const struct sw_flow_mask
*mask
);
91 #endif /* flow_table.h */