aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/flow.h
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2014-10-03 18:35:33 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-06 00:32:21 -0400
commitf5796684069e0c71c65bce6a6d4766114aec1396 (patch)
treea4906c8cba2b6c2d116e7b72a71f9e1020b476cb /net/openvswitch/flow.h
parent6b205b2ca17e88ef5e10451b720056b790cc63a5 (diff)
openvswitch: Add support for Geneve tunneling.
The Openvswitch implementation is completely agnostic to the options that are in use and can handle newly defined options without further work. It does this by simply matching on a byte array of options and allowing userspace to setup flows on this array. Signed-off-by: Jesse Gross <jesse@nicira.com> Singed-off-by: Ansis Atteka <aatteka@nicira.com> Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/flow.h')
-rw-r--r--net/openvswitch/flow.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/net/openvswitch/flow.h b/net/openvswitch/flow.h
index fe5a71b81c1f..71813318c8c7 100644
--- a/net/openvswitch/flow.h
+++ b/net/openvswitch/flow.h
@@ -51,11 +51,24 @@ struct ovs_key_ipv4_tunnel {
51 51
52struct ovs_tunnel_info { 52struct ovs_tunnel_info {
53 struct ovs_key_ipv4_tunnel tunnel; 53 struct ovs_key_ipv4_tunnel tunnel;
54 struct geneve_opt *options;
55 u8 options_len;
54}; 56};
55 57
58/* Store options at the end of the array if they are less than the
59 * maximum size. This allows us to get the benefits of variable length
60 * matching for small options.
61 */
62#define GENEVE_OPTS(flow_key, opt_len) \
63 ((struct geneve_opt *)((flow_key)->tun_opts + \
64 FIELD_SIZEOF(struct sw_flow_key, tun_opts) - \
65 opt_len))
66
56static inline void ovs_flow_tun_info_init(struct ovs_tunnel_info *tun_info, 67static inline void ovs_flow_tun_info_init(struct ovs_tunnel_info *tun_info,
57 const struct iphdr *iph, 68 const struct iphdr *iph,
58 __be64 tun_id, __be16 tun_flags) 69 __be64 tun_id, __be16 tun_flags,
70 struct geneve_opt *opts,
71 u8 opts_len)
59{ 72{
60 tun_info->tunnel.tun_id = tun_id; 73 tun_info->tunnel.tun_id = tun_id;
61 tun_info->tunnel.ipv4_src = iph->saddr; 74 tun_info->tunnel.ipv4_src = iph->saddr;
@@ -67,9 +80,14 @@ static inline void ovs_flow_tun_info_init(struct ovs_tunnel_info *tun_info,
67 /* clear struct padding. */ 80 /* clear struct padding. */
68 memset((unsigned char *)&tun_info->tunnel + OVS_TUNNEL_KEY_SIZE, 0, 81 memset((unsigned char *)&tun_info->tunnel + OVS_TUNNEL_KEY_SIZE, 0,
69 sizeof(tun_info->tunnel) - OVS_TUNNEL_KEY_SIZE); 82 sizeof(tun_info->tunnel) - OVS_TUNNEL_KEY_SIZE);
83
84 tun_info->options = opts;
85 tun_info->options_len = opts_len;
70} 86}
71 87
72struct sw_flow_key { 88struct sw_flow_key {
89 u8 tun_opts[255];
90 u8 tun_opts_len;
73 struct ovs_key_ipv4_tunnel tun_key; /* Encapsulating tunnel key. */ 91 struct ovs_key_ipv4_tunnel tun_key; /* Encapsulating tunnel key. */
74 struct { 92 struct {
75 u32 priority; /* Packet QoS priority. */ 93 u32 priority; /* Packet QoS priority. */