diff options
author | Pravin B Shelar <pshelar@nicira.com> | 2012-08-23 15:40:54 -0400 |
---|---|---|
committer | Jesse Gross <jesse@nicira.com> | 2012-09-03 22:20:49 -0400 |
commit | 15eac2a74277bc7de68a7c2a64a7c91b4b6f5961 (patch) | |
tree | cbe59331108927c14a1930a6303ffbb2b303b9a7 /net/openvswitch/datapath.h | |
parent | 46df7b814548849deee01f50bc75f8f5ae8cd767 (diff) |
openvswitch: Increase maximum number of datapath ports.
Use hash table to store ports of datapath. Allow 64K ports per switch.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'net/openvswitch/datapath.h')
-rw-r--r-- | net/openvswitch/datapath.h | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/net/openvswitch/datapath.h b/net/openvswitch/datapath.h index 771c11e13e34..129ec5480758 100644 --- a/net/openvswitch/datapath.h +++ b/net/openvswitch/datapath.h | |||
@@ -29,7 +29,9 @@ | |||
29 | #include "flow.h" | 29 | #include "flow.h" |
30 | #include "vport.h" | 30 | #include "vport.h" |
31 | 31 | ||
32 | #define DP_MAX_PORTS 1024 | 32 | #define DP_MAX_PORTS USHRT_MAX |
33 | #define DP_VPORT_HASH_BUCKETS 1024 | ||
34 | |||
33 | #define SAMPLE_ACTION_DEPTH 3 | 35 | #define SAMPLE_ACTION_DEPTH 3 |
34 | 36 | ||
35 | /** | 37 | /** |
@@ -57,10 +59,8 @@ struct dp_stats_percpu { | |||
57 | * @list_node: Element in global 'dps' list. | 59 | * @list_node: Element in global 'dps' list. |
58 | * @n_flows: Number of flows currently in flow table. | 60 | * @n_flows: Number of flows currently in flow table. |
59 | * @table: Current flow table. Protected by genl_lock and RCU. | 61 | * @table: Current flow table. Protected by genl_lock and RCU. |
60 | * @ports: Map from port number to &struct vport. %OVSP_LOCAL port | 62 | * @ports: Hash table for ports. %OVSP_LOCAL port always exists. Protected by |
61 | * always exists, other ports may be %NULL. Protected by RTNL and RCU. | 63 | * RTNL and RCU. |
62 | * @port_list: List of all ports in @ports in arbitrary order. RTNL required | ||
63 | * to iterate or modify. | ||
64 | * @stats_percpu: Per-CPU datapath statistics. | 64 | * @stats_percpu: Per-CPU datapath statistics. |
65 | * @net: Reference to net namespace. | 65 | * @net: Reference to net namespace. |
66 | * | 66 | * |
@@ -75,8 +75,7 @@ struct datapath { | |||
75 | struct flow_table __rcu *table; | 75 | struct flow_table __rcu *table; |
76 | 76 | ||
77 | /* Switch ports. */ | 77 | /* Switch ports. */ |
78 | struct vport __rcu *ports[DP_MAX_PORTS]; | 78 | struct hlist_head *ports; |
79 | struct list_head port_list; | ||
80 | 79 | ||
81 | /* Stats. */ | 80 | /* Stats. */ |
82 | struct dp_stats_percpu __percpu *stats_percpu; | 81 | struct dp_stats_percpu __percpu *stats_percpu; |
@@ -87,6 +86,26 @@ struct datapath { | |||
87 | #endif | 86 | #endif |
88 | }; | 87 | }; |
89 | 88 | ||
89 | struct vport *ovs_lookup_vport(const struct datapath *dp, u16 port_no); | ||
90 | |||
91 | static inline struct vport *ovs_vport_rcu(const struct datapath *dp, int port_no) | ||
92 | { | ||
93 | WARN_ON_ONCE(!rcu_read_lock_held()); | ||
94 | return ovs_lookup_vport(dp, port_no); | ||
95 | } | ||
96 | |||
97 | static inline struct vport *ovs_vport_rtnl_rcu(const struct datapath *dp, int port_no) | ||
98 | { | ||
99 | WARN_ON_ONCE(!rcu_read_lock_held() && !rtnl_is_locked()); | ||
100 | return ovs_lookup_vport(dp, port_no); | ||
101 | } | ||
102 | |||
103 | static inline struct vport *ovs_vport_rtnl(const struct datapath *dp, int port_no) | ||
104 | { | ||
105 | ASSERT_RTNL(); | ||
106 | return ovs_lookup_vport(dp, port_no); | ||
107 | } | ||
108 | |||
90 | /** | 109 | /** |
91 | * struct ovs_skb_cb - OVS data in skb CB | 110 | * struct ovs_skb_cb - OVS data in skb CB |
92 | * @flow: The flow associated with this packet. May be %NULL if no flow. | 111 | * @flow: The flow associated with this packet. May be %NULL if no flow. |