Merge branch 'i2c/for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
[cascardo/linux.git] / net / ipv4 / ip_gre.c
index 113cc43..576f705 100644 (file)
@@ -246,25 +246,6 @@ static void gre_err(struct sk_buff *skb, u32 info)
        ipgre_err(skb, info, &tpi);
 }
 
-static __be64 key_to_tunnel_id(__be32 key)
-{
-#ifdef __BIG_ENDIAN
-       return (__force __be64)((__force u32)key);
-#else
-       return (__force __be64)((__force u64)key << 32);
-#endif
-}
-
-/* Returns the least-significant 32 bits of a __be64. */
-static __be32 tunnel_id_to_key(__be64 x)
-{
-#ifdef __BIG_ENDIAN
-       return (__force __be32)x;
-#else
-       return (__force __be32)((__force u64)x >> 32);
-#endif
-}
-
 static int __ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
                       struct ip_tunnel_net *itn, int hdr_len, bool raw_proto)
 {
@@ -290,7 +271,7 @@ static int __ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
                        __be64 tun_id;
 
                        flags = tpi->flags & (TUNNEL_CSUM | TUNNEL_KEY);
-                       tun_id = key_to_tunnel_id(tpi->key);
+                       tun_id = key32_to_tunnel_id(tpi->key);
                        tun_dst = ip_tun_rx_dst(skb, flags, tun_id, 0);
                        if (!tun_dst)
                                return PACKET_REJECT;
@@ -446,7 +427,7 @@ static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev,
 
        flags = tun_info->key.tun_flags & (TUNNEL_CSUM | TUNNEL_KEY);
        gre_build_header(skb, tunnel_hlen, flags, proto,
-                        tunnel_id_to_key(tun_info->key.tun_id), 0);
+                        tunnel_id_to_key32(tun_info->key.tun_id), 0);
 
        df = key->tun_flags & TUNNEL_DONT_FRAGMENT ?  htons(IP_DF) : 0;