Blame view

net/openvswitch/flow_table.h 2.82 KB
e64457191   Pravin B Shelar   openvswitch: Rest...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  /*
   * Copyright (c) 2007-2013 Nicira, Inc.
   *
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of version 2 of the GNU General Public
   * License as published by the Free Software Foundation.
   *
   * This program is distributed in the hope that it will be useful, but
   * WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
   * along with this program; if not, write to the Free Software
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
   * 02110-1301, USA
   */
  
  #ifndef FLOW_TABLE_H
  #define FLOW_TABLE_H 1
  
  #include <linux/kernel.h>
  #include <linux/netlink.h>
  #include <linux/openvswitch.h>
  #include <linux/spinlock.h>
  #include <linux/types.h>
  #include <linux/rcupdate.h>
  #include <linux/if_ether.h>
  #include <linux/in6.h>
  #include <linux/jiffies.h>
  #include <linux/time.h>
  #include <linux/flex_array.h>
  
  #include <net/inet_ecn.h>
  #include <net/ip_tunnels.h>
  
  #include "flow.h"
b637e4988   Pravin B Shelar   openvswitch: Move...
38
  struct table_instance {
e64457191   Pravin B Shelar   openvswitch: Rest...
39
  	struct flex_array *buckets;
b637e4988   Pravin B Shelar   openvswitch: Move...
40
  	unsigned int n_buckets;
e64457191   Pravin B Shelar   openvswitch: Rest...
41
  	struct rcu_head rcu;
e64457191   Pravin B Shelar   openvswitch: Rest...
42
43
44
45
  	int node_ver;
  	u32 hash_seed;
  	bool keep_flows;
  };
b637e4988   Pravin B Shelar   openvswitch: Move...
46
47
  struct flow_table {
  	struct table_instance __rcu *ti;
74ed7ab92   Joe Stringer   openvswitch: Add ...
48
  	struct table_instance __rcu *ufid_ti;
b637e4988   Pravin B Shelar   openvswitch: Move...
49
50
51
  	struct list_head mask_list;
  	unsigned long last_rehash;
  	unsigned int count;
74ed7ab92   Joe Stringer   openvswitch: Add ...
52
  	unsigned int ufid_count;
b637e4988   Pravin B Shelar   openvswitch: Move...
53
  };
63e7959c4   Jarno Rajahalme   openvswitch: Per ...
54
  extern struct kmem_cache *flow_stats_cache;
e64457191   Pravin B Shelar   openvswitch: Rest...
55
56
  int ovs_flow_init(void);
  void ovs_flow_exit(void);
23dabf88a   Jarno Rajahalme   openvswitch: Remo...
57
  struct sw_flow *ovs_flow_alloc(void);
e64457191   Pravin B Shelar   openvswitch: Rest...
58
  void ovs_flow_free(struct sw_flow *, bool deferred);
b637e4988   Pravin B Shelar   openvswitch: Move...
59
  int ovs_flow_tbl_init(struct flow_table *);
12eb18f71   Thomas Graf   openvswitch: Cons...
60
  int ovs_flow_tbl_count(const struct flow_table *table);
9b996e544   Pravin B Shelar   openvswitch: Move...
61
  void ovs_flow_tbl_destroy(struct flow_table *table);
b637e4988   Pravin B Shelar   openvswitch: Move...
62
  int ovs_flow_tbl_flush(struct flow_table *flow_table);
e64457191   Pravin B Shelar   openvswitch: Rest...
63

618ed0c80   Pravin B Shelar   openvswitch: Simp...
64
  int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow,
12eb18f71   Thomas Graf   openvswitch: Cons...
65
  			const struct sw_flow_mask *mask);
e64457191   Pravin B Shelar   openvswitch: Rest...
66
  void ovs_flow_tbl_remove(struct flow_table *table, struct sw_flow *flow);
1bd7116f1   Andy Zhou   openvswitch: coll...
67
  int  ovs_flow_tbl_num_masks(const struct flow_table *table);
b637e4988   Pravin B Shelar   openvswitch: Move...
68
  struct sw_flow *ovs_flow_tbl_dump_next(struct table_instance *table,
e64457191   Pravin B Shelar   openvswitch: Rest...
69
  				       u32 *bucket, u32 *idx);
5bb506324   Andy Zhou   openvswitch: Chan...
70
  struct sw_flow *ovs_flow_tbl_lookup_stats(struct flow_table *,
1bd7116f1   Andy Zhou   openvswitch: coll...
71
72
  				    const struct sw_flow_key *,
  				    u32 *n_mask_hit);
5bb506324   Andy Zhou   openvswitch: Chan...
73
74
  struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *,
  				    const struct sw_flow_key *);
4a46b24e1   Alex Wang   openvswitch: Use ...
75
  struct sw_flow *ovs_flow_tbl_lookup_exact(struct flow_table *tbl,
12eb18f71   Thomas Graf   openvswitch: Cons...
76
  					  const struct sw_flow_match *match);
74ed7ab92   Joe Stringer   openvswitch: Add ...
77
78
79
80
  struct sw_flow *ovs_flow_tbl_lookup_ufid(struct flow_table *,
  					 const struct sw_flow_id *);
  
  bool ovs_flow_cmp(const struct sw_flow *, const struct sw_flow_match *);
e64457191   Pravin B Shelar   openvswitch: Rest...
81

e64457191   Pravin B Shelar   openvswitch: Rest...
82
  void ovs_flow_mask_key(struct sw_flow_key *dst, const struct sw_flow_key *src,
ae5f2fb1d   Jesse Gross   openvswitch: Zero...
83
  		       bool full, const struct sw_flow_mask *mask);
e64457191   Pravin B Shelar   openvswitch: Rest...
84
  #endif /* flow_table.h */