X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fnet%2Fmlx5%2Fmlx5.h;fp=drivers%2Fnet%2Fmlx5%2Fmlx5.h;h=0ffb9401920cf6189b9393cb92af52bafb4c760a;hb=5076209fa6f4affdf93f4d2f23f51a427f64f72b;hp=79b7a6008fa68bcaaca8b513c5c6a38bb63dd252;hpb=68f5e9d7d40c36c6ea398953af7e56519928ea78;p=deb_dpdk.git diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 79b7a600..0ffb9401 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -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. *