[3/4] net/sfc: make adapter lock recursive

Message ID 20211105083333.1960017-4-andrew.rybchenko@oktetlabs.ru (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series net/sfc: support SN1022 SoC |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrew Rybchenko Nov. 5, 2021, 8:33 a.m. UTC
  Adapter lock is held when mempool for MAE counter packets is populated.
Follow up patch will add a callback on mempool creation which
requires to take lock as well. However, the callback will be called for
other mempools as well when adapter lock is not held.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
---
 drivers/net/sfc/sfc.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
  

Patch

diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index fee1738d1d..f292f9f41b 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -217,7 +217,7 @@  struct sfc_adapter {
 	 * and add device level lock. Adapter control operations which
 	 * change its state should acquire the lock.
 	 */
-	rte_spinlock_t			lock;
+	rte_spinlock_recursive_t	lock;
 	enum sfc_ethdev_state		state;
 	struct rte_eth_dev		*eth_dev;
 	struct rte_kvargs		*kvargs;
@@ -331,31 +331,31 @@  sfc_sa2shared(struct sfc_adapter *sa)
 static inline void
 sfc_adapter_lock_init(struct sfc_adapter *sa)
 {
-	rte_spinlock_init(&sa->lock);
+	rte_spinlock_recursive_init(&sa->lock);
 }
 
 static inline int
 sfc_adapter_is_locked(struct sfc_adapter *sa)
 {
-	return rte_spinlock_is_locked(&sa->lock);
+	return rte_spinlock_is_locked(&sa->lock.sl);
 }
 
 static inline void
 sfc_adapter_lock(struct sfc_adapter *sa)
 {
-	rte_spinlock_lock(&sa->lock);
+	rte_spinlock_recursive_lock(&sa->lock);
 }
 
 static inline int
 sfc_adapter_trylock(struct sfc_adapter *sa)
 {
-	return rte_spinlock_trylock(&sa->lock);
+	return rte_spinlock_recursive_trylock(&sa->lock);
 }
 
 static inline void
 sfc_adapter_unlock(struct sfc_adapter *sa)
 {
-	rte_spinlock_unlock(&sa->lock);
+	rte_spinlock_recursive_unlock(&sa->lock);
 }
 
 static inline void