mirror of
https://github.com/openvswitch/ovs
synced 2025-10-19 14:37:21 +00:00
datapath: 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> Acked-by: Thomas Graf <tgraf@suug.ch> Acked-by: Pravin B Shelar <pshelar@nicira.com>
This commit is contained in:
@@ -51,20 +51,24 @@ struct ovs_key_ipv4_tunnel {
|
||||
u8 ipv4_ttl;
|
||||
} __packed __aligned(4); /* Minimize padding. */
|
||||
|
||||
static inline void ovs_flow_tun_key_init(struct ovs_key_ipv4_tunnel *tun_key,
|
||||
struct ovs_tunnel_info {
|
||||
struct ovs_key_ipv4_tunnel tunnel;
|
||||
};
|
||||
|
||||
static inline void ovs_flow_tun_info_init(struct ovs_tunnel_info *tun_info,
|
||||
const struct iphdr *iph, __be64 tun_id,
|
||||
__be16 tun_flags)
|
||||
{
|
||||
tun_key->tun_id = tun_id;
|
||||
tun_key->ipv4_src = iph->saddr;
|
||||
tun_key->ipv4_dst = iph->daddr;
|
||||
tun_key->ipv4_tos = iph->tos;
|
||||
tun_key->ipv4_ttl = iph->ttl;
|
||||
tun_key->tun_flags = tun_flags;
|
||||
tun_info->tunnel.tun_id = tun_id;
|
||||
tun_info->tunnel.ipv4_src = iph->saddr;
|
||||
tun_info->tunnel.ipv4_dst = iph->daddr;
|
||||
tun_info->tunnel.ipv4_tos = iph->tos;
|
||||
tun_info->tunnel.ipv4_ttl = iph->ttl;
|
||||
tun_info->tunnel.tun_flags = tun_flags;
|
||||
|
||||
/* clear struct padding. */
|
||||
memset((unsigned char *) tun_key + OVS_TUNNEL_KEY_SIZE, 0,
|
||||
sizeof(*tun_key) - OVS_TUNNEL_KEY_SIZE);
|
||||
memset((unsigned char *) &tun_info->tunnel + OVS_TUNNEL_KEY_SIZE, 0,
|
||||
sizeof(tun_info->tunnel) - OVS_TUNNEL_KEY_SIZE);
|
||||
}
|
||||
|
||||
struct sw_flow_key {
|
||||
|
Reference in New Issue
Block a user