DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, Jingjing Wu <jingjing.wu@intel.com>,
	Beilei Xing <beilei.xing@intel.com>,
	Yuying Zhang <Yuying.Zhang@intel.com>,
	Qiming Yang <qiming.yang@intel.com>,
	Qi Zhang <qi.z.zhang@intel.com>
Subject: [PATCH v2 06/20] drivers: inherit lock annotations for Intel drivers
Date: Fri, 24 Feb 2023 16:11:29 +0100	[thread overview]
Message-ID: <20230224151143.3274897-7-david.marchand@redhat.com> (raw)
In-Reply-To: <20230224151143.3274897-1-david.marchand@redhat.com>

Due to clang limitation, inline helpers don't inherit lock annotations
from the EAL lock API.
Replace them with macros.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/iavf/iavf_osdep.h       | 39 ++++++--------------------
 drivers/common/iavf/iavf_prototype.h   |  6 ----
 drivers/common/idpf/base/idpf_osdep.h  | 26 +++--------------
 drivers/net/i40e/base/i40e_osdep.h     |  8 +++---
 drivers/net/i40e/base/i40e_prototype.h |  5 ----
 drivers/net/i40e/i40e_ethdev.c         | 24 ----------------
 drivers/net/ice/base/ice_osdep.h       | 26 +++--------------
 7 files changed, 20 insertions(+), 114 deletions(-)

diff --git a/drivers/common/iavf/iavf_osdep.h b/drivers/common/iavf/iavf_osdep.h
index 31d3d809f9..263d92400c 100644
--- a/drivers/common/iavf/iavf_osdep.h
+++ b/drivers/common/iavf/iavf_osdep.h
@@ -170,11 +170,6 @@ struct iavf_virt_mem {
 	u32 size;
 } __rte_packed;
 
-/* SW spinlock */
-struct iavf_spinlock {
-	rte_spinlock_t spinlock;
-};
-
 #define iavf_allocate_dma_mem(h, m, unused, s, a) \
 			iavf_allocate_dma_mem_d(h, m, s, a)
 #define iavf_free_dma_mem(h, m) iavf_free_dma_mem_d(h, m)
@@ -182,32 +177,14 @@ struct iavf_spinlock {
 #define iavf_allocate_virt_mem(h, m, s) iavf_allocate_virt_mem_d(h, m, s)
 #define iavf_free_virt_mem(h, m) iavf_free_virt_mem_d(h, m)
 
-static inline void
-iavf_init_spinlock_d(struct iavf_spinlock *sp)
-{
-	rte_spinlock_init(&sp->spinlock);
-}
-
-static inline void
-iavf_acquire_spinlock_d(struct iavf_spinlock *sp)
-{
-	rte_spinlock_lock(&sp->spinlock);
-}
-
-static inline void
-iavf_release_spinlock_d(struct iavf_spinlock *sp)
-{
-	rte_spinlock_unlock(&sp->spinlock);
-}
-
-static inline void
-iavf_destroy_spinlock_d(__rte_unused struct iavf_spinlock *sp)
-{
-}
+/* SW spinlock */
+struct iavf_spinlock {
+	rte_spinlock_t spinlock;
+};
 
-#define iavf_init_spinlock(_sp) iavf_init_spinlock_d(_sp)
-#define iavf_acquire_spinlock(_sp) iavf_acquire_spinlock_d(_sp)
-#define iavf_release_spinlock(_sp) iavf_release_spinlock_d(_sp)
-#define iavf_destroy_spinlock(_sp) iavf_destroy_spinlock_d(_sp)
+#define iavf_init_spinlock(sp) rte_spinlock_init(&(sp)->spinlock)
+#define iavf_acquire_spinlock(sp) rte_spinlock_lock(&(sp)->spinlock)
+#define iavf_release_spinlock(sp) rte_spinlock_unlock(&(sp)->spinlock)
+#define iavf_destroy_spinlock(sp) RTE_SET_USED(sp)
 
 #endif /* _IAVF_OSDEP_H_ */
diff --git a/drivers/common/iavf/iavf_prototype.h b/drivers/common/iavf/iavf_prototype.h
index b5124de5bf..ba78ec5169 100644
--- a/drivers/common/iavf/iavf_prototype.h
+++ b/drivers/common/iavf/iavf_prototype.h
@@ -76,12 +76,6 @@ STATIC INLINE struct iavf_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
 	return iavf_ptype_lookup[ptype];
 }
 
