summaryrefslogtreecommitdiffstats
path: root/net/openvswitch/flow_table.h
diff options
context:
space:
mode:
authorPravin B Shelar <pshelar@nicira.com>2013-10-04 00:14:23 -0700
committerJesse Gross <jesse@nicira.com>2013-10-04 00:18:26 -0700
commitb637e4988c2d689bb43f943a5af0e684a4981159 (patch)
tree36fbf2ee83323b2441861de650c6dabe6d5cc663 /net/openvswitch/flow_table.h
parente64457191a259537bbbfaebeba9a8043786af96f (diff)
downloadlinux-b637e4988c2d689bb43f943a5af0e684a4981159.tar.bz2
openvswitch: Move mega-flow list out of rehashing struct.
ovs-flow rehash does not touch mega flow list. Following patch moves it dp struct datapath. Avoid one extra indirection for accessing mega-flow list head on every packet receive. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'net/openvswitch/flow_table.h')
-rw-r--r--net/openvswitch/flow_table.h32
1 files changed, 13 insertions, 19 deletions
diff --git a/net/openvswitch/flow_table.h b/net/openvswitch/flow_table.h
index d7a114457cde..5d1abe566c46 100644
--- a/net/openvswitch/flow_table.h
+++ b/net/openvswitch/flow_table.h
@@ -36,42 +36,36 @@
#include "flow.h"
-#define TBL_MIN_BUCKETS 1024
-
-struct flow_table {
+struct table_instance {
struct flex_array *buckets;
- unsigned int count, n_buckets;
+ unsigned int n_buckets;
struct rcu_head rcu;
- struct list_head *mask_list;
int node_ver;
u32 hash_seed;
bool keep_flows;
};
+struct flow_table {
+ struct table_instance __rcu *ti;
+ struct list_head mask_list;
+ unsigned long last_rehash;
+ unsigned int count;
+};
+
int ovs_flow_init(void);
void ovs_flow_exit(void);
struct sw_flow *ovs_flow_alloc(void);
void ovs_flow_free(struct sw_flow *, bool deferred);
-static inline int ovs_flow_tbl_count(struct flow_table *table)
-{
- return table->count;
-}
-
-static inline int ovs_flow_tbl_need_to_expand(struct flow_table *table)
-{
- return (table->count > table->n_buckets);
-}
-
-struct flow_table *ovs_flow_tbl_alloc(int new_size);
-struct flow_table *ovs_flow_tbl_expand(struct flow_table *table);
-struct flow_table *ovs_flow_tbl_rehash(struct flow_table *table);
+int ovs_flow_tbl_init(struct flow_table *);
+int ovs_flow_tbl_count(struct flow_table *table);
void ovs_flow_tbl_destroy(struct flow_table *table, bool deferred);
+int ovs_flow_tbl_flush(struct flow_table *flow_table);
void ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow);
void ovs_flow_tbl_remove(struct flow_table *table, struct sw_flow *flow);
-struct sw_flow *ovs_flow_tbl_dump_next(struct flow_table *table,
+struct sw_flow *ovs_flow_tbl_dump_next(struct table_instance *table,
u32 *bucket, u32 *idx);
struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *,
const struct sw_flow_key *);