clang: Add annotations for thread safety check.
[sliver-openvswitch.git] / lib / netdev-dummy.c
index 3e2187e..c4f58b7 100644 (file)
@@ -129,7 +129,7 @@ netdev_dummy_run(void)
                 list_init(&s->txq);
             } else if (error != EAGAIN) {
                 VLOG_WARN("%s: accept failed (%s)",
-                          pstream_get_name(dev->pstream), strerror(error));
+                          pstream_get_name(dev->pstream), ovs_strerror(error));
                 pstream_close(dev->pstream);
                 dev->pstream = NULL;
             }
@@ -241,9 +241,11 @@ static int
 netdev_dummy_create(const struct netdev_class *class, const char *name,
                     struct netdev **netdevp)
 {
-    static unsigned int n = 0xaa550000;
+    static atomic_uint next_n = ATOMIC_VAR_INIT(0xaa550000);
     struct netdev_dummy *netdev;
+    unsigned int n;
 
+    atomic_add(&next_n, 1, &n);
     netdev = xzalloc(sizeof *netdev);
     netdev_init(&netdev->up, name, class);
     netdev->hwaddr[0] = 0xaa;
@@ -265,8 +267,6 @@ netdev_dummy_create(const struct netdev_class *class, const char *name,
 
     shash_add(&dummy_netdevs, name, netdev);
 
-    n++;
-
     *netdevp = &netdev->up;
 
     return 0;
@@ -322,7 +322,8 @@ netdev_dummy_set_config(struct netdev *netdev_, const struct smap *args)
 
             error = pstream_open(pstream, &netdev->pstream, DSCP_DEFAULT);
             if (error) {
-                VLOG_WARN("%s: open failed (%s)", pstream, strerror(error));
+                VLOG_WARN("%s: open failed (%s)",
+                          pstream, ovs_strerror(error));
             }
         }
     }
@@ -623,7 +624,7 @@ eth_from_packet_or_flow(const char *s)
      * settle for parsing a datapath key for now.
      */
     ofpbuf_init(&odp_key, 0);
-    error = odp_flow_key_from_string(s, NULL, &odp_key);
+    error = odp_flow_from_string(s, NULL, &odp_key, NULL);
     if (error) {
         ofpbuf_uninit(&odp_key);
         return NULL;