datapath: move tunnel-init function to flow.h
authorPravin B Shelar <pshelar@nicira.com>
Mon, 29 Jul 2013 22:47:27 +0000 (15:47 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Tue, 13 Aug 2013 07:13:54 +0000 (00:13 -0700)
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>
datapath/flow.h
datapath/tunnel.h
datapath/vport-gre.c
datapath/vport-lisp.c
datapath/vport-vxlan.c

index 5d15783..d8277b5 100644 (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 {
index 17de7c4..aa52145 100644 (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 */
index 38245a7..9bba42a 100644 (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;
index 54c10ae..6027a16 100644 (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);
index 5546820..8fdec16 100644 (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;