2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 12:58:00 +00:00

datapath: move tunnel-init function to flow.h

This makes ovs-module more in-sync with upstream ovs-module.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
This commit is contained in:
Pravin B Shelar 2013-07-29 15:47:27 -07:00
parent 3b00e887bb
commit adda018cb8
5 changed files with 19 additions and 19 deletions

View File

@ -58,6 +58,22 @@ struct ovs_key_ipv4_tunnel {
u8 ipv4_ttl;
};
static inline void ovs_flow_tun_key_init(struct ovs_key_ipv4_tunnel *tun_key,
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;
/* clear struct padding. */
memset((unsigned char *) tun_key + OVS_TUNNEL_KEY_SIZE, 0,
sizeof(*tun_key) - OVS_TUNNEL_KEY_SIZE);
}
struct sw_flow_key {
struct ovs_key_ipv4_tunnel tun_key; /* Encapsulating tunnel key. */
struct {

View File

@ -41,20 +41,4 @@ int ovs_tnl_send(struct vport *vport, struct sk_buff *skb,
void ovs_tnl_rcv(struct vport *vport, struct sk_buff *skb,
struct ovs_key_ipv4_tunnel *tun_key);
static inline void tnl_tun_key_init(struct ovs_key_ipv4_tunnel *tun_key,
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;
/* clear struct padding. */
memset((unsigned char*) tun_key + OVS_TUNNEL_KEY_SIZE, 0,
sizeof(*tun_key) - OVS_TUNNEL_KEY_SIZE);
}
#endif /* TUNNEL_H */

View File

@ -112,7 +112,7 @@ static int gre_rcv(struct sk_buff *skb,
return PACKET_REJECT;
key = key_to_tunnel_id(tpi->key, tpi->seq);
tnl_tun_key_init(&tun_key, ip_hdr(skb), key, filter_tnl_flags(tpi->flags));
ovs_flow_tun_key_init(&tun_key, ip_hdr(skb), key, filter_tnl_flags(tpi->flags));
ovs_vport_receive(vport, skb, &tun_key);
return PACKET_RCVD;

View File

@ -218,7 +218,7 @@ static int lisp_rcv(struct sock *sk, struct sk_buff *skb)
/* Save outer tunnel values */
iph = ip_hdr(skb);
tnl_tun_key_init(&tun_key, iph, key, TUNNEL_KEY);
ovs_flow_tun_key_init(&tun_key, iph, key, TUNNEL_KEY);
/* Drop non-IP inner packets */
inner_iph = (struct iphdr *)(lisph + 1);

View File

@ -73,7 +73,7 @@ static int vxlan_rcv(struct vxlan_handler *vh, struct sk_buff *skb, __be32 vx_vn
/* Save outer tunnel values */
iph = ip_hdr(skb);
key = cpu_to_be64(ntohl(vx_vni) >> 8);
tnl_tun_key_init(&tun_key, iph, key, TUNNEL_KEY);
ovs_flow_tun_key_init(&tun_key, iph, key, TUNNEL_KEY);
ovs_vport_receive(vport, skb, &tun_key);
return PACKET_RCVD;