diff options
Diffstat (limited to 'net/openvswitch/flow.h')
| -rw-r--r-- | net/openvswitch/flow.h | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/net/openvswitch/flow.h b/net/openvswitch/flow.h index 0f5db4ec565d..71813318c8c7 100644 --- a/net/openvswitch/flow.h +++ b/net/openvswitch/flow.h | |||
| @@ -49,23 +49,45 @@ 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 | ||
| 52 | static inline void ovs_flow_tun_key_init(struct ovs_key_ipv4_tunnel *tun_key, | 52 | struct ovs_tunnel_info { |
| 53 | const struct iphdr *iph, __be64 tun_id, | 53 | struct ovs_key_ipv4_tunnel tunnel; |
| 54 | __be16 tun_flags) | 54 | struct geneve_opt *options; |
| 55 | u8 options_len; | ||
| 56 | }; | ||
| 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 | |||
| 67 | static inline void ovs_flow_tun_info_init(struct ovs_tunnel_info *tun_info, | ||
| 68 | const struct iphdr *iph, | ||
| 69 | __be64 tun_id, __be16 tun_flags, | ||
| 70 | struct geneve_opt *opts, | ||
| 71 | u8 opts_len) | ||
| 55 | { | 72 | { |
| 56 | tun_key->tun_id = tun_id; | 73 | tun_info->tunnel.tun_id = tun_id; |
| 57 | tun_key->ipv4_src = iph->saddr; | 74 | tun_info->tunnel.ipv4_src = iph->saddr; |
| 58 | tun_key->ipv4_dst = iph->daddr; | 75 | tun_info->tunnel.ipv4_dst = iph->daddr; |
| 59 | tun_key->ipv4_tos = iph->tos; | 76 | tun_info->tunnel.ipv4_tos = iph->tos; |
| 60 | tun_key->ipv4_ttl = iph->ttl; | 77 | tun_info->tunnel.ipv4_ttl = iph->ttl; |
| 61 | tun_key->tun_flags = tun_flags; | 78 | tun_info->tunnel.tun_flags = tun_flags; |
| 62 | 79 | ||
| 63 | /* clear struct padding. */ | 80 | /* clear struct padding. */ |
| 64 | memset((unsigned char *) tun_key + OVS_TUNNEL_KEY_SIZE, 0, | 81 | memset((unsigned char *)&tun_info->tunnel + OVS_TUNNEL_KEY_SIZE, 0, |
| 65 | sizeof(*tun_key) - 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; | ||
| 66 | } | 86 | } |
| 67 | 87 | ||
| 68 | struct sw_flow_key { | 88 | struct sw_flow_key { |
| 89 | u8 tun_opts[255]; | ||
| 90 | u8 tun_opts_len; | ||
| 69 | struct ovs_key_ipv4_tunnel tun_key; /* Encapsulating tunnel key. */ | 91 | struct ovs_key_ipv4_tunnel tun_key; /* Encapsulating tunnel key. */ |
| 70 | struct { | 92 | struct { |
| 71 | u32 priority; /* Packet QoS priority. */ | 93 | u32 priority; /* Packet QoS priority. */ |
| @@ -190,8 +212,8 @@ void ovs_flow_stats_clear(struct sw_flow *); | |||
| 190 | u64 ovs_flow_used_time(unsigned long flow_jiffies); | 212 | u64 ovs_flow_used_time(unsigned long flow_jiffies); |
| 191 | 213 | ||
| 192 | int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key); | 214 | int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key); |
| 193 | int ovs_flow_key_extract(struct ovs_key_ipv4_tunnel *tun_key, | 215 | int ovs_flow_key_extract(struct ovs_tunnel_info *tun_info, struct sk_buff *skb, |
| 194 | struct sk_buff *skb, struct sw_flow_key *key); | 216 | struct sw_flow_key *key); |
| 195 | /* Extract key from packet coming from userspace. */ | 217 | /* Extract key from packet coming from userspace. */ |
| 196 | int ovs_flow_key_extract_userspace(const struct nlattr *attr, | 218 | int ovs_flow_key_extract_userspace(const struct nlattr *attr, |
| 197 | struct sk_buff *skb, | 219 | struct sk_buff *skb, |