-/* prototype for functions used for SW spinlocks */
-void iavf_init_spinlock(struct iavf_spinlock *sp);
-void iavf_acquire_spinlock(struct iavf_spinlock *sp);
-void iavf_release_spinlock(struct iavf_spinlock *sp);
-void iavf_destroy_spinlock(struct iavf_spinlock *sp);
-
 __rte_internal
 void iavf_vf_parse_hw_config(struct iavf_hw *hw,
 			     struct virtchnl_vf_resource *msg);
diff --git a/drivers/common/idpf/base/idpf_osdep.h b/drivers/common/idpf/base/idpf_osdep.h
index 99ae9cf60a..49bd7c4b21 100644
--- a/drivers/common/idpf/base/idpf_osdep.h
+++ b/drivers/common/idpf/base/idpf_osdep.h
@@ -210,28 +210,10 @@ struct idpf_lock {
 	rte_spinlock_t spinlock;
 };
 
-static inline void
-idpf_init_lock(struct idpf_lock *sp)
-{
-	rte_spinlock_init(&sp->spinlock);
-}
-
-static inline void
-idpf_acquire_lock(struct idpf_lock *sp)
-{
-	rte_spinlock_lock(&sp->spinlock);
-}
-
-static inline void
-idpf_release_lock(struct idpf_lock *sp)
-{
-	rte_spinlock_unlock(&sp->spinlock);
-}
-
-static inline void
-idpf_destroy_lock(__rte_unused struct idpf_lock *sp)
-{
-}
+#define idpf_init_lock(sp) rte_spinlock_init(&(sp)->spinlock)
+#define idpf_acquire_lock(sp) rte_spinlock_lock(&(sp)->spinlock)
+#define idpf_release_lock(sp) rte_spinlock_unlock(&(sp)->spinlock)
+#define idpf_destroy_lock(sp) RTE_SET_USED(sp)
 
 struct idpf_hw;
 
diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h
index 51537c5cf3..aa5dc61841 100644
--- a/drivers/net/i40e/base/i40e_osdep.h
+++ b/drivers/net/i40e/base/i40e_osdep.h
@@ -215,10 +215,10 @@ struct i40e_spinlock {
 	rte_spinlock_t spinlock;
 };
 
-#define i40e_init_spinlock(_sp) i40e_init_spinlock_d(_sp)
-#define i40e_acquire_spinlock(_sp) i40e_acquire_spinlock_d(_sp)
-#define i40e_release_spinlock(_sp) i40e_release_spinlock_d(_sp)
-#define i40e_destroy_spinlock(_sp) i40e_destroy_spinlock_d(_sp)
+#define i40e_init_spinlock(sp) rte_spinlock_init(&(sp)->spinlock)
+#define i40e_acquire_spinlock(sp) rte_spinlock_lock(&(sp)->spinlock)
+#define i40e_release_spinlock(sp) rte_spinlock_unlock(&(sp)->spinlock)
+#define i40e_destroy_spinlock(sp) RTE_SET_USED(sp)
 
 #define I40E_NTOHS(a) rte_be_to_cpu_16(a)
 #define I40E_NTOHL(a) rte_be_to_cpu_32(a)
diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h
index 29c86c7fe8..691c977172 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -546,11 +546,6 @@ i40e_virtchnl_link_speed(enum i40e_aq_link_speed link_speed)
 	}
 }
 #endif /* PF_DRIVER */
