diff options
author | Fan Du <fan.du@intel.com> | 2015-01-14 00:10:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-14 16:32:06 -0500 |
commit | 3f4c1d87af2a0c8a599b95bfebbc6338de343aca (patch) | |
tree | eb8a54a9c56cec232bbebf303c18f749965a1e59 /net/openvswitch/vport.h | |
parent | 2733135329e9bbc306be9f58af1b4be92b359d23 (diff) |
openvswitch: Introduce ovs_tunnel_route_lookup
Introduce ovs_tunnel_route_lookup to consolidate route lookup
shared by vxlan, gre, and geneve ports.
Signed-off-by: Fan Du <fan.du@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/vport.h')
-rw-r--r-- | net/openvswitch/vport.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h index 99c8e71d9e6c..f8ae295fb001 100644 --- a/net/openvswitch/vport.h +++ b/net/openvswitch/vport.h | |||
@@ -236,4 +236,22 @@ static inline void ovs_skb_postpush_rcsum(struct sk_buff *skb, | |||
236 | int ovs_vport_ops_register(struct vport_ops *ops); | 236 | int ovs_vport_ops_register(struct vport_ops *ops); |
237 | void ovs_vport_ops_unregister(struct vport_ops *ops); | 237 | void ovs_vport_ops_unregister(struct vport_ops *ops); |
238 | 238 | ||
239 | static inline struct rtable *ovs_tunnel_route_lookup(struct net *net, | ||
240 | const struct ovs_key_ipv4_tunnel *key, | ||
241 | u32 mark, | ||
242 | struct flowi4 *fl, | ||
243 | u8 protocol) | ||
244 | { | ||
245 | struct rtable *rt; | ||
246 | |||
247 | memset(fl, 0, sizeof(*fl)); | ||
248 | fl->daddr = key->ipv4_dst; | ||
249 | fl->saddr = key->ipv4_src; | ||
250 | fl->flowi4_tos = RT_TOS(key->ipv4_tos); | ||
251 | fl->flowi4_mark = mark; | ||
252 | fl->flowi4_proto = protocol; | ||
253 | |||
254 | rt = ip_route_output_key(net, fl); | ||
255 | return rt; | ||
256 | } | ||
239 | #endif /* vport.h */ | 257 | #endif /* vport.h */ |