vppinfra: add atomic macros for __sync builtins
[vpp.git] / src / vnet / interface.h
index b34d19c..7ce6aaf 100644 (file)
@@ -69,7 +69,8 @@ typedef clib_error_t *(vnet_subif_add_del_function_t)
 
 /* Interface set mac address callback. */
 typedef clib_error_t *(vnet_interface_set_mac_address_function_t)
-  (struct vnet_hw_interface_t * hi, char *address);
+  (struct vnet_hw_interface_t * hi,
+   const u8 * old_address, const u8 * new_address);
 
 /* Interface set rx mode callback. */
 typedef clib_error_t *(vnet_interface_set_rx_mode_function_t)
@@ -89,7 +90,7 @@ typedef enum
   VNET_FLOW_DEV_OP_RESET_COUNTER,
 } vnet_flow_dev_op_t;
 
-/* Interface flow opeations callback. */
+/* Interface flow operations callback. */
 typedef int (vnet_flow_dev_ops_function_t) (struct vnet_main_t * vnm,
                                            vnet_flow_dev_op_t op,
                                            u32 hw_if_index, u32 index,
@@ -428,7 +429,7 @@ typedef struct _vnet_hw_interface_class
                        u32 sw_if_index,
                        vnet_link_t link_type, const void *dst_hw_address);
 
-  /* Update an adjacecny added by FIB (as opposed to via the
+  /* Update an adjacency added by FIB (as opposed to via the
    * neighbour resolution protocol). */
   void (*update_adjacency) (struct vnet_main_t * vnm,
                            u32 sw_if_index, u32 adj_index);
@@ -685,7 +686,7 @@ extern vnet_mtu_t vnet_link_to_mtu (vnet_link_t link);
 
 typedef enum vnet_sw_interface_flags_t_
 {
-  /* Interface is "up" meaning adminstratively up.
+  /* Interface is "up" meaning administratively up.
      Up in the sense of link state being up is maintained by hardware interface. */
   VNET_SW_INTERFACE_FLAG_ADMIN_UP = (1 << 0),
 
@@ -871,7 +872,7 @@ static inline void
 vnet_interface_counter_lock (vnet_interface_main_t * im)
 {
   if (im->sw_if_counter_lock)
-    while (__sync_lock_test_and_set (im->sw_if_counter_lock, 1))
+    while (clib_atomic_test_and_set (im->sw_if_counter_lock))
       /* zzzz */ ;
 }
 
@@ -879,7 +880,7 @@ static inline void
 vnet_interface_counter_unlock (vnet_interface_main_t * im)
 {
   if (im->sw_if_counter_lock)
-    *im->sw_if_counter_lock = 0;
+    clib_atomic_release (im->sw_if_counter_lock);
 }
 
 void vnet_pcap_drop_trace_filter_add_del (u32 error_index, int is_add);