-/* prototype for functions used for SW spinlocks */
-void i40e_init_spinlock(struct i40e_spinlock *sp);
-void i40e_acquire_spinlock(struct i40e_spinlock *sp);
-void i40e_release_spinlock(struct i40e_spinlock *sp);
-void i40e_destroy_spinlock(struct i40e_spinlock *sp);
 
 /* i40e_common for VF drivers*/
 void i40e_vf_parse_hw_config(struct i40e_hw *hw,
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7726a89d99..cf2969f6ce 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -4622,30 +4622,6 @@ i40e_free_virt_mem_d(__rte_unused struct i40e_hw *hw,
 	return I40E_SUCCESS;
 }
 
-void
-i40e_init_spinlock_d(struct i40e_spinlock *sp)
-{
-	rte_spinlock_init(&sp->spinlock);
-}
-
-void
-i40e_acquire_spinlock_d(struct i40e_spinlock *sp)
-{
-	rte_spinlock_lock(&sp->spinlock);
-}
-
-void
-i40e_release_spinlock_d(struct i40e_spinlock *sp)
-{
-	rte_spinlock_unlock(&sp->spinlock);
-}
-
-void
-i40e_destroy_spinlock_d(__rte_unused struct i40e_spinlock *sp)
-{
-	return;
-}
-
 /**
  * Get the hardware capabilities, which will be parsed
  * and saved into struct i40e_hw.
diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h
index 4b92057521..0e14b934c8 100644
--- a/drivers/net/ice/base/ice_osdep.h
+++ b/drivers/net/ice/base/ice_osdep.h
@@ -211,28 +211,10 @@ struct ice_lock {
 	rte_spinlock_t spinlock;
 };
 
-static inline void
-ice_init_lock(struct ice_lock *sp)
-{
-	rte_spinlock_init(&sp->spinlock);
-}
-
-static inline void
-ice_acquire_lock(struct ice_lock *sp)
-{
-	rte_spinlock_lock(&sp->spinlock);
-}
-
-static inline void
-ice_release_lock(struct ice_lock *sp)
-{
-	rte_spinlock_unlock(&sp->spinlock);
-}
-
-static inline void
-ice_destroy_lock(__rte_unused struct ice_lock *sp)
-{
-}
+#define ice_init_lock(sp) rte_spinlock_init(&(sp)->spinlock)
+#define ice_acquire_lock(sp) rte_spinlock_lock(&(sp)->spinlock)
+#define ice_release_lock(sp) rte_spinlock_unlock(&(sp)->spinlock)
+#define ice_destroy_lock(sp) RTE_SET_USED(sp)
 
 struct ice_hw;
 
-- 
2.39.2


  parent reply	other threads:[~2023-02-24 15:12 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24  8:16 [PATCH 00/14] Enable lock annotations on most libraries and drivers David Marchand
2023-02-24  8:16 ` [PATCH 01/14] malloc: rework heap lock handling David Marchand
2023-02-24  8:16 ` [PATCH 02/14] mem: rework malloc heap init David Marchand
2023-02-24  8:16 ` [PATCH 03/14] mem: annotate shared memory config locks David Marchand
2023-02-24  8:16 ` [PATCH 04/14] hash: annotate cuckoo hash lock David Marchand
2023-02-24  8:16 ` [PATCH 05/14] graph: annotate graph lock David Marchand
2023-02-24  8:16 ` [PATCH 06/14] drivers: inherit lock annotations for Intel drivers David Marchand
2023-02-24  8:16 ` [PATCH 07/14] net/cxgbe: inherit lock annotations David Marchand
2023-02-24  8:16 ` [PATCH 08/14] net/fm10k: annotate mailbox lock David Marchand
2023-02-24  8:16 ` [PATCH 09/14] net/sfc: rework locking in proxy code David Marchand
2023-02-24  8:16 ` [PATCH 10/14] net/sfc: inherit lock annotations David Marchand
2023-02-24  8:16 ` [PATCH 11/14] net/virtio: annotate lock for guest announce David Marchand
2023-02-24  8:16 ` [PATCH 12/14] raw/ifpga: inherit lock annotations David Marchand
2023-02-24  8:16 ` [PATCH 13/14] vdpa/sfc: " David Marchand
2023-02-24  8:16 ` [PATCH 14/14] enable lock check David Marchand
2023-02-24 15:11 ` [PATCH v2 00/20] Enable lock annotations on most libraries and drivers David Marchand
2023-02-24 15:11   ` [PATCH v2 01/20] malloc: rework heap lock handling David Marchand
2023-02-24 15:11   ` [PATCH v2 02/20] mem: rework malloc heap init David Marchand
2023-02-24 15:11   ` [PATCH v2 03/20] mem: annotate shared memory config locks David Marchand
2023-02-24 15:11   ` [PATCH v2 04/20] hash: annotate cuckoo hash lock David Marchand
2023-02-24 15:11   ` [PATCH v2 05/20] graph: annotate graph lock David Marchand
2023-02-24 15:11   ` David Marchand [this message]
2023-02-24 15:11   ` [PATCH v2 07/20] net/cxgbe: inherit lock annotations David Marchand
2023-02-24 15:11   ` [PATCH v2 08/20] net/fm10k: annotate mailbox lock David Marchand
2023-02-24 15:11   ` [PATCH v2 09/20] net/sfc: rework locking in proxy code David Marchand
2023-02-24 15:11   ` [PATCH v2 10/20] net/sfc: inherit lock annotations David Marchand
2023-02-24 15:11   ` [PATCH v2 11/20] net/virtio: annotate lock for guest announce David Marchand
2023-02-27  2:05     ` Xia, Chenbo
2023-02-27  8:24       ` David Marchand
2023-02-27 16:28         ` Maxime Coquelin
2023-02-28  2:45           ` Xia, Chenbo
2023-03-02  9:26           ` David Marchand
2023-03-02  9:28             ` Maxime Coquelin
2023-03-02 12:35               ` David Marchand
2023-02-24 15:11   ` [PATCH v2 12/20] raw/ifpga: inherit lock annotations David Marchand
2023-02-27  6:29     ` Xu, Rosen
2023-02-27  7:15       ` Huang, Wei
2023-02-24 15:11   ` [PATCH v2 13/20] vdpa/sfc: " David Marchand
2023-02-24 15:11   ` [PATCH v2 14/20] ipc: annotate pthread mutex David Marchand
2023-02-24 15:11   ` [PATCH v2 15/20] ethdev: " David Marchand
2023-02-24 15:11   ` [PATCH v2 16/20] net/failsafe: fix mutex locking David Marchand
2023-02-24 15:35     ` Gaëtan Rivet
2023-02-24 15:11   ` [PATCH v2 17/20] net/failsafe: annotate pthread mutex David Marchand
2023-02-24 15:11   ` [PATCH v2 18/20] net/hinic: " David Marchand
2023-02-24 15:11   ` [PATCH v2 19/20] eal/windows: disable lock check on alarm code David Marchand
2023-02-24 15:11   ` [PATCH v2 20/20] enable lock check David Marchand
2023-02-27  2:32     ` Xia, Chenbo
2023-02-24 15:58   ` [PATCH v2 00/20] Enable lock annotations on most libraries and drivers Gaëtan Rivet
2023-02-25 10:16     ` David Marchand
2023-02-27 16:12       ` Gaëtan Rivet
2023-03-02  8:52         ` David Marchand
2023-04-03 10:52           ` David Marchand
2023-04-03 15:03             ` Tyler Retzlaff
2023-04-03 15:36             ` Tyler Retzlaff
2023-04-04  7:45               ` David Marchand
2023-04-04 12:48 ` [PATCH v3 00/16] " David Marchand
2023-04-04 12:48   ` [PATCH v3 01/16] malloc: rework heap destroy David Marchand
2023-04-04 12:48   ` [PATCH v3 02/16] mem: rework malloc heap init David Marchand
2023-04-04 12:48   ` [PATCH v3 03/16] mem: annotate shared memory config locks David Marchand
2023-04-04 12:48   ` [PATCH v3 04/16] hash: annotate cuckoo hash lock David Marchand
2023-04-04 12:48   ` [PATCH v3 05/16] graph: annotate graph lock David Marchand
2023-04-04 12:48   ` [PATCH v3 06/16] drivers: inherit lock annotations for Intel drivers David Marchand
2023-04-04 12:48   ` [PATCH v3 07/16] net/cxgbe: inherit lock annotations David Marchand
2023-04-04 12:48   ` [PATCH v3 08/16] net/fm10k: annotate mailbox lock David Marchand
2023-04-04 12:48   ` [PATCH v3 09/16] net/sfc: rework locking in proxy code David Marchand
2023-04-04 12:48   ` [PATCH v3 10/16] net/sfc: inherit lock annotations David Marchand
2023-04-04 12:48   ` [PATCH v3 11/16] net/virtio: rework guest announce notify helper David Marchand
2023-04-04 12:48   ` [PATCH v3 12/16] raw/ifpga: inherit lock annotations David Marchand
2023-04-04 12:48   ` [PATCH v3 13/16] vdpa/sfc: " David Marchand
2023-04-04 12:48   ` [PATCH v3 14/16] net/failsafe: fix mutex locking David Marchand
2023-04-04 12:48   ` [PATCH v3 15/16] eal/windows: disable lock check on alarm code David Marchand
2023-04-04 16:08     ` Tyler Retzlaff
2023-04-04 21:02     ` Dmitry Kozlyuk
2023-04-04 12:48   ` [PATCH v3 16/16] enable lock check David Marchand
2023-04-11  3:21     ` Sachin Saxena (OSS)
2023-04-23 20:09   ` [PATCH v3 00/16] Enable lock annotations on most libraries and drivers Thomas Monjalon

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=20230224151143.3274897-7-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=Yuying.Zhang@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=thomas@monjalon.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).