net: openvswitch: add flow-mask cache for performance
The idea of this optimization comes from a patch which is committed in 2014, openvswitch community. The author is Pravin B Shelar. In order to get high performance, I implement it again. Later patches will use it. Pravin B Shelar, says: | On every packet OVS needs to lookup flow-table with every | mask until it finds a match. The packet flow-key is first | masked with mask in the list and then the masked key is | looked up in flow-table. Therefore number of masks can | affect packet processing performance. Link: https://github.com/openvswitch/ovs/commit/5604935e4e1cbc16611d2d97f50b717aa31e8ec5 Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com> Tested-by: Greg Rose <gvrose8192@gmail.com> Acked-by: William Tu <u9012063@gmail.com> Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
ae8a76fb8b
commit
04b7d136d0
@@ -22,6 +22,11 @@
|
||||
|
||||
#include "flow.h"
|
||||
|
||||
struct mask_cache_entry {
|
||||
u32 skb_hash;
|
||||
u32 mask_index;
|
||||
};
|
||||
|
||||
struct table_instance {
|
||||
struct hlist_head *buckets;
|
||||
unsigned int n_buckets;
|
||||
@@ -34,6 +39,7 @@ struct table_instance {
|
||||
struct flow_table {
|
||||
struct table_instance __rcu *ti;
|
||||
struct table_instance __rcu *ufid_ti;
|
||||
struct mask_cache_entry __percpu *mask_cache;
|
||||
struct list_head mask_list;
|
||||
unsigned long last_rehash;
|
||||
unsigned int count;
|
||||
@@ -60,8 +66,9 @@ int ovs_flow_tbl_num_masks(const 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_stats(struct flow_table *,
|
||||
const struct sw_flow_key *,
|
||||
u32 *n_mask_hit);
|
||||
const struct sw_flow_key *,
|
||||
u32 skb_hash,
|
||||
u32 *n_mask_hit);
|
||||
struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *,
|
||||
const struct sw_flow_key *);
|
||||
struct sw_flow *ovs_flow_tbl_lookup_exact(struct flow_table *tbl,
|
||||
|
||||
Reference in New Issue
Block a user