New upstream version 16.11.5
[deb_dpdk.git] / drivers / net / mlx5 / mlx5.h
index 79b7a60..0ffb940 100644 (file)
@@ -160,6 +160,22 @@ priv_lock(struct priv *priv)
        rte_spinlock_lock(&priv->lock);
 }
 
+/**
+ * Try to lock private structure to protect it from concurrent access in the
+ * control path.
+ *
+ * @param priv
+ *   Pointer to private structure.
+ *
+ * @return
+ *   1 if the lock is successfully taken; 0 otherwise.
+ */
+static inline int
+priv_trylock(struct priv *priv)
+{
+       return rte_spinlock_trylock(&priv->lock);
+}
+
 /**
  * Unlock private structure.
  *