diff options
author | Fan Du <fan.du@intel.com> | 2015-01-14 13:10:35 +0800 |
---|---|---|
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) | |
download | op-kernel-dev-3f4c1d87af2a0c8a599b95bfebbc6338de343aca.zip op-kernel-dev-3f4c1d87af2a0c8a599b95bfebbc6338de343aca.tar.gz |
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 99c8e71..f8ae295 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 */ |