All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: dev@dpdk.org
Cc: Ferruh Yigit <ferruh.yigit@intel.com>,
	Ivan Malov <ivan.malov@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 3/4] net/sfc: make adapter lock recursive
Date: Fri,  5 Nov 2021 11:33:32 +0300	[thread overview]
Message-ID: <20211105083333.1960017-4-andrew.rybchenko@oktetlabs.ru> (raw)
In-Reply-To: <20211105083333.1960017-1-andrew.rybchenko@oktetlabs.ru>

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(-)

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
-- 
2.30.2


  parent reply	other threads:[~2021-11-05  8:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05  8:33 [dpdk-dev] [PATCH 0/4] net/sfc: support SN1022 SoC Andrew Rybchenko
2021-11-05  8:33 ` [dpdk-dev] [PATCH 1/4] common/sfc_efx: use correct define to control debug Andrew Rybchenko
2021-11-05 21:07   ` Ferruh Yigit
2021-11-05  8:33 ` [dpdk-dev] [PATCH 2/4] common/sfc_efx/base: support NIC DMA memory regions API Andrew Rybchenko
2021-11-05  8:33 ` Andrew Rybchenko [this message]
2021-11-05  8:33 ` [dpdk-dev] [PATCH 4/4] net/sfc: support regioned NIC DMA memory mapping type Andrew Rybchenko
2021-11-05 19:05   ` Ferruh Yigit
2021-11-05 20:14     ` Thomas Monjalon
2021-11-06  8:39       ` Andrew Rybchenko
2021-11-06  8:48         ` Thomas Monjalon
2021-11-17  7:05 ` [PATCH v2 0/2] net/sfc: support SN1022 SoC Andrew Rybchenko
2021-11-17  7:05   ` [PATCH v2 1/2] common/sfc_efx/base: support NIC DMA memory regions API Andrew Rybchenko
2021-11-17  7:05   ` [PATCH v2 2/2] net/sfc: support regioned NIC DMA memory mapping type Andrew Rybchenko
2021-11-17 11:44   ` [PATCH v2 0/2] net/sfc: support SN1022 SoC Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211105083333.1960017-4-andrew.rybchenko@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=ivan.malov@oktetlabs.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.