summaryrefslogtreecommitdiffstats
path: root/net/openvswitch/vport.h
diff options
context:
space:
mode:
authorFan Du <fan.du@intel.com>2015-01-14 06:10:35 +0100
committerDavid S. Miller <davem@davemloft.net>2015-01-14 22:32:06 +0100
commit3f4c1d87af2a0c8a599b95bfebbc6338de343aca (patch)
treeeb8a54a9c56cec232bbebf303c18f749965a1e59 /net/openvswitch/vport.h
parentMerge branch 'vxlan_rco' (diff)
downloadlinux-3f4c1d87af2a0c8a599b95bfebbc6338de343aca.tar.xz
linux-3f4c1d87af2a0c8a599b95bfebbc6338de343aca.zip
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.h18
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,
int ovs_vport_ops_register(struct vport_ops *ops);
void ovs_vport_ops_unregister(struct vport_ops *ops);
+static inline struct rtable *ovs_tunnel_route_lookup(struct net *net,
+ const struct ovs_key_ipv4_tunnel *key,
+ u32 mark,
+ struct flowi4 *fl,
+ u8 protocol)
+{
+ struct rtable *rt;
+
+ memset(fl, 0, sizeof(*fl));
+ fl->daddr = key->ipv4_dst;
+ fl->saddr = key->ipv4_src;
+ fl->flowi4_tos = RT_TOS(key->ipv4_tos);
+ fl->flowi4_mark = mark;
+ fl->flowi4_proto = protocol;
+
+ rt = ip_route_output_key(net, fl);
+ return rt;
+}
#endif /* vport.h */