aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/flow.h
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2014-10-03 18:35:31 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-06 00:32:20 -0400
commitf0b128c1e2cc33ad104daf0f51a51e34f7763c5f (patch)
tree41b08ab786ae83f1890cafb6847d1fd67884af5f /net/openvswitch/flow.h
parent67fa034194bf82a3d5ca841759d921297daa63ca (diff)
openvswitch: Wrap struct ovs_key_ipv4_tunnel in a new structure.
Currently, the flow information that is matched for tunnels and the tunnel data passed around with packets is the same. However, as additional information is added this is not necessarily desirable, as in the case of pointers. This adds a new structure for tunnel metadata which currently contains only the existing struct. This change is purely internal to the kernel since the current OVS_KEY_ATTR_IPV4_TUNNEL is simply a compressed version of OVS_KEY_ATTR_TUNNEL that is translated at flow setup. Signed-off-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Andy Zhou <azhou@nicira.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.h30
1 files changed, 17 insertions, 13 deletions
diff --git a/net/openvswitch/flow.h b/net/openvswitch/flow.h
index 0f5db4ec565d..fe5a71b81c1f 100644
--- a/net/openvswitch/flow.h
+++ b/net/openvswitch/flow.h
@@ -49,20 +49,24 @@ struct ovs_key_ipv4_tunnel {
49 u8 ipv4_ttl; 49 u8 ipv4_ttl;
50} __packed __aligned(4); /* Minimize padding. */ 50} __packed __aligned(4); /* Minimize padding. */
51 51
52static inline void ovs_flow_tun_key_init(struct ovs_key_ipv4_tunnel *tun_key, 52struct ovs_tunnel_info {
53 const struct iphdr *iph, __be64 tun_id, 53 struct ovs_key_ipv4_tunnel tunnel;
54 __be16 tun_flags) 54};
55
56static inline void ovs_flow_tun_info_init(struct ovs_tunnel_info *tun_info,
57 const struct iphdr *iph,
58 __be64 tun_id, __be16 tun_flags)
55{ 59{
56 tun_key->tun_id = tun_id; 60 tun_info->tunnel.tun_id = tun_id;
57 tun_key->ipv4_src = iph->saddr; 61 tun_info->tunnel.ipv4_src = iph->saddr;
58 tun_key->ipv4_dst = iph->daddr; 62 tun_info->tunnel.ipv4_dst = iph->daddr;
59 tun_key->ipv4_tos = iph->tos; 63 tun_info->tunnel.ipv4_tos = iph->tos;
60 tun_key->ipv4_ttl = iph->ttl; 64 tun_info->tunnel.ipv4_ttl = iph->ttl;
61 tun_key->tun_flags = tun_flags; 65 tun_info->tunnel.tun_flags = tun_flags;
62 66
63 /* clear struct padding. */ 67 /* clear struct padding. */
64 memset((unsigned char *) tun_key + OVS_TUNNEL_KEY_SIZE, 0, 68 memset((unsigned char *)&tun_info->tunnel + OVS_TUNNEL_KEY_SIZE, 0,
65 sizeof(*tun_key) - OVS_TUNNEL_KEY_SIZE); 69 sizeof(tun_info->tunnel) - OVS_TUNNEL_KEY_SIZE);
66} 70}
67 71
68struct sw_flow_key { 72struct sw_flow_key {
@@ -190,8 +194,8 @@ void ovs_flow_stats_clear(struct sw_flow *);
190u64 ovs_flow_used_time(unsigned long flow_jiffies); 194u64 ovs_flow_used_time(unsigned long flow_jiffies);
191 195
192int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key); 196int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key);
193int ovs_flow_key_extract(struct ovs_key_ipv4_tunnel *tun_key, 197int ovs_flow_key_extract(struct ovs_tunnel_info *tun_info, struct sk_buff *skb,
194 struct sk_buff *skb, struct sw_flow_key *key); 198 struct sw_flow_key *key);
195/* Extract key from packet coming from userspace. */ 199/* Extract key from packet coming from userspace. */
196int ovs_flow_key_extract_userspace(const struct nlattr *attr, 200int ovs_flow_key_extract_userspace(const struct nlattr *attr,
197 struct sk_buff *skb, 201 struct sk_buff *skb,