Merge remote-tracking branch 'lsk/v3.10/topic/gator' into linux-linaro-lsk
[firefly-linux-kernel-4.4.55.git] / net / ipv6 / output_core.c
index c2e73e647e440745acd32dcaa1564031f4323e38..3d2c81a66d6a10e150ff0c2b0190d1f08b073a6d 100644 (file)
@@ -9,7 +9,7 @@
 void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt)
 {
        static atomic_t ipv6_fragmentation_id;
-       int old, new;
+       int ident;
 
 #if IS_ENABLED(CONFIG_IPV6)
        if (rt && !(rt->dst.flags & DST_NOPEER)) {
@@ -25,13 +25,8 @@ void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt)
                }
        }
 #endif
-       do {
-               old = atomic_read(&ipv6_fragmentation_id);
-               new = old + 1;
-               if (!new)
-                       new = 1;
-       } while (atomic_cmpxchg(&ipv6_fragmentation_id, old, new) != old);
-       fhdr->identification = htonl(new);
+       ident = atomic_inc_return(&ipv6_fragmentation_id);
+       fhdr->identification = htonl(ident);
 }
 EXPORT_SYMBOL(ipv6_select_ident